CLASS MANUAL
thermodynamics.h
Go to the documentation of this file.
1 
3 #ifndef __THERMODYNAMICS__
4 #define __THERMODYNAMICS__
5 
6 #include "background.h"
7 //#include "arrays.h"
8 //#include "helium.h"
9 //#include "hydrogen.h"
10 
16  recfast,
17  hyrec
18 };
19 
31 };
32 
40 };
41 
46 #define f1(x) (-0.75*x*(x*x/3.-1.)+0.5)
47 #define f2(x) (x*x*(0.5-x/3.)*6.)
58 struct thermo
59 {
65 
66  double YHe;
70  enum reionization_parametrization reio_parametrization;
72  enum reionization_z_or_tau reio_z_or_tau;
74  double tau_reio;
76  double z_reio;
96  double * binned_reio_z;
98  double * binned_reio_xe;
106  double * many_tanh_z;
108  double * many_tanh_xe;
116  double * reio_inter_z;
118  double * reio_inter_xe;
122  double annihilation;
126  double decay;
138  double annihilation_z;
155 
159 
175  int th_size;
178 
182 
183  int tt_size;
184  double * z_table;
188 
192 
196 
197 
201 
202  double z_rec;
203  double tau_rec;
204  double rs_rec;
205  double ds_rec;
206  double ra_rec;
207  double da_rec;
208  double rd_rec;
209  double z_d;
210  double tau_d;
211  double ds_d;
212  double rs_d;
213  double tau_cut;
217 
221 
225 
229 
230  double tau_ini;
233 
237 
238  double n_e;
241 
247 
248  short inter_normal;
252 
256 
259  ErrorMsg error_message;
262 
263 };
264 
273 
277 
283  int re_size;
286 
290 
291  int rt_size;
295 
300 
301  double CDB;
302  double CR;
303  double CK;
304  double CL;
305  double CT;
306  double fHe;
307  double CDB_He;
308  double CK_He;
309  double CL_He;
310  double fu;
311  double H_frac;
312  double Tnow;
313  double Nnow;
314  double Bfact;
315  double CB1;
316  double CB1_He1;
317  double CB1_He2;
318  double H0;
319  double YHe;
321  /* parameters for energy injection */
322 
323  double annihilation;
327  double decay;
339  double annihilation_z;
356 
357 };
358 
366 struct reionization {
367 
371 
379  int re_size;
382 
386 
387  int rt_size;
391 
395 
399 
403 
404  /* parameters used by reio_camb */
405 
415  /* parameters used by reio_bins_tanh, reio_many_tanh, reio_inter */
416 
422  /* parameters used by all schemes */
423 
427 
434 
438 
442 
443 };
444 
450 
451  /* structures containing fixed input parameters (indices, ...) */
452  struct background * pba;
453  struct precision * ppr;
454  struct recombination * preco;
455 
456  /* workspace */
457  double * pvecback;
458 
459 };
460 
461 /**************************************************************/
462 /* @cond INCLUDE_WITH_DOXYGEN */
463 /*
464  * Boilerplate for C++
465  */
466 #ifdef __cplusplus
467 extern "C" {
468 #endif
469 
471  struct background * pba,
472  struct thermo * pth,
473  double z,
474  short inter_mode,
475  int * last_index,
476  double * pvecback,
477  double * pvecthermo
478  );
479 
481  struct precision * ppr,
482  struct background * pba,
483  struct thermo * pth
484  );
485 
487  struct thermo * pthermo
488  );
489 
491  struct thermo * pthermo,
492  struct recombination * preco,
493  struct reionization * preio
494  );
495 
497  struct precision * ppr,
498  struct background * pba,
499  struct thermo * pth
500  );
501 
503  struct precision * ppr,
504  struct background * pba,
505  struct recombination * preco,
506  double z,
507  double * energy_rate,
508  ErrorMsg error_message
509  );
510 
512  struct precision * ppr,
513  struct background * pba,
514  struct recombination * preco,
515  double z,
516  double * energy_rate,
517  ErrorMsg error_message
518  );
519 
521  double z,
522  struct thermo * pth,
523  struct reionization * preio,
524  double * xe
525  );
526 
528  struct precision * ppr,
529  struct background * pba,
530  struct thermo * pth,
531  struct recombination * preco,
532  struct reionization * preio,
533  double * pvecback
534  );
535 
537  struct precision * ppr,
538  struct background * pba,
539  struct thermo * pth,
540  struct recombination * preco,
541  struct reionization * preio,
542  double * pvecback
543  );
544 
546  struct precision * ppr,
547  struct thermo * pth,
548  struct recombination * preco,
549  double z,
550  double * xe);
551 
553  struct precision * ppr,
554  struct background * pba,
555  struct thermo * pth,
556  struct recombination * prec,
557  double * pvecback
558  );
559 
561  struct precision * ppr,
562  struct background * pba,
563  struct thermo * pth,
564  struct recombination * prec,
565  double * pvecback
566  );
567 
569  struct precision * ppr,
570  struct background * pba,
571  struct thermo * pth,
572  struct recombination * prec,
573  double * pvecback
574  );
575 
577  double z,
578  double * y,
579  double * dy,
580  void * fixed_parameters,
581  ErrorMsg error_message
582  );
583 
585  struct precision * ppr,
586  struct thermo * pth,
587  struct recombination * preco,
588  struct reionization * preio
589  );
590 
591  int thermodynamics_output_titles(struct background * pba,
592  struct thermo *pth,
593  char titles[_MAXTITLESTRINGLENGTH_]
594  );
595 
596  int thermodynamics_output_data(struct background * pba,
597  struct thermo *pth,
598  int number_of_titles,
599  double *data
600  );
601 
602  int thermodynamics_tanh(double x,
603  double center,
604  double before,
605  double after,
606  double width,
607  double * result);
608 
609 #ifdef __cplusplus
610 }
611 #endif
612 
613 /**************************************************************/
614 
620 
621 #define _BBN_ -1
622 
624 
630 
631 #define _m_e_ 9.10938215e-31
632 #define _m_p_ 1.672621637e-27
633 #define _m_H_ 1.673575e-27
634 #define _not4_ 3.9715
635 #define _sigma_ 6.6524616e-29
638 
639 
644 
645 #define _RECFAST_INTEG_SIZE_ 3
646 
647 #define _Lambda_ 8.2245809
648 #define _Lambda_He_ 51.3
649 #define _L_H_ion_ 1.096787737e7
650 #define _L_H_alpha_ 8.225916453e6
651 #define _L_He1_ion_ 1.98310772e7
652 #define _L_He2_ion_ 4.389088863e7
653 #define _L_He_2s_ 1.66277434e7
654 #define _L_He_2p_ 1.71134891e7
655 #define _A2P_s_ 1.798287e9 /*updated like in recfast 1.4*/
656 #define _A2P_t_ 177.58e0 /*updated like in recfast 1.4*/
657 #define _L_He_2Pt_ 1.690871466e7 /*updated like in recfast 1.4*/
658 #define _L_He_2St_ 1.5985597526e7 /*updated like in recfast 1.4*/
659 #define _L_He2St_ion_ 3.8454693845e6 /*updated like in recfast 1.4*/
660 #define _sigma_He_2Ps_ 1.436289e-22 /*updated like in recfast 1.4*/
661 #define _sigma_He_2Pt_ 1.484872e-22 /*updated like in recfast 1.4*/
662 
664 
670 
671 #define _a_PPB_ 4.309
672 #define _b_PPB_ -0.6166
673 #define _c_PPB_ 0.6703
674 #define _d_PPB_ 0.5300
675 #define _T_0_ pow(10.,0.477121) /* from recfast 1.4 */
676 #define _a_VF_ pow(10.,-16.744)
677 #define _b_VF_ 0.711
678 #define _T_1_ pow(10.,5.114)
679 #define _a_trip_ pow(10.,-16.306) /* from recfast 1.4 */
680 #define _b_trip_ 0.761 /* from recfast 1.4 */
681 
683 
687 /* @endcond */
689 
690 #define _YHE_BIG_ 0.5
691 #define _YHE_SMALL_ 0.01
692 #define _Z_REC_MAX_ 2000.
693 #define _Z_REC_MIN_ 500.
694 
696 
697 #endif
int index_re_cb2
Definition: thermodynamics.h:375
int thermodynamics_merge_reco_and_reio(struct precision *ppr, struct thermo *pth, struct recombination *preco, struct reionization *preio)
Definition: thermodynamics.c:3591
short has_on_the_spot
Definition: thermodynamics.h:325
short inter_normal
Definition: thermodynamics.h:248
double rs_rec
Definition: thermodynamics.h:204
double tau_ini
Definition: thermodynamics.h:230
int index_re_dkappadtau
Definition: thermodynamics.h:376
double CB1_He2
Definition: thermodynamics.h:317
int index_th_tau_d
Definition: thermodynamics.h:162
double CB1_He1
Definition: thermodynamics.h:316
Definition: background.h:25
int index_th_ddcb2
Definition: thermodynamics.h:172
double da_rec
Definition: thermodynamics.h:207
int rt_size
Definition: thermodynamics.h:387
int index_reio_width
Definition: thermodynamics.h:408
int index_re_xe
Definition: thermodynamics.h:279
double CDB_He
Definition: thermodynamics.h:307
Definition: thermodynamics.h:27
reionization_z_or_tau
Definition: thermodynamics.h:37
int index_th_dddkappa
Definition: thermodynamics.h:164
int index_reio_first_z
Definition: thermodynamics.h:418
double tau_free_streaming
Definition: thermodynamics.h:222
double decay
Definition: thermodynamics.h:327
int index_reio_first_xe
Definition: thermodynamics.h:419
int th_size
Definition: thermodynamics.h:175
int index_re_Tb
Definition: thermodynamics.h:374
double annihilation_zmax
Definition: thermodynamics.h:143
int index_reio_step_sharpness
Definition: thermodynamics.h:420
int thermodynamics_indices(struct thermo *pth, struct recombination *preco, struct reionization *preio)
Definition: thermodynamics.c:857
int re_size
Definition: thermodynamics.h:379
double annihilation
Definition: thermodynamics.h:323
double CT
Definition: thermodynamics.h:305
double reionization_width
Definition: thermodynamics.h:84
ErrorMsg error_message
Definition: thermodynamics.h:259
int thermodynamics_reionization_function(double z, struct thermo *pth, struct reionization *preio, double *xe)
Definition: thermodynamics.c:1434
double Tnow
Definition: thermodynamics.h:312
Definition: thermodynamics.h:26
double ds_rec
Definition: thermodynamics.h:205
double annihilation_variation
Definition: thermodynamics.h:128
double YHe
Definition: thermodynamics.h:66
Definition: thermodynamics.h:58
int index_re_cb2
Definition: thermodynamics.h:281
Definition: thermodynamics.h:30
int thermodynamics_free(struct thermo *pth)
Definition: thermodynamics.c:835
reionization_parametrization
Definition: thermodynamics.h:24
int re_size
Definition: thermodynamics.h:283
double CK_He
Definition: thermodynamics.h:308
double annihilation_z
Definition: thermodynamics.h:138
int index_th_dg
Definition: thermodynamics.h:167
double CK
Definition: thermodynamics.h:303
double n_e
Definition: thermodynamics.h:238
double z_d
Definition: thermodynamics.h:209
int index_th_xe
Definition: thermodynamics.h:160
int thermodynamics_init(struct precision *ppr, struct background *pba, struct thermo *pth)
Definition: thermodynamics.c:252
int index_reio_xe_after
Definition: thermodynamics.h:410
Definition: thermodynamics.h:29
double tau_rec
Definition: thermodynamics.h:203
int index_re_z
Definition: thermodynamics.h:372
int thermodynamics_get_xe_before_reionization(struct precision *ppr, struct thermo *pth, struct recombination *preco, double z, double *xe)
Definition: thermodynamics.c:1673
short has_on_the_spot
Definition: thermodynamics.h:124
int index_th_r_d
Definition: thermodynamics.h:174
int thermodynamics_helium_from_bbn(struct precision *ppr, struct background *pba, struct thermo *pth)
Definition: thermodynamics.c:1054
double angular_rescaling
Definition: thermodynamics.h:214
double * thermodynamics_table
Definition: thermodynamics.h:185
int thermodynamics_recombination_with_recfast(struct precision *ppr, struct background *pba, struct thermo *pth, struct recombination *preco, double *pvecback)
Definition: thermodynamics.c:2932
double fHe
Definition: thermodynamics.h:306
double annihilation_z
Definition: thermodynamics.h:339
int thermodynamics_at_z(struct background *pba, struct thermo *pth, double z, short inter_mode, int *last_index, double *pvecback, double *pvecthermo)
Definition: thermodynamics.c:97
int index_th_ddg
Definition: thermodynamics.h:168
double annihilation_zmax
Definition: thermodynamics.h:344
Definition: thermodynamics.h:449
int index_re_Tb
Definition: thermodynamics.h:280
int thermodynamics_derivs_with_recfast(double z, double *y, double *dy, void *parameters_and_workspace, ErrorMsg error_message)
Definition: thermodynamics.c:3327
double * z_table
Definition: thermodynamics.h:184
int index_re_z
Definition: thermodynamics.h:278
double * reionization_table
Definition: thermodynamics.h:388
double CDB
Definition: thermodynamics.h:301
int index_reio_xe_before
Definition: thermodynamics.h:409
double ds_d
Definition: thermodynamics.h:211
double annihilation_f_halo
Definition: thermodynamics.h:151
double rs_d
Definition: thermodynamics.h:212
int index_th_Tb
Definition: thermodynamics.h:169
double YHe
Definition: thermodynamics.h:319
int index_th_g
Definition: thermodynamics.h:166
double * d2thermodynamics_dz2_table
Definition: thermodynamics.h:193
int index_th_exp_m_kappa
Definition: thermodynamics.h:165
Definition: thermodynamics.h:39
int index_reio_exponent
Definition: thermodynamics.h:407
int index_th_ddkappa
Definition: thermodynamics.h:163
double tau_reio
Definition: thermodynamics.h:74
double annihilation
Definition: thermodynamics.h:122
short compute_cb2_derivatives
Definition: thermodynamics.h:78
int index_reio_start
Definition: thermodynamics.h:424
double annihilation_f_halo
Definition: thermodynamics.h:352
int index_reco_when_reio_start
Definition: thermodynamics.h:439
Definition: thermodynamics.h:28
double tau_cut
Definition: thermodynamics.h:213
int index_helium_fullreio_fraction
Definition: thermodynamics.h:411
int index_helium_fullreio_redshift
Definition: thermodynamics.h:412
double reionization_exponent
Definition: thermodynamics.h:86
int thermodynamics_reionization(struct precision *ppr, struct background *pba, struct thermo *pth, struct recombination *preco, struct reionization *preio, double *pvecback)
Definition: thermodynamics.c:1716
double helium_fullreio_width
Definition: thermodynamics.h:90
double * binned_reio_xe
Definition: thermodynamics.h:98
Definition: thermodynamics.h:25
Definition: thermodynamics.h:366
double * reio_inter_xe
Definition: thermodynamics.h:118
double annihilation_zmin
Definition: thermodynamics.h:147
double * binned_reio_z
Definition: thermodynamics.h:96
Definition: thermodynamics.h:272
double annihilation_variation
Definition: thermodynamics.h:329
double * reionization_parameters
Definition: thermodynamics.h:430
int thermodynamics_onthespot_energy_injection(struct precision *ppr, struct background *pba, struct recombination *preco, double z, double *energy_rate, ErrorMsg error_message)
Definition: thermodynamics.c:1279
double CL_He
Definition: thermodynamics.h:309
double ra_rec
Definition: thermodynamics.h:206
int index_reio_redshift
Definition: thermodynamics.h:406
double annihilation_z_halo
Definition: thermodynamics.h:152
double * many_tanh_z
Definition: thermodynamics.h:106
int index_th_rate
Definition: thermodynamics.h:173
recombination_algorithm
Definition: thermodynamics.h:15
double rd_rec
Definition: thermodynamics.h:208
double z_rec
Definition: thermodynamics.h:202
int index_helium_fullreio_width
Definition: thermodynamics.h:413
int index_re_xe
Definition: thermodynamics.h:373
int index_th_cb2
Definition: thermodynamics.h:170
double CB1
Definition: thermodynamics.h:315
int index_th_dcb2
Definition: thermodynamics.h:171
Definition: thermodynamics.h:38
double H0
Definition: thermodynamics.h:318
short compute_damping_scale
Definition: thermodynamics.h:80
double CR
Definition: thermodynamics.h:302
int reio_inter_num
Definition: thermodynamics.h:114
int index_re_dkappadz
Definition: thermodynamics.h:377
int index_th_dkappa
Definition: thermodynamics.h:161
double annihilation_zmin
Definition: thermodynamics.h:348
double * recombination_table
Definition: thermodynamics.h:292
int thermodynamics_recombination(struct precision *ppr, struct background *pba, struct thermo *pth, struct recombination *preco, double *pvecback)
Definition: thermodynamics.c:2574
int reio_num_params
Definition: thermodynamics.h:431
Definition: common.h:345
double fu
Definition: thermodynamics.h:310
double H_frac
Definition: thermodynamics.h:311
int thermodynamics_recombination_with_hyrec(struct precision *ppr, struct background *pba, struct thermo *pth, struct recombination *preco, double *pvecback)
Definition: thermodynamics.c:2623
double Nnow
Definition: thermodynamics.h:313
int thermodynamics_energy_injection(struct precision *ppr, struct background *pba, struct recombination *preco, double z, double *energy_rate, ErrorMsg error_message)
Definition: thermodynamics.c:1343
double z_reio
Definition: thermodynamics.h:76
short thermodynamics_verbose
Definition: thermodynamics.h:257
double Bfact
Definition: thermodynamics.h:314
double * many_tanh_xe
Definition: thermodynamics.h:108
int binned_reio_num
Definition: thermodynamics.h:94
double * reio_inter_z
Definition: thermodynamics.h:116
double binned_reio_step_sharpness
Definition: thermodynamics.h:100
double annihilation_z_halo
Definition: thermodynamics.h:353
int thermodynamics_reionization_sample(struct precision *ppr, struct background *pba, struct thermo *pth, struct recombination *preco, struct reionization *preio, double *pvecback)
Definition: thermodynamics.c:2246
int thermodynamics_output_titles(struct background *pba, struct thermo *pth, char titles[_MAXTITLESTRINGLENGTH_])
Definition: thermodynamics.c:3666
int rt_size
Definition: thermodynamics.h:291
double reionization_optical_depth
Definition: thermodynamics.h:396
double decay
Definition: thermodynamics.h:126
short inter_closeby
Definition: thermodynamics.h:249
double many_tanh_width
Definition: thermodynamics.h:110
double CL
Definition: thermodynamics.h:304
int index_re_dkappadtau
Definition: thermodynamics.h:282
double tau_d
Definition: thermodynamics.h:210
int reio_num_z
Definition: thermodynamics.h:417
int tt_size
Definition: thermodynamics.h:183
int index_re_d3kappadz3
Definition: thermodynamics.h:378
double helium_fullreio_redshift
Definition: thermodynamics.h:88
int many_tanh_num
Definition: thermodynamics.h:104