CLASS MANUAL
background_neutrino_horizon.h
1 
3 #ifndef __BACKGROUND__
4 #define __BACKGROUND__
5 
6 #include "common.h"
7 #include "quadrature.h"
8 #include "growTable.h"
9 #include "arrays.h"
10 #include "dei_rkck.h"
11 #include "parser.h"
12 
15 enum equation_of_state {CLP,EDE};
16 
17 
20 enum varconst_dependence {varconst_none,varconst_instant};
21 
24 enum vecback_format {short_info, normal_info, long_info};
25 
30 enum interpolation_method {inter_normal, inter_closeby};
31 
43 struct background
44 {
57 
58  double H0;
59  double h;
61  double Omega0_g;
62  double T_cmb;
64  double Omega0_b;
66  double Omega0_ur;
68  double Omega0_cdm;
70  double Omega0_idm;
73  double Omega0_idr;
74  double T_idr;
76  double Omega0_dcdmdr;
77  double Omega_ini_dcdm;
78  double Gamma_dcdm;
79  double tau_dcdm;
80 
81  int N_ncdm;
82  /* the following parameters help to define tabulated ncdm p-s-d passed in file */
83  char * ncdm_psd_files;
84  int * got_files;
85  /* the following parameters help to define the analytical ncdm phase space distributions (p-s-d) */
86  double * ncdm_psd_parameters;
88  double * M_ncdm;
89  double * m_ncdm_in_eV;
90  double * Omega0_ncdm, Omega0_ncdm_tot;
91  double * T_ncdm,T_ncdm_default;
93  double * ksi_ncdm, ksi_ncdm_default;
95  double * deg_ncdm, deg_ncdm_default;
98  int * ncdm_input_q_size;
99  double * ncdm_qmax;
101  double Omega0_k;
103  double Omega0_lambda;
104  double Omega0_fld;
105  double Omega0_scf;
106  short use_ppf;
108  double c_gamma_over_c_fld;
110  double w0_fld;
111  double wa_fld;
112  double cs2_fld;
114  double Omega_EDE;
115  double * scf_parameters;
116  short attractor_ic_scf;
117  int scf_tuning_index;
118  double phi_ini_scf;
119  double phi_prime_ini_scf;
120  int scf_parameters_size;
121  double varconst_alpha;
122  double varconst_me;
127 
128 
132 
133  double age;
134  double conformal_age;
135  double K;
136  int sgnK;
137  double Neff;
138  double Omega0_dcdm;
139  double Omega0_dr;
140  double Omega0_m;
141  double Omega0_r;
142  double Omega0_de;
143  double Omega0_nfsm;
144  double a_eq;
145  double H_eq;
146  double z_eq;
147  double tau_eq;
150 
151 
155 
156  int index_bg_a;
159  int index_bg_H;
160  int index_bg_H_prime;
162  /* end of vector in short format, now quantities in normal format */
163 
164  int index_bg_rho_g;
165  int index_bg_rho_b;
166  int index_bg_rho_cdm;
167  int index_bg_rho_idm;
168  int index_bg_rho_lambda;
169  int index_bg_rho_fld;
170  int index_bg_w_fld;
171  int index_bg_rho_idr;
172  int index_bg_rho_ur;
173  int index_bg_rho_dcdm;
174  int index_bg_rho_dr;
176  int index_bg_phi_scf;
178  int index_bg_V_scf;
179  int index_bg_dV_scf;
180  int index_bg_ddV_scf;
181  int index_bg_rho_scf;
182  int index_bg_p_scf;
185  int index_bg_rho_ncdm1;
186  int index_bg_p_ncdm1;
189  int index_bg_rho_tot;
190  int index_bg_p_tot;
193  int index_bg_Omega_r;
195  /* end of vector in normal format, now quantities in long format */
196 
197  int index_bg_rho_crit;
198  int index_bg_Omega_m;
202  int index_bg_time;
203  int index_bg_rs;
206  int index_bg_D;
207  int index_bg_f;
209  int index_bg_varc_alpha;
210  int index_bg_varc_me;
212  int bg_size_short;
213  int bg_size_normal;
214  int bg_size;
217 
218 
222 
223  int bt_size;
224  double * loga_table;
225  double * tau_table;
226  double * z_table;
227  double * background_table;
230 
231 
235 
236  double * d2tau_dz2_table;
237  double * d2z_dtau2_table;
238  double * d2background_dloga2_table;
241 
242 
255 
256  int index_bi_rho_dcdm;
257  int index_bi_rho_dr;
258  int index_bi_rho_fld;
259  int index_bi_phi_scf;
262  int index_bi_time;
263  int index_bi_rs;
265  int index_bi_tau;
266  int index_bi_D;
267  int index_bi_D_prime;
269  int bi_B_size;
270  int bi_size;
273 
283 
284  short has_cdm;
285  short has_idm;
286  short has_dcdm;
287  short has_dr;
288  short has_scf;
289  short has_ncdm;
290  short has_lambda;
291  short has_fld;
292  short has_ur;
293  short has_idr;
294  short has_curvature;
295  short has_varconst;
298 
299 
305 
307  double ** q_ncdm_bg;
308  double ** w_ncdm_bg;
309  double ** q_ncdm;
310  double ** w_ncdm;
311  double ** dlnf0_dlnq_ncdm;
312  int * q_size_ncdm_bg;
313  int * q_size_ncdm;
314  double * factor_ncdm;
317 
321 
322  short shooting_failed;
323  ErrorMsg shooting_error;
325  short background_verbose;
327  ErrorMsg error_message;
329  short is_allocated;
331 };
332 
333 
339 
340  /* structures containing fixed input parameters (indices, ...) */
341  struct background * pba;
342 
343  /* workspace */
344  double * pvecback;
345 
346 };
347 
353 
354  /* structures containing fixed input parameters (indices, ...) */
355  struct background * pba;
356 
357  /* Additional parameters */
358 
359  /* Index of current distribution function */
360  int n_ncdm;
361 
362  /* Used for interpolating in file of tabulated p-s-d: */
363  int tablesize;
364  double *q;
365  double *f0;
366  double *d2f0;
367  int last_index;
368 
369 };
370 
371 /**************************************************************/
372 /* @cond INCLUDE_WITH_DOXYGEN */
373 /*
374  * Boilerplate for C++
375  */
376 #ifdef __cplusplus
377 extern "C" {
378 #endif
379 
380  int background_at_z(
381  struct background *pba,
382  double a_rel,
383  enum vecback_format return_format,
384  enum interpolation_method inter_mode,
385  int * last_index,
386  double * pvecback
387  );
388 
389  int background_at_tau(
390  struct background *pba,
391  double tau,
392  enum vecback_format return_format,
393  enum interpolation_method inter_mode,
394  int * last_index,
395  double * pvecback
396  );
397 
399  struct background *pba,
400  double z,
401  double * tau
402  );
403 
405  struct background *pba,
406  double tau,
407  double * z
408  );
409 
411  struct background *pba,
412  double a_rel,
413  double * pvecback_B,
414  enum vecback_format return_format,
415  double * pvecback
416  );
417 
418  int background_w_fld(
419  struct background * pba,
420  double a,
421  double * w_fld,
422  double * dw_over_da_fld,
423  double * integral_fld);
424 
426  struct background* pba,
427  double z,
428  double* alpha,
429  double* me
430  );
431 
432  int background_init(
433  struct precision *ppr,
434  struct background *pba
435  );
436 
437  int background_free(
438  struct background *pba
439  );
440 
442  struct background *pba
443  );
444 
446  struct background *pba
447  );
448 
449  int background_indices(
450  struct background *pba
451  );
452 
454  void *pba,
455  double q,
456  double * f0
457  );
458 
460  void *pba,
461  double q,
462  double * test
463  );
464 
466  struct precision *ppr,
467  struct background *pba
468  );
469 
471  double * qvec,
472  double * wvec,
473  int qsize,
474  double M,
475  double factor,
476  double z,
477  double * n,
478  double * rho,
479  double * p,
480  double * drho_dM,
481  double * pseudo_p
482  );
483 
485  struct precision *ppr,
486  struct background *pba,
487  int species
488  );
489 
490  int background_checks(
491  struct precision * ppr,
492  struct background *pba
493  );
494 
495  int background_solve(
496  struct precision *ppr,
497  struct background *pba
498  );
499 
501  struct precision *ppr,
502  struct background *pba,
503  double * pvecback,
504  double * pvecback_integration,
505  double * loga_ini
506  );
507 
509  struct precision *ppr,
510  struct background *pba
511  );
512 
513 
514  int background_output_titles(struct background * pba,
515  char titles[_MAXTITLESTRINGLENGTH_]
516  );
517 
519  struct background *pba,
520  int number_of_titles,
521  double *data);
522 
523  int background_derivs(
524  double loga,
525  double * y,
526  double * dy,
527  void * parameters_and_workspace,
528  ErrorMsg error_message
529  );
530 
531  int background_sources(
532  double loga,
533  double * y,
534  double * dy,
535  int index_loga,
536  void * parameters_and_workspace,
537  ErrorMsg error_message
538  );
539 
541  double loga,
542  void * parameters_and_workspace,
543  double * timescale,
544  ErrorMsg error_message
545  );
546 
548  struct background* pba
549  );
550 
552  double V_scf(
553  struct background *pba,
554  double phi
555  );
556 
557  double dV_scf(
558  struct background *pba,
559  double phi
560  );
561 
562  double ddV_scf(
563  struct background *pba,
564  double phi
565  );
566 
568  double Q_scf(
569  struct background *pba,
570  double phi,
571  double phi_prime
572  );
573 
574 #ifdef __cplusplus
575 }
576 #endif
577 
578 /**************************************************************/
579 
585 
586 #define _Mpc_over_m_ 3.085677581282e22
587 /* remark: CAMB uses 3.085678e22: good to know if you want to compare with high accuracy */
588 
589 #define _Gyr_over_Mpc_ 3.06601394e2
591 #define _c_ 2.99792458e8
592 #define _G_ 6.67428e-11
593 #define _eV_ 1.602176487e-19
595 /* parameters entering in Stefan-Boltzmann constant sigma_B */
596 #define _k_B_ 1.3806504e-23
597 #define _h_P_ 6.62606896e-34
598 /* remark: sigma_B = 2 pi^5 k_B^4 / (15h^3c^2) = 5.670400e-8
599  = Stefan-Boltzmann constant in W/m^2/K^4 = Kg/K^4/s^3 */
600 
602 
608 
609 #define _h_BIG_ 1.5
610 #define _h_SMALL_ 0.3
611 #define _omegab_BIG_ 0.039
612 #define _omegab_SMALL_ 0.005
615 
621 
622 #define _SCALE_BACK_ 0.1
626 #define _PSD_DERIVATIVE_EXP_MIN_ -30
627 #define _PSD_DERIVATIVE_EXP_MAX_ 2
629 #define _zeta3_ 1.2020569031595942853997381615114499907649862923404988817922
630 #define _zeta5_ 1.0369277551433699263313654864570341680570809195019128119741
633 
634 
635 #endif
636 /* @endcond */
int background_output_titles(struct background *pba, char titles[_MAXTITLESTRINGLENGTH_])
Definition: background.c:2422
int background_output_data(struct background *pba, int number_of_titles, double *data)
Definition: background.c:2492
int background_checks(struct precision *ppr, struct background *pba)
Definition: background.c:1735
int background_varconst_of_z(struct background *pba, double z, double *alpha, double *me)
Definition: background.c:766
int background_functions(struct background *pba, double a, double *pvecback_B, enum vecback_format return_format, double *pvecback)
Definition: background.c:371
int background_output_budget(struct background *pba)
Definition: background.c:2781
int background_initial_conditions(struct precision *ppr, struct background *pba, double *pvecback, double *pvecback_integration, double *loga_ini)
Definition: background.c:2131
int background_ncdm_distribution(void *pbadist, double q, double *f0)
Definition: background.c:1205
int background_w_fld(struct background *pba, double a, double *w_fld, double *dw_over_da_fld, double *integral_fld)
Definition: background.c:664
int background_at_z(struct background *pba, double z, enum vecback_format return_format, enum interpolation_method inter_mode, int *last_index, double *pvecback)
Definition: background.c:132
int background_ncdm_test_function(void *pbadist, double q, double *test)
Definition: background.c:1342
int background_free(struct background *pba)
Definition: background.c:863
int background_ncdm_M_from_Omega(struct precision *ppr, struct background *pba, int n_ncdm)
Definition: background.c:1667
int background_free_input(struct background *pba)
Definition: background.c:910
int background_free_noinput(struct background *pba)
Definition: background.c:888
int background_ncdm_init(struct precision *ppr, struct background *pba)
Definition: background.c:1367
int background_sources(double loga, double *y, double *dy, int index_loga, void *parameters_and_workspace, ErrorMsg error_message)
Definition: background.c:2690
int background_tau_of_z(struct background *pba, double z, double *tau)
Definition: background.c:268
int background_indices(struct background *pba)
Definition: background.c:963
int background_z_of_tau(struct background *pba, double tau, double *z)
Definition: background.c:318
int background_derivs(double loga, double *y, double *dy, void *parameters_and_workspace, ErrorMsg error_message)
Definition: background.c:2583
int background_at_tau(struct background *pba, double tau, enum vecback_format return_format, enum interpolation_method inter_mode, int *last_index, double *pvecback)
Definition: background.c:230
int background_timescale(double loga, void *parameters_and_workspace, double *timescale, ErrorMsg error_message)
Definition: background.c:2759
double V_scf(struct background *pba, double phi)
Definition: background.c:2985
int background_solve(struct precision *ppr, struct background *pba)
Definition: background.c:1871
int background_find_equality(struct precision *ppr, struct background *pba)
Definition: background.c:2345
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)
Definition: background.c:1600
int background_init(struct precision *ppr, struct background *pba)
Definition: background.c:805
varconst_dependence
Definition: background.h:20
equation_of_state
Definition: background.h:15
vecback_format
Definition: background.h:24
interpolation_method
Definition: background.h:30
Definition: common.h:406
Definition: background.h:336
Definition: background.h:350
Definition: background.h:44
double Gamma_dcdm
Definition: background.h:78
int index_bg_phi_prime_scf
Definition: background.h:177
int index_bg_rho_tot
Definition: background.h:189
double Omega0_ncdm_tot
Definition: background.h:90
double * M_ncdm
Definition: background.h:88
int N_ncdm
Definition: background.h:81
int index_bg_rho_b
Definition: background.h:165
int index_bi_phi_prime_scf
Definition: background.h:259
double Omega0_ur
Definition: background.h:66
int index_bg_Omega_r
Definition: background.h:193
double T_ncdm_default
Definition: background.h:91
double * scf_parameters
Definition: background.h:115
int bg_size
Definition: background.h:213
double Omega0_idr
Definition: background.h:73
double h
Definition: background.h:59
int index_bi_nu
Definition: background_neutrino_horizon.h:264
int index_bg_p_ncdm1
Definition: background.h:186
int index_bg_conf_distance
Definition: background.h:199
double * tau_table
Definition: background.h:224
int index_bi_rho_dcdm
Definition: background.h:255
short attractor_ic_scf
Definition: background.h:116
int index_bg_w_fld
Definition: background.h:170
char * ncdm_psd_files
Definition: background.h:83
double * z_table
Definition: background.h:225
double Omega0_g
Definition: background.h:61
double Omega0_dr
Definition: background.h:139
short has_ncdm
Definition: background.h:287
double T_idr
Definition: background.h:74
int index_bg_varc_alpha
Definition: background.h:208
double Omega_ini_dcdm
Definition: background.h:77
double ** w_ncdm_bg
Definition: background.h:306
int index_bg_D
Definition: background.h:205
short has_fld
Definition: background.h:289
int * ncdm_quadrature_strategy
Definition: background.h:304
double Omega0_dcdmdr
Definition: background.h:76
double Omega0_k
Definition: background.h:101
double tau_eq
Definition: background.h:147
double age
Definition: background.h:133
int index_bg_rs
Definition: background.h:203
short shooting_failed
Definition: background.h:320
int index_bi_rho_dr
Definition: background.h:256
double * background_table
Definition: background.h:226
double deg_ncdm_default
Definition: background.h:95
double Omega0_scf
Definition: background.h:105
short has_varconst
Definition: background.h:293
int * ncdm_input_q_size
Definition: background.h:98
int index_bg_rho_crit
Definition: background.h:197
double Omega0_de
Definition: background.h:142
double varconst_transition_redshift
Definition: background.h:124
double varconst_me
Definition: background.h:122
int scf_parameters_size
Definition: background.h:120
short has_idr
Definition: background.h:291
int index_bg_p_prime_scf
Definition: background.h:183
int index_bg_H
Definition: background.h:159
double * loga_table
Definition: background.h:223
int index_bg_a
Definition: background.h:156
enum varconst_dependence varconst_dep
Definition: background.h:123
int bg_size_short
Definition: background.h:211
double Omega0_dcdm
Definition: background.h:138
double * ncdm_psd_parameters
Definition: background.h:86
double Neff
Definition: background.h:137
int index_bg_rho_ur
Definition: background.h:172
int index_bg_rho_lambda
Definition: background.h:168
int bg_size_normal
Definition: background.h:212
int index_bi_tau
Definition: background.h:263
double * m_ncdm_in_eV
Definition: background.h:89
double * d2background_dloga2_table
Definition: background.h:237
double ** dlnf0_dlnq_ncdm
Definition: background.h:309
int bi_size
Definition: background.h:268
double Omega_EDE
Definition: background.h:114
short background_verbose
Definition: background.h:323
int index_bi_D_prime
Definition: background.h:265
short use_ppf
Definition: background.h:106
int index_bg_varc_me
Definition: background.h:209
double ksi_ncdm_default
Definition: background.h:93
int index_bi_D
Definition: background.h:264
int index_bi_phi_scf
Definition: background.h:258
short has_ur
Definition: background.h:290
double K
Definition: background.h:135
double * factor_ncdm
Definition: background.h:312
int index_bg_V_scf
Definition: background.h:178
double Omega0_fld
Definition: background.h:104
double cs2_fld
Definition: background.h:112
enum equation_of_state fluid_equation_of_state
Definition: background.h:109
int index_bg_p_tot
Definition: background.h:190
double z_eq
Definition: background.h:146
double w0_fld
Definition: background.h:110
int index_bg_phi_scf
Definition: background.h:176
int index_bg_rho_scf
Definition: background.h:181
int index_bi_time
Definition: background.h:261
short has_curvature
Definition: background.h:292
short is_allocated
Definition: background.h:327
double Omega0_cdm
Definition: background.h:68
double a_eq
Definition: background.h:144
int index_bi_rs
Definition: background.h:262
int bt_size
Definition: background.h:222
double ** q_ncdm_bg
Definition: background.h:305
int index_bi_rho_fld
Definition: background.h:257
double H0
Definition: background.h:58
double c_gamma_over_c_fld
Definition: background.h:108
double T_cmb
Definition: background.h:62
int * got_files
Definition: background.h:84
double phi_ini_scf
Definition: background.h:118
double Omega0_r
Definition: background.h:141
double Omega0_nfsm
Definition: background.h:143
int bi_B_size
Definition: background.h:267
int sgnK
Definition: background.h:136
double Omega0_b
Definition: background.h:64
double Omega0_idm
Definition: background.h:70
double * d2z_dtau2_table
Definition: background.h:236
int index_bg_rho_cdm
Definition: background.h:166
double phi_prime_ini_scf
Definition: background.h:119
ErrorMsg error_message
Definition: background.h:325
int index_bg_rho_idr
Definition: background.h:171
int index_bg_rho_idm
Definition: background.h:167
int index_bg_H_prime
Definition: background.h:160
double ** q_ncdm
Definition: background.h:307
int index_bg_rho_fld
Definition: background.h:169
int index_bg_rho_ncdm1
Definition: background.h:185
double wa_fld
Definition: background.h:111
short has_dcdm
Definition: background.h:284
short has_scf
Definition: background.h:286
double * d2tau_dz2_table
Definition: background.h:235
int index_bg_dV_scf
Definition: background.h:179
int index_bg_pseudo_p_ncdm1
Definition: background.h:187
double Omega0_lambda
Definition: background.h:103
short has_idm
Definition: background.h:283
double Omega0_m
Definition: background.h:140
double H_eq
Definition: background.h:145
int index_bg_rho_dr
Definition: background.h:174
int index_bg_lum_distance
Definition: background.h:201
short has_lambda
Definition: background.h:288
int index_bg_Omega_m
Definition: background.h:198
int index_bg_f
Definition: background.h:206
double * ncdm_qmax
Definition: background.h:99
int index_bg_ang_distance
Definition: background.h:200
ErrorMsg shooting_error
Definition: background.h:321
int index_bg_rho_g
Definition: background.h:164
short has_dr
Definition: background.h:285
int index_bg_p_tot_prime
Definition: background.h:191
double ** w_ncdm
Definition: background.h:308
int index_bg_p_scf
Definition: background.h:182
int index_bg_time
Definition: background.h:202
double conformal_age
Definition: background.h:134
int index_bg_nu
Definition: background_neutrino_horizon.h:204
int * q_size_ncdm_bg
Definition: background.h:310
int * q_size_ncdm
Definition: background.h:311
short has_cdm
Definition: background.h:282
int index_bg_ddV_scf
Definition: background.h:180
int index_bg_rho_dcdm
Definition: background.h:173
int scf_tuning_index
Definition: background.h:117
double varconst_alpha
Definition: background.h:121