This version August 2004.
Origially based on CMBFAST 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://cmbfast.org. For latest information on this program see camb.info.
CAMB is also supplied as part of the CosmoMC parameter estimation package.
You will need a Fortran 90 (or higher) compiler - you can get the Intel Linux one here.The Makefile comes set up for Intel machines using ifc. Just comment the relevant parts to compile on different systems. If you have Visual Fortran you can open the supplied .dsp project file, no need to use the Makefile. To run on multi-processor machines add the -mp (or equivalent) option to the Makefile's FFLAGS parameter to compile a parallelized version. The first time CAMB is run it is slower because it pre-computes a set of Bessel functions and writes them to disk.
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. Note that the FITS file format for polarization changed with HEALPIX 1.2, CAMB uses the new format.
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).
After modifying any of the source code run "make clean" before running "make" to recompile (Visual Fortran will re-compile dependent code automatically). 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).
By default CAMB produces results normalized to unit initial curvature perturbation. You can set COBE_normalize=T in the .ini file to match the COBE normalization of the temperature C_l, or set scalar_amp(1) in the .ini file to a realistic value for the initial power spectrum amplitude on 0.05 MPc^{-1} scales (e.g. about 3e-9) . To compute lensed C_ls you must set the normalization to some realistic value (the calculation is second order, so normalization matters).
Fixed effect of reionization on the lensed C_l (0.5% on small scale TT).
Fixed serious problem with tensor mode polarized C_l from reionization (significantly underestimated power).
Changed default tensor pivot scale to 0.05/MPc (same as for scalars). Flat Bessel functions no longer cached to disk (faster to compute than read in many cases; prevents problems in uses with MPI). New accurate_reionization flag for accurate calculation of large scale scalar EE around the first dip (also outputs computed optical depth due to reionization). Option to output vector mode spectra from regular vorticity mode (astro-ph/0403583) or magnetic field (astro-ph/0406096).
Improved accuracy of non-flat calculation, and allowed for very nearly flat models (Om_K ~ 1e-5). Non-flat code should be as accurate as the flat (0.5%) on most scales. Added run-time parameters do_tensor_neutrinos (to include the neutrino evolution in the tensor equations) and cs2_lam (constant sound speed of the dark energy) instead of having to modify the code. Fixed fatal bug in tensor neutrino setup introduced some time this year. Added parameter CMB_outputscale to scale output Cls by a constant (see comments in params.ini for getting microK^2 output).
Fixed instability in bessels.f90 which gave problem for very nearly flat closed models with abnormal Helium fractions (and possibly other models). Dark energy equations in equations.f90 changed to use simpler general fluid equations for the perturbations (see astro-ph/0307104). inidriver.F90 now reads in scalar amplitude even if computing tensors only (so combination with the initial ratio sets correct tensor amplitude).
Fixed bug in equations.f90 giving errors with non-flat models. Fixed bug in inidriver.F90 setting H_0 with use_physical=F. Fixed camb.f90 file in download - missing routines for getting C_l transfer functions.
Some major restructuring, including new functions to return the CMB transfer functions (see camb.f90). The tight coupling code has been re-written, adding quadrupole terms and accounting for the time variation of the opacity numerically. The code should be more accurate and faster, especially on small scales. Minor fixes to RECFAST to match version in CMBFAST (0.01% effect on C_ls), and bug fix in output routine (0.3%). Includes constant w dark energy and running spectral index parameters by default (rather than with an add-on). New 'use_physical' parameter to allow alternative model specification by Om_b h^2, Om_b h^2 and Om_k. Polarization .fits files now compatible with HEALPIX 1.2.
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 many cases. CAMB agrees with the CMBFAST 4.5 high precision TT calculation to < 1% at low l, and about 0.3% at l>100 in concordance flat models. If CAMB is run with high precision options the agreement is nearly 0.1% at high l. The polarized spectra also agree well except around the first dip in the EE spectrum with reionization.
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. CMBFAST 4 also supports some extended models not supported by CAMB, e.g. 5-D models.
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.
Note that the conventions for the polarization power spectra output by CAMB agree with those of CMBFAST. This sign convention for the cross-correlation C_l^TE spectrum differs from the definitions in astro-ph/9911481. As from CMBFAST 4.2 the intial power spectrum normalization conventions also agree.
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. You can also use CAMB_GetTransfers to access the C_l transfer functions directly without incorporating the initial power spectrum.
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.
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%, more on small scales
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 (see also the Appendix of astro-ph/0406096). A handy BibTex file is given on the CosmoMC home page.
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 Evolution of cosmological dark matter perturbations
Microwave background anisotropies from gravitational waves: the 1+3
covariant approach
Microwave background polarization in cosmological models
Observable primordial vector modes
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
August 2004
Fix - 17 Dec: corrected problem with significantly non-flat models (e.g. Om_K=-0.1, H_0=40)
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.
The source files
camb.f90
Accuracy
RMS errors < 0.5% for min(2500, l well into the damping tail)
for most models. See also comparison with CMBFAST. Accuracy of course assumes the model is correct, and is dependent on RECFAST being the correct ionization history.
REFERENCES
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
Antony Lewis and Anthony Challinor astro-ph/0203507
Phys. Rev. D66, 023531 (2002)
Anthony Challinor, astro-ph/9906474
Anthony Challinor, astro-ph/9911481
Antony Lewis, astro-ph/0403583
Martin Bucher, Kavilan Moodley and Neil Turok, astro-ph/9904231
(These results extended to the non-flat case; see the theory page)
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
See also astro-ph/0301064, astro-ph/0301031
Uros Seljak and Matias Zaldarriaga, astro-ph/9603033
Ap.J. 469:2 437-444, 1996
Uros Seljak and Matias Zaldariaga, astro-ph/9911219