CLASS MANUAL
|
#include "distortions.h"
Functions | |
int | distortions_init (struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct perturbations *ppt, struct primordial *ppm, struct distortions *psd) |
int | distortions_free (struct distortions *psd) |
int | distortions_constants (struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct distortions *psd) |
int | distortions_set_detector (struct precision *ppr, struct distortions *psd) |
int | distortions_generate_detector (struct precision *ppr, struct distortions *psd) |
int | distortions_read_detector_noisefile (struct precision *ppr, struct distortions *psd) |
int | distortions_indices (struct distortions *psd) |
int | distortions_get_xz_lists (struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct distortions *psd) |
int | distortions_compute_branching_ratios (struct precision *ppr, struct distortions *psd) |
int | distortions_compute_heating_rate (struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct perturbations *ppt, struct primordial *ppm, struct distortions *psd) |
int | distortions_compute_spectral_shapes (struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct distortions *psd) |
int | distortions_add_effects_reio (struct background *pba, struct thermodynamics *pth, struct distortions *psd, double T_e, double Dtau, double beta, double beta_z, double x, double *y_reio, double *DI_reio) |
int | distortions_read_br_data (struct precision *ppr, struct distortions *psd) |
int | distortions_spline_br_data (struct distortions *psd) |
int | distortions_interpolate_br_data (struct distortions *psd, double z, double *f_g, double *f_y, double *f_mu, double *f_E, int *last_index) |
int | distortions_free_br_data (struct distortions *psd) |
int | distortions_read_sd_data (struct precision *ppr, struct distortions *psd) |
int | distortions_spline_sd_data (struct distortions *psd) |
int | distortions_interpolate_sd_data (struct distortions *psd, double nu, double *G_T, double *Y_SZ, double *M_mu, double *S, int *index) |
int | distortions_free_sd_data (struct distortions *psd) |
int | distortions_output_heat_titles (struct distortions *psd, char titles[_MAXTITLESTRINGLENGTH_]) |
int | distortions_output_heat_data (struct distortions *psd, int number_of_titles, double *data) |
int | distortions_output_sd_titles (struct distortions *psd, char titles[_MAXTITLESTRINGLENGTH_]) |
int | distortions_output_sd_data (struct distortions *psd, int number_of_titles, double *data) |
Documented module on spectral distortions Matteo Lucca, 31.10.2018 Nils Schoeneberg, 18.02.2019
When using this module please consider citing: Lucca et al. 2019 (JCAP02(2020)026, arXiv:1910.04619) as well as related pioneering works such as: Chluba & Sunyaev 2012 (MNRAS419(2012)1294-1314, arXiv:1109.6552) Chluba 2013 (MNRAS434(2013)352, arXiv:1304.6120) Clube & Jeong 2014 (MNRAS438(2014)2065–2082, arXiv:1306.5751)
int distortions_init | ( | struct precision * | ppr, |
struct background * | pba, | ||
struct thermodynamics * | pth, | ||
struct perturbations * | ppt, | ||
struct primordial * | ppm, | ||
struct distortions * | psd | ||
) |
Initialize the distortions structure.
ppr | Input: pointer to precision structure |
pba | Input: pointer to background structure |
pth | Input: pointer to the thermodynamics structure |
ppt | Input: pointer to the perturbations structure |
ppm | Input: pointer to the primordial structure |
psd | Input/Output: pointer to initialized distortions structure |
Set physical constants
Set/Check the distortions detector
Assign values to all indices in the distortions structure
Define z and x arrays
Define branching ratios
Define heating function
Define final spectral distortions
int distortions_free | ( | struct distortions * | psd | ) |
Free all memory space allocated by distortions_init()
psd | Input: pointer to distortions structure (to be freed) |
Define local variables
Delete lists
Delete noise file
Delete branching ratios
Delete heating functions
Delete distortion shapes
Delete distortion amplitudes
Delete total distortion
int distortions_constants | ( | struct precision * | ppr, |
struct background * | pba, | ||
struct thermodynamics * | pth, | ||
struct distortions * | psd | ||
) |
Calculate physical constant.
ppr | Input: pointer to precision structure |
pba | Input: pointer to background structure |
pth | Input: pointer to thermodynamics structure |
psd | Input: pointer to the distortions structure |
Define unit conventions
Define transition redshifts z_muy and z_th
int distortions_set_detector | ( | struct precision * | ppr, |
struct distortions * | psd | ||
) |
Check wether the detector name and the detector properties are a valid combination.
There are four options for the user
defined_name = true, defined_detector = true Meaning: The user requests a specific detector with specific settings --> Check that the detector exists and has the same settings
defined_name = true, defined_detector = false Meaning: The user requests a specific detector --> Check that the detector exists and use the given settings
defined_name = false, defined_detector = true Meaning: The user requests specific settings, but does not name their detector --> Check that the settings exists, or create them
defined_name = false, defined_detector = false Meaning: The user just wants the default detector and settings --> Just use the default settings and skip this function
ppr | Input: pointer to precision structure |
psd | Input/Output: pointer to initialized distortions structure |
Local variables
Open file
int distortions_generate_detector | ( | struct precision * | ppr, |
struct distortions * | psd | ||
) |
Evaluate branching ratios, spectral shapes, E and S vectors for a given detector as described in external/distortions/README using generate_PCA_files.py.
ppr | Input: pointer to precision structure |
psd | Input: pointer to the distortions structure |
Define local variables
int distortions_read_detector_noisefile | ( | struct precision * | ppr, |
struct distortions * | psd | ||
) |
Reads the external detector noise file containing the array of frequencies and the detector accuracies Assumed to be in units of [GHz] and [10^-26 W/m^2/Hz/sr] respectively
ppr | Input: pointer to the precisions structure |
psd | Input: pointer to the distortions structure |
Define local variables
Open file
Read header
Read number of lines, infer size of arrays and allocate them
Read parameters
int distortions_indices | ( | struct distortions * | psd | ) |
Assign value to each relevant index in vectors of distortions quantities.
psd | Input: pointer to distortions structure |
Define local variables
Define indeces for tables - br_table defined in distortions_compute_branching_ratios,
int distortions_get_xz_lists | ( | struct precision * | ppr, |
struct background * | pba, | ||
struct thermodynamics * | pth, | ||
struct distortions * | psd | ||
) |
Calculate redshift and frequency vectors and weights for redshift integral.
ppr | Input: pointer to precision structure |
pba | Input: pointer to background structure |
pth | Input: pointer to the thermodynamics structure |
psd | Input/Output: pointer to initialized distortions structure |
Define local variables
Define and allocate z array
Define and allocate integrating weights for z array
Define and allocate x array
Define and allocate integrating weights for x array
int distortions_compute_branching_ratios | ( | struct precision * | ppr, |
struct distortions * | psd | ||
) |
Calculate branching ratios.
Computing the full evolution of the thermal history of the universe is rather time consuming and mathematically challenging. It is therefore not implemented here. However, there are (at least) 5 levels of possible approximatin to evaluate the SD branching ratios (see also Chluba 2016 for useful discussion) 1) Use a sharp transition at z_mu-y and no distortions before z_th ('branching approx'=sharp_sharp) 2) Use a sharp transition at z_mu-y and a soft transition at z_th ('branching approx'=sharp_soft) 3) Use a soft transition at a_mu-y and z_th as described in Chluba 2013 ('branching approx'=soft_soft) In this case, the user must be aware that energy conservation is violated and no residuals are taken into consideration. 4) Use a soft transition at a_mu-y and z_th imposing conservation of energy ('branching approx'=soft_soft_cons) 5) Use a PCA method as described in Chluba & Jeong 2014 ('branching approx'=exact) In this case, the definition of the BRs is detector dependent and the user has therefore to specify the detector type and corresponding characteristics.
All quantities are stored in the table br_table.
ppr | Input: pointer to the precision structure |
psd | Input: pointer to the distortions structure |
Define local variables
Allocate space for branching ratios in br_table
Calulate branching ratios
int distortions_compute_heating_rate | ( | struct precision * | ppr, |
struct background * | pba, | ||
struct thermodynamics * | pth, | ||
struct perturbations * | ppt, | ||
struct primordial * | ppm, | ||
struct distortions * | psd | ||
) |
Import heating rates from heating structure.
ppr | Input: pointer to precision structure |
pba | Input: pointer to background structure |
pth | Input: pointer to the thermodynamics structure |
ppt | Input: pointer to the perturbations structure |
ppm | Input: pointer to the primordial structure |
psd | Input: pointer to the distortions structure |
Define local variables
Update heating table with second order contributions
Allocate space for background vector
Allocate space for total heating function
Import quantities from background structure
Import heat from non-injection structure
Add heat from injection structure
Calculate total heating rate
Update heating table with second order contributions
int distortions_compute_spectral_shapes | ( | struct precision * | ppr, |
struct background * | pba, | ||
struct thermodynamics * | pth, | ||
struct distortions * | psd | ||
) |
Calculate spectral amplitudes and corresponding distortions.
The calculation has been done according to Chluba & Jeong 2014 (arxiv:1306.5751). All quantities are stored in the tables sd_parameter_table and sd_table.
ppr | Input: pointer to precision structure |
pba | Input: pointer to background structure |
pth | Input: pointer to thermodynamics structure |
psd | Input: pointer to the distortions structure |
Define local variables
Allocate space for spectral distortion amplitude in table sd_parameter_table
Compute distortion amplitudes corresponding to each branching ratio (g, y and mu)
Allocate space for distortions shapes in distortions_table
Calculate spectral shapes
Compute distortion amplitude for residual parameter epsilon
Allocate space for final spectral distortion
Calculate spectral distortions according to Chluba & Jeong 2014 (arxiv:1306.5751, Eq. (11))
Include additional sources of distortions
Compute total heating
Print found parameters
int distortions_add_effects_reio | ( | struct background * | pba, |
struct thermodynamics * | pth, | ||
struct distortions * | psd, | ||
double | T_e, | ||
double | Dtau, | ||
double | beta, | ||
double | beta_z, | ||
double | x, | ||
double * | y_reio, | ||
double * | DI_reio | ||
) |
Compute relativistic contribution from reionization and structure formation according to 1) Nozawa et al. 2005 (up to order 3 in theta_e) or 2) Chluba et al. 2012 (up to order ? in ?). Note that, for the moment, this appoximation is only valid for cluster temperatures lower than few KeV.
pba | Input: pointer to background structure |
pth | Input: pointer to thermodynamics structure |
psd | Input: pointer to the distortions structure |
T_e | Input: electron temperature in keV |
Dtau | Input: optical depth |
beta | Input: peculiar velocity of the cluster |
beta_z | Input: peculiar velocity of the cluster with respect to the line-of-sight |
x | Input: dimensionless frequency |
y_reio | Output: y-parameter |
DI_reio | Output: spectral distortion |
Define local variables
Thermal SZ effect (TSZ)
Non-relativistic TSZ
Relativistic TSZ
Kinematic SZ effect (kSZ)
Total distortion
int distortions_read_br_data | ( | struct precision * | ppr, |
struct distortions * | psd | ||
) |
Reads the external file branching_ratios calculated according to Chluba & Jeong 2014
ppr | Input: pointer to precision structure |
psd | Input: pointer to the distortions structure |
Define local variables
Open file
Read header
Read number of lines, infer size of arrays and allocate them
Read parameters
int distortions_spline_br_data | ( | struct distortions * | psd | ) |
Spline the quantitites read in distortions_read_br_data
psd | Input: pointer to the distortions structure |
Allocate second derivatives
Spline branching ratios
int distortions_interpolate_br_data | ( | struct distortions * | psd, |
double | z, | ||
double * | f_g, | ||
double * | f_y, | ||
double * | f_mu, | ||
double * | f_E, | ||
int * | last_index | ||
) |
Interpolate the quantitites splined in distortions_spline_br_data
psd | Input: pointer to the distortions structure |
z | Input: redshift |
f_g | Output: branching ratio for temperature shift |
f_y | Output: branching ratio for y distortions |
f_mu | Output: branching ratio for mu-distortions |
f_E | Output: branching ratio for residuals (multipole expansion) |
last_index | Output: multipole of PCA expansion for f_E |
Define local variables
Find z position
Evaluate corresponding values for the branching ratios
int distortions_free_br_data | ( | struct distortions * | psd | ) |
Free from distortions_read_br_data and distortions_spline_br_data
psd | Input: pointer to distortions structure (to be freed) |
int distortions_read_sd_data | ( | struct precision * | ppr, |
struct distortions * | psd | ||
) |
Reads the external file distortions_shapes calculated according to Chluba & Jeong 2014
ppr | Input: pointer to precision structure |
psd | Input: pointer to the distortions structure |
Define local variables
Open file
Read header
Read number of lines, infer size of arrays and allocate them
Read parameters
int distortions_spline_sd_data | ( | struct distortions * | psd | ) |
Spline the quantitites read in distortions_read_sd_data
psd | Input: pointer to the distortions structure |
Allocate second derivatievs
Spline branching ratios
int distortions_interpolate_sd_data | ( | struct distortions * | psd, |
double | nu, | ||
double * | G_T, | ||
double * | Y_SZ, | ||
double * | M_mu, | ||
double * | S, | ||
int * | index | ||
) |
Interpolate the quantitites splined in distortions_spline_sd_data
psd | Input: pointer to the distortions structure |
nu | Input: dimnetionless frequency |
G_T | Output: shape of temperature shift |
Y_SZ | Output: shape of y distortions |
M_mu | Output: shape of mu-distortions |
S | Output: shape of residuals (multipole expansion) |
index | Output: multipole of PCA expansion for S |
Define local variables
Find z position
Evaluate corresponding values for the branching ratios
int distortions_free_sd_data | ( | struct distortions * | psd | ) |
Free from distortions_read_sd_data and distortions_spline_sd_data
psd | Input: pointer to distortions structure (in which some fields should be freed) |
int distortions_output_heat_titles | ( | struct distortions * | psd, |
char | titles[_MAXTITLESTRINGLENGTH_] | ||
) |
Define title of columns in the heat output
psd | Input: pointer to distortions structure |
titles | Output: title of each column in the output |
int distortions_output_heat_data | ( | struct distortions * | psd, |
int | number_of_titles, | ||
double * | data | ||
) |
Store data in the heat output
psd | Input/Output: pointer to distortions structure |
number_of_titles | Input: numbert of column in the output |
data | Input: data to be stored |
int distortions_output_sd_titles | ( | struct distortions * | psd, |
char | titles[_MAXTITLESTRINGLENGTH_] | ||
) |
Define title of columns in the spectral distortion output
psd | Input: pointer to distortions structure |
titles | Output: title of each column in the output |
int distortions_output_sd_data | ( | struct distortions * | psd, |
int | number_of_titles, | ||
double * | data | ||
) |
Store data in the distortion output
psd | Input/Output: pointer to distortions structure |
number_of_titles | Input: numbert of column in the output |
data | Input: data to be stored |