CLASSpp Manual
Cosmology reference and developer manual
Loading...
Searching...
No Matches
perturbations.h File Reference
#include <memory>
#include <vector>
#include "../species/base_species.h"
#include "evolver_ndf15.h"
#include "evolver_rkck.h"
#include "evolver_rkdp45.h"
#include "thermodynamics.h"

Go to the source code of this file.

Data Structures

struct  perturbs
 
struct  perturb_vector
 
struct  perturb_vector::TensorRelativisticLayout
 
struct  perturb_workspace
 

Macros

#define _SELECTION_NUM_MAX_   100
 
#define _MAX_NUMBER_OF_K_FILES_   30
 

Enumerations

enum  tca_flags
 
enum  idr_method
 
enum class  possible_gauges { newtonian , synchronous }
 

Detailed Description

Input data and shared types for perturbations.


Data Structure Documentation

◆ perturbs

struct perturbs

Input parameters for the perturbation calculation.

Computed perturbations and source tables belong to PerturbationsModule; this structure holds the shared configuration read by InputModule.

Data Fields
bool has_perturbations

do we need to compute perturbations at all ?

bool has_cls

do we need any harmonic space spectrum $ C_l $ (and hence Bessel functions, transfer functions, ...)?

bool has_scalars = true

do we need scalars?

bool has_vectors = false

do we need vectors?

bool has_tensors = false

do we need tensors?

bool has_ad = true

do we need adiabatic mode?

bool has_bi = false

do we need isocurvature bi mode?

bool has_cdi = false

do we need isocurvature cdi mode?

bool has_nid = false

do we need isocurvature nid mode?

bool has_niv = false

do we need isocurvature niv mode?

bool has_perturbed_recombination = false

Do we want to consider perturbed temperature and ionization fraction?

enum tensor_methods tensor_method

Neutrino contribution to tensors way to treat neutrinos in tensor perturbations(neglect, approximate as massless, take exact equations)

bool has_cl_cmb_temperature = false

do we need $ C_l $'s for CMB temperature?

bool has_cl_cmb_polarization = false

do we need $ C_l $'s for CMB polarization?

bool has_cl_cmb_lensing_potential

do we need $ C_l $'s for CMB lensing potential?

bool want_lcmb_full_limber

use the separate full-Limber CMB lensing scheme above l_switch_limber

bool has_cl_lensing_potential

do we need $ C_l $'s for galaxy lensing potential?

bool has_cl_number_count = false

do we need $ C_l $'s for density number count?

bool has_pk_matter = false

do we need matter Fourier spectrum?

bool has_density_transfers

do we need to output individual matter density transfer functions?

bool has_velocity_transfers

do we need to output individual matter velocity transfer functions?

bool has_metricpotential_transfers

do we need to output individual transfer functions for scalar metric perturbations?

bool has_Nbody_gauge_transfers

should we convert density and velocity transfer functions to Nbody gauge?

bool has_nl_corrections_based_on_delta_m

do we want to compute non-linear corrections with an algorithm relying on delta_m (like halofit)?

bool has_nc_density = false

in dCl, do we want density terms ?

bool has_nc_rsd = false

in dCl, do we want redshift space distortion terms ?

bool has_nc_lens = false

in dCl, do we want lensing terms ?

bool has_nc_gr = false

in dCl, do we want gravity terms ?

int l_scalar_max = 2500

maximum l value for CMB scalars $ C_l $'s

int l_vector_max = 500

maximum l value for CMB vectors $ C_l $'s

int l_tensor_max = 500

maximum l value for CMB tensors $ C_l $'s

int l_lss_max

maximum l value for LSS $ C_l $'s (density and lensing potential in bins)

double k_max_for_pk

maximum value of k in 1/Mpc in P(k) (if $ C_l $'s also requested, overseeded by value kmax inferred from l_scalar_max if it is bigger)

int selection_num = 1

number of selection functions (i.e. bins) for matter density $ C_l $'s

enum selection_type selection = gaussian

type of selection functions

double selection_mean[_SELECTION_NUM_MAX_]

centers of selection functions; element [0] default 1

double selection_width[_SELECTION_NUM_MAX_]

widths of selection functions; element [0] default 0.1

int switch_sw

in temperature calculation, do we want to include the intrinsic temperature + Sachs Wolfe term?

int switch_eisw

in temperature calculation, do we want to include the early integrated Sachs Wolfe term?

int switch_lisw

in temperature calculation, do we want to include the late integrated Sachs Wolfe term?

int switch_dop = 1

in temperature calculation, do we want to include the Doppler term?

int switch_pol

in temperature calculation, do we want to include the polarization-related term?

double eisw_lisw_split_z

at which redshift do we define the cut between eisw and lisw ?

int store_perturbations = false

Do we want to store perturbations?

int k_output_values_num = 0

Number of perturbation outputs (default=0)

double k_output_values[_MAX_NUMBER_OF_K_FILES_]

List of k values where perturbation output is requested.

double three_ceff2_ur

3 x effective squared sound speed for the ultrarelativistic perturbations

double three_cvis2_ur

3 x effective viscosity parameter for the ultrarelativistic perturbations

double G_eff_ur = 0.
double z_max_pk

when we compute only the matter spectrum / transfer functions, but not the CMB, we are sometimes interested to sample source functions at very high redshift, way before recombination. This z_max_pk will then fix the initial sampling time of the sources.

possible_gauges gauge

gauge in which to perform this calculation

double selection_min_of_tau_min

used in presence of selection functions (for matter density, cosmic shear...)

double selection_max_of_tau_max

used in presence of selection functions (for matter density, cosmic shear...)

double selection_delta_tau

used in presence of selection functions (for matter density, cosmic shear...)

double * selection_tau_min

value of conformal time below which W(tau) is considered to vanish for each bin

double * selection_tau_max

value of conformal time above which W(tau) is considered to vanish for each bin

double * selection_tau

value of conformal time at the center of each bin

double * selection_function

selection function W(tau), normalized to $ \int W(tau) dtau=1 $, stored in selection_function[bin*tau_size_+index_tau]

short perturbations_verbose

flag regulating the amount of information sent to standard output (none if set to zero)

◆ perturb_vector

struct perturb_vector

Structure containing the indices and the values of the perturbation variables which are integrated over time (as well as their time-derivatives). For a given wavenumber, the size of these vectors changes when the approximation scheme changes.

Data Fields
vector< unique_ptr< PerturbLayout > > species_layouts
vector< ActiveSpecies > active_species
vector< SourceSpecies > source_species
PerturbLayout * photon_layout = nullptr
PerturbLayout * baryon_layout = nullptr
PerturbLayout * cdm_layout = nullptr
int index_pt_perturbed_recombination_delta_temp

Gas temperature perturbation

int index_pt_perturbed_recombination_delta_chi

Inionization fraction perturbation

int index_pt_eta

synchronous gauge metric perturbation eta

int index_pt_phi

newtonian gauge metric perturbation phi

int index_pt_hv_prime

vector metric perturbation h_v' in synchronous gauge

int index_pt_V

vector metric perturbation V in Newtonian gauge

int index_pt_gw

tensor metric perturbation h (gravitational waves)

int index_pt_gwdot

its time-derivative

struct TensorRelativisticLayout tensor_ur_layout
int pt_size

size of perturbation vector

vector< double > y

vector of perturbations to be integrated

vector< double > dy

time-derivative of the same vector

vector< int > used_in_sources

boolean array specifying which perturbations enter in the calculation of source functions

◆ perturb_vector::TensorRelativisticLayout

struct perturb_vector::TensorRelativisticLayout

Tensor "relativistic neutrino" Boltzmann hierarchy. Unlike the scalar/vector hierarchies this is NOT owned by a species: it is a single hierarchy sourced by the gravitational waves (index_pt_gwdot) and exists whenever evolve_tensor_ur_ is set — i.e. when any massless relativistic species contributes, be it the ultra-relativistic neutrinos or massive ncdm under the massless approximation. The perturb_vector owns it and the perturbations module registers/evolves it directly (formerly the bare index_pt_*_ur fields).

Data Fields
int idx_delta = -1

was index_pt_delta_ur

int idx_theta = -1

was index_pt_theta_ur

int idx_shear = -1

was index_pt_shear_ur

int idx_l3 = -1

was index_pt_l3_ur (only registered when l_max >= 3)

int l_max = -1

was l_max_ur

◆ perturb_workspace

struct perturb_workspace

Workspace containing, among other things, the value at a given time of all background/perturbed quantities, as well as their indices. There will be one such structure created for each mode (scalar/.../tensor) and each thread (in case of parallel computing)

Data Fields
int index_mt_psi

psi in longitudinal gauge

int index_mt_phi_prime

(d phi/d conf.time) in longitudinal gauge

int index_mt_h_prime

h' (wrt conf. time) in synchronous gauge

int index_mt_h_prime_prime

h'' (wrt conf. time) in synchronous gauge

int index_mt_eta_prime

eta' (wrt conf. time) in synchronous gauge

int index_mt_alpha

$ \alpha = (h' + 6 \eta') / (2 k^2) $ in synchronous gauge

int index_mt_alpha_prime

$ \alpha'$ wrt conf. time) in synchronous gauge

int index_mt_gw_prime_prime

second derivative wrt conformal time of gravitational wave field, often called h

int index_mt_V_prime

derivative of Newtonian gauge vector metric perturbation V

int index_mt_hv_prime_prime

Second derivative of Synchronous gauge vector metric perturbation $ h_v$

int mt_size

size of metric perturbation vector

vector< double > pvecback

background quantities

vector< double > pvecthermo

thermodynamics quantities

vector< double > pvecmetric

metric quantities

unique_ptr< perturb_vector > pv

owning pointer to vector of integrated perturbations and their time-derivatives

double delta_rho

total density perturbation (gives delta Too)

double rho_plus_p_theta

total (rho+p)*theta perturbation (gives delta Toi)

double rho_plus_p_shear

total (rho+p)*shear (gives delta Tij)

double delta_p

total pressure perturbation (gives Tii)

double rho_plus_p_tot

total (rho+p) (used to infer theta_tot from rho_plus_p_theta)

double gw_source

stress-energy source term in Einstein's tensor equations (gives Tij[tensor])

double vector_source_pi

first stress-energy source term in Einstein's vector equations

double vector_source_v

second stress-energy source term in Einstein's vector equations

double tca_shear_g

photon shear in tight-coupling approximation

double tca_slip

photon-baryon slip in tight-coupling approximation

double rsa_delta_g

photon density in radiation streaming approximation

double rsa_theta_g

photon velocity in radiation streaming approximation

double rsa_delta_ur

photon density in radiation streaming approximation

double rsa_theta_ur

photon velocity in radiation streaming approximation

double rsa_delta_idr

interacting dark radiation density in dark radiation streaming approximation

double rsa_theta_idr

interacting dark radiation velocity in dark radiation streaming approximation

double delta_m

relative density perturbation of all non-relativistic species

double theta_m

velocity divergence theta of all non-relativistic species

double delta_cb

relative density perturbation of only cdm and baryon

double theta_cb

velocity divergence theta of only cdm and baryon

double delta_rho_fld

density perturbation of fluid, not so trivial in PPF scheme

double delta_p_fld

pressure perturbation of fluid, very non-trivial in PPF scheme

double rho_plus_p_theta_fld

velocity divergence of fluid, not so trivial in PPF scheme

double Gamma_prime_fld

Gamma_prime in PPF scheme (equivalent to eq. 14 in 0808.3125)

FILE * perturb_output_file

filepointer to output file

int index_ikout

index for output k value (when k_output_values is set)

PerturbScalarContext scalar_ctx
short inter_mode

flag defining the method used for interpolation background/thermo quantities tables

int last_index_back

the background interpolation function background_at_tau() keeps memory of the last point called through this index

int last_index_thermo

the thermodynamics interpolation function thermodynamics_at_z() keeps memory of the last point called through this index

int index_ap_tca

index for tight-coupling approximation

int index_ap_rsa

index for radiation streaming approximation

int index_ap_tca_idm_dr

index for dark tight-coupling approximation (idm-idr)

int index_ap_tca_idm_drmd

index for dark tight-coupling approximation (DRMD)

int index_ap_rsa_idr

index for dark radiation streaming approximation

int index_ap_ufa

index for ur fluid approximation

int index_ap_ncdmfa

index for ncdm fluid approximation

int ap_size

number of relevant approximations for a given mode

vector< int > approx

array of approximation flags holding at a given time: approx[index_ap]

int max_l_max

maximum l_max for any multipole

vector< double > s_l

array of freestreaming coefficients $ s_l = \sqrt{1-K*(l^2-1)/k^2} $

double cotKgen

generalised cot(sqrt(|K|)*tau)/k, for closing free-streaming hierarchies; valid for all modes

Macro Definition Documentation

◆ _SELECTION_NUM_MAX_

#define _SELECTION_NUM_MAX_   100

maximum number and types of selection function (for bins of matter density or cosmic shear)

◆ _MAX_NUMBER_OF_K_FILES_

#define _MAX_NUMBER_OF_K_FILES_   30

maximum number of k-values for perturbation output

Enumeration Type Documentation

◆ tca_flags

enum tca_flags

flags for various approximation schemes (tca = tight-coupling approximation, rsa = radiation streaming approximation, ufa = massless neutrinos / ultra-relativistic relics fluid approximation)

CAUTION: must be listed below in chronological order, and cannot be reversible. When integrating equations for a given mode, it is only possible to switch from left to right in the lists below.

◆ idr_method

enum idr_method

labels for the way in which each approximation scheme is implemented

◆ possible_gauges

enum class possible_gauges
strong

List of coded gauges. More gauges can in principle be defined.

Enumerator
newtonian 

newtonian (or longitudinal) gauge

synchronous 

synchronous gauge with $ \theta_{cdm} = 0 $ by convention