Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
bcm_bm.c
Go to the documentation of this file.
1 
8 ...
9 
10 
11  //This would be appended after line 169 of nonlinear.c in the version above.
12  //add the baryonic effects on top
13  if (pnl->method == nl_baryon) {
14  if (pnl->nonlinear_verbose > 0)
15  printf("Adding baryonic effects (eq 4.2 of 1510.06034) \n");
16 
19  for (index_tau = pnl->tau_size-1; index_tau>=0; index_tau--) {
20 
21  /* get P_L(k) at this time */
22  class_call(nonlinear_pk_l(ppt,ppm,pnl,index_tau,pk_l),
23  pnl->error_message,
24  pnl->error_message);
25 
26  class_alloc(pvecback,pba->bg_size*sizeof(double),pnl->error_message);
27 
28  class_call(background_at_tau(pba,pnl->tau[index_tau],pba->long_info,pba->inter_normal,&last_index,pvecback),
29  pba->error_message,
30  pnl->error_message);
31 
32  /* correct the spectrum */
33  for (index_k=0; index_k<pnl->k_size; index_k++) {
34 
35  /*Section 4.6 of 1510.06034
36  * NOTE: factors of h!
37  */
38  B = 0.105*log10(pnl->baryon_M_c) - 1.27;
39  B /= (1.+pow((1./pvecback[pba->index_bg_a]-1.)/2.3, 2.5));
40 
41  k_g = pba->h*0.7*pow(1.-B, 4)*pow(pnl->baryon_eta_b,-1.6);
42 
43  G = 1. + B*(1./(1. + pow(pnl->k[index_k]/k_g,3)) -1.);
44 
45  //multiply by the stellar correction
46  G *= 1. + pow(pnl->k[index_k]/55./pba->h,2);
47 
48  // sqrt(pk_nl[index_k]/pk_l[index_k])
49  pnl->nl_corr_density[index_tau * pnl->k_size + index_k] *= sqrt(G);
50  }
51  }
52 
53  }
54 
55 ...
Grid< NDIM, T > sqrt(Grid< NDIM, T > lhs)
Definition: grid.h:231
float pow(float base, unsigned long int exp)
Definition: precision.hpp:39