CLASS MANUAL
|
#include "perturbations.h"
Functions | |
int | perturbations_sources_at_tau (struct perturbations *ppt, int index_md, int index_ic, int index_tp, double tau, double *psource_at_tau) |
int | perturbations_sources_at_z (struct background *pba, struct perturbations *ppt, int index_md, int index_ic, int index_tp, double z, double *psource_at_z) |
int | perturbations_sources_at_k_and_z (struct background *pba, struct perturbations *ppt, int index_md, int index_ic, int index_tp, double k, double z, double *psource_at_k_and_z) |
int | perturbations_output_data_at_z (struct background *pba, struct perturbations *ppt, enum file_format output_format, double z, int number_of_titles, double *data) |
int | perturbations_output_data_at_index_tau (struct background *pba, struct perturbations *ppt, enum file_format output_format, int index_tau, int number_of_titles, double *data) |
int | perturbations_output_data (struct background *pba, struct perturbations *ppt, enum file_format output_format, double *tkfull, int number_of_titles, double *data) |
int | perturbations_output_titles (struct background *pba, struct perturbations *ppt, enum file_format output_format, char titles[_MAXTITLESTRINGLENGTH_]) |
int | perturbations_output_firstline_and_ic_suffix (struct perturbations *ppt, int index_ic, char first_line[_LINE_LENGTH_MAX_], char ic_suffix[_SUFFIXNAMESIZE_]) |
int | perturbations_init (struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct perturbations *ppt) |
int | perturbations_free_input (struct perturbations *ppt) |
int | perturbations_free (struct perturbations *ppt) |
int | perturbations_indices (struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct perturbations *ppt) |
int | perturbations_timesampling_for_sources (struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct perturbations *ppt) |
int | perturbations_get_k_list (struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct perturbations *ppt) |
int | perturbations_workspace_init (struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct perturbations *ppt, int index_md, struct perturbations_workspace *ppw) |
int | perturbations_workspace_free (struct perturbations *ppt, int index_md, struct perturbations_workspace *ppw) |
int | perturbations_solve (struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct perturbations *ppt, int index_md, int index_ic, int index_k, struct perturbations_workspace *ppw) |
int | perturbations_prepare_k_output (struct background *pba, struct perturbations *ppt) |
int | perturbations_find_approximation_number (struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct perturbations *ppt, int index_md, double k, struct perturbations_workspace *ppw, double tau_ini, double tau_end, int *interval_number, int *interval_number_of) |
int | perturbations_find_approximation_switches (struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct perturbations *ppt, int index_md, double k, struct perturbations_workspace *ppw, double tau_ini, double tau_end, double precision, int interval_number, int *interval_number_of, double *interval_limit, int **interval_approx) |
int | perturbations_vector_init (struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct perturbations *ppt, int index_md, int index_ic, double k, double tau, struct perturbations_workspace *ppw, int *pa_old) |
int | perturbations_vector_free (struct perturbations_vector *pv) |
int | perturbations_initial_conditions (struct precision *ppr, struct background *pba, struct perturbations *ppt, int index_md, int index_ic, double k, double tau, struct perturbations_workspace *ppw) |
int | perturbations_approximations (struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct perturbations *ppt, int index_md, double k, double tau, struct perturbations_workspace *ppw) |
int | perturbations_timescale (double tau, void *parameters_and_workspace, double *timescale, ErrorMsg error_message) |
int | perturbations_einstein (struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct perturbations *ppt, int index_md, double k, double tau, double *y, struct perturbations_workspace *ppw) |
int | perturbations_total_stress_energy (struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct perturbations *ppt, int index_md, double k, double *y, struct perturbations_workspace *ppw) |
int | perturbations_sources (double tau, double *y, double *dy, int index_tau, void *parameters_and_workspace, ErrorMsg error_message) |
int | perturbations_print_variables (double tau, double *y, double *dy, void *parameters_and_workspace, ErrorMsg error_message) |
int | perturbations_derivs (double tau, double *y, double *dy, void *parameters_and_workspace, ErrorMsg error_message) |
int | perturbations_tca_slip_and_shear (double *y, void *parameters_and_workspace, ErrorMsg error_message) |
int | perturbations_rsa_delta_and_theta (struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct perturbations *ppt, double k, double *y, double a_prime_over_a, double *pvecthermo, struct perturbations_workspace *ppw, ErrorMsg error_message) |
int | perturbations_rsa_idr_delta_and_theta (struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct perturbations *ppt, double k, double *y, double a_prime_over_a, double *pvecthermo, struct perturbations_workspace *ppw, ErrorMsg error_message) |
Documented perturbation module
Julien Lesgourgues, 23.09.2010
Deals with the perturbation evolution. This module has two purposes:
Hence the following functions can be called from other modules:
int perturbations_sources_at_tau | ( | struct perturbations * | ppt, |
int | index_md, | ||
int | index_ic, | ||
int | index_tp, | ||
double | tau, | ||
double * | psource_at_tau | ||
) |
Source function at a given conformal time tau.
Evaluate source functions at given conformal time tau by reading the pre-computed table and interpolating.
ppt | Input: pointer to perturbation structure containing interpolation tables |
index_md | Input: index of requested mode (for scalars, just pass ppt->index_md_scalars) |
index_ic | Input: index of requested initial condition (for adiabatic, just pass ppt->index_ic_ad) |
index_tp | Input: index of requested source function type |
tau | Input: any value of conformal time |
psource_at_tau | Output: vector (already allocated) of source function as a function of k, psource_at_tau[index_k] |
Summary:
int perturbations_sources_at_z | ( | struct background * | pba, |
struct perturbations * | ppt, | ||
int | index_md, | ||
int | index_ic, | ||
int | index_tp, | ||
double | z, | ||
double * | psource_at_z | ||
) |
Source function at a given redhsift z.
Evaluate source functions at given redhsift z by reading the pre-computed table and interpolating.
pba | Input: pointer to background structure |
ppt | Input: pointer to perturbation structure containing interpolation tables |
index_md | Input: index of requested mode (for scalars, just pass ppt->index_md_scalars) |
index_ic | Input: index of requested initial condition (for adiabatic, just pass ppt->index_ic_ad) |
index_tp | Input: index of requested source function type |
z | Input: any value of redshift |
psource_at_z | Output: vector (already allocated) of source function as a function of k, psource_at_z[index_k] |
int perturbations_sources_at_k_and_z | ( | struct background * | pba, |
struct perturbations * | ppt, | ||
int | index_md, | ||
int | index_ic, | ||
int | index_tp, | ||
double | k, | ||
double | z, | ||
double * | psource_at_k_and_z | ||
) |
Source function at a given redhsift z and wavenumber k.
Evaluate source functions at given redhsift z and wavenumber k by reading the pre-computed table and interpolating.
pba | Input: pointer to background structure |
ppt | Input: pointer to perturbation structure containing interpolation tables |
index_md | Input: index of requested mode (for scalars, just pass ppt->index_md_scalars) |
index_ic | Input: index of requested initial condition (for adiabatic, just pass ppt->index_ic_ad) |
index_tp | Input: index of requested source function type |
k | Input: any value of wavenumber |
z | Input: any value of redshift |
psource_at_k_and_z | Output: pointer to the source function at (k,z) (so to just one number) |
int perturbations_output_data_at_z | ( | struct background * | pba, |
struct perturbations * | ppt, | ||
enum file_format | output_format, | ||
double | z, | ||
int | number_of_titles, | ||
double * | data | ||
) |
Function called by the output module or the wrappers, which returns the source functions corresponding to densities ('dTk') and velocities ('vTk') at a given conformal time tau corresponding to the input redshift z.
pba | Input: pointer to background structure |
ppt | Input: pointer to perturbation structure |
output_format | Input: choice of ordering and normalisation for the output quantities |
z | Input: redshift |
number_of_titles | Input: number of requested source functions (found in perturbations_output_titles) |
data | Output: vector of all source functions for all k values and initial conditions (previously allocated with the right size) |
int perturbations_output_data_at_index_tau | ( | struct background * | pba, |
struct perturbations * | ppt, | ||
enum file_format | output_format, | ||
int | index_tau, | ||
int | number_of_titles, | ||
double * | data | ||
) |
Function called by the output module or the wrappers, which returns the source functions corresponding to densities ('dTk') and velocities ('vTk') at a given conformal time tau corresponding to index index_tau in pre-computed table.
pba | Input: pointer to background structure |
ppt | Input: pointer to perturbation structure |
output_format | Input: choice of ordering and normalisation for the output quantities |
index_tau | Input: index pre-computed table ppt->ln_tau[index_tau] |
number_of_titles | Input: number of requested source functions (found in perturbations_output_titles) |
data | Output: vector of all source functions for all k values and initial conditions (previously allocated with the right size) |
int perturbations_output_data | ( | struct background * | pba, |
struct perturbations * | ppt, | ||
enum file_format | output_format, | ||
double * | tkfull, | ||
int | number_of_titles, | ||
double * | data | ||
) |
Function called by the output module or the wrappers, which returns the source functions corresponding to densities ('dTk') and velocities ('vTk') in the correct order (matching that in perturbations_output_titles), given a vector containing the corresponding scalar source functions at a given time.
pba | Input: pointer to background structure |
ppt | Input: pointer to perturbation structure |
output_format | Input: choice of ordering and normalisation for the output quantities |
tkfull | Input: vector of scalar sources at given time, tk[(index_k * ppt->ic_size[index_md] + index_ic) * ppt->tp_size[index_md] + index_tp] |
number_of_titles | Input: number of requested source functions (found in perturbations_output_titles) |
data | Output: vector of all source functions for all k values and initial conditions (previously allocated with the right size) |
int perturbations_output_titles | ( | struct background * | pba, |
struct perturbations * | ppt, | ||
enum file_format | output_format, | ||
char | titles[_MAXTITLESTRINGLENGTH_] | ||
) |
Fill array of strings with the name of the requested 'mTk, vTk' functions (transfer functions as a function of wavenumber for fixed times).
pba | Input: pointer to the background structure |
ppt | Input: pointer to the perturbation structure |
output_format | Input: flag for the format |
titles | Output: name strings |
int perturbations_output_firstline_and_ic_suffix | ( | struct perturbations * | ppt, |
int | index_ic, | ||
char | first_line[_LINE_LENGTH_MAX_], | ||
char | ic_suffix[_SUFFIXNAMESIZE_] | ||
) |
Fill strings that will be used when writing the transfer functions and the spectra in files (in the file names and in the comment at the beginning of each file).
ppt | Input: pointer to the perturbation structure |
index_ic | Input: index of the initial condition |
first_line | Output: line of comment |
ic_suffix | Output: suffix for the output file name |
int perturbations_init | ( | struct precision * | ppr, |
struct background * | pba, | ||
struct thermodynamics * | pth, | ||
struct perturbations * | ppt | ||
) |
Initialize the perturbations structure, and in particular the table of source functions.
Main steps:
ppr | Input: pointer to precision structure |
pba | Input: pointer to background structure |
pth | Input: pointer to thermodynamics structure |
ppt | Output: Initialized perturbation structure |
Summary:
int perturbations_free_input | ( | struct perturbations * | ppt | ) |
Free all memory space allocated by input.
Called by perturbations_free(), during shooting and if shooting failed
ppt | Input: perturbation structure with input pointers to be freed |
int perturbations_free | ( | struct perturbations * | ppt | ) |
Free all memory space allocated by perturbations_init().
To be called at the end of each run, only when no further calls to perturbations_sources_at_tau() are needed.
ppt | Input: perturbation structure to be freed |
Stuff related to perturbations output:
int perturbations_indices | ( | struct precision * | ppr, |
struct background * | pba, | ||
struct thermodynamics * | pth, | ||
struct perturbations * | ppt | ||
) |
Initialize all indices and allocate most arrays in perturbations structure.
ppr | Input: pointer to precision structure |
pba | Input: pointer to background structure |
pth | Input: pointer to thermodynamics structure |
ppt | Input/Output: Initialized perturbation structure |
Summary:
gamma is not neccessary for converting output to Nbody gauge but is included anyway.
int perturbations_timesampling_for_sources | ( | struct precision * | ppr, |
struct background * | pba, | ||
struct thermodynamics * | pth, | ||
struct perturbations * | ppt | ||
) |
Define time sampling for source functions.
For each type, compute the list of values of tau at which sources will be sampled. Knowing the number of tau values, allocate all arrays of source functions.
ppr | Input: pointer to precision structure |
pba | Input: pointer to background structure |
pth | Input: pointer to thermodynamics structure |
ppt | Input/Output: Initialized perturbation structure |
Summary:
int perturbations_get_k_list | ( | struct precision * | ppr, |
struct background * | pba, | ||
struct thermodynamics * | pth, | ||
struct perturbations * | ppt | ||
) |
Define the number of comoving wavenumbers using the information passed in the precision structure.
ppr | Input: pointer to precision structure |
pba | Input: pointer to background structure |
pth | Input: pointer to thermodynamics structure |
ppt | Input: pointer to perturbation structure |
Summary:
int perturbations_workspace_init | ( | struct precision * | ppr, |
struct background * | pba, | ||
struct thermodynamics * | pth, | ||
struct perturbations * | ppt, | ||
int | index_md, | ||
struct perturbations_workspace * | ppw | ||
) |
Initialize a perturbations_workspace structure. All fields are allocated here, with the exception of the perturbations_vector '-->pv' field, which is allocated separately in perturbations_vector_init. We allocate one such perturbations_workspace structure per thread and per mode (scalar/../tensor). Then, for each thread, all initial conditions and wavenumbers will use the same workspace.
ppr | Input: pointer to precision structure |
pba | Input: pointer to background structure |
pth | Input: pointer to the thermodynamics structure |
ppt | Input: pointer to the perturbation structure |
index_md | Input: index of mode under consideration (scalar/.../tensor) |
ppw | Input/Output: pointer to perturbations_workspace structure which fields are allocated or filled here |
Summary:
int perturbations_workspace_free | ( | struct perturbations * | ppt, |
int | index_md, | ||
struct perturbations_workspace * | ppw | ||
) |
Free the perturbations_workspace structure (with the exception of the perturbations_vector '-->pv' field, which is freed separately in perturbations_vector_free).
ppt | Input: pointer to the perturbation structure |
index_md | Input: index of mode under consideration (scalar/.../tensor) |
ppw | Input: pointer to perturbations_workspace structure to be freed |
int perturbations_solve | ( | struct precision * | ppr, |
struct background * | pba, | ||
struct thermodynamics * | pth, | ||
struct perturbations * | ppt, | ||
int | index_md, | ||
int | index_ic, | ||
int | index_k, | ||
struct perturbations_workspace * | ppw | ||
) |
Solve the perturbation evolution for a given mode, initial condition and wavenumber, and compute the corresponding source functions.
For a given mode, initial condition and wavenumber, this function finds the time ranges over which the perturbations can be described within a given approximation. For each such range, it initializes (or redistributes) perturbations using perturbations_vector_init(), and integrates over time. Whenever a "source sampling time" is passed, the source terms are computed and stored in the source table using perturbations_sources().
ppr | Input: pointer to precision structure |
pba | Input: pointer to background structure |
pth | Input: pointer to the thermodynamics structure |
ppt | Input/Output: pointer to the perturbation structure (output source functions S(k,tau) written here) |
index_md | Input: index of mode under consideration (scalar/.../tensor) |
index_ic | Input: index of initial condition under consideration (ad, iso...) |
index_k | Input: index of wavenumber |
ppw | Input: pointer to perturbations_workspace structure containing index values and workspaces |
Summary:
int perturbations_prepare_k_output | ( | struct background * | pba, |
struct perturbations * | ppt | ||
) |
Fill array of strings with the name of the 'k_output_values' functions (transfer functions as a function of time, for fixed values of k).
pba | Input: pointer to the background structure |
ppt | Input/Output: pointer to the perturbation structure |
Write titles for all perturbations that we would like to print/store.
Fluid
int perturbations_find_approximation_number | ( | struct precision * | ppr, |
struct background * | pba, | ||
struct thermodynamics * | pth, | ||
struct perturbations * | ppt, | ||
int | index_md, | ||
double | k, | ||
struct perturbations_workspace * | ppw, | ||
double | tau_ini, | ||
double | tau_end, | ||
int * | interval_number, | ||
int * | interval_number_of | ||
) |
For a given mode and wavenumber, find the number of intervals of time between tau_ini and tau_end such that the approximation scheme (and the number of perturbation equations) is uniform.
ppr | Input: pointer to precision structure |
pba | Input: pointer to background structure |
pth | Input: pointer to the thermodynamics structure |
ppt | Input: pointer to the perturbation structure |
index_md | Input: index of mode under consideration (scalar/.../tensor) |
k | Input: index of wavenumber |
ppw | Input: pointer to perturbations_workspace structure containing index values and workspaces |
tau_ini | Input: initial time of the perturbation integration |
tau_end | Input: final time of the perturbation integration |
interval_number | Output: total number of intervals |
interval_number_of | Output: number of intervals with respect to each particular approximation |
Summary:
int perturbations_find_approximation_switches | ( | struct precision * | ppr, |
struct background * | pba, | ||
struct thermodynamics * | pth, | ||
struct perturbations * | ppt, | ||
int | index_md, | ||
double | k, | ||
struct perturbations_workspace * | ppw, | ||
double | tau_ini, | ||
double | tau_end, | ||
double | precision, | ||
int | interval_number, | ||
int * | interval_number_of, | ||
double * | interval_limit, | ||
int ** | interval_approx | ||
) |
For a given mode and wavenumber, find the values of time at which the approximation changes.
ppr | Input: pointer to precision structure |
pba | Input: pointer to background structure |
pth | Input: pointer to the thermodynamics structure |
ppt | Input: pointer to the perturbation structure |
index_md | Input: index of mode under consideration (scalar/.../tensor) |
k | Input: index of wavenumber |
ppw | Input: pointer to perturbations_workspace structure containing index values and workspaces |
tau_ini | Input: initial time of the perturbation integration |
tau_end | Input: final time of the perturbation integration |
precision | Input: tolerance on output values |
interval_number | Input: total number of intervals |
interval_number_of | Input: number of intervals with respect to each particular approximation |
interval_limit | Output: value of time at the boundary of the intervals: tau_ini, tau_switch1, ..., tau_end |
interval_approx | Output: value of approximations in each interval |
Summary:
int perturbations_vector_init | ( | struct precision * | ppr, |
struct background * | pba, | ||
struct thermodynamics * | pth, | ||
struct perturbations * | ppt, | ||
int | index_md, | ||
int | index_ic, | ||
double | k, | ||
double | tau, | ||
struct perturbations_workspace * | ppw, | ||
int * | pa_old | ||
) |
Initialize the field '-->pv' of a perturbations_workspace structure, which is a perturbations_vector structure. This structure contains indices and values of all quantities which need to be integrated with respect to time (and only them: quantities fixed analytically or obeying constraint equations are NOT included in this vector). This routine distinguishes between two cases:
--> the input pa_old is set to the NULL pointer:
This happens when we start integrating over a new wavenumber and we want to set initial conditions for the perturbations. Then, it is assumed that ppw-->pv is not yet allocated. This routine allocates it, defines all indices, and then fills the vector ppw-->pv-->y with the initial conditions defined in perturbations_initial_conditions.
--> the input pa_old is not set to the NULL pointer and describes some set of approximations:
This happens when we need to change approximation scheme while integrating over a given wavenumber. The new approximation described by ppw-->pa is then different from pa_old. Then, this routine allocates a new vector with a new size and new index values; it fills this vector with initial conditions taken from the previous vector passed as an input in ppw-->pv, and eventually with some analytic approximations for the new variables appearing at this time; then the new vector comes in replacement of the old one, which is freed.
ppr | Input: pointer to precision structure |
pba | Input: pointer to background structure |
pth | Input: pointer to the thermodynamics structure |
ppt | Input: pointer to the perturbation structure |
index_md | Input: index of mode under consideration (scalar/.../tensor) |
index_ic | Input: index of initial condition under consideration (ad, iso...) |
k | Input: wavenumber |
tau | Input: conformal time |
ppw | Input/Output: workspace containing in input the approximation scheme, the background/thermodynamics/metric quantities, and eventually the previous vector y; and in output the new vector y. |
pa_old | Input: NULL is we need to set y to initial conditions for a new wavenumber; points towards a perturbations_approximations if we want to switch of approximation. |
Summary:
int perturbations_vector_free | ( | struct perturbations_vector * | pv | ) |
Free the perturbations_vector structure.
pv | Input: pointer to perturbations_vector structure to be freed |
int perturbations_initial_conditions | ( | struct precision * | ppr, |
struct background * | pba, | ||
struct perturbations * | ppt, | ||
int | index_md, | ||
int | index_ic, | ||
double | k, | ||
double | tau, | ||
struct perturbations_workspace * | ppw | ||
) |
For each mode, wavenumber and initial condition, this function initializes in the vector all values of perturbed variables (in a given gauge). It is assumed here that all values have previously been set to zero, only non-zero values are set here.
ppr | Input: pointer to precision structure |
pba | Input: pointer to background structure |
ppt | Input: pointer to the perturbation structure |
index_md | Input: index of mode under consideration (scalar/.../tensor) |
index_ic | Input: index of initial condition under consideration (ad, iso...) |
k | Input: wavenumber |
tau | Input: conformal time |
ppw | Input/Output: workspace containing in input the approximation scheme, the background/thermodynamics/metric quantities, and eventually the previous vector y; and in output the new vector y. |
Summary:
--> Declare local variables
--> For scalars
--> For tensors
tensor initial conditions take into account the fact that scalar (resp. tensor) 's are related to the real space power spectrum of curvature (resp. of the tensor part of metric perturbations)
In momentum space it is conventional to use the modes R(k) and h(k) where the quantity h obeying to the equation of propagation:
and the power spectra in real space and momentum space are related through:
where and are the dimensionless spectrum of curvature R, and F is a function of k2/K, where K is the curvature parameter. F is equal to one in flat space (K=0), and coming from the contraction of the laplacian eigentensor with itself. We will give F explicitly below.
Similarly the scalar (S) and tensor (T) 's are given by
The usual convention for the tensor-to-scalar ratio at pivot scale = 16 epsilon in single-field inflation is such that for constant and ,
so
A priori it would make sense to say that for a power-law primordial spectrum there is an extra factor (and eventually running and so on and so forth...)
However it has been shown that the minimal models of inflation in a negatively curved bubble lead to . In open models it is customary to define the tensor tilt in a non-flat universe as a deviation from this behavior rather than from true scale-invariance in the above sense.
Hence we should have
where the brackets
mean "if K<0"
Then
In the code, it is then a matter of choice to write:
or:
We choose this last option, such that the primordial and harmonic module differ minimally in flat and non-flat space. Then we must impose
The factor F is found to be given by:
Introducing as usual and using qdq = kdk this gives
Using qdq = kdk this is equivalent to
Finally, introducing and sgnK=SIGN(k) , this could also be written
Equation (43,44) of Hu, Seljak, White, Zaldarriaga is equivalent to absorbing the above factor in the definition of the primordial spectrum. Since the initial condition should be written in terms of k rather than nu, they should read
We leave the freedom to multiply by an arbitrary number ppr->gw_ini. The standard convention corresponding to standard definitions of r, , is however ppr->gw_ini=1.
int perturbations_approximations | ( | struct precision * | ppr, |
struct background * | pba, | ||
struct thermodynamics * | pth, | ||
struct perturbations * | ppt, | ||
int | index_md, | ||
double | k, | ||
double | tau, | ||
struct perturbations_workspace * | ppw | ||
) |
Evaluate background/thermodynamics at , infer useful flags / time scales for integrating perturbations.
Evaluate background quantities at , as well as thermodynamics for scalar mode; infer useful flags and time scales for integrating the perturbations:
So, in general, min_time_scale = .
However, if and , we can use the tight-coupling regime for photons and write equations in such way that the time scale becomes irrelevant (no effective mass term in ). Then, the smallest scale in the equations is only . In practise, it is sufficient to use only the condition .
Also, if and , we can switch off radiation perturbations (i.e. switch on the free-streaming approximation) and then the smallest scale is simply .
ppr | Input: pointer to precision structure |
pba | Input: pointer to background structure |
pth | Input: pointer to thermodynamics structure |
ppt | Input: pointer to the perturbation structure |
index_md | Input: index of mode under consideration (scalar/.../tensor) |
k | Input: wavenumber |
tau | Input: conformal time |
ppw | Input/Output: in output contains the approximation to be used at this time |
Summary:
int perturbations_timescale | ( | double | tau, |
void * | parameters_and_workspace, | ||
double * | timescale, | ||
ErrorMsg | error_message | ||
) |
Compute typical timescale over which the perturbation equations vary. Some integrators (e.g. Runge-Kunta) benefit from calling this routine at each step in order to adapt the next step.
This is one of the few functions in the code which is passed to the generic_integrator() routine. Since generic_integrator() should work with functions passed from various modules, the format of the arguments is a bit special:
tau | Input: conformal time |
parameters_and_workspace | Input: fixed parameters (e.g. indices), workspace, approximation used, etc. |
timescale | Output: perturbation variation timescale (given the approximation used) |
error_message | Output: error message |
Summary:
int perturbations_einstein | ( | struct precision * | ppr, |
struct background * | pba, | ||
struct thermodynamics * | pth, | ||
struct perturbations * | ppt, | ||
int | index_md, | ||
double | k, | ||
double | tau, | ||
double * | y, | ||
struct perturbations_workspace * | ppw | ||
) |
Compute metric perturbations (those not integrated over time) using Einstein equations
ppr | Input: pointer to precision structure |
pba | Input: pointer to background structure |
pth | Input: pointer to thermodynamics structure |
ppt | Input: pointer to the perturbation structure |
index_md | Input: index of mode under consideration (scalar/.../tensor) |
k | Input: wavenumber |
tau | Input: conformal time |
y | Input: vector of perturbations (those integrated over time) (already allocated) |
ppw | Input/Output: in output contains the updated metric perturbations |
Summary:
int perturbations_total_stress_energy | ( | struct precision * | ppr, |
struct background * | pba, | ||
struct thermodynamics * | pth, | ||
struct perturbations * | ppt, | ||
int | index_md, | ||
double | k, | ||
double * | y, | ||
struct perturbations_workspace * | ppw | ||
) |
Summary:
Variables used for FLD and PPF
We must gauge transform the pressure perturbation from the fluid rest-frame to the gauge we are working in
The equation is too stiff for Runge-Kutta when c_gamma_k_H_square is large. Use the asymptotic solution Gamma=Gamma'=0 in that case.
We must now check the stiffness criterion again and set Gamma_prime_fld accordingly.
Now construct the pressure perturbation, see 1903.xxxxx.
Construct energy density and pressure for DE (_fld) and the rest (_t). Also compute derivatives.
Compute background quantities X,Y,Z and their derivatives.
Construct theta_t and its derivative from the Euler equation
Analytic derivative of the equation for ppw->rho_plus_p_theta_fld above.
We can finally compute the pressure perturbation using the Euler equation for theta_fld
int perturbations_sources | ( | double | tau, |
double * | y, | ||
double * | dy, | ||
int | index_tau, | ||
void * | parameters_and_workspace, | ||
ErrorMsg | error_message | ||
) |
Compute the source functions (three terms for temperature, one for E or B modes, etc.)
This is one of the few functions in the code which is passed to the generic_integrator() routine. Since generic_integrator() should work with functions passed from various modules, the format of the arguments is a bit special:
tau | Input: conformal time |
y | Input: vector of perturbations |
dy | Input: vector of time derivative of perturbations |
index_tau | Input: index in the array tau_sampling |
parameters_and_workspace | Input/Output: in input, all parameters needed by perturbations_derivs, in output, source terms |
error_message | Output: error message |
Summary:
gamma in N-body gauge. Eq. A.2 in 1811.00904 gives k2gamma = (a'/a)H_T' + k2(phi-psi) - H_T''. The last term is cubersome to calculate (one would need finite derivatives) but usually small. Here we only compute an approximate k2gamma without this last term. If needed, the term could be restored: you can see how T. Tram did it in a previous commit beec79548877e1e43403d1f4de5ddee6741a3c16 (28.02.2019) - then it had to go to harmonic.c, now it could stay in this module. Later this feature was removed for simplicity. Note that to compute the transfer functions in the N-body gauge we do not need k2gamma anyway.
We follow the (debatable) CMBFAST/CAMB convention of not including rho_lambda in rho_tot
int perturbations_print_variables | ( | double | tau, |
double * | y, | ||
double * | dy, | ||
void * | parameters_and_workspace, | ||
ErrorMsg | error_message | ||
) |
When testing the code or a cosmological model, it can be useful to output perturbations at each step of integration (and not just the delta's at each source sampling point, which is achieved simply by asking for matter transfer functions). Then this function can be passed to the generic_evolver routine.
By default, instead of passing this function to generic_evolver, one passes a null pointer. Then this function is just not used.
tau | Input: conformal time |
y | Input: vector of perturbations |
dy | Input: vector of its derivatives (already allocated) |
parameters_and_workspace | Input: fixed parameters (e.g. indices) |
error_message | Output: error message |
Summary:
Fluid
int perturbations_derivs | ( | double | tau, |
double * | y, | ||
double * | dy, | ||
void * | parameters_and_workspace, | ||
ErrorMsg | error_message | ||
) |
Compute derivative of all perturbations to be integrated
For each mode (scalar/vector/tensor) and each wavenumber k, this function computes the derivative of all values in the vector of perturbed variables to be integrated.
This is one of the few functions in the code which is passed to the generic_integrator() routine. Since generic_integrator() should work with functions passed from various modules, the format of the arguments is a bit special:
tau | Input: conformal time |
y | Input: vector of perturbations |
dy | Output: vector of its derivatives (already allocated) |
parameters_and_workspace | Input/Output: in input, fixed parameters (e.g. indices); in output, background and thermo quantities evaluated at tau. |
error_message | Output: error message |
Summary:
int perturbations_tca_slip_and_shear | ( | double * | y, |
void * | parameters_and_workspace, | ||
ErrorMsg | error_message | ||
) |
Compute the baryon-photon slip (theta_g - theta_b)' and the photon shear in the tight-coupling approximation
y | Input: vector of perturbations |
parameters_and_workspace | Input/Output: in input, fixed parameters (e.g. indices); in output, slip and shear |
error_message | Output: error message |
Summary:
int perturbations_rsa_delta_and_theta | ( | struct precision * | ppr, |
struct background * | pba, | ||
struct thermodynamics * | pth, | ||
struct perturbations * | ppt, | ||
double | k, | ||
double * | y, | ||
double | a_prime_over_a, | ||
double * | pvecthermo, | ||
struct perturbations_workspace * | ppw, | ||
ErrorMsg | error_message | ||
) |
Compute the density delta and velocity theta of photons and ultra-relativistic neutrinos in the radiation streaming approximation
ppr | Input: pointer to precision structure |
pba | Input: pointer to background structure |
pth | Input: pointer to thermodynamics structure |
ppt | Input: pointer to perturbation structure |
k | Input: wavenumber |
y | Input: vector of perturbations |
a_prime_over_a | Input: a'/a |
pvecthermo | Input: vector of thermodynamics quantites |
ppw | Input/Output: in input, fixed parameters (e.g. indices); in output, delta and theta |
error_message | Output: error message |
int perturbations_rsa_idr_delta_and_theta | ( | struct precision * | ppr, |
struct background * | pba, | ||
struct thermodynamics * | pth, | ||
struct perturbations * | ppt, | ||
double | k, | ||
double * | y, | ||
double | a_prime_over_a, | ||
double * | pvecthermo, | ||
struct perturbations_workspace * | ppw, | ||
ErrorMsg | error_message | ||
) |
Compute the density delta and velocity theta of interacting dark radiation in its streaming approximation
ppr | Input: pointer to precision structure |
pba | Input: pointer to background structure |
pth | Input: pointer to thermodynamics structure |
ppt | Input: pointer to perturbation structure |
k | Input: wavenumber |
y | Input: vector of perturbations |
a_prime_over_a | Input: a'/a |
pvecthermo | Input: vector of thermodynamics quantites |
ppw | Input/Output: in input, fixed parameters (e.g. indices); in output, delta and theta |
error_message | Output: error message |