3 #ifndef __THERMODYNAMICS__
4 #define __THERMODYNAMICS__
7 #include "evolver_ndf15.h"
8 #include "evolver_rkck.h"
9 #include "wrap_hyrec.h"
10 #include "wrap_recfast.h"
11 #include "injection.h"
48 #define f1(x) (-0.75*x*(x*x/3.-1.)+0.5)
49 #define f2(x) (x*x*(0.5-x/3.)*6.)
403 double * ap_z_limits;
404 double * ap_z_limits_delta;
410 struct thermohyrec * phyrec;
411 struct thermorecfast * precfast;
518 double * pvecthermo);
589 void * parameters_and_workspace,
590 ErrorMsg error_message
594 void * thermo_parameters_and_workspace,
596 ErrorMsg error_message);
602 void * thermo_parameters_and_workspace,
603 ErrorMsg error_message);
657 char titles[_MAXTITLESTRINGLENGTH_]);
661 int number_of_titles,
704 #define _m_e_ 9.10938215e-31
705 #define _m_p_ 1.672621637e-27
706 #define _m_H_ 1.673575e-27
707 #define _not4_ 3.9715
708 #define _sigma_ 6.6524616e-29
710 #define _RECFAST_INTEG_SIZE_ 3
720 #define _s_over_Mpc_ 9.71561189e-15
721 #define _Mpc_over_GeV_ 1.56373832e38
722 #define _GeV_over_kg_ 1.78266191e-27
723 #define _GeVcm3_over_Mpc2_ 94.7024726
724 #define _Jm3_over_Mpc2_ 0.0151730087
725 #define _Sun_mass_ 1.98855e30
726 #define _eV_over_Kelvin_ 8.61733034e-5
727 #define _eV_over_joules_ 6.24150647996e+18
740 #define _YHE_BIG_ 0.5
741 #define _YHE_SMALL_ 0.01
742 #define _Z_REC_MAX_ 2000.
743 #define _Z_REC_MIN_ 500.
interpolation_method
Definition: background.h:30
Definition: background.h:44
int thermodynamics_set_parameters_reionization(struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct thermo_reionization_parameters *preio)
Definition: thermodynamics.c:1169
int thermodynamics_derivs(double mz, double *y, double *dy, void *parameters_and_workspace, ErrorMsg error_message)
Definition: thermodynamics.c:2525
int thermodynamics_calculate_idm_and_idr_quantities(struct precision *ppr, struct background *pba, struct thermodynamics *pth, double *pvecback)
Definition: thermodynamics.c:3552
int thermodynamics_free(struct thermodynamics *pth)
Definition: thermodynamics.c:441
int thermodynamics_lists(struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct thermo_workspace *ptw)
Definition: thermodynamics.c:1103
int thermodynamics_indices(struct background *pba, struct thermodynamics *pth, struct thermo_workspace *ptw)
Definition: thermodynamics.c:942
int thermodynamics_calculate_recombination_quantities(struct precision *ppr, struct background *pba, struct thermodynamics *pth, double *pvecback)
Definition: thermodynamics.c:3746
int thermodynamics_vector_init(struct precision *ppr, struct background *pba, struct thermodynamics *pth, double mz, struct thermo_workspace *ptw)
Definition: thermodynamics.c:1923
int thermodynamics_workspace_free(struct thermodynamics *pth, struct thermo_workspace *ptw)
Definition: thermodynamics.c:1874
int thermodynamics_output_titles(struct background *pba, struct thermodynamics *pth, char titles[_MAXTITLESTRINGLENGTH_])
Definition: thermodynamics.c:4362
int thermodynamics_calculate_drag_quantities(struct precision *ppr, struct background *pba, struct thermodynamics *pth, double *pvecback)
Definition: thermodynamics.c:3889
int thermodynamics_idm_quantities(struct background *pba, double z, double *y, double *dy, struct thermodynamics *pth, struct thermo_workspace *ptw, double *pvecback)
Definition: thermodynamics.c:4508
int thermodynamics_calculate_remaining_quantities(struct precision *ppr, struct background *pba, struct thermodynamics *pth, double *pvecback)
Definition: thermodynamics.c:1729
int thermodynamics_vector_free(struct thermo_vector *tv)
Definition: thermodynamics.c:3138
int thermodynamics_output_summary(struct background *pba, struct thermodynamics *pth)
Definition: thermodynamics.c:1793
int thermodynamics_output_data(struct background *pba, struct thermodynamics *pth, int number_of_titles, double *data)
Definition: thermodynamics.c:4421
int thermodynamics_solve(struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct thermo_workspace *ptw, double *pvecback)
Definition: thermodynamics.c:1539
int thermodynamics_workspace_init(struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct thermo_workspace *ptw)
Definition: thermodynamics.c:780
int thermodynamics_free_input(struct thermodynamics *pth)
Definition: thermodynamics.c:472
int thermodynamics_checks(struct precision *ppr, struct background *pba, struct thermodynamics *pth)
Definition: thermodynamics.c:740
int thermodynamics_timescale(double mz, void *thermo_parameters_and_workspace, double *timescale, ErrorMsg error_message)
Definition: thermodynamics.c:2830
int thermodynamics_calculate_conformal_drag_time(struct background *pba, struct thermodynamics *pth, double *pvecback)
Definition: thermodynamics.c:3159
int thermodynamics_init(struct precision *ppr, struct background *pba, struct thermodynamics *pth)
Definition: thermodynamics.c:298
int thermodynamics_idm_initial_temperature(struct background *pba, struct thermodynamics *pth, double z_ini, struct thermo_diffeq_workspace *ptdw)
Definition: thermodynamics.c:4716
int thermodynamics_reionization_evolve_with_tau(struct thermodynamics_parameters_and_workspace *ptpaw, double mz_ini, double mz_end, double *mz_output, int mz_size)
Definition: thermodynamics.c:2175
int thermodynamics_at_z(struct background *pba, struct thermodynamics *pth, double z, enum interpolation_method inter_mode, int *last_index, double *pvecback, double *pvecthermo)
Definition: thermodynamics.c:57
int thermodynamics_sources(double mz, double *y, double *dy, int index_z, void *thermo_parameters_and_workspace, ErrorMsg error_message)
Definition: thermodynamics.c:2896
int thermodynamics_obtain_z_ini(struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct thermo_workspace *ptw)
Definition: thermodynamics.c:4601
int thermodynamics_reionization_get_tau(struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct thermo_workspace *ptw)
Definition: thermodynamics.c:3042
int thermodynamics_helium_from_bbn(struct precision *ppr, struct background *pba, struct thermodynamics *pth)
Definition: thermodynamics.c:523
int thermodynamics_reionization_function(double z, struct thermodynamics *pth, struct thermo_reionization_parameters *preio, double *x)
Definition: thermodynamics.c:4133
int thermodynamics_calculate_damping_scale(struct background *pba, struct thermodynamics *pth, double *pvecback)
Definition: thermodynamics.c:3244
int thermodynamics_ionization_fractions(double z, double *y, struct background *pba, struct thermodynamics *pth, struct thermo_workspace *ptw, int current_ap)
Definition: thermodynamics.c:3952
int thermodynamics_calculate_opticals(struct precision *ppr, struct thermodynamics *pth)
Definition: thermodynamics.c:3354
double helium_fullreio_width
Definition: thermodynamics.h:99
struct injection in
Definition: thermodynamics.h:140
int index_ti_T_idm
Definition: thermodynamics.h:356
double rs_rec
Definition: thermodynamics.h:248
short thermodynamics_verbose
Definition: thermodynamics.h:329
double * many_tanh_xe
Definition: thermodynamics.h:117
double x
Definition: thermodynamics.h:376
int Nz_tot
Definition: thermodynamics.h:458
int binned_reio_num
Definition: thermodynamics.h:103
int index_th_dmu_idr
Definition: thermodynamics.h:199
short has_ap_idmtca
Definition: thermodynamics.h:473
double annihilation_z_halo
Definition: thermodynamics.h:172
double T_idm_prime
Definition: thermodynamics.h:382
double da_star
Definition: thermodynamics.h:259
double SIunit_H0
Definition: thermodynamics.h:463
int index_th_c2_idm
Definition: thermodynamics.h:194
short has_on_the_spot
Definition: thermodynamics.h:144
double reionization_optical_depth
Definition: thermodynamics.h:476
int index_th_tau_d
Definition: thermodynamics.h:186
double m_idm
Definition: thermodynamics.h:301
double tau_idr
Definition: thermodynamics.h:275
int * used_in_output
Definition: thermodynamics.h:361
double n_coeff_idm_b
Definition: thermodynamics.h:307
double tau_star
Definition: thermodynamics.h:255
double cross_idm_b
Definition: thermodynamics.h:305
int index_re_xe_after
Definition: thermodynamics.h:427
double binned_reio_step_sharpness
Definition: thermodynamics.h:109
double ra_star
Definition: thermodynamics.h:258
double u_idm_g
Definition: thermodynamics.h:309
recombination_algorithm
Definition: thermodynamics.h:17
int index_re_reio_width
Definition: thermodynamics.h:425
double * z_table
Definition: thermodynamics.h:228
int n_index_idm_b
Definition: thermodynamics.h:306
double rd_star
Definition: thermodynamics.h:260
double const_Tion_HeII
Definition: thermodynamics.h:471
int index_th_ddmu_idm_g
Definition: thermodynamics.h:204
short has_idm_b
Definition: thermodynamics.h:87
double * d2thermodynamics_dz2_table
Definition: thermodynamics.h:238
double const_Tion_H
Definition: thermodynamics.h:469
double annihilation_zmin
Definition: thermodynamics.h:167
double annihilation_f_halo
Definition: thermodynamics.h:171
int re_size
Definition: thermodynamics.h:444
int index_th_dTb
Definition: thermodynamics.h:211
reionization_parametrization
Definition: thermodynamics.h:26
@ reio_none
Definition: thermodynamics.h:27
@ reio_bins_tanh
Definition: thermodynamics.h:29
@ reio_camb
Definition: thermodynamics.h:28
@ reio_inter
Definition: thermodynamics.h:32
@ reio_half_tanh
Definition: thermodynamics.h:30
@ reio_many_tanh
Definition: thermodynamics.h:31
int index_th_Tb
Definition: thermodynamics.h:210
double Tmat
Definition: thermodynamics.h:378
int index_re_reio_exponent
Definition: thermodynamics.h:424
int index_th_dR_idm_b
Definition: thermodynamics.h:208
int index_th_dmu_idm_dr
Definition: thermodynamics.h:196
double tau_d
Definition: thermodynamics.h:263
int index_th_ddg
Definition: thermodynamics.h:192
short hyrec_verbose
Definition: thermodynamics.h:330
double z_d
Definition: thermodynamics.h:262
int index_re_helium_fullreio_redshift
Definition: thermodynamics.h:429
double tau_free_streaming
Definition: thermodynamics.h:273
double a_idm_dr
Definition: thermodynamics.h:302
double tau_cut
Definition: thermodynamics.h:270
double fHe
Definition: thermodynamics.h:292
double const_NR_numberdens
Definition: thermodynamics.h:468
double rs_star
Definition: thermodynamics.h:256
double ds_d
Definition: thermodynamics.h:264
double cross_idm_g
Definition: thermodynamics.h:308
int reio_inter_num
Definition: thermodynamics.h:123
int index_th_tau_idm_dr
Definition: thermodynamics.h:200
double rd_rec
Definition: thermodynamics.h:252
double tau_ini
Definition: thermodynamics.h:284
int ti_size
Definition: thermodynamics.h:351
double tau_idr_free_streaming
Definition: thermodynamics.h:274
ErrorMsg error_message
Definition: thermodynamics.h:332
double * reio_inter_z
Definition: thermodynamics.h:125
int index_th_T_idr
Definition: thermodynamics.h:195
double * dy
Definition: thermodynamics.h:359
int index_th_wb
Definition: thermodynamics.h:212
double YHe
Definition: thermodynamics.h:461
double x_He
Definition: thermodynamics.h:372
int index_th_ddR_idm_b
Definition: thermodynamics.h:209
double z_star
Definition: thermodynamics.h:254
int index_ti_D_Tmat
Definition: thermodynamics.h:355
double decay
Definition: thermodynamics.h:146
struct thermo_reionization_parameters * ptrp
Definition: thermodynamics.h:481
int index_th_exp_m_kappa
Definition: thermodynamics.h:189
double reionization_width
Definition: thermodynamics.h:93
short inter_closeby
Definition: thermodynamics.h:321
double many_tanh_width
Definition: thermodynamics.h:119
short has_idm_g
Definition: thermodynamics.h:88
int index_th_g_idm_dr
Definition: thermodynamics.h:202
enum recombination_algorithm recombination
Definition: thermodynamics.h:69
double da_rec
Definition: thermodynamics.h:251
int index_th_dddkappa
Definition: thermodynamics.h:188
int index_th_dmu_idm_g
Definition: thermodynamics.h:203
double YHe
Definition: thermodynamics.h:65
double b_idr
Definition: thermodynamics.h:303
int index_th_dkappa
Definition: thermodynamics.h:185
int index_re_reio_start
Definition: thermodynamics.h:441
double annihilation
Definition: thermodynamics.h:142
short has_varconst
Definition: thermodynamics.h:176
double tau_idm_dr
Definition: thermodynamics.h:276
double n_e
Definition: thermodynamics.h:293
int index_re_helium_fullreio_width
Definition: thermodynamics.h:430
int index_th_r_d
Definition: thermodynamics.h:217
double bbn_alpha_sensitivity
Definition: thermodynamics.h:67
int index_re_step_sharpness
Definition: thermodynamics.h:437
int index_th_xe
Definition: thermodynamics.h:184
int Nz_reio
Definition: thermodynamics.h:457
double tau_rec
Definition: thermodynamics.h:247
double reionization_exponent
Definition: thermodynamics.h:95
short is_allocated
Definition: thermodynamics.h:334
double * binned_reio_z
Definition: thermodynamics.h:105
double angular_rescaling
Definition: thermodynamics.h:272
double annihilation_zmax
Definition: thermodynamics.h:163
int n_index_idm_g
Definition: thermodynamics.h:310
int index_th_tau_idr
Definition: thermodynamics.h:201
double z_reio
Definition: thermodynamics.h:79
double * reio_inter_xe
Definition: thermodynamics.h:127
int index_th_ddmu_idm_dr
Definition: thermodynamics.h:197
double z_ap_idmtca
Definition: thermodynamics.h:474
int many_tanh_num
Definition: thermodynamics.h:113
double ra_rec
Definition: thermodynamics.h:250
double x_noreio
Definition: thermodynamics.h:373
int index_th_R_idm_b
Definition: thermodynamics.h:207
double rs_d
Definition: thermodynamics.h:265
int index_th_T_idm
Definition: thermodynamics.h:193
int Nz_reco_log
Definition: thermodynamics.h:455
int index_ti_x_H
Definition: thermodynamics.h:353
int re_z_size
Definition: thermodynamics.h:434
double * binned_reio_xe
Definition: thermodynamics.h:107
int th_size
Definition: thermodynamics.h:219
double x_H
Definition: thermodynamics.h:371
double fHe
Definition: thermodynamics.h:462
int index_re_first_xe
Definition: thermodynamics.h:436
double const_Tion_HeI
Definition: thermodynamics.h:470
double * thermodynamics_table
Definition: thermodynamics.h:230
double ds_rec
Definition: thermodynamics.h:249
int tt_size
Definition: thermodynamics.h:227
int index_re_helium_fullreio_fraction
Definition: thermodynamics.h:428
short has_exotic_injection
Definition: thermodynamics.h:131
int Nz_reco_lin
Definition: thermodynamics.h:454
reionization_z_or_tau
Definition: thermodynamics.h:39
@ reio_z
Definition: thermodynamics.h:40
@ reio_tau
Definition: thermodynamics.h:41
double T_idm
Definition: thermodynamics.h:381
short compute_damping_scale
Definition: thermodynamics.h:83
double ds_star
Definition: thermodynamics.h:257
double * tau_table
Definition: thermodynamics.h:229
int index_re_xe_before
Definition: thermodynamics.h:426
int index_th_ddkappa
Definition: thermodynamics.h:187
int Nz_reco
Definition: thermodynamics.h:456
double R_idm_b
Definition: thermodynamics.h:380
enum reionization_parametrization reio_parametrization
Definition: thermodynamics.h:73
int index_th_dddmu_idm_dr
Definition: thermodynamics.h:198
double helium_fullreio_redshift
Definition: thermodynamics.h:97
double * y
Definition: thermodynamics.h:358
int index_th_dddmu_idm_g
Definition: thermodynamics.h:205
int index_th_dg
Definition: thermodynamics.h:191
double n_index_idm_dr
Definition: thermodynamics.h:304
double conf_time_reio
Definition: thermodynamics.h:267
int index_ti_x_He
Definition: thermodynamics.h:354
double z_rec
Definition: thermodynamics.h:246
double x_reio
Definition: thermodynamics.h:374
double * reionization_parameters
Definition: thermodynamics.h:443
int index_th_exp_mu_idm_g
Definition: thermodynamics.h:206
short has_idm_dr
Definition: thermodynamics.h:89
int last_index_back
Definition: thermodynamics.h:478
int index_th_ddcb2
Definition: thermodynamics.h:215
double Tcmb
Definition: thermodynamics.h:465
short compute_cb2_derivatives
Definition: thermodynamics.h:81
int index_th_cb2
Definition: thermodynamics.h:213
int index_th_rate
Definition: thermodynamics.h:216
int index_re_reio_redshift
Definition: thermodynamics.h:423
struct thermo_diffeq_workspace * ptdw
Definition: thermodynamics.h:480
short inter_normal
Definition: thermodynamics.h:320
enum reionization_z_or_tau reio_z_or_tau
Definition: thermodynamics.h:75
enum recfast_photoion_modes recfast_photoion_mode
Definition: thermodynamics.h:71
double SIunit_nH0
Definition: thermodynamics.h:464
double * many_tanh_z
Definition: thermodynamics.h:115
int index_re_first_z
Definition: thermodynamics.h:435
double annihilation_variation
Definition: thermodynamics.h:148
double tau_reio
Definition: thermodynamics.h:77
int index_th_g
Definition: thermodynamics.h:190
double annihilation_z
Definition: thermodynamics.h:158
int index_th_dcb2
Definition: thermodynamics.h:214
Definition: thermodynamics.h:369
Definition: thermodynamics.h:419
Definition: thermodynamics.h:349
Definition: thermodynamics.h:451
Definition: thermodynamics.h:59
Definition: thermodynamics.h:489