CLASS MANUAL
fourier.h
Go to the documentation of this file.
1 
3 #include "primordial.h"
4 #include "trigonometric_integrals.h"
5 
6 #ifndef __FOURIER__
7 #define __FOURIER__
8 
9 #define _M_EV_TOO_BIG_FOR_HALOFIT_ 10.
11 #define _M_SUN_ 1.98847e30
13 #define _MAX_NUM_EXTRAPOLATION_ 100000
14 
15 enum non_linear_method {nl_none,nl_halofit,nl_HMcode};
16 enum pk_outputs {pk_linear,pk_nonlinear};
17 
18 enum source_extrapolation {extrap_zero,extrap_only_max,extrap_only_max_units,extrap_max_scaled,extrap_hmcode,extrap_user_defined};
19 
20 enum halofit_integral_type {halofit_integral_one, halofit_integral_two, halofit_integral_three};
21 
22 enum hmcode_baryonic_feedback_model {nl_emu_dmonly, nl_owls_dmonly, nl_owls_ref, nl_owls_agn, nl_owls_dblim, nl_user_defined};
23 enum out_sigmas {out_sigma,out_sigma_prime,out_sigma_disp};
24 
33 struct fourier {
34 
41 
42  enum non_linear_method method;
44  enum source_extrapolation extrapolation_method;
46  enum hmcode_baryonic_feedback_model feedback;
48  double c_min;
49  double eta_0;
50  double z_infinity;
52  short has_pk_eq;
55 
59 
63  int ic_size;
64  int ic_ic_size;
65  short * is_non_zero;
68 
72 
73  short has_pk_m;
74  short has_pk_cb;
76  int index_pk_m;
79  /* and two redundent but useful indices: */
80 
86  int pk_size;
89 
93 
94  short has_pk_matter;
96  int k_size;
97  int k_size_pk;
98  double * k;
99  double * ln_k;
101  double * ln_tau;
110  double ** ln_pk_ic_l;
126  double ** ddln_pk_ic_l;
136  double ** ln_pk_l;
141  double ** ddln_pk_l;
143  double ** ln_pk_nl;
148  double ** ddln_pk_nl;
150  double * sigma8;
153 
157 
158  int k_size_extra;
160  int tau_size;
161  double * tau;
164  double ** nl_corr_density;
165  double ** k_nl;
171 
175 
182  double * pk_eq_tau;
183  double * pk_eq_w_and_Omega;
187 
191 
194  ErrorMsg error_message;
197 };
198 
205 
209 
210  double * rtab;
211  double * stab;
212  double * ddstab;
214  double * growtable;
215  double * ztable;
216  double * tautable;
217 
218  double ** sigma_8;
219  double ** sigma_disp;
220  double ** sigma_disp_100;
221  double ** sigma_prime;
222 
223  double dark_energy_correction;
228 
229 };
230 
231 /********************************************************************************/
232 
233 /* @cond INCLUDE_WITH_DOXYGEN */
234 /*
235  * Boilerplate for C++
236  */
237 #ifdef __cplusplus
238 extern "C" {
239 #endif
240 
241  /* external functions (meant to be called from other modules) */
242 
243  int fourier_pk_at_z(
244  struct background * pba,
245  struct fourier *pfo,
246  enum linear_or_logarithmic mode,
247  enum pk_outputs pk_output,
248  double z,
249  int index_pk,
250  double * out_pk,
251  double * out_pk_ic
252  );
253 
254  int fourier_pks_at_z(
255  struct background * pba,
256  struct fourier *pfo,
257  enum linear_or_logarithmic mode,
258  enum pk_outputs pk_output,
259  double z,
260  double * out_pk,
261  double * out_pk_ic,
262  double * out_pk_cb,
263  double * out_pk_cb_ic
264  );
265 
267  struct background * pba,
268  struct primordial * ppm,
269  struct fourier *pfo,
270  enum pk_outputs pk_output,
271  double k,
272  double z,
273  int index_pk,
274  double * out_pk,
275  double * out_pk_ic
276  );
277 
278  int fourier_pks_at_k_and_z(
279  struct background * pba,
280  struct primordial * ppm,
281  struct fourier *pfo,
282  enum pk_outputs pk_output,
283  double k,
284  double z,
285  double * out_pk,
286  double * out_pk_ic,
287  double * out_pk_cb,
288  double * out_pk_cb_ic
289  );
290 
292  struct background * pba,
293  struct fourier * pfo,
294  enum pk_outputs pk_output,
295  double * kvec,
296  int kvec_size,
297  double * zvec,
298  int zvec_size,
299  double * out_pk,
300  double * out_pk_cb
301  );
302 
304  struct precision * ppr,
305  struct background * pba,
306  struct fourier * pfo,
307  double R,
308  double z,
309  int index_pk,
310  enum out_sigmas sigma_output,
311  double * result
312  );
313 
315  struct background * pba,
316  struct primordial * ppm,
317  struct fourier * pfo,
318  enum pk_outputs pk_output,
319  double k,
320  double z,
321  int index_pk,
322  double * pk_tilt
323  );
324 
325  int fourier_k_nl_at_z(
326  struct background *pba,
327  struct fourier * pfo,
328  double z,
329  double * k_nl,
330  double * k_nl_cb
331  );
332 
333  /* internal functions */
334 
335  int fourier_init(
336  struct precision *ppr,
337  struct background *pba,
338  struct thermodynamics *pth,
339  struct perturbations *ppt,
340  struct primordial *ppm,
341  struct fourier *pfo
342  );
343 
344  int fourier_free(
345  struct fourier *pfo
346  );
347 
348  int fourier_indices(
349  struct precision *ppr,
350  struct background *pba,
351  struct perturbations * ppt,
352  struct primordial * ppm,
353  struct fourier * pfo
354  );
355 
356  int fourier_get_k_list(
357  struct precision *ppr,
358  struct perturbations * ppt,
359  struct fourier * pfo
360  );
361 
363  struct perturbations * ppt,
364  struct fourier * pfo
365  );
366 
367  int fourier_get_source(
368  struct background * pba,
369  struct perturbations * ppt,
370  struct fourier * pfo,
371  int index_k,
372  int index_ic,
373  int index_tp,
374  int index_tau,
375  double ** sources,
376  double * source);
377 
378  int fourier_pk_linear(
379  struct background *pba,
380  struct perturbations *ppt,
381  struct primordial *ppm,
382  struct fourier *pfo,
383  int index_pk,
384  int index_tau,
385  int k_size,
386  double * lnpk,
387  double * lnpk_ic
388  );
389 
390  int fourier_sigmas(
391  struct fourier * pfo,
392  double R,
393  double *lnpk_l,
394  double *ddlnpk_l,
395  int k_size,
396  double k_per_decade,
397  enum out_sigmas sigma_output,
398  double * result
399  );
400 
401  int fourier_sigma_at_z(
402  struct background * pba,
403  struct fourier * pfo,
404  double R,
405  double z,
406  int index_pk,
407  double k_per_decade,
408  double * result
409  );
410 
411  int fourier_halofit(
412  struct precision *ppr,
413  struct background *pba,
414  struct perturbations *ppt,
415  struct primordial *ppm,
416  struct fourier *pfo,
417  int index_pk,
418  double tau,
419  double *pk_nl,
420  double *lnpk_l,
421  double *ddlnpk_l,
422  double *k_nl,
423  short * halofit_found_k_max
424  );
425 
427  struct fourier *pfo,
428  double * integrand_array,
429  int integrand_size,
430  int ia_size,
431  int index_ia_k,
432  int index_ia_pk,
433  int index_ia_sum,
434  int index_ia_ddsum,
435  double R,
436  enum halofit_integral_type type,
437  double * sum
438  );
439 
440  int fourier_hmcode(
441  struct precision *ppr,
442  struct background *pba,
443  struct perturbations *ppt,
444  struct primordial *ppm,
445  struct fourier *pfo,
446  int index_pk,
447  int index_tau,
448  double tau,
449  double *pk_nl,
450  double **lnpk_l,
451  double **ddlnpk_l,
452  double *k_nl,
453  short * halofit_found_k_max,
454  struct fourier_workspace * pnw
455  );
456 
458  struct precision *ppr,
459  struct background *pba,
460  struct fourier *pfo,
461  struct fourier_workspace * pnw
462  );
463 
465  struct fourier *pfo,
466  struct fourier_workspace * pnw
467  );
468 
470  struct precision *ppr,
471  struct background *pba,
472  struct fourier *pfo,
473  struct fourier_workspace * pnw
474  );
475 
477  struct fourier *pfo
478  );
479 
480 
482  struct precision *ppr,
483  struct background * pba,
484  struct perturbations *ppt,
485  struct primordial * ppm,
486  struct fourier * pfo,
487  int index_tau,
488  double *lnpk_l,
489  double *ddlnpk_l,
490  struct fourier_workspace * pnw
491  );
492 
494  struct precision *ppr,
495  struct background * pba,
496  struct fourier * pfo,
497  struct fourier_workspace * pnw
498  );
499 
501  struct precision *ppr,
502  struct background * pba,
503  struct fourier * pfo,
504  double a,
505  double w,
506  double wa,
507  double * growth
508  );
509 
511  struct fourier * pfo,
512  double k,
513  double rv,
514  double c,
515  double *window_nfw
516  );
517 
519  double nu,
520  double *hmf
521  );
522 
524  struct background *pba,
525  struct fourier * pfo,
526  double z,
527  double * sigma_8,
528  double * sigma_8_cb,
529  struct fourier_workspace * pnw
530  );
531 
533  struct background *pba,
534  struct fourier * pfo,
535  double z,
536  double * sigma_disp,
537  double * sigma_disp_cb,
538  struct fourier_workspace * pnw
539  );
540 
542  struct background *pba,
543  struct fourier * pfo,
544  double z,
545  double * sigma_disp_100,
546  double * sigma_disp_100_cb,
547  struct fourier_workspace * pnw
548  );
549 
551  struct background *pba,
552  struct fourier * pfo,
553  double z,
554  double * sigma_prime,
555  double * sigma_prime_cb,
556  struct fourier_workspace * pnw
557  );
558 
559 #ifdef __cplusplus
560 }
561 #endif
562 
563 #endif
564 /* @endcond */
Definition: background.h:48
Definition: common.h:378
int fourier_pks_at_kvec_and_zvec(struct background *pba, struct fourier *pfo, enum pk_outputs pk_output, double *kvec, int kvec_size, double *zvec, int zvec_size, double *out_pk, double *out_pk_cb)
Definition: fourier.c:748
int fourier_sigma_at_z(struct background *pba, struct fourier *pfo, double R, double z, int index_pk, double k_per_decade, double *result)
Definition: fourier.c:2467
int fourier_hmcode_sigma8_at_z(struct background *pba, struct fourier *pfo, double z, double *sigma_8, double *sigma_8_cb, struct fourier_workspace *pnw)
Definition: fourier.c:4171
int fourier_k_nl_at_z(struct background *pba, struct fourier *pfo, double z, double *k_nl, double *k_nl_cb)
Definition: fourier.c:1106
int fourier_hmcode_growint(struct precision *ppr, struct background *pba, struct fourier *pfo, double a, double w0, double wa, double *growth)
Definition: fourier.c:3978
int fourier_halofit(struct precision *ppr, struct background *pba, struct perturbations *ppt, struct primordial *ppm, struct fourier *pfo, int index_pk, double tau, double *pk_nl, double *lnpk_l, double *ddlnpk_l, double *k_nl, short *nl_corr_not_computable_at_this_k)
Definition: fourier.c:2556
int fourier_pk_tilt_at_k_and_z(struct background *pba, struct primordial *ppm, struct fourier *pfo, enum pk_outputs pk_output, double k, double z, int index_pk, double *pk_tilt)
Definition: fourier.c:956
int fourier_hmcode_baryonic_feedback(struct fourier *pfo)
Definition: fourier.c:3755
int fourier_hmcode_fill_sigtab(struct precision *ppr, struct background *pba, struct perturbations *ppt, struct primordial *ppm, struct fourier *pfo, int index_tau, double *lnpk_l, double *ddlnpk_l, struct fourier_workspace *pnw)
Definition: fourier.c:3823
int fourier_hmcode(struct precision *ppr, struct background *pba, struct perturbations *ppt, struct primordial *ppm, struct fourier *pfo, int index_pk, int index_tau, double tau, double *pk_nl, double **lnpk_l, double **ddlnpk_l, double *k_nl, short *nl_corr_not_computable_at_this_k, struct fourier_workspace *pnw)
Definition: fourier.c:3100
int fourier_hmcode_sigmadisp100_at_z(struct background *pba, struct fourier *pfo, double z, double *sigma_disp_100, double *sigma_disp_100_cb, struct fourier_workspace *pnw)
Definition: fourier.c:4326
int fourier_hmcode_fill_growtab(struct precision *ppr, struct background *pba, struct fourier *pfo, struct fourier_workspace *pnw)
Definition: fourier.c:3916
int fourier_get_source(struct background *pba, struct perturbations *ppt, struct fourier *pfo, int index_k, int index_ic, int index_tp, int index_tau, double **sources, double *source)
Definition: fourier.c:1967
int fourier_sigmas_at_z(struct precision *ppr, struct background *pba, struct fourier *pfo, double R, double z, int index_pk, enum out_sigmas sigma_output, double *result)
Definition: fourier.c:1030
int fourier_hmcode_halomassfunction(double nu, double *hmf)
Definition: fourier.c:4143
int fourier_free(struct fourier *pfo)
Definition: fourier.c:1654
int fourier_hmcode_workspace_init(struct precision *ppr, struct background *pba, struct fourier *pfo, struct fourier_workspace *pnw)
Definition: fourier.c:3601
int fourier_pk_at_k_and_z(struct background *pba, struct primordial *ppm, struct fourier *pfo, enum pk_outputs pk_output, double k, double z, int index_pk, double *out_pk, double *out_pk_ic)
Definition: fourier.c:378
int fourier_hmcode_window_nfw(struct fourier *pfo, double k, double rv, double c, double *window_nfw)
Definition: fourier.c:4085
int fourier_indices(struct precision *ppr, struct background *pba, struct perturbations *ppt, struct primordial *ppm, struct fourier *pfo)
Definition: fourier.c:1724
int fourier_get_k_list(struct precision *ppr, struct perturbations *ppt, struct fourier *pfo)
Definition: fourier.c:1854
int fourier_hmcode_workspace_free(struct fourier *pfo, struct fourier_workspace *pnw)
Definition: fourier.c:3653
int fourier_get_tau_list(struct perturbations *ppt, struct fourier *pfo)
Definition: fourier.c:1916
int fourier_pk_at_z(struct background *pba, struct fourier *pfo, enum linear_or_logarithmic mode, enum pk_outputs pk_output, double z, int index_pk, double *out_pk, double *out_pk_ic)
Definition: fourier.c:63
int fourier_hmcode_sigmadisp_at_z(struct background *pba, struct fourier *pfo, double z, double *sigma_disp, double *sigma_disp_cb, struct fourier_workspace *pnw)
Definition: fourier.c:4249
int fourier_hmcode_sigmaprime_at_z(struct background *pba, struct fourier *pfo, double z, double *sigma_prime, double *sigma_prime_cb, struct fourier_workspace *pnw)
Definition: fourier.c:4402
int fourier_pk_linear(struct background *pba, struct perturbations *ppt, struct primordial *ppm, struct fourier *pfo, int index_pk, int index_tau, int k_size, double *lnpk, double *lnpk_ic)
Definition: fourier.c:2120
int fourier_halofit_integrate(struct fourier *pfo, double *integrand_array, int integrand_size, int ia_size, int index_ia_k, int index_ia_pk, int index_ia_sum, int index_ia_ddsum, double R, enum halofit_integral_type type, double *sum)
Definition: fourier.c:3022
int fourier_init(struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct perturbations *ppt, struct primordial *ppm, struct fourier *pfo)
Definition: fourier.c:1192
int fourier_sigmas(struct fourier *pfo, double R, double *lnpk_l, double *ddlnpk_l, int k_size, double k_per_decade, enum out_sigmas sigma_output, double *result)
Definition: fourier.c:2291
int fourier_hmcode_dark_energy_correction(struct precision *ppr, struct background *pba, struct fourier *pfo, struct fourier_workspace *pnw)
Definition: fourier.c:3692
double * pk_eq_w_and_Omega
Definition: fourier.h:183
int index_md_scalars
Definition: fourier.h:60
short has_pk_m
Definition: fourier.h:73
double ** nl_corr_density
Definition: fourier.h:164
double ** ddln_pk_nl
Definition: fourier.h:148
int index_tau_min_nl
Definition: fourier.h:167
double * k
Definition: fourier.h:98
int pk_eq_size
Definition: fourier.h:178
int pk_eq_tau_size
Definition: fourier.h:180
double ** ddln_pk_ic_l
Definition: fourier.h:126
double * tau
Definition: fourier.h:161
double ** ddln_pk_l
Definition: fourier.h:141
int index_pk_eq_w
Definition: fourier.h:176
enum source_extrapolation extrapolation_method
Definition: fourier.h:44
int pk_size
Definition: fourier.h:86
enum non_linear_method method
Definition: fourier.h:42
int ic_ic_size
Definition: fourier.h:64
ErrorMsg error_message
Definition: fourier.h:194
int k_size
Definition: fourier.h:96
int index_pk_eq_Omega_m
Definition: fourier.h:177
double eta_0
Definition: fourier.h:49
double * ddstab
Definition: fourier.h:212
double z_infinity
Definition: fourier.h:50
int k_size_pk
Definition: fourier.h:97
int index_pk_total
Definition: fourier.h:81
short has_pk_eq
Definition: fourier.h:52
double ** ln_pk_nl
Definition: fourier.h:143
double ** ln_pk_ic_l
Definition: fourier.h:110
double ** ln_pk_l
Definition: fourier.h:136
int index_ln_tau_pk
Definition: fourier.h:108
short * is_non_zero
Definition: fourier.h:65
double ** k_nl
Definition: fourier.h:165
short has_pk_cb
Definition: fourier.h:74
double * growtable
Definition: fourier.h:214
int tau_size
Definition: fourier.h:160
double c_min
Definition: fourier.h:48
double * pk_eq_tau
Definition: fourier.h:182
int index_pk_cb
Definition: fourier.h:77
int ic_size
Definition: fourier.h:63
double * ln_k
Definition: fourier.h:99
short fourier_verbose
Definition: fourier.h:192
double * pk_eq_ddw_and_ddOmega
Definition: fourier.h:184
int ln_tau_size
Definition: fourier.h:107
double * sigma8
Definition: fourier.h:150
short has_pk_matter
Definition: fourier.h:94
double * stab
Definition: fourier.h:211
int index_pk_cluster
Definition: fourier.h:83
int index_pk_m
Definition: fourier.h:76
double * ln_tau
Definition: fourier.h:101
Definition: fourier.h:33
Definition: fourier.h:204
Definition: perturbations.h:98
linear_or_logarithmic
Definition: primordial.h:21
Definition: primordial.h:79
Definition: thermodynamics.h:59