CLASS MANUAL
|
#include "background.h"
Functions | |
int | background_at_tau (struct background *pba, double tau, short return_format, short intermode, int *last_index, double *pvecback) |
int | background_tau_of_z (struct background *pba, double z, double *tau) |
int | background_functions (struct background *pba, double *pvecback_B, short return_format, double *pvecback) |
int | background_init (struct precision *ppr, struct background *pba) |
int | background_free (struct background *pba) |
int | background_free_input (struct background *pba) |
int | background_indices (struct background *pba) |
int | background_ncdm_distribution (void *pbadist, double q, double *f0) |
int | background_ncdm_test_function (void *pbadist, double q, double *test) |
int | background_ncdm_init (struct precision *ppr, struct background *pba) |
int | background_ncdm_momenta (double *qvec, double *wvec, int qsize, double M, double factor, double z, double *n, double *rho, double *p, double *drho_dM, double *pseudo_p) |
int | background_ncdm_M_from_Omega (struct precision *ppr, struct background *pba, int n_ncdm) |
int | background_solve (struct precision *ppr, struct background *pba) |
int | background_initial_conditions (struct precision *ppr, struct background *pba, double *pvecback, double *pvecback_integration) |
int | background_output_titles (struct background *pba, char titles[_MAXTITLESTRINGLENGTH_]) |
int | background_output_data (struct background *pba, int number_of_titles, double *data) |
int | background_derivs (double tau, double *y, double *dy, void *parameters_and_workspace, ErrorMsg error_message) |
double | V_e_scf (struct background *pba, double phi) |
double | V_p_scf (struct background *pba, double phi) |
double | V_scf (struct background *pba, double phi) |
Documented background module
Deals with the cosmological background evolution. This module has two purposes:
The overall logic in this module is the following:
So, we define the following routines:
Later in the code, if we know the variables {B} and need some quantity {A}, the quickest and most precise way is to call directly background_functions() (for instance, in simple models, if we want H at a given value of the scale factor). If we know 'tau' and want any other quantity, we can call background_at_tau(), which interpolates in the table and returns all values. Finally it can be useful to get 'tau' for a given redshift 'z': this can be done with background_tau_of_z(). So if we are somewhere in the code, knowing z and willing to get background quantities, we should call first background_tau_of_z() and then background_at_tau().
In order to save time, background_at_tau() can be called in three modes: short_info, normal_info, long_info (returning only essential quantities, or useful quantities, or rarely useful quantities). Each line in the interpolation table is a vector whose first few elements correspond to the short_info format; a larger fraction contribute to the normal format; and the full vector corresponds to the long format. The guideline is that short_info returns only geometric quantities like a, H, H'; normal format returns quantities strictly needed at each step in the integration of perturbations; long_info returns quantities needed only occasionally.
In summary, the following functions can be called from other modules:
int background_at_tau | ( | struct background * | pba, |
double | tau, | ||
short | return_format, | ||
short | intermode, | ||
int * | last_index, | ||
double * | pvecback | ||
) |
Background quantities at given conformal time tau.
Evaluates all background quantities at a given value of conformal time by reading the pre-computed table and interpolating.
pba | Input: pointer to background structure (containing pre-computed table) |
tau | Input: value of conformal time |
return_format | Input: format of output vector (short, normal, long) |
intermode | Input: interpolation mode (normal or closeby) |
last_index | Input/Output: index of the previous/current point in the interpolation array (input only for closeby mode, output for both) |
pvecback | Output: vector (assumed to be already allocated) |
Summary:
int background_tau_of_z | ( | struct background * | pba, |
double | z, | ||
double * | tau | ||
) |
Conformal time at given redshift.
Returns tau(z) by interpolation from pre-computed table.
pba | Input: pointer to background structure |
z | Input: redshift |
tau | Output: conformal time |
Summary:
int background_functions | ( | struct background * | pba, |
double * | pvecback_B, | ||
short | return_format, | ||
double * | pvecback | ||
) |
Background quantities at given .
Function evaluating all background quantities which can be computed analytically as a function of {B} parameters such as the scale factor 'a' (see discussion at the beginning of this file). In extended cosmological models, the pvecback_B vector contains other input parameters than just 'a', e.g. (phi, phidot) for quintessence, some temperature of exotic relics, etc...
pba | Input: pointer to background structure |
pvecback_B | Input: vector containing all {B} type quantities (scale factor, ...) |
return_format | Input: format of output vector |
pvecback | Output: vector of background quantities (assumed to be already allocated) |
Summary:
int background_init | ( | struct precision * | ppr, |
struct background * | pba | ||
) |
Initialize the background structure, and in particular the background interpolation table.
ppr | Input: pointer to precision structure |
pba | Input/Output: pointer to initialized background structure |
Summary:
int background_free | ( | struct background * | pba | ) |
Free all memory space allocated by background_init().
pba | Input: pointer to background structure (to be freed) |
int background_free_input | ( | struct background * | pba | ) |
Free pointers inside background structure which were allocated in input_read_parameters()
pba | Input: pointer to background structure |
int background_indices | ( | struct background * | pba | ) |
Assign value to each relevant index in vectors of background quantities.
pba | Input: pointer to background structure |
Summary:
int background_ncdm_distribution | ( | void * | pbadist, |
double | q, | ||
double * | f0 | ||
) |
This is the routine where the distribution function f0(q) of each ncdm species is specified (it is the only place to modify if you need a partlar f0(q))
pbadist | Input: structure containing all parameters defining f0(q) |
q | Input: momentum |
f0 | Output: phase-space distribution |
Next enter your analytic expression(s) for the p.s.d.'s. If you need different p.s.d.'s for different species, put each p.s.d inside a condition, like for instance: if (n_ncdm==2) {*f0=...}. Remember that n_ncdm = 0 refers to the first species.
This form is only appropriate for approximate studies, since in reality the chemical potentials are associated with flavor eigenstates, not mass eigenstates. It is easy to take this into account by introducing the mixing angles. In the later part (not read by the code) we illustrate how to do this.
int background_ncdm_test_function | ( | void * | pbadist, |
double | q, | ||
double * | test | ||
) |
This function is only used for the purpose of finding optimal quadrature weights. The logic is: if we can accurately convolve f0(q) with this function, then we can convolve it accurately with any other relevant function.
pbadist | Input: structure containing all background parameters |
q | Input: momentum |
test | Output: value of the test function test(q) |
Using a + bq creates problems for otherwise acceptable distributions which diverges as or
for
int background_ncdm_init | ( | struct precision * | ppr, |
struct background * | pba | ||
) |
This function finds optimal quadrature weights for each ncdm species
ppr | Input: precision structure |
pba | Input/Output: background structure |
int background_ncdm_momenta | ( | double * | qvec, |
double * | wvec, | ||
int | qsize, | ||
double | M, | ||
double | factor, | ||
double | z, | ||
double * | n, | ||
double * | rho, | ||
double * | p, | ||
double * | drho_dM, | ||
double * | pseudo_p | ||
) |
For a given ncdm species: given the quadrature weights, the mass and the redshift, find background quantities by a quick weighted sum over. Input parameters passed as NULL pointers are not evaluated for speed-up
qvec | Input: sampled momenta |
wvec | Input: quadrature weights |
qsize | Input: number of momenta/weights |
M | Input: mass |
factor | Input: normalization factor for the p.s.d. |
z | Input: redshift |
n | Output: number density |
rho | Output: energy density |
p | Output: pressure |
drho_dM | Output: derivative used in next function |
pseudo_p | Output: pseudo-pressure used in perturbation module for fluid approx |
Summary:
int background_ncdm_M_from_Omega | ( | struct precision * | ppr, |
struct background * | pba, | ||
int | n_ncdm | ||
) |
When the user passed the density fraction Omega_ncdm or omega_ncdm in input but not the mass, infer the mass with Newton iteration method.
ppr | Input: precision structure |
pba | Input/Output: background structure |
n_ncdm | Input: index of ncdm species |
int background_solve | ( | struct precision * | ppr, |
struct background * | pba | ||
) |
This function integrates the background over time, allocates and fills the background table
ppr | Input: precision structure |
pba | Input/Output: background structure |
Summary:
int background_initial_conditions | ( | struct precision * | ppr, |
struct background * | pba, | ||
double * | pvecback, | ||
double * | pvecback_integration | ||
) |
Assign initial values to background integrated variables.
ppr | Input: pointer to precision structure |
pba | Input: pointer to background structure |
pvecback | Input: vector of background quantities used as workspace |
pvecback_integration | Output: vector of background quantities to be integrated, returned with proper initial values |
Summary:
fix initial value of
If we have ncdm species, perhaps we need to start earlier than the standard value for the species to be relativistic. This could happen for some WDM models.
f = -Omega_rad+pow(pow(Omega_rad,3./2.)+0.5*pow(a/pba->a_today,6)*pvecback_integration[pba->index_bi_rho_dcdm]*pba->Gamma_dcdm/pow(pba->H0,3),2./3.);
but it is not numerically stable for very small f which is always the case. Instead we use the Taylor expansion of this equation, which is equivalent to ignoring f(a) in the Hubble rate.
There is also a space reserved for a future case where dr is not sourced by dcdm
TODO:
int background_output_titles | ( | struct background * | pba, |
char | titles[_MAXTITLESTRINGLENGTH_] | ||
) |
Subroutine for formatting background output
int background_output_data | ( | struct background * | pba, |
int | number_of_titles, | ||
double * | data | ||
) |
Stores quantities
int background_derivs | ( | double | tau, |
double * | y, | ||
double * | dy, | ||
void * | parameters_and_workspace, | ||
ErrorMsg | error_message | ||
) |
Subroutine evaluating the derivative with respect to conformal time of quantities which are integrated (a, t, 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 variable |
dy | Output: its derivative (already allocated) |
parameters_and_workspace | Input: pointer to fixed parameters (e.g. indices) |
error_message | Output: error message |
Summary:
double V_e_scf | ( | struct background * | pba, |
double | phi | ||
) |
Scalar field potential and its derivatives with respect to the field _scf For Albrecht & Skordis model: 9908085
TODO:
The units of phi, tau in the derivatives and the potential V are the following:
double V_p_scf | ( | struct background * | pba, |
double | phi | ||
) |
parameters and functions for the polynomial coefficient (polynomial bump)
double scf_alpha = 2;
double scf_B = 34.8;
double scf_A = 0.01; (values for their Figure 2)
double V_scf | ( | struct background * | pba, |
double | phi | ||
) |
Fianlly we can obtain the overall potential