This version November 2002.
Based on CMBFAST (version 2.4.1 and 3.2) developed by Uros Seljak and Matias
Zaldarriaga, itself based on Boltzmann code written by
Edmund Bertschinger, Chung-Pei Ma and Paul Bode.
For information on CMBFAST see
http://physics.nyu.edu/matiasz/CMBFAST/cmbfast.htmlFor latest information on this program see camb.info.
You will need a Fortran 90 compiler (a free academic Linux compiler is available from Intel).
The Makefile comes set up for SGI machines. Just comment the relevant parts to compile on different systems. If you have Visual Fortran you can just add all the files to a new project and everything will be build automatically, no need to use the supplied Makefile. To run on multi-processor machines add the -mp (or equivalent) option to the Makefile's FFLAGS parameter to compile a parallelized version.
You can also edit the Makefile's EQUATIONS and POWERSPECTRUM variables. The POWERSPECTRUM.f90 file contains a module giving the initial power spectrum, the EQUATIONS.f90 file contains the background evolution equations and sets of gauge-dependent perturbation equations. To avoid problems run "make clean" after changing the Makefile before recompiling.
You can produce files in FITS format - to do this you will need to have HEALPIX installed and make some edits to the Makefile - see the Makefile for details. After compiling with "make camb_fits", you can then use "camb_fits" instead of "camb" - the FITS file produced is given the name specified in params.ini.
You may be interested in an inflationary parameterization of the initial power spectra - see this add-on code by Samuel Leach.
All the equations that need to be modified for simple non-standard models are in the equations.f90 file. It should be possible to produce other files for extended models (see the sample quintessence module). (Note that varying constant - e.g. alpha - models are not quite so simple to plug in).
Run "make all" to build a library libcamb.a that you can use when linking to other programs. (You will also need to include the module files using -I/cambfolder).
Minor changes for greater compiler compatibility, in particular with Visual Fortran. Makefile includes suggested options for a variety of compilers.
Added support for neutrino isocurvature initial conditions, and
totally correlated mixed initial conditions (assuming the same power
spectrum for each mode) - new initial_vector parameter in
params.ini. Partially correlated mixed initial conditions can be
computed by combining results from different runs with totally
correlated initial conditions.
Changes for compatibility with CosmoMC. New option to output matter power spectrum.
Changed default pivot point for tensor initial power spectrum to
0.002/MPc (power_tilt.f90), added pivot point and normalization to
initial power parameters. Minor enhancements to inifile.f90. Utility
routines Re_OpticalDepthAtZ and Transfer_GetMatterPower added to
modules.f90.
Massive neutrino support improved. Background evolution is much
faster, and only ever needs to be computed once for all neutrino
masses. Output transfer function files now include columns for the
massive neutrino and total perturbations. Sigma_8 is now computed
including CDM, baryons and massive neutrinos. Fixed problem computing matter
power spectrum in massive neutrino models. New parameter
"massive_nu_approx" to control
how the massive neutrinos are evolved - option for new approximate fast scheme
that is quite accurate for the CMB. New "feedback_level" parameter
that can be used to get useful information about the model being
calculated.
Fixed FITS file output to start at l=0 rather than l=2 to be consistent
with HEALPIX.
The code is now fully internally parallelized and lensing is
supported. Can now use about 16 processors with good efficiency -
just compile with the OpenMP -mp compiler flag. The lensing power
spectrum is computed explicitly and then used to computed the lensed
CMB power spectra using the full-sky results of astro-ph/0001303 (many
thanks for Gayoung Chon for work on the lensed power spectrum
code). To generate the lensed power spectra set do_lensing=T in
params.ini and the output will be in the lensed_output_file. The lensing power spectrum l^4 C_l^{phi phi} is also output as the 5th
column of the scalar_output_file, followed by the cross-correlation
with the temperature l^3 C_l^{phi T}.
Fixed bug in RECFAST - corrects C_l errors at 1-2% level. Background
evolution is now determined from routines in gauge_inv.f90 (and
gauge_sync.f90) - you now only need to edit these files to add
additional matter components, use extended theories, etc. RECFAST now
consistent with massive neutrinos.
Added Makefile for better compilation, and added option to create FITS
format power spectrum files. Changed driver.f90 to driver.F90, and new
file writefits.f90. Some minor changes to ease use with a
wider range of compilers (e.g. NaG F95 for Linux).
May 2001
Fixed the neutrino ratio factor in the normalization of the scalar
power spectrum to be consistent with the power spectrum as defined
since the January 2001 version. Changes to gauge_inv.f90 and gauge_sync.f90.
April 2001
New example
code. These samples show how you can call CAMB from other programs
via a subroutine. There are also improved InitialPower
modules for parameterizing the initial power spectrum to obtain
meaningful tensor/scalar ratios for general models and for
parameterizing in terms of slow-roll inflation parameters.
Fixed a floating error arising when both tensor and scalar spectra are generated but
with ratio zero.
February 2001
Fixed bug in recfast.f90 introduced in August 2000 update (caused
erroneous blip in ionization history).
January 2001
New file power.f90 added to separate out the InitialPower module for
easily modifying the initial power spectrum. The InitialPower module now has
additional parameters to control the normalization of the output Cls,
allowing absolute computations using correctly normalized initial
power spectra (set the UseScalTensRatio parameter to false to compute the
tensor/scalar ratio correctly from the initial power spectra in
general models). The InitialPower module is now commented to fully
explain the definition of the power spectra that should be returned by the TensorPower and
ScalarPower routines.
The transfer functions are now output in terms of k rather than beta
(nu*K) in non-flat models,
and the way to compute the matter power spectrum from the transfer
functions via d2norm is documented. The variables used to propagate
the tensor modes in gauge_inv.f90 have been changed to be equivalent
to the metric variables, improving stability when DoTensorNeutrinos=true.
September 2000
Now uses an accurate approximation to propagate massive neutrino
perturbations once no longer highly relativistic, speeding up
computation by about a factor of two (gauge_inv routine only). All massive
neutrino code is now
re-organized into a module called MassiveNu in modules.f90. The massive
neutrino equations are described in astro-ph/0203507
August 2000
Minor changes to recfast.f90 and modules.f90 to prevent floating
point errors on some systems. (Thanks for Louise Griffiths)
July 2000
Fixes inaccurate computation of the tensor quadrupole in flat
models, pointed out in astro-ph/0006392 . The only code change is to subroutine TensSourceSumIntJl in cmbmain.f90.
February 2000
Massive neutrinos are now supported. The treatment is essentially the
same as CMBFAST. However gauge_inv now includes neutrino anisotropic
stress in the tensor computation by default, accounting for massive neutrinos
when appropriate. You can revert to the old default by changing the
"DoTensorNeutrinos" parameter in gauge_inv.
This version also fixes the tight coupling switch over to give
accurate results with gauge_sync. This fixes errors introduced in
CMBFAST 3.0/CAMB Nov 99.
November 1999
Adds support for RECFAST recombination
and fixes various bugs that were in CMBFAST 2.4.1 but fixed in CMBFAST
3.0. RECFAST is an option via the fifth line in the input file as in
CMBFAST. Using it does not slow things down significantly and corrects
errors at around the 2% level.
The main differences in the non-flat computation lie in how we perform the integral of the source
functions with the hyperspherical Bessel functions. We use
Kosowsky's WKB approximation or the recursion relation to evaluate the Bessel
functions at the starting point of ranges of integration, and then
integrate the differential equation. CMBFAST
integrates up the differential equation from a pre-calculated starting point. Unlike
CMBFAST 3.2 our ranges of integration continue into the Chi > pi/2
region for closed models. We avoid problems with stability of the
integration (contamination with the irregular solution) by cutting off
the integration when the errors become important (where the values in the
dissipative tail are becoming small). This leads to very small errors,
and allows for a much simpler scheme than that used in CMBFAST 3.2 where
the symmetry of the Bessel functions is used to extend to the Chi> Pi/2 region.
From the user's point of view the main point is that this code is
rather faster than CMBFAST in open and closed models for a single run,
and for models with massive neutrinos. We have also
checked accuracy by varying the various step sizes and
parameters. Some of these were adjusted to be consistent with the target 1% accuracy over a wide range
of models.
CMBFAST 3.2 introduced an include file for adjusting the
l-sampling. In CAMB this is done automatically depending on the model,
so there is no need to modify the l-sampling by hand.
CAMB uses full-sky lensing using computed lensing power spectra,
CMBFAST uses the flat sky approximation and works from the transfer
functions.
CMBFAST 4 uses a "k-splitting" to allow rapid computation of grids on
models to reasonable accuracy. If you need to generate a large number
of models and accuracy is not vital using CMBFAST 4 would probably
save you some time and effort.
CAMB is in Fortran 90 and is more modularized, so using different initial power spectra, modified equations, etc. is often just a case of modifying one or two files and re-compiling.
Transfer functions output by CAMB include column for the total
(CDM+Baryon+neutrino). Sigma_8 calculation includes baryons and
neutrinos (CMBFAST includes only CDM).
Transfer functions are with different variable - these differ from the synchronous gauge variables just
by a constant scaling (3/2) in the flat case, but also differ by a factor of
1-3K/k^2 otherwise.
Isocurvature Cls differ in non-flat models. This is
because our initial conditions differ by a relative factor of
1-3K/k^2.
Initial power spectrum normalizations differ.
Main wrapper routines for running CAMB in your programs. Add "use
camb" to your programs and call CAMB_GetResults to generate output
from a set of model parameters (specified in the CAMBparams type -
defined at the top of modules.f90). You can call
CAMB_ValidateParams(P) to check that the parameter set is valid, use
CAMB_GetAge to compute the age of a model in gigayears, and
CAMB_GetCls to retrieve the computed Cls. The results can also be
accessed directly using the arrays in the ModelData module (defined in modules.f90).
Sample programs tester.f90 and sigma8.f90 are supplied showing how to
use CAMB from your own programs.
The main subroutine that does integrations, etc. Encompasses CMBFAST's
cmbflat and cmbopen.
equations.f90
Files containing background and perturbation evolution equations. The
perturbations equations used are derived in the covariant approach,
fixing to the CDM (zero acceleration) frame, which are essentially
equivalent to the synchronous gauge equations.
The file defines a module called "GaugeInterface" which provides
the necessary perturbation calculation routines for
"cmbmain".
The subroutine dtauda(a) returns dt/da and is used wherever the
background evolution is needed. It
can be modified for different backgrounds. You may
also need to change the GetOmegak routine if you add additional
components, and can edit the init_background routine to do
additional initialization.
outtransf writes out the matter transfer functions. These depend on which
variable set is used.
The "output" subroutine computes the scalar sources at a given time for a
given wavenumber. These are the temperature, E polarization and (if
doing lensing) the lensing source. By editing the equation for the
lensing source it should be straightforward to compute power
spectra for other matter tracers, e.g. for cross-correlation with
the CMB. The lensing power spectrum is automatically computed if
DoLensing is true.
power_tilt.f90
This file defines a module called InitialPower that returns the
initial power spectra. Change this file to use your own initial power
spectrum, change how the spectra are parameterized, or to change how
the Cls are normalized. Comments in the code explain this further.
inidriver.F90
Reads in parameters from a file of name/value pairs and calls CAMB. Modify
this file to generate grids of models, change the parameterization, etc.
modules.f90
Various modules used by the other parts of the program, Module
"ModelParams" contains most of the model parameters. Boolean vars
flat, open and closed determine the model type.
bessels.f90
Module to calculate spherical and hyper-spherical Bessel
functions. Hyper-spherical functions generated by use of
either the recursion relation or Kosowsky's WKB approximation. Based on
Arthur Kosowsky's "hyperjl.c".
lensing.f90
Lensing module for computing the lensed CMB power spectra from the
unlensed spectra and a lensing power spectrum. Adapted from code
written by Gayoung Chon.
Various subroutines for interpolation, and modified Runge-Kutta
dverk for parallelised evolution.
writefits.f90
Subroutine WriteFitsCls that uses HEALPIX routines to output power spectrum
in FITS format.
recfast.f90
RECFAST integrator for Cosmic Recombination of Hydrogen and Helium
by Douglas Scott (with minor modifications for CMBFAST and the
CAMB). See RECFAST
for the original code.
Extreme models (e.g. scale > 4, h>1) may give errors of 5% or more.
Tensor errors around 2%
Hierarchy truncation errors up to 5% at high l (>1500) in some
closed models
You can improve or check accuracy (or increase speed) by changing
global accuracy parameters at the bottom of the params.ini input file.
Some notes and relevant Maple derivations are given here.
Evolution of cosmological dark matter perturbations
Efficient computation of CMB anisotropies in closed FRW Models
Geometric Algebra and
Covariant Methods in Physics and Cosmology, Chapters 6&7
Covariant theory
Cosmic Microwave Background Anisotropies in the CDM model: A
Covariant and Gauge-Invariant Approach
Microwave background anisotropies from gravitational waves: the 1+3
covariant approach
Microwave background polarization in cosmological models
Initial conditions
The General Primordial Cosmic Perturbation
WKB approx to hyperspherical Bessel functions
Efficient Computation of Hyperspherical Bessel Functions
RECFAST
A new calculation of the recombination epoch.
Synchronous gauge theory and non-flat models
Complete treatment of CMB anisotropies in a FRW universe
Full-sky weak lensing of the CMB
Weak Lensing of the CMB: A Harmonic Approach
A line of sight integration approach to Cosmic Microwave Background
Anisotropies
CMBFAST for spatially closed universes
See also the references on the CMBFAST home page.
Version History
November 2002
Fixed rare problem computing closed models, and bug in computation of
closed transfer functions. The names of the massive neutrino
subroutines have been changed because the argument that is passed has changed.
For details of other changes see the parallel CAMB changes page.
Comparison with CMBFAST
This code was originally developed from CMBFAST 2.4.1 to support closed models
and gauge invariant variables. After releasing this code CMBFAST 3.2
was released which also supports closed models. These codes were
developed independently and so are somewhat different, and both codes
have developed independently since then. CMBFAST 4
introduces a technique for generating grids of models quickly which is
not implemented in CAMB.
Things that differ from CMFBAST
The source files
camb.f90
Accuracy
RMS errors < 1% for min(2500, l well into the damping tail)
for most models. Excursions mostly below 1.5%.
REFERENCES
Antony Lewis and Anthony Challinor astro-ph/0203507
Phys. Rev. D66, 023531 (2002)
Antony Lewis, Anthony Challinor and Anthony Lasenby astro-ph/9911177 Ap. J. 538:473-476, 2000.
PhD thesis, Antony Lewis 2000. PostScript.
Anthony Challinor and Anthony Lasenby, astro-ph/9804301
Ap. J. 513:1 1-22, 1999
Anthony Challinor, astro-ph/9906474
Anthony Challinor, astro-ph/9911481
Martin Bucher, Kavilan Moodley and Neil Turok, astro-ph/9904231
(These results extended to the non-flat case)
Arthur Kosowsky, astro-ph/9805173
Seager, S., Sasselov, D. & Scott, D., 1999, ApJ, 523, L1, astro-ph/9909275.
Wayne Hu, Uros Seljak and Matias Zaldarriaga.
Phys. Rev. D57:6, 3290-3301, 1998. astro-ph/9709066.
Wayne Hu. astro-ph/0001303
Uros Seljak and Matias Zaldarriaga, astro-ph/9603033
Ap.J. 469:2 437-444, 1996
Uros Seljak and Matias Zaldariaga, astro-ph/9911219