Brian A. Powell and William H. Kinney
Flowcode1.0 is a C program that solves the inflationary flow equations using a
Monte Carlo approach1. It utilizes routines from the Gnu Scientific Library (GSL).
The code works by randomly drawing initial values of the flow parameters and
numerically solving the system of flow equations. The flow equations can
be solved to arbitrarily high-order in the flow space. Each solution
represents a unique inflationary trajectory with inflaton potential
For each inflationary trajectory thus generated, Flowcode1.0 is also capable of numerically calculating
both scalar and tensor power spectra. The spectra are obtained by
solving the mode equations of quantum
fluctuations for different values of the comoving
wavenumber, k3. See Ref. 1 and references therein for a detailed
discussion of the inflationary flow formalism and the use of the flow
code. Ref. 3 discusses the spectrum calculation.
Downloading and compiling
Download the release tar file here and run "tar -xzf flowcode_1.0.2.tar.gz" to unzip and untar it.
You will need to download GSL and include the path to the gsl libraries in the Makefile or in your environment variables.
The makefile is setup to use gcc, but you may edit this if you wish to use an
alternative compiler. Flowcode1.0 offers varying degrees of functionality and
should be compiled appropriately:
- Run "make flow" to compile the most basic version of Flowcode1.0. This
version does not calculate power spectra. Instead, it returns values of the
spectral parameters r, n and \alpha for each model generated. These
observables are specified at Nobs, the number of e-folds
before the end of inflation, which is chosen at random from the range [46,60]. It
also generates the full path of the inflationary trajectory - the
functions \phi(N), H(N), \epsilon(N), ..., from Nobs to the end of inflation.
- Run "make mpi" to enable multiprocessing capability. This is a
parallelized version of the "flow" compile. It does not generate path
- Run "make mpi_savepath" to enable path generation capability with MPI.
- Run "make spectrum" to compile Flowcode1.0 with the ability to calculate
scalar and tensor power spectra.
You must indicate with a compiler flag whether you are using a "new" or "old" version of GSL. "Old" is defined as version 1.5 and earlier. The default flag is set to GSL_NEW.
You can download the MPICH implementation or the
implementation. Both provide
the mpicc compiler required.
There are several user-defined parameters that you may wish to change.
These are specified as #define's in various header files. In
- NEQS: The order at which to truncate the flow expansion. This should
be 6 or larger.
- kmax: Maximum number of iterations allowed for the flow
- Y: The value of k/aH, where k is the comoving wavenumber of the
fluctuation, a is the scale factor and H the Hubble parameter, at which
to initialize the mode function. Y = 50 is a good value. Taking Y
much larger will improve accuracy but only at the cost of debilitating
- Amp: The amplitude at which to normalize the power spectra.
- knorm: Wavenumber at which to normalize the spectrum (in units of
hMpc-1). This can be set to
anything, but be sure that the value is included in the file that
supplies that k-values at which the spectrum is to be integrated (see
- NUMEFOLDSMAX/MIN: The number of efolds before the end of inflation at
which the quadrupole leaves the horizon is drawn randomly from the ranges set by
- NUMPOINTS: Number of models to generate. This can be made to refer
to the total number of models, total number of models of a particular type (see
calcpath.c below), etc.
The basic "flow" compile generates:
The "spectrum" compilation additionally outputs
- esigma.dat: Logs the values of the flow parameters at
- nr.dat: Logs the values of n, r and \alpha at this
- pathxxx.dat: There is a path file for each model generated containing \phi(N), H(N), the flow parameters, V(N) and KE(N), where V(N)
and KE(N) are the reconstructed potential and kinetic energies of the
spectra, nr.dat is still written but is no longer necessary.
- spec_sxxx.dat: Scalar spectra. Contains either P(k) or k vs. P(k) (default is set to output P(k) only, but this can be changed in flow.c). Outputting P(k) alone is best if feeding spectra to another program, such as CAMB, but outputting k vs. P(k) is clearly needed for plotting these spectra directly.
- spec_txxx.dat: Tensor spectra.
See description of functions in and comments throughout the above files for
- spectrum.c: This function calculates the power spectra. The spectrum
is interpolated using cubic splines to improve efficiency. In
order to maximize versatility, the k-values (in units of hMpc-1) at which to integrate and
interpolate the spectrum are user supplied. The included file
is a basic set of k-values to be used for integration, and the file
ks_eval.dat includes values at which to evaluate the interpolated
spectrum. ks_eval.dat includes the k-values used by CAMB to evaluate
power spectra and is therefore recommended if using Flowcode1.0 with CAMB.
If you wish to supply your own files of k-values be sure to change the
#defines in spectrum.h:
- ki_file: Name of file containing k-values at which to integrate
- k_file: File containing k-values at which to evaluate interpolated
- kinos: Total number of k's in ki_file.
- knos: Total number of k's in k_file.
- int_de.c: Integrates the system of flow equations.
- calcpath.c: Calls int_de.c and buffers path
information. This function also determines what type of model has just
been generated and returns one of the following qualifiers1:
- asymptote: the model approaches a late-time attractor.
- noconverge: the model does not evolve to a known asymptote.
- nontrivial: inflation ends through a failure of slow-roll, \epsilon >
- insuff: the model does not support enough e-foldings of
- randoms.c: Random number generator interface routines.
- flow.c: This is the main driver program that generates
initial flow parameters and calls
calcpath.c and spectrum.c. The initial values are
chosen by the function pick_init_vals(). Full spectra are only calculated
if the model is of nontrivial type. Additionally, a wrapper function
we_should_calc_spec() is defined in flow.c that allows
the user to define specific criteria that must be met in order for a
particular model's spectrum to be calculated. The default condition is
that the spectral index at Nobs lie between 0.8 < n < 1.2.
flow.c writes all output files. Another wrapper function,
we_should_save_this_path allows the user to determine when to
write path data to file. The function save_path() does the
actual writing, and the content of the path files can be modified here.
- MyMPI.c: Wrapper for MPI_Send and MPI_Receive functions.
- Build_MPI_type.c: Custom MPI_Datatypes defined
- ks.dat: k-values at which to integrate power spectrum.
- ks_eval.dat: k-values at which to evaluate the interpolated
power spectrum (see spectrum.c above).
- spectrum.h, calcpath.h, randoms.h, mytypes.h: Header files
containing parameter definitions and values, function prototypes, and
Other functions of interest
- derivs(): The system of flow equations are defined
- tsratio(), specindex(), dspecindex(): These functions
calculate the tensor-to-scalar ratio, spectral index and running of the
spectral index, respectively. Observables can be calculated to 2nd- or
3rd-order in the flow parameters. The default behavior is to calculate
to 3rd-order. Include the DSECONDORDER compilation
flag if you wish to calculate observables to second order.
- scalarsys(): Defines the mode equation of scalar
fluctuations as a system of 2 first-order equations.
- tensorsys(): Defines the mode equation of tensor
fluctuations as a system of 2 first-order equations.
The basic "flow" compilation can be parallelized. In this mode, slave
processes generate their own initial conditions and call
calcpath. If the solution meets certain criteria (specified in
the send() wrapper function defined in flow.c), the
flow parameters at Nobs are sent to the master process. The
master process then writes these to esigma.dat and
nr.dat. Path data is not sent over the MPI network because
passing such large amounts of data creates serious bottlenecks. Path
writing capability can be implemented by issuing "make mpi_savepath", as
mentioned above. In this mode, if the solution
satisfies the conditions specified in
we_should_save_this_path(), the master process buffers the flow
parameters at Nobs and writes the path only after the MPI
portion of the run has completed. The number of solutions to buffer is
specified by #define SAVBUFSIZE in flow.c.
Flowcode1.0 has been tested on the Linux operating system running on the X86 architecture only. Specifically, Gentoo running Linux kernel 2.6.15-r5 and Ubuntu running kernel 2.6.17-r10.
It is compatible with GSL versions 1.5-1.8. We do not recommend adjusting the error control specified in spectrum.c and int_de.c or changing the default
integrator (which is set to a general-purpose Runge-Kutta-Fehlberg 4-5 method).
This software is public domain and is supplied as-is with no warranty of any kind. Please credit the authors, Brian A. Powell and William H. Kinney, and reference this paper for the analysis methodology.
1.0.3 - 3/11/14: Fixed compatibility bug with GSL 1.15.
1.0.2 - 7/16/07: Changed normalization of the tensor-to-scalar ratio, r = 16\epsilon. Due to a change in the sensitivity of the rk4 integrator across old and new versions of GSL, we have
added a compiler flag where you specifies whether you are using a "new" or "old" version of GSL. An "old" version is defined as GSL_1.5 or earlier.
1.0.1 - 6/27/07: Fixed minor typo in nr.dat output file. Switched to an rk4 integrator for flow integration for improved stability. Architecture-dependent output bug in spectrum code fixed. Disabled static linking, which created problems compiling on MacOS.
- W.H.Kinney, "Inflation: Flow, fixed points and observables to
arbitrary order in slow roll," Phys. Rev. D 66, 083508 (2002)
- R. Easther and W. H. Kinney, "Monte Carlo reconstruction of the
inflationary potential," Phys. Rev. D 67, 043511 (2003)
- B. A. Powell and W. H. Kinney, "Limits on primordial power spectrum resolution: An an inflationary flow analysis," [arXiv:astro-ph/0706.1982].
This work is supported in part by National Science Foundation Grant NSF-PHY-0456777.