Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
ccl_3dcorr_sample.c
Go to the documentation of this file.
1 #include "ccl.h"
2 #include "ccl_correlation.h"
3 #include "ccl_utils.h"
4 #include "ctest.h"
5 #include <stdlib.h>
6 #include <stdio.h>
7 #include <math.h>
8 #include <time.h>
9 #include <string.h>
10 
11 // Define cosmological parameter values
12 #define OC 0.25
13 #define OB 0.05
14 #define OK 0.00
15 #define ON 0.00
16 #define HH 0.70
17 #define W0 -1.0
18 #define WA 0.00
19 #define NS 0.96
20 #define NORMPS 0.80
21 #define ZD 0.5
22 #define NZ 128
23 #define Z0_GC 0.50
24 #define SZ_GC 0.05
25 #define NL 512
26 #define PS 0.1
27 #define NEFF 3.046
28 #define K_MIN 0.001
29 #define K_MAX 100
30 #define N_MAX_PK 20000
31 
32 
33 int main(int argc,char **argv)
34 {
35  // Use the default configuration, plus the cosmological parameters that were
36  // defined above
37  int status=0;
40 
41  double mnuval = 0.;
42  double* mnu;
43  mnu = &mnuval;
45 
47  W0, WA, HH, NORMPS, NS,
48  14.079181246047625, 0.5, 55, 0, NULL, NULL, &status);
49  ccl_cosmology *cosmo = ccl_cosmology_create(params,config);
50 
51  // Define cosine tapering, to reduce ringing. The first two numbers are
52  // [kmin, kmax] for the low-k taper, and the last two are [kmin, kmax] for
53  // the high-k taper.
54  double taper_pk_limits[4] = {0.001, 0.002, 50, 75};
55 
56  double *xi, *r;
57  int n_r = 20;
58  r = ccl_log_spacing(0.1, 50., n_r); // New array with log spacing
59  xi = malloc(n_r*sizeof(double));
60 
61  // Calculate 3dcorrelation function from power spectrum
62  ccl_correlation_3d(cosmo, 1.0,
63  n_r, r, xi,
64  0, taper_pk_limits,
65  &status);
66 
67  // Print results
68  for(int it=0; it < n_r; it++)
69  printf("%le %le\n", r[it], xi[it]);
70 
71  // Free allocated memory
72  ccl_cosmology_free(cosmo);
73  free(xi);
74 
75  return 0;
76 }
matter_power_spectrum_t matter_power_spectrum_method
Definition: ccl_config.h:112
#define NORMPS
#define OB
#define OC
double * ccl_log_spacing(double xmin, double xmax, int N)
Definition: ccl_utils.c:102
#define HH
#define OK
int main(int argc, char **argv)
ccl_cosmology * ccl_cosmology_create(ccl_parameters params, ccl_configuration config)
Definition: ccl_core.c:173
#define W0
ccl_mnu_convention
Definition: ccl_core.h:142
void ccl_cosmology_free(ccl_cosmology *cosmo)
Definition: ccl_core.c:829
dictionary params
Definition: halomod_bm.py:27
const ccl_configuration default_config
Definition: ccl_core.c:21
#define NS
void ccl_correlation_3d(ccl_cosmology *cosmo, double a, int n_r, double *r, double *xi, int do_taper_pk, double *taper_pk_limits, int *status)
#define WA
ccl_parameters ccl_parameters_create(double Omega_c, double Omega_b, double Omega_k, double Neff, double *mnu, ccl_mnu_convention mnu_type, double w0, double wa, double h, double norm_pk, double n_s, double bcm_log10Mc, double bcm_etab, double bcm_ks, int nz_mgrowth, double *zarr_mgrowth, double *dfarr_mgrowth, int *status)
Definition: ccl_core.c:294
#define NEFF