CLASS MANUAL
common.h File Reference
#include "stdio.h"
#include "stdlib.h"
#include "math.h"
#include "string.h"
#include "float.h"
#include "svnversion.h"
#include <stdarg.h>
+ Include dependency graph for common.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  precision
 

Enumerations

enum  evolver_type
 
enum  pk_def { delta_m_squared, delta_tot_squared, delta_bc_squared, delta_tot_from_poisson_squared }
 
enum  file_format
 

Detailed Description

Generic libraries, parameters and functions used in the whole code.


Data Structure Documentation

◆ precision

struct precision

All precision parameters.

Includes integrations steps, flags telling how the computation is to be performed, etc.

Data Fields
double a_ini_over_a_today_default

default initial value of scale factor in background integration, in units of scale factor today

double back_integration_stepsize

default step d tau in background integration, in units of conformal Hubble time ( $ d \tau $ = back_integration_stepsize / aH )

double tol_background_integration

parameter controlling precision of background integration

double tol_initial_Omega_r

parameter controlling how deep inside radiation domination must the initial time be chosen

double tol_M_ncdm

parameter controlling relative precision of ncdm mass for given ncdm current density

double tol_ncdm_newtonian

parameter controlling relative precision of integrals over ncdm phase-space distribution during perturbation calculation: value to be applied in Newtonian gauge

double tol_ncdm_synchronous

parameter controlling relative precision of integrals over ncdm phase-space distribution during perturbation calculation: value to be applied in synchronous gauge

double tol_ncdm

parameter controlling relative precision of integrals over ncdm phase-space distribution during perturbation calculation: value actually applied in chosen gauge

double tol_ncdm_bg

parameter controlling relative precision of integrals over ncdm phase-space distribution during background evolution

double tol_ncdm_initial_w

parameter controlling how relativistic must non-cold relics be at initial time

double safe_phi_scf

parameter controlling the initial scalar field in background functions

double recfast_z_initial

initial redshift in recfast

int recfast_Nz0

number of integration steps

double tol_thermo_integration

precision of each integration step

int recfast_Heswitch

recfast 1.4 parameter

double recfast_fudge_He

recfast 1.4 parameter

int recfast_Hswitch

recfast 1.5 switching parameter

double recfast_fudge_H

H fudge factor when recfast_Hswitch set to false (v1.4 fudging)

double recfast_delta_fudge_H

correction to H fudge factor in v1.5

double recfast_AGauss1

Amplitude of 1st Gaussian

double recfast_AGauss2

Amplitude of 2nd Gaussian

double recfast_zGauss1

ln(1+z) of 1st Gaussian

double recfast_zGauss2

ln(1+z) of 2nd Gaussian

double recfast_wGauss1

Width of 1st Gaussian

double recfast_wGauss2

Width of 2nd Gaussian

double recfast_z_He_1

down to which redshift Helium fully ionized

double recfast_delta_z_He_1

z range over which transition is smoothed

double recfast_z_He_2

down to which redshift first Helium recombination not complete

double recfast_delta_z_He_2

z range over which transition is smoothed

double recfast_z_He_3

down to which redshift Helium singly ionized

double recfast_delta_z_He_3

z range over which transition is smoothed

double recfast_x_He0_trigger

value below which recfast uses the full equation for Helium

double recfast_x_He0_trigger2

a second threshold used in derivative routine

double recfast_x_He0_trigger_delta

x_He range over which transition is smoothed

double recfast_x_H0_trigger

value below which recfast uses the full equation for Hydrogen

double recfast_x_H0_trigger2

a second threshold used in derivative routine

double recfast_x_H0_trigger_delta

x_H range over which transition is smoothed

double recfast_H_frac

governs time at which full equation of evolution for Tmat is used

double reionization_z_start_max

maximum redshift at which reionization should start. If not, return an error.

double reionization_sampling

control stepsize in z during reionization

double reionization_optical_depth_tol

fractional error on optical_depth

double reionization_start_factor

parameter for CAMB-like parametrization

int thermo_rate_smoothing_radius

plays a minor (almost aesthetic) role in the definition of the variation rate of thermodynamical quantities

enum evolver_type evolver

which type of evolver for integrating perturbations (Runge-Kutta? Stiff?...)

double k_min_tau0

number defining k_min for the computation of Cl's and P(k)'s (dimensionless): (k_min tau_0), usually chosen much smaller than one

double k_max_tau0_over_l_max

number defining k_max for the computation of Cl's (dimensionless): (k_max tau_0)/l_max, usually chosen around two

double k_step_sub

step in k space, in units of one period of acoustic oscillation at decoupling, for scales inside sound horizon at decoupling

double k_step_super

step in k space, in units of one period of acoustic oscillation at decoupling, for scales above sound horizon at decoupling

double k_step_transition

dimensionless number regulating the transition from 'sub' steps to 'super' steps. Decrease for more precision.

double k_step_super_reduction

the step k_step_super is reduced by this amount in the k–>0 limit (below scale of Hubble and/or curvature radius)

double k_per_decade_for_pk

if values needed between kmax inferred from k_oscillations and k_kmax_for_pk, this gives the number of k per decade outside the BAO region

double k_per_decade_for_bao

if values needed between kmax inferred from k_oscillations and k_kmax_for_pk, this gives the number of k per decade inside the BAO region (for finer sampling)

double k_bao_center

in ln(k) space, the central value of the BAO region where sampling is finer is defined as k_rec times this number (recommended: 3, i.e. finest sampling near 3rd BAO peak)

double k_bao_width

in ln(k) space, width of the BAO region where sampling is finer: this number gives roughly the number of BAO oscillations well resolved on both sides of the central value (recommended: 4, i.e. finest sampling from before first up to 3+4=7th peak)

double start_small_k_at_tau_c_over_tau_h

largest wavelengths start being sampled when universe is sufficiently opaque. This is quantified in terms of the ratio of thermo to hubble time scales, $ \tau_c/\tau_H $. Start when start_largek_at_tau_c_over_tau_h equals this ratio. Decrease this value to start integrating the wavenumbers earlier in time.

double start_large_k_at_tau_h_over_tau_k

largest wavelengths start being sampled when mode is sufficiently outside Hubble scale. This is quantified in terms of the ratio of hubble time scale to wavenumber time scale, $ \tau_h/\tau_k $ which is roughly equal to (k*tau). Start when this ratio equals start_large_k_at_tau_k_over_tau_h. Decrease this value to start integrating the wavenumbers earlier in time.

double tight_coupling_trigger_tau_c_over_tau_h

when to switch off tight-coupling approximation: first condition: $ \tau_c/\tau_H $ > tight_coupling_trigger_tau_c_over_tau_h. Decrease this value to switch off earlier in time. If this number is larger than start_sources_at_tau_c_over_tau_h, the code returns an error, because the source computation requires tight-coupling to be switched off.

double tight_coupling_trigger_tau_c_over_tau_k

when to switch off tight-coupling approximation: second condition: $ \tau_c/\tau_k \equiv k \tau_c $ < tight_coupling_trigger_tau_c_over_tau_k. Decrease this value to switch off earlier in time.

double start_sources_at_tau_c_over_tau_h

sources start being sampled when universe is sufficiently opaque. This is quantified in terms of the ratio of thermo to hubble time scales, $ \tau_c/\tau_H $. Start when start_sources_at_tau_c_over_tau_h equals this ratio. Decrease this value to start sampling the sources earlier in time.

int tight_coupling_approximation

method for tight coupling approximation

int l_max_g

number of momenta in Boltzmann hierarchy for photon temperature (scalar), at least 4

int l_max_pol_g

number of momenta in Boltzmann hierarchy for photon polarization (scalar), at least 4

int l_max_dr

number of momenta in Boltzmann hierarchy for decay radiation, at least 4

int l_max_ur

number of momenta in Boltzmann hierarchy for relativistic neutrino/relics (scalar), at least 4

int l_max_ncdm

number of momenta in Boltzmann hierarchy for relativistic neutrino/relics (scalar), at least 4

int l_max_g_ten

number of momenta in Boltzmann hierarchy for photon temperature (tensor), at least 4

int l_max_pol_g_ten

number of momenta in Boltzmann hierarchy for photon polarization (tensor), at least 4

double curvature_ini

initial condition for curvature for adiabatic

double entropy_ini

initial condition for entropy perturbation for isocurvature

double gw_ini

initial condition for tensor metric perturbation h

double perturb_integration_stepsize

default step $ d \tau $ in perturbation integration, in units of the timescale involved in the equations (usually, the min of $ 1/k $, $ 1/aH $, $ 1/\dot{\kappa} $)

double perturb_sampling_stepsize

default step $ d \tau $ for sampling the source function, in units of the timescale involved in the sources: $ (\dot{\kappa}- \ddot{\kappa}/\dot{\kappa})^{-1} $

double tol_perturb_integration

control parameter for the precision of the perturbation integration

double tol_tau_approx

precision with which the code should determine (by bisection) the times at which sources start being sampled, and at which approximations must be switched on/off (units of Mpc)

int radiation_streaming_approximation

method for switching off photon perturbations

double radiation_streaming_trigger_tau_over_tau_k

when to switch off photon perturbations, ie when to switch on photon free-streaming approximation (keep density and thtau, set shear and higher momenta to zero): first condition: $ k \tau $ > radiation_streaming_trigger_tau_h_over_tau_k

double radiation_streaming_trigger_tau_c_over_tau

when to switch off photon perturbations, ie when to switch on photon free-streaming approximation (keep density and theta, set shear and higher momenta to zero): second condition:

int ur_fluid_approximation

method for ultra relativistic fluid approximation

double ur_fluid_trigger_tau_over_tau_k

when to switch off ur (massless neutrinos / ultra-relativistic relics) fluid approximation

int ncdm_fluid_approximation

method for non-cold dark matter fluid approximation

double ncdm_fluid_trigger_tau_over_tau_k

when to switch off ncdm (massive neutrinos / non-cold relics) fluid approximation

double neglect_CMB_sources_below_visibility

whether CMB source functions can be approximated as zero when visibility function g(tau) is tiny

double k_per_decade_primordial

logarithmic sampling for primordial spectra (number of points per decade in k space)

double primordial_inflation_ratio_min

for each k, start following wavenumber when aH = k/primordial_inflation_ratio_min

double primordial_inflation_ratio_max

for each k, stop following wavenumber, at the latest, when aH = k/primordial_inflation_ratio_max

int primordial_inflation_phi_ini_maxit

maximum number of iteration when searching a suitable initial field value phi_ini (value reached when no long-enough slow-roll period before the pivot scale)

double primordial_inflation_pt_stepsize

controls the integration timestep for inflaton perturbations

double primordial_inflation_bg_stepsize

controls the integration timestep for inflaton background

double primordial_inflation_tol_integration

controls the precision of the ODE integration during inflation

double primordial_inflation_attractor_precision_pivot

targeted precision when searching attractor solution near phi_pivot

double primordial_inflation_attractor_precision_initial

targeted precision when searching attractor solution near phi_ini

int primordial_inflation_attractor_maxit

maximum number of iteration when searching attractor solution

double primordial_inflation_tol_curvature

for each k, stop following wavenumber, at the latest, when curvature perturbation R is stable up to to this tolerance

double primordial_inflation_aH_ini_target

control the step size in the search for a suitable initial field value

double primordial_inflation_end_dphi

first bracketing width, when trying to bracket the value phi_end at which inflation ends naturally

double primordial_inflation_end_logstep

logarithmic step for updating the bracketing width, when trying to bracket the value phi_end at which inflation ends naturally

double primordial_inflation_small_epsilon

value of slow-roll parameter epsilon used to define a field value phi_end close to the end of inflation (doesn't need to be exactly at the end): epsilon(phi_end)=small_epsilon (should be smaller than one)

double primordial_inflation_small_epsilon_tol

tolerance in the search for phi_end

double primordial_inflation_extra_efolds

a small number of efolds, irrelevant at the end, used in the search for the pivot scale (backward from the end of inflation)

int l_linstep

factor for logarithmic spacing of values of l over which bessel and transfer functions are sampled

double l_logstep

maximum spacing of values of l over which Bessel and transfer functions are sampled (so, spacing becomes linear instead of logarithmic at some point)

double hyper_x_min

flat case: lower bound on the smallest value of x at which we sample $ \Phi_l^{\nu}(x)$ or $ j_l(x)$

double hyper_sampling_flat

flat case: number of sampled points x per approximate wavelength $ 2\pi $

double hyper_sampling_curved_low_nu

open/closed cases: number of sampled points x per approximate wavelength $ 2\pi/\nu$, when $ \nu $ smaller than hyper_nu_sampling_step

double hyper_sampling_curved_high_nu

open/closed cases: number of sampled points x per approximate wavelength $ 2\pi/\nu$, when $ \nu $ greater than hyper_nu_sampling_step

double hyper_nu_sampling_step

open/closed cases: value of nu at which sampling changes

double hyper_phi_min_abs

small value of Bessel function used in calculation of first point x ( $ \Phi_l^{\nu}(x) $ equals hyper_phi_min_abs)

double hyper_x_tol

tolerance parameter used to determine first value of x

double hyper_flat_approximation_nu

value of nu below which the flat approximation is used to compute Bessel function

double q_linstep

asymptotic linear sampling step in q space, in units of $ 2\pi/r_a(\tau_rec) $ (comoving angular diameter distance to recombination)

double q_logstep_spline

initial logarithmic sampling step in q space, in units of $ 2\pi/r_a(\tau_{rec})$ (comoving angular diameter distance to recombination)

double q_logstep_open

in open models, the value of q_logstep_spline must be decreased according to curvature. Increasing this number will make the calculation more accurate for large positive Omega_k

double q_logstep_trapzd

initial logarithmic sampling step in q space, in units of $ 2\pi/r_a(\tau_{rec}) $ (comoving angular diameter distance to recombination), in the case of small q's in the closed case, for which one must used trapezoidal integration instead of spline (the number of q's for which this is the case decreases with curvature and vanishes in the flat limit)

double q_numstep_transition

number of steps for the transition from q_logstep_trapzd steps to q_logstep_spline steps (transition must be smooth for spline)

double transfer_neglect_delta_k_S_t0

for temperature source function T0 of scalar mode, range of k values (in 1/Mpc) taken into account in transfer function: for l < (k-delta_k)*tau0, ie for k > (l/tau0 + delta_k), the transfer function is set to zero

double transfer_neglect_delta_k_S_t1

same for temperature source function T1 of scalar mode

double transfer_neglect_delta_k_S_t2

same for temperature source function T2 of scalar mode

double transfer_neglect_delta_k_S_e

same for polarization source function E of scalar mode

double transfer_neglect_delta_k_V_t1

same for temperature source function T1 of vector mode

double transfer_neglect_delta_k_V_t2

same for temperature source function T2 of vector mode

double transfer_neglect_delta_k_V_e

same for polarization source function E of vector mode

double transfer_neglect_delta_k_V_b

same for polarization source function B of vector mode

double transfer_neglect_delta_k_T_t2

same for temperature source function T2 of tensor mode

double transfer_neglect_delta_k_T_e

same for polarization source function E of tensor mode

double transfer_neglect_delta_k_T_b

same for polarization source function B of tensor mode

double transfer_neglect_late_source

value of l below which the CMB source functions can be neglected at late time, excepted when there is a Late ISW contribution

double l_switch_limber

when to use the Limber approximation for project gravitational potential cl's

double l_switch_limber_for_nc_local_over_z

when to use the Limber approximation for local number count contributions to cl's (relative to central redshift of each bin)

double l_switch_limber_for_nc_los_over_z

when to use the Limber approximation for number count contributions to cl's integrated along the line-of-sight (relative to central redshift of each bin)

double selection_cut_at_sigma

in sigma units, where to cut gaussian selection functions

double selection_sampling

controls sampling of integral over time when selection functions vary quicker than Bessel functions. Increase for better sampling.

double selection_sampling_bessel

controls sampling of integral over time when selection functions vary slower than Bessel functions. Increase for better sampling

double selection_sampling_bessel_los

controls sampling of integral over time when selection functions vary slower than Bessel functions. This parameter is specific to number counts contributions to Cl integrated along the line of sight. Increase for better sampling

double selection_tophat_edge

controls how smooth are the edge of top-hat window function (<<1 for very sharp, 0.1 for sharp)

double halofit_dz

parameters relevant for HALOFIT computation spacing in redshift space defining values of z at which HALOFIT will be used. Intermediate values will be obtained by interpolation. Decrease for more precise interpolations, at the expense of increasing time spent in nonlinear_init()

double halofit_min_k_nonlinear

value of k in 1/Mpc above which non-linear corrections will be computed

double halofit_sigma_precision

a smaller value will lead to a more precise halofit result at the highest requested redshift, at the expense of requiring a larger k_max

double halofit_min_k_max

when halofit is used, k_max must be at least equal to this value (otherwise halofit could not find the scale of non-linearity)

double halofit_k_per_decade

halofit needs to evalute integrals (linear power spectrum times some kernels). They are sampled using this logarithmic step size.

int accurate_lensing

switch between Gauss-Legendre quadrature integration and simple quadrature on a subdomain of angles

int num_mu_minus_lmax

difference between num_mu and l_max, increase for more precision

int delta_l_max

difference between l_max in unlensed and lensed spectra

double tol_gauss_legendre

tolerance with which quadrature points are found: must be very small for an accurate integration (if not entered manually, set automatically to match machine precision)

double smallest_allowed_variation

machine-dependent, assigned automatically by the code

ErrorMsg error_message

zone for writing error messages

Enumeration Type Documentation

◆ evolver_type

parameters related to the precision of the code and to the method of calculation list of evolver types for integrating perturbations over time

◆ pk_def

enum pk_def

List of ways in which matter power spectrum P(k) can be defined. The standard definition is the first one (delta_m_squared) but alternative definitions can be useful in some projects.

Enumerator
delta_m_squared 

normal definition (delta_m includes all non-relativistic species at late times)

delta_tot_squared 

delta_tot includes all species contributions to (delta rho), and only non-relativistic contributions to rho

delta_bc_squared 

delta_bc includes contribution of baryons and cdm only to (delta rho) and to rho

delta_tot_from_poisson_squared 

use delta_tot inferred from gravitational potential through Poisson equation

◆ file_format

Different ways to present output files