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 - photons

  • r - massless neutrinos

  • c - CDM (Cold Dark Matter)

  • b - baryons

  • nu - massive neutrinos

  • de - dark energy

Variable Prefixes:
  • clx - fractional density perturbations (\(\Delta_i = \delta\rho_i/\rho_i\))

  • q - heat flux variables

  • v - velocity perturbations

  • pi - anisotropic stress components

  • grho - background densities (with g prefix 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:

Density Perturbations

Symbolic

CAMB Variable

Description

\(\Delta_c\)

clxc

CDM fractional density perturbation

\(\Delta_b\)

clxb

Baryon fractional density perturbation

\(\Delta_g\)

clxg

Photon fractional density perturbation

\(\Delta_r\)

clxr

Massless neutrino fractional density perturbation

\(\Delta_{\nu}\)

clxnu

Massive neutrino fractional density perturbation

\(\Delta_{de}\)

clxde

Dark energy fractional density perturbation

Velocity and Heat Flux

Symbolic

CAMB Variable

Description

\(v_b\)

vb

Baryon velocity

\(q_g\)

qg

Photon heat flux

\(q_r\)

qr

Massless neutrino heat flux

\(q_{\nu}\)

qnu

Massive neutrino heat flux

Anisotropic Stress

Symbolic

CAMB Variable

Description

\(\pi_g\)

pig

Photon anisotropic stress

\(\pi_r\)

pir

Massless neutrino anisotropic stress

\(\pi_{\nu}\)

pinu

Massive neutrino anisotropic stress

Metric and Total Quantities

Symbolic

CAMB Variable

Description

\(\eta\)

etak

Three-curvature (\(\mathrm{etak} = k\eta_s = -k\eta/2\) in CDM frame)

\(\delta\) (total)

dgrho

Total density perturbation (\(\kappa a^2 \sum_i \rho_i\Delta_i\))

\(q\) (total)

dgq

Total heat flux (\(\kappa a^2 \sum_i \rho_i q_i\))

\(\Pi\) (total)

dgpi

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:

\[\rho_i q_i = (\rho_i + p_i)v_i\]

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:

Background Densities and Pressures

Symbolic

CAMB Variable

Description

\(\rho_b\)

grhob_t

Baryon background density (\(\kappa\rho_b a^2\))

\(\rho_c\)

grhoc_t

CDM background density (\(\kappa\rho_c a^2\))

\(\rho_g\)

grhog_t

Photon background density (\(\kappa\rho_g a^2\))

\(\rho_r\)

grhor_t

Massless neutrino background density (\(\kappa\rho_r a^2\))

\(\rho_{\nu}\)

grhonu_t

Massive neutrino background density (\(\kappa\rho_{\nu} a^2\))

\(\rho_{de}\)

grhov_t

Dark energy background density (\(\kappa\rho_{de} a^2\))

\(H\)

adotoa

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:

\[ds^2 = a^2(\tau)[d\tau^2 - (\delta_{ij} + h_{ij})dx^i dx^j]\]

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:

\[\eta_s = -\frac{\eta}{2K_{\mathrm{fac}}} \quad \text{where} \quad K_{\mathrm{fac}} = 1 - \frac{3K}{k^2}\]
\[\mathrm{etak} = k\eta_s = -\frac{k\eta}{2K_{\mathrm{fac}}}\]

In the flat case (\(K = 0\)), this simplifies to:

\[\mathrm{etak} = -\frac{k\eta}{2}\]

In the CDM frame (\(v_c = 0\), \(A = 0\)), the relationship of CAMB’s hdot to the synchronous gauge variable is given by:

\[\dot{h}_s = 6\dot{h} = 2kz\]

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 combinations

  • The 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

For the complete mathematical framework and equation derivations, see the technical notes referenced in the main documentation and the symbolic module documentation.