Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
ccl_sample_pkemu.c File Reference
#include <math.h>
#include <stdio.h>
#include <ccl.h>
#include <ccl_params.h>
Include dependency graph for ccl_sample_pkemu.c:
This graph shows which files directly or indirectly include this file:

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_pkemu.c.

References ccl_cosmology_create(), ccl_emu, ccl_emulator, ccl_linear_matter_power(), ccl_mnu_list, ccl_nonlin_matter_power(), cl_cmbl_bm::cosmo, default_config, ccl_test_distances::h, ccl_configuration::matter_power_spectrum_method, ccl_test_distances::mnu, ccl_test_distances::n_s, ccl_test_distances::Neff, ccl_test_distances::Omega_b, ccl_test_distances::Omega_c, p, halomod_bm::params, and ccl_configuration::transfer_function_method.

8 {
9  int status=0;
10  double Omega_c = 0.25;
11  double h = 0.7;
12  double Omega_b = 0.022/h/h;
13  double normp = 0.8; //2.1e-9
14  double n_s = 0.96;
15  double Omega_k = 0.;
16  /*If you want to call the emulator with
17  massive neutrinos, in order for the number
18  of relativistic species in the early Universe
19  to be 3.04, compatible with the emulator
20  set-up, we need:
21  */
22  double Neff = 3.04;
23  double mnu[3] = {0.02, 0.02, 0.02};
25  /*In the case of the emulator without massive
26  neutrinos, we simply set:
27  */
28  //double Neff = 3.04;
29  //double mnu[1] = {0};
30 
34 
35  ccl_parameters params = ccl_parameters_create_lcdm_nu(Omega_c, Omega_b, Omega_k,h, normp, n_s, Neff, mnu, mnutype, &status);
36  ccl_cosmology * cosmo = ccl_cosmology_create(params, config);
37 
38  //The linear power spectrum will be from CLASS
39  //The NL power spectrum comes from the emulator
40  printf("# k [1/Mpc],Plin(k,z=0),Plin(k,z=1),Plin(k,z=2),Pnl(k,z=0),Pnl(k,z=1),Pnl(k,z=2)\n");
41 
42  double k,p,p1,p2,pnl,p1nl,p2nl;//,p3=0;
43  double a_at_z1=0.5;
44  double a_at_z2=1./3.;
45  for (k = 1.e-3; k<5.; k*=1.05){
46  pnl = ccl_nonlin_matter_power(cosmo, k,1.0,&status);
47  p1nl = ccl_nonlin_matter_power(cosmo,k, a_at_z1,&status);
48  p2nl = ccl_nonlin_matter_power(cosmo,k, a_at_z2,&status);
49  p = ccl_linear_matter_power(cosmo, k,1.0, &status);
50  p1 = ccl_linear_matter_power(cosmo,k, a_at_z1,&status);
51  p2 = ccl_linear_matter_power(cosmo,k, a_at_z2,&status);
52  printf("%le %le %le %le %le %le %le\n", k, p,p1,p2,pnl,p1nl,p2nl);
53  }
54 
55  return 0;
56 }
matter_power_spectrum_t matter_power_spectrum_method
Definition: ccl_config.h:112
double ccl_nonlin_matter_power(ccl_cosmology *cosmo, double k, double a, int *status)
Definition: ccl_power.c:1562
transfer_function_t transfer_function_method
Definition: ccl_config.h:111
ccl_cosmology * ccl_cosmology_create(ccl_parameters params, ccl_configuration config)
Definition: ccl_core.c:173
ccl_mnu_convention
Definition: ccl_core.h:142
double ccl_linear_matter_power(ccl_cosmology *cosmo, double k, double a, int *status)
Definition: ccl_power.c:1506
dictionary params
Definition: halomod_bm.py:27
static int p
Definition: ccl_emu17.c:25
const ccl_configuration default_config
Definition: ccl_core.c:21