Flowcode 1.0


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 V(N)2. 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:
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 lam-mpi 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 calcpath.h: In spectrum.h: In flow.c:

Output files

The basic "flow" compile generates: The "spectrum" compilation additionally outputs When generating spectra, nr.dat is still written but is no longer necessary.

Files included

See description of functions in and comments throughout the above files for further information.

Other functions of interest

In calcpath.h: In spectrum.c:

MPI Capability

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.

Version History

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.



This work is supported in part by National Science Foundation Grant NSF-PHY-0456777.