Magnetic Fields in the Early Universe

For our recent paper (arXiv:0911.2714) we generated some work which may be of use to other people, which is include below. If you make use of any of them in published work, please cite the above paper.

Magnetic Fields in CAMB

We modified CAMB to allow calculation of the compensated magnetic mode in the scalar, vector and tensor case. Previously CAMB included code only for the vectors. This also corrects for the tight-coupling issues we found in our work, and adds in the ability to include massive neutrinos when calculating vector modes.

Th changes are in the two files equations.f90 and inidriver.F90. A tarball of these files is here, simply replace the CAMB (Feb 2009 version) files with these.

To calculate the magnetic modes use the scalar_mode, vector_mode and tensor_mode switches. A value of 0 turns off the magnetic modes. For the vectors and tensors 1 turns the magnetic modes on. For the scalars scalar_mode = 1 turns on the density perturbation, scalar_mode = 2 turns on the anisotropic stress perturbation, and scalar_mode = 2 turns on both simultaneously. For the scalar modes only you must also set the initial_condition = 6. To calculate the correct scalar power spectrum these must be weighted by the appropriate amplitudes and summed.

Passive Magnetic Modes

Calculating the amplitude of the passive modes, requires solving the Einstein equations on superhorizon scales sourced by the anisotropic stress from the magnetic fields (prior to neutrino decoupling), and the magnetic and neutrino stress (after decoupling). The calculations are quite tricky in our gauge-invariant notation.

The Mathematica notebook for performing the calculations is here: decouplingmodes.nb.

Calculating Initial Conditions

I wrote a lot of Mathematica code for finding the initial series solutions for perturbations in our Universe. This includes all scalar (1 adiabatic, 4 isocurvature and 2 magnetic modes), vector (1 vorticity mode, 1 magnetic mode), and tensor (1 gravitational wave mode and 1 magnetic mode) perturbations including terms up to second order in the neutrino mass. This will handle the standard species (cdm, baryons, photons), and two neutrino mass eigenstates (1 light, 1 heavy).

The code itself has no separate documentation, other than the text in the notebooks themselves. It should be reasonably obvious for mathematica users. A quick reference for the different files

gaugeinvariant.m
Contains all the gauge invariant perturbation equations, and machinery for gauge fixing.
dseries.m
A set of routines for forming series solutions to systems of coupled differential equations. Works by expanding out consistently and using Solve to find relationship between coefficients.
scalar.nb
A notebook for solving for the scalar intial conditions. General setup: first import equations and solve for background.; second take equations, gauge fix, substitute in background and solve for general perturbations; lastly take general perturbation and import initial conditions to find find individual modes.
vector.nb
Same as scalar.nb
tensor.nb
Same as scalar.nb

A tarball of all the files can be found here.