Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
ccl_sample_neutrinos.c
Go to the documentation of this file.
1 #include <stdio.h>
2 #include <math.h>
3 #include <ccl.h>
4 #include <ccl_params.h>
5 
6 int main(int argc, char * argv[])
7 {
8  int status=0;
9  double Omega_c = 0.25;
10  double Omega_b = 0.05;
11  double h = 0.7;
12  double A_s = 2.1e-9;
13  double n_s = 0.96;
14  double Omega_k = 0.;
15  double Neff = 2.046;
16  double Nmass = 1.;
17  double mnu = 0.04;
18  double k, p, Omnu;
19 
20  // Initialize the default configuration and set the transfer function method to use CLASS.
23 
24  // Set parameters and initialize cosmology
25  ccl_parameters params = ccl_parameters_create_lcdm_nu(Omega_c, Omega_b, Omega_k,h, A_s, n_s, Neff, &mnu, ccl_mnu_sum, &status);
26  ccl_cosmology * cosmo = ccl_cosmology_create(params, config);
27 
28  // Get Omega_nu(z) for massive neutrinos at a variety of redshifts ( / scale factor values).
29  for (double z = 0.; z<=4.; z = z+0.2){
30  Omnu = ccl_omega_x(cosmo, 1./ (1. + z), ccl_species_nu_label, &status);
31  printf("z=%.16le, Omnu(z)=%.16le \n",z,Omnu);
32 
33  }
34 
35  // Get the power spectrum at a number of k values and output
36  for (double kpow = -4 ; kpow <=2; kpow = kpow+ 0.02){
37  k = pow(10, kpow);
38  // Get the nonlinear matter power spectrum today.
39  p = ccl_nonlin_matter_power(cosmo, k, 1.0, &status);
40  printf("k=%.16le, P(k)=%.16le \n",k,p);
41  }
42 
43  printf("Completed. Status = %d\n",status);
44 
45  return 0;
46 
47 }
double ccl_omega_x(ccl_cosmology *cosmo, double a, ccl_species_x_label label, int *status)
double ccl_nonlin_matter_power(ccl_cosmology *cosmo, double k, double a, int *status)
Definition: ccl_power.c:1562
int main(int argc, char *argv[])
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
dictionary params
Definition: halomod_bm.py:27
static double z[8]
static int p
Definition: ccl_emu17.c:25
const ccl_configuration default_config
Definition: ccl_core.c:21
float pow(float base, unsigned long int exp)
Definition: precision.hpp:39