As an example of the equations to be solved, we outline briefly the Einstein and Boltzmann equations for massive neutrinos, taken from the more detailed derivation in Ma and Bertschinger (1995).
The code is only for spatially flat (
) background spacetimes
with isentropic scalar metric perturbations. The spacetime
coordinates are denoted by
; repeated indices are summed. Since
our interests lie in the physics in an expanding universe, we use
comoving coordinates
with the expansion
factor
of the universe factored out. The comoving
coordinates are related to the proper time and positions
t
and
by
,
.
Dots will denote derivatives with respect to
:
.
The conformal Newtonian gauge (also known as the longitudinal gauge)
is a particularly simple gauge to use
for the scalar mode of metric perturbations. The perturbations are
characterized by two scalar potentials
and
which appear
in the line element as
One advantage of this gauge is that
plays the role of the
gravitational potential in the Newtonian limit and thus has a simple
physical interpretation.
The conformal Newtonian gauge gravitational potentials in equation (1) obey equations similar to the classical Poisson equation:


Here,
and
are the spatial average density and
pressure,
is the density fluctuation,
is a potential for the momentum density
,
and
is a potential for the shear stress tensor
.
In the Newtonian limit, the momentum density, pressure, and shear stress
are negligible compared with the density. However, we must use the fully
relativistic equations since important gravitational contributions are
made by photons and massless neutrinos. To get these, we must calculate
the energy-momentum tensor components for these species. This is done
starting from a phase space description.
A phase space is described by six variables: three positions
and
their conjugate momenta
.
The conjugate momentum has the property that it is simply the spatial
part of the 4-momentum with lower indices, i.e., for a particle of mass
m,
where
.
The phase space distribution of the particles gives the
number of particles in a differential volume
in phase space:

The zeroth-order phase space distribution is the Fermi-Dirac distribution for fermions (+ sign) and the Bose-Einstein distribution for bosons (- sign):
where
,
denotes the temperature of the particles today, the factor
is the
number of spin degrees of freedom, and
and
are
the Planck and the Boltzmann constants.
It is convenient to replace
by
in order to eliminate the metric perturbations
from the definition of the momenta. Moreover, we shall write the
comoving 3-momentum
in terms of its magnitude and direction:
where
. Thus, we change our
phase space variables, replacing
by
.
It is also convenient to write the phase space distribution as a
zeroth-order distribution plus a perturbed piece in
the new variables
q
and
:
The phase space distribution evolves according to the Boltzmann equation.
In terms of our variables
this is

where the right-hand side involves terms due to collisions,
whose form depends on the type of particle interactions involved.
Since
is also a first-order quantity, the term
in the Boltzmann equation can be neglected to first
order. Then the Boltzmann equation in
k-space
can be written as
The terms in the Boltzmann equation depend on the direction of the
momentum
only through its angle with
.
Therefore, if the
momentum-dependence of the initial phase space perturbation is axially
symmetric about
, it will remain axially symmetric.
If axially-asymmetric perturbations in the neutrinos or other
collisionless particles are produced, they would generate no scalar
metric perturbations and thus would have no effect on other species.
Therefore, we shall assume that the initial momentum-dependence is
axially symmetric so that
depends on
only
through
q
and
. This assumption, which
effectively reduces the dimensionality of phase space perturbations by
one.
Massive neutrinos also obey the collisionless Boltzmann equation. The evolution of the distribution function for massive neutrinos is, however, complicated by their nonzero mass.
The perturbation
is expanded directly in a Legendre series
The Boltzmann equation becomes
Because these equations are independent of the direction of
,
the integration needs to be performed for each l on a grid in
k.
and
q.
High-resolution runs use 10,000 values of
l, 5000 values of
k,
and 128 values of
q,
or
points. For photons and
massless neutrinos the
q-dependence
is trivial (
in eqs. 8),
allowing us to integrate over
q
analytically and thereby simplify
the numerical integration.
The last piece needed for inclusion of the massive neutrinos is the means by which we go from the phase space distribution to the density, velocity, and shear stress fluctuations appearing in equations (2). As Ma and Bertschinger (1995) show, these are given by simple integrals over momentum:
These integrals are performed using 6th and 8th-order Newton-Cotes quadratures.