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.)
399 double * ap_z_limits;
400 double * ap_z_limits_delta;
406 struct thermohyrec * phyrec;
407 struct thermorecfast * precfast;
514 double * pvecthermo);
583 void * parameters_and_workspace,
584 ErrorMsg error_message
588 void * thermo_parameters_and_workspace,
590 ErrorMsg error_message);
596 void * thermo_parameters_and_workspace,
597 ErrorMsg error_message);
651 char titles[_MAXTITLESTRINGLENGTH_]);
655 int number_of_titles,
698 #define _m_e_ 9.10938215e-31
699 #define _m_p_ 1.672621637e-27
700 #define _m_H_ 1.673575e-27
701 #define _not4_ 3.9715
702 #define _sigma_ 6.6524616e-29
704 #define _RECFAST_INTEG_SIZE_ 3
714 #define _s_over_Mpc_ 9.71561189e-15
715 #define _Mpc_over_GeV_ 1.56373832e38
716 #define _GeV_over_kg_ 1.78266191e-27
717 #define _GeVcm3_over_Mpc2_ 94.7024726
718 #define _Jm3_over_Mpc2_ 0.0151730087
719 #define _Sun_mass_ 1.98855e30
720 #define _eV_over_Kelvin_ 8.61733034e-5
721 #define _eV_over_joules_ 6.24150647996e+18
734 #define _YHE_BIG_ 0.5
735 #define _YHE_SMALL_ 0.01
736 #define _Z_REC_MAX_ 2000.
737 #define _Z_REC_MIN_ 500.
interpolation_method
Definition: background.h:34
Definition: background.h:48
int thermodynamics_set_parameters_reionization(struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct thermo_reionization_parameters *preio)
Definition: thermodynamics.c:1120
int thermodynamics_derivs(double mz, double *y, double *dy, void *parameters_and_workspace, ErrorMsg error_message)
Definition: thermodynamics.c:2474
int thermodynamics_calculate_idm_and_idr_quantities(struct precision *ppr, struct background *pba, struct thermodynamics *pth, double *pvecback)
Definition: thermodynamics.c:3501
int thermodynamics_free(struct thermodynamics *pth)
Definition: thermodynamics.c:439
int thermodynamics_lists(struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct thermo_workspace *ptw)
Definition: thermodynamics.c:1054
int thermodynamics_indices(struct background *pba, struct thermodynamics *pth, struct thermo_workspace *ptw)
Definition: thermodynamics.c:893
int thermodynamics_calculate_recombination_quantities(struct precision *ppr, struct background *pba, struct thermodynamics *pth, double *pvecback)
Definition: thermodynamics.c:3695
int thermodynamics_vector_init(struct precision *ppr, struct background *pba, struct thermodynamics *pth, double mz, struct thermo_workspace *ptw)
Definition: thermodynamics.c:1872
int thermodynamics_workspace_free(struct thermodynamics *pth, struct thermo_workspace *ptw)
Definition: thermodynamics.c:1823
int thermodynamics_output_titles(struct background *pba, struct thermodynamics *pth, char titles[_MAXTITLESTRINGLENGTH_])
Definition: thermodynamics.c:4311
int thermodynamics_calculate_drag_quantities(struct precision *ppr, struct background *pba, struct thermodynamics *pth, double *pvecback)
Definition: thermodynamics.c:3838
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:4457
int thermodynamics_calculate_remaining_quantities(struct precision *ppr, struct background *pba, struct thermodynamics *pth, double *pvecback)
Definition: thermodynamics.c:1675
int thermodynamics_vector_free(struct thermo_vector *tv)
Definition: thermodynamics.c:3087
int thermodynamics_output_summary(struct background *pba, struct thermodynamics *pth)
Definition: thermodynamics.c:1739
int thermodynamics_output_data(struct background *pba, struct thermodynamics *pth, int number_of_titles, double *data)
Definition: thermodynamics.c:4370
int thermodynamics_solve(struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct thermo_workspace *ptw, double *pvecback)
Definition: thermodynamics.c:1485
int thermodynamics_workspace_init(struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct thermo_workspace *ptw)
Definition: thermodynamics.c:731
int thermodynamics_checks(struct precision *ppr, struct background *pba, struct thermodynamics *pth)
Definition: thermodynamics.c:691
int thermodynamics_timescale(double mz, void *thermo_parameters_and_workspace, double *timescale, ErrorMsg error_message)
Definition: thermodynamics.c:2779
int thermodynamics_calculate_conformal_drag_time(struct background *pba, struct thermodynamics *pth, double *pvecback)
Definition: thermodynamics.c:3108
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:4665
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:2124
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:2845
int thermodynamics_obtain_z_ini(struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct thermo_workspace *ptw)
Definition: thermodynamics.c:4550
int thermodynamics_reionization_get_tau(struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct thermo_workspace *ptw)
Definition: thermodynamics.c:2991
int thermodynamics_helium_from_bbn(struct precision *ppr, struct background *pba, struct thermodynamics *pth)
Definition: thermodynamics.c:474
int thermodynamics_reionization_function(double z, struct thermodynamics *pth, struct thermo_reionization_parameters *preio, double *x)
Definition: thermodynamics.c:4082
int thermodynamics_calculate_damping_scale(struct background *pba, struct thermodynamics *pth, double *pvecback)
Definition: thermodynamics.c:3193
int thermodynamics_ionization_fractions(double z, double *y, struct background *pba, struct thermodynamics *pth, struct thermo_workspace *ptw, int current_ap)
Definition: thermodynamics.c:3901
int thermodynamics_calculate_opticals(struct precision *ppr, struct thermodynamics *pth)
Definition: thermodynamics.c:3303
double helium_fullreio_width
Definition: thermodynamics.h:99
struct injection in
Definition: thermodynamics.h:140
int index_ti_T_idm
Definition: thermodynamics.h:352
double rs_rec
Definition: thermodynamics.h:248
short thermodynamics_verbose
Definition: thermodynamics.h:326
double * many_tanh_xe
Definition: thermodynamics.h:117
double x
Definition: thermodynamics.h:372
int Nz_tot
Definition: thermodynamics.h:454
int binned_reio_num
Definition: thermodynamics.h:103
int index_th_dmu_idr
Definition: thermodynamics.h:199
short has_ap_idmtca
Definition: thermodynamics.h:469
double annihilation_z_halo
Definition: thermodynamics.h:172
double T_idm_prime
Definition: thermodynamics.h:378
double da_star
Definition: thermodynamics.h:259
double SIunit_H0
Definition: thermodynamics.h:459
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:472
int index_th_tau_d
Definition: thermodynamics.h:186
double m_idm
Definition: thermodynamics.h:298
double tau_idr
Definition: thermodynamics.h:272
int * used_in_output
Definition: thermodynamics.h:357
double n_coeff_idm_b
Definition: thermodynamics.h:304
double tau_star
Definition: thermodynamics.h:255
double cross_idm_b
Definition: thermodynamics.h:302
int index_re_xe_after
Definition: thermodynamics.h:423
double binned_reio_step_sharpness
Definition: thermodynamics.h:109
double ra_star
Definition: thermodynamics.h:258
double u_idm_g
Definition: thermodynamics.h:306
recombination_algorithm
Definition: thermodynamics.h:17
int index_re_reio_width
Definition: thermodynamics.h:421
double * z_table
Definition: thermodynamics.h:228
int n_index_idm_b
Definition: thermodynamics.h:303
double rd_star
Definition: thermodynamics.h:260
double const_Tion_HeII
Definition: thermodynamics.h:467
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:465
double annihilation_zmin
Definition: thermodynamics.h:167
double annihilation_f_halo
Definition: thermodynamics.h:171
int re_size
Definition: thermodynamics.h:440
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:374
int index_re_reio_exponent
Definition: thermodynamics.h:420
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:327
double z_d
Definition: thermodynamics.h:262
int index_re_helium_fullreio_redshift
Definition: thermodynamics.h:425
double tau_free_streaming
Definition: thermodynamics.h:270
double a_idm_dr
Definition: thermodynamics.h:299
double tau_cut
Definition: thermodynamics.h:267
double fHe
Definition: thermodynamics.h:289
double const_NR_numberdens
Definition: thermodynamics.h:464
double rs_star
Definition: thermodynamics.h:256
double ds_d
Definition: thermodynamics.h:264
double cross_idm_g
Definition: thermodynamics.h:305
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:281
int ti_size
Definition: thermodynamics.h:347
double tau_idr_free_streaming
Definition: thermodynamics.h:271
ErrorMsg error_message
Definition: thermodynamics.h:329
double * reio_inter_z
Definition: thermodynamics.h:125
int index_th_T_idr
Definition: thermodynamics.h:195
double * dy
Definition: thermodynamics.h:355
int index_th_wb
Definition: thermodynamics.h:212
double YHe
Definition: thermodynamics.h:457
double x_He
Definition: thermodynamics.h:368
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:351
double decay
Definition: thermodynamics.h:146
struct thermo_reionization_parameters * ptrp
Definition: thermodynamics.h:477
int index_th_exp_m_kappa
Definition: thermodynamics.h:189
double reionization_width
Definition: thermodynamics.h:93
short inter_closeby
Definition: thermodynamics.h:318
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:300
int index_th_dkappa
Definition: thermodynamics.h:185
int index_re_reio_start
Definition: thermodynamics.h:437
double annihilation
Definition: thermodynamics.h:142
short has_varconst
Definition: thermodynamics.h:176
double tau_idm_dr
Definition: thermodynamics.h:273
double n_e
Definition: thermodynamics.h:290
int index_re_helium_fullreio_width
Definition: thermodynamics.h:426
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:433
int index_th_xe
Definition: thermodynamics.h:184
int Nz_reio
Definition: thermodynamics.h:453
double tau_rec
Definition: thermodynamics.h:247
double reionization_exponent
Definition: thermodynamics.h:95
double * binned_reio_z
Definition: thermodynamics.h:105
double angular_rescaling
Definition: thermodynamics.h:269
double annihilation_zmax
Definition: thermodynamics.h:163
int n_index_idm_g
Definition: thermodynamics.h:307
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:470
int many_tanh_num
Definition: thermodynamics.h:113
double ra_rec
Definition: thermodynamics.h:250
double x_noreio
Definition: thermodynamics.h:369
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:451
int index_ti_x_H
Definition: thermodynamics.h:349
int re_z_size
Definition: thermodynamics.h:430
double * binned_reio_xe
Definition: thermodynamics.h:107
int th_size
Definition: thermodynamics.h:219
double x_H
Definition: thermodynamics.h:367
double fHe
Definition: thermodynamics.h:458
int index_re_first_xe
Definition: thermodynamics.h:432
double const_Tion_HeI
Definition: thermodynamics.h:466
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:424
short has_exotic_injection
Definition: thermodynamics.h:131
int Nz_reco_lin
Definition: thermodynamics.h:450
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:377
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:422
int index_th_ddkappa
Definition: thermodynamics.h:187
int Nz_reco
Definition: thermodynamics.h:452
double R_idm_b
Definition: thermodynamics.h:376
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:354
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:301
int index_ti_x_He
Definition: thermodynamics.h:350
double z_rec
Definition: thermodynamics.h:246
double x_reio
Definition: thermodynamics.h:370
double * reionization_parameters
Definition: thermodynamics.h:439
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:474
int index_th_ddcb2
Definition: thermodynamics.h:215
double Tcmb
Definition: thermodynamics.h:461
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:419
struct thermo_diffeq_workspace * ptdw
Definition: thermodynamics.h:476
short inter_normal
Definition: thermodynamics.h:317
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:460
double * many_tanh_z
Definition: thermodynamics.h:115
int index_re_first_z
Definition: thermodynamics.h:431
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:365
Definition: thermodynamics.h:415
Definition: thermodynamics.h:345
Definition: thermodynamics.h:447
Definition: thermodynamics.h:59
Definition: thermodynamics.h:485