CAMB Variables and Gauge Conventions
This page provides a comprehensive guide to the variable naming conventions used in CAMB and their relationship to different gauge choices, particularly the synchronous gauge. For detailed mathematical derivations and symbolic manipulation, see the ScalEqs notebook, the Symbolic manipulation module documentation, and the technical notes.
Units Convention: CAMB uses natural units where \(c = 1\) and distances are measured in Mpc. The gravitational coupling is \(\kappa = 8\pi G\) with units of \(\text{Mpc}^{-2}\).
Overview
CAMB uses a covariant perturbation formalism that can be expressed in different gauge choices. The code internally works in the CDM frame (equivalent to synchronous gauge) but provides functions to convert to other gauges like the Newtonian gauge. The variable naming follows specific conventions that encode both the physical quantity and the species.
Key Physical Quantities
The fundamental perturbation variables in CAMB represent different aspects of the perturbed spacetime and matter fields:
Metric Perturbations:
\(\phi\) (phi): Weyl potential - gauge-invariant gravitational potential
\(\eta\) (eta): Three-curvature perturbation (CAMB variable:
etak)\(\sigma\) (sigma): Shear perturbation
\(z\): Expansion rate perturbation
\(\dot{h}\) (hdot): Time derivative of scale factor perturbation
\(A\): Acceleration perturbation
Matter Perturbations:
\(\delta\) (delta): Density perturbation
\(q\): Heat flux (momentum density)
\(\Pi\) (Pi): Anisotropic stress
Variable Naming Conventions
CAMB uses systematic naming conventions for variables:
- Species Indices:
g- photonsr- massless neutrinosc- CDM (Cold Dark Matter)b- baryonsnu- massive neutrinosde- dark energy
- Variable Prefixes:
clx- fractional density perturbations (\(\Delta_i = \delta\rho_i/\rho_i\))q- heat flux variablesv- velocity perturbationspi- anisotropic stress componentsgrho- background densities (withgprefix for “\(\kappa\) times \(\rho\)”)dg- total (summed over species) perturbation quantities
CAMB Fortran Variables
This shows the correspondence between symbolic variables (in CDM frame) and CAMB Fortran variables:
Symbolic |
CAMB Variable |
Description |
|---|---|---|
\(\Delta_c\) |
|
CDM fractional density perturbation |
\(\Delta_b\) |
|
Baryon fractional density perturbation |
\(\Delta_g\) |
|
Photon fractional density perturbation |
\(\Delta_r\) |
|
Massless neutrino fractional density perturbation |
\(\Delta_{\nu}\) |
|
Massive neutrino fractional density perturbation |
\(\Delta_{de}\) |
|
Dark energy fractional density perturbation |
Symbolic |
CAMB Variable |
Description |
|---|---|---|
\(v_b\) |
|
Baryon velocity |
\(q_g\) |
|
Photon heat flux |
\(q_r\) |
|
Massless neutrino heat flux |
\(q_{\nu}\) |
|
Massive neutrino heat flux |
Symbolic |
CAMB Variable |
Description |
|---|---|---|
\(\pi_g\) |
|
Photon anisotropic stress |
\(\pi_r\) |
|
Massless neutrino anisotropic stress |
\(\pi_{\nu}\) |
|
Massive neutrino anisotropic stress |
Symbolic |
CAMB Variable |
Description |
|---|---|---|
\(\eta\) |
|
Three-curvature (\(\mathrm{etak} = k\eta_s = -k\eta/2\) in CDM frame) |
\(\delta\) (total) |
|
Total density perturbation (\(\kappa a^2 \sum_i \rho_i\Delta_i\)) |
\(q\) (total) |
|
Total heat flux (\(\kappa a^2 \sum_i \rho_i q_i\)) |
\(\Pi\) (total) |
|
Total anisotropic stress |
Physical Interpretation
Heat Flux Relations: For each species i, the heat flux \(q_i\) is related to the velocity \(v_i\) by:
This gives:
For relativistic species (photons, massless neutrinos): \(q_i = \frac{4}{3}v_i\)
For non-relativistic matter: \(q_i \approx v_i\)
Density Perturbations: The fractional density perturbations \(\Delta_i = \delta\rho_i/\rho_i\) are gauge-dependent. In synchronous gauge, they represent the fractional density contrast in the frame comoving with the CDM. Note the distinction: \(\delta\rho_i\) is the absolute density perturbation, while \(\Delta_i\) is the fractional (relative) density perturbation.
Anisotropic Stress: The anisotropic stress \(\pi_i\) represents the traceless part of the stress tensor and is gauge-invariant. It is important for:
Photon polarization (\(\pi_g\))
Free-streaming neutrinos (\(\pi_r\), \(\pi_{\nu}\))
Gravitational wave generation
Background Variables
CAMB also defines background (unperturbed) quantities with specific naming:
Symbolic |
CAMB Variable |
Description |
|---|---|---|
\(\rho_b\) |
|
Baryon background density (\(\kappa\rho_b a^2\)) |
\(\rho_c\) |
|
CDM background density (\(\kappa\rho_c a^2\)) |
\(\rho_g\) |
|
Photon background density (\(\kappa\rho_g a^2\)) |
\(\rho_r\) |
|
Massless neutrino background density (\(\kappa\rho_r a^2\)) |
\(\rho_{\nu}\) |
|
Massive neutrino background density (\(\kappa\rho_{\nu} a^2\)) |
\(\rho_{de}\) |
|
Dark energy background density (\(\kappa\rho_{de} a^2\)) |
\(H\) |
|
Hubble parameter (conformal time) |
Note: The g prefix in CAMB variables stands for “\(\kappa\) times” where \(\kappa = 8\pi G\), and densities are stored as \(\kappa\rho a^2\) with units of \(\text{Mpc}^{-2}\) for numerical convenience.
Synchronous Gauge Details
CDM Frame
CAMB natively works in the CDM frame where:
CDM velocity: \(v_c = 0\)
Acceleration: \(A = 0\)
This is equivalent to the synchronous gauge with the gauge choice that the CDM is at rest.
Synchronous Gauge Metric
In synchronous gauge, the metric takes the form:
where the metric perturbation \(h_{ij}\) can be decomposed into scalar, vector, and tensor parts.
CAMB’s Synchronous Gauge Variables:
\(\eta_s\): Related to the trace of \(h_{ij}\) (synchronous gauge curvature)
\(\dot{h}_s\): Time derivative of the trace
etak: \(k\eta_s\) (the variable actually stored in CAMB)
Conversion Relations:
From CAMB’s covariant variables to synchronous gauge:
In the flat case (\(K = 0\)), this simplifies to:
In the CDM frame (\(v_c = 0\), \(A = 0\)), the relationship of CAMB’s hdot to the synchronous gauge variable is given by:
where \(z\) is the expansion rate perturbation.
Gauge Transformation Examples
Example 1: CDM Frame to Newtonian Gauge
To transform from CDM frame to Newtonian gauge, apply:
Set \(\sigma = 0\) (zero shear condition)
\(\Phi_N = \phi + \frac{1}{2}\frac{a^2\kappa\Pi}{k^2}\)
\(\Psi_N = \phi - \frac{1}{2}\frac{a^2\kappa\Pi}{k^2}\)
Example 2: Frame-Dependent Variables
Some variables change under gauge transformations:
Density perturbations: \(\Delta_i \to \Delta_i + \frac{3H(1+w_i)\delta u}{k}\)
Velocities: \(v_i \to v_i - \delta u\)
Heat flux: \(q_i \to q_i - \frac{(\rho_i+p_i)\delta u}{\rho_i}\)
where \(\delta u\) is the frame transformation parameter.
Practical Usage Notes
For Transfer Functions:
All density variables \(\Delta_i\) are in synchronous gauge
Velocities depend on the specific context and gauge choice
The Weyl potential is gauge-invariant
For Custom Sources:
Use
camb.symbolic.make_frame_invariant()to create gauge-invariant combinationsThe symbolic module provides automatic conversion between gauges
See the ScalEqs notebook for practical examples
Common Pitfalls:
Don’t mix variables from different gauges without proper transformation
Remember that CAMB’s “synchronous gauge” is specifically the CDM frame
Anisotropic stress components (\(\pi_g\), \(\pi_r\), \(\pi_{\nu}\)) and total anisotropic stress \(\Pi\) are gauge-invariant
Cross-References
Symbolic manipulation - Complete symbolic equation system and gauge transformations
ScalEqs notebook - Interactive examples with variable definitions
Matter power spectrum and matter transfer function variables - Transfer function variables and their meanings
Input parameter model - Parameter and variable definitions for the Python interface
For the complete mathematical framework and equation derivations, see the technical notes referenced in the main documentation and the symbolic module documentation.