Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
ccl_sample_baryons.c File Reference
#include <math.h>
#include <stdio.h>
#include <ccl.h>
#include <ccl_params.h>
Include dependency graph for ccl_sample_baryons.c:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 7 of file ccl_sample_baryons.c.

References ccl_configuration::baryons_power_spectrum_method, ccl_bcm, ccl_cosmology_create(), ccl_cosmology_free(), ccl_nonlin_matter_power(), ccl_splines, cl_cmbl_bm::cosmo, default_config, ccl_test_distances::h, K_MAX, ccl_spline_params::K_MIN, ccl_test_distances::n_s, ccl_test_distances::Omega_b, ccl_test_distances::Omega_c, p, and halomod_bm::params.

8 {
9  int status=0;
10  double Omega_c = 0.25;
11  double Omega_b = 0.05;
12  double h = 0.7;
13  double normp = 0.8; //2.1e-9
14  double n_s = 0.96;
15  double other_bcm_log10Mc = log10(1.7e14);
16  double other_bcm_etab = 0.3;
17  double other_bcm_ks = 75.;
18 
21  //The following two options are identical if the parameters being passed are the fiducial ones
22  //In this case, we are passing user-specified parameters
23  //ccl_parameters params = ccl_parameters_create_flat_lcdm(Omega_c, Omega_b, h, normp, n_s, &status);
24  ccl_parameters params = ccl_parameters_create_flat_lcdm_bar(Omega_c, Omega_b, h, normp, n_s,
25  other_bcm_log10Mc, other_bcm_etab,
26  other_bcm_ks, &status);
27  ccl_cosmology * cosmo = ccl_cosmology_create(params, config);
28 
29  double k,p,p1,p2,p3=0;
30  double a_at_z1=0.5;
31  double a_at_z2=1./3.;
32  double a_at_z3=0.25;
33  //The linear power spectrum is not changed when baryons are passed
34  /*printf("Linear matter PS\n");
35  printf("# k [1/Mpc],P(k,z=0),P(k,z=1),P(k,z=2),P(k,z=3)\n");
36  for (k = ccl_splines->K_MIN; k<ccl_splines->K_MAX; k*=1.05) {
37  p = ccl_linear_matter_power(cosmo, k,1.0, &status);
38  p1 = ccl_linear_matter_power(cosmo,k, a_at_z1,&status);
39  p2 = ccl_linear_matter_power(cosmo,k, a_at_z2,&status);
40  p3 = ccl_linear_matter_power(cosmo,k, a_at_z3,&status);
41  printf("%le %le %le %le %le\n", k, p,p1,p2,p3);
42  }*/
43  printf("# Total matter power spectrum\n");
44  printf("# k [1/Mpc],P(k,z=0),P(k,z=1),P(k,z=2),P(k,z=3)\n");
45  for (k = ccl_splines->K_MIN; k<ccl_splines->K_MAX; k*=1.05) {
46  p = ccl_nonlin_matter_power(cosmo, k,1.0,&status);
47  p1 = ccl_nonlin_matter_power(cosmo,k, a_at_z1,&status);
48  p2 = ccl_nonlin_matter_power(cosmo,k, a_at_z2,&status);
49  p3 = ccl_nonlin_matter_power(cosmo,k, a_at_z3,&status);
50  printf("%le %le %le %le %le\n", k, p,p1,p2,p3);
51  }
52 
53  printf("Completed. Status = %d\n",status);
54 
55  ccl_cosmology_free(cosmo);
56 
57  return 0;
58 }
double ccl_nonlin_matter_power(ccl_cosmology *cosmo, double k, double a, int *status)
Definition: ccl_power.c:1562
#define K_MAX
ccl_spline_params * ccl_splines
Definition: ccl_core.c:47
ccl_cosmology * ccl_cosmology_create(ccl_parameters params, ccl_configuration config)
Definition: ccl_core.c:173
void ccl_cosmology_free(ccl_cosmology *cosmo)
Definition: ccl_core.c:829
dictionary params
Definition: halomod_bm.py:27
baryons_power_spectrum_t baryons_power_spectrum_method
Definition: ccl_config.h:113
static int p
Definition: ccl_emu17.c:25
const ccl_configuration default_config
Definition: ccl_core.c:21