Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
ccl_halomod.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define HM_MMIN   1e7
 
#define HM_MMAX   1e17
 
#define HM_EPSABS   0
 
#define HM_EPSREL   1E-4
 
#define HM_LIMIT   1000
 
#define HM_INT_METHOD   GSL_INTEG_GAUSS41
 

Typedefs

typedef CCL_BEGIN_DECLS enum ccl_win_label ccl_win_label
 

Enumerations

enum  ccl_win_label { ccl_nfw = 1 }
 

Functions

double ccl_twohalo_matter_power (ccl_cosmology *cosmo, double k, double a, int *status)
 
double ccl_onehalo_matter_power (ccl_cosmology *cosmo, double k, double a, int *status)
 
double ccl_halomodel_matter_power (ccl_cosmology *cosmo, double k, double a, int *status)
 
double ccl_halo_concentration (ccl_cosmology *cosmo, double halomass, double a, double odelta, int *status)
 

Macro Definition Documentation

#define HM_EPSABS   0

Definition at line 8 of file ccl_halomod.h.

Referenced by one_halo_integral(), and two_halo_integral().

#define HM_EPSREL   1E-4

Definition at line 9 of file ccl_halomod.h.

Referenced by one_halo_integral(), and two_halo_integral().

#define HM_INT_METHOD   GSL_INTEG_GAUSS41

Definition at line 11 of file ccl_halomod.h.

Referenced by one_halo_integral(), and two_halo_integral().

#define HM_LIMIT   1000

Definition at line 10 of file ccl_halomod.h.

Referenced by one_halo_integral(), and two_halo_integral().

#define HM_MMAX   1e17

Definition at line 7 of file ccl_halomod.h.

Referenced by one_halo_integral(), and two_halo_integral().

#define HM_MMIN   1e7

Definition at line 6 of file ccl_halomod.h.

Referenced by ccl_twohalo_matter_power(), one_halo_integral(), and two_halo_integral().

Typedef Documentation

Enumeration Type Documentation

Enumerator
ccl_nfw 

Definition at line 16 of file ccl_halomod.h.

16  {
17  ccl_nfw = 1,
18  } ccl_win_label;
ccl_win_label
Definition: ccl_halomod.h:16

Function Documentation

double ccl_halo_concentration ( ccl_cosmology cosmo,
double  halomass,
double  a,
double  odelta,
int *  status 
)

Computes the concentration of a halo of mass M. This is the ratio of virial raidus to scale radius for an NFW halo.

Parameters
cosmocosmology object containing parameters
halomasshalo mass in units of Msun
ascale factor normalised to a=1 today
odeltaoverdensity criteria (with respect to matter density) used for halo mass
statusStatus flag: 0 if there are no errors, non-zero otherwise
Returns
halo_concentration: the halo concentration

Definition at line 52 of file ccl_halomod.c.

References ccl_bhattacharya2011, ccl_constant_concentration, ccl_cosmology_set_status_message(), ccl_duffy2008, CCL_ERROR_CONC_DV, CCL_ERROR_HALOCONC, ccl_growth_factor(), ccl_raise_exception(), ccl_sigmaM(), ccl_cosmology::config, Dv_BryanNorman(), ccl_parameters::h, ccl_configuration::halo_concentration_method, ccl_cosmology::params, and pow().

Referenced by window_function().

52  {
53 
54  double gz, g0, nu, delta_c, a_form;
55  double Mpiv, A, B, C;
56 
57  switch(cosmo->config.halo_concentration_method){
58 
59  // Bhattacharya et al. (2011; 1005.2239; Delta = 200rho_m; Table 2)
61 
62  if (odelta != 200.) {
63  *status = CCL_ERROR_CONC_DV;
64  ccl_cosmology_set_status_message(cosmo, "ccl_halomod.c: halo_concentration(): Bhattacharya (2011) concentration relation only valid for Delta_v = 200 \n");
65  return NAN;
66  }
67 
68  gz = ccl_growth_factor(cosmo,a,status);
69  g0 = ccl_growth_factor(cosmo,1.0,status);
70  delta_c = 1.686;
71  nu = delta_c/ccl_sigmaM(cosmo, halomass, a, status);
72  return 9.*pow(nu,-0.29)*pow(gz/g0,1.15);
73 
74  // Duffy et al. (2008; 0804.2486; Table 1)
75  case ccl_duffy2008:
76 
77  Mpiv = 2e12/cosmo->params.h; // Pivot mass in Msun (note in the paper units are Msun/h)
78 
79  if (odelta == Dv_BryanNorman(cosmo, a, status)) {
80 
81  // Duffy et al. (2008) for virial density haloes (second section in Table 1)
82  A = 7.85;
83  B = -0.081;
84  C = -0.71;
85  return A*pow(halomass/Mpiv,B)*pow(a,-C);
86 
87  } else if (odelta == 200.) {
88 
89  // Duffy et al. (2008) for x200 mean-matter-density haloes (third section in Table 1)
90  A = 10.14;
91  B = -0.081;
92  C = -1.01;
93  return A*pow(halomass/Mpiv,B)*pow(a,-C);
94 
95  } else {
96 
97  *status = CCL_ERROR_CONC_DV;
98  ccl_cosmology_set_status_message(cosmo, "ccl_halomod.c: halo_concentration(): Duffy (2008) virial concentration only valid for virial Delta_v or 200\n");
99  return NAN;
100 
101  }
102 
103  // Constant concentration (good for tests)
105 
106  return 4.;
107 
108  // Something went wrong
109  default:
110 
111  *status = CCL_ERROR_HALOCONC;
112  ccl_raise_exception(*status, "ccl_halomod.c: concentration-mass relation specified incorrectly");
113  return NAN;
114 
115  }
116 }
#define CCL_ERROR_HALOCONC
Definition: ccl_error.h:29
halo_concentration_t halo_concentration_method
Definition: ccl_config.h:115
ccl_parameters params
Definition: ccl_core.h:124
double ccl_growth_factor(ccl_cosmology *cosmo, double a, int *status)
double h
Definition: ccl_core.h:33
double ccl_sigmaM(ccl_cosmology *cosmo, double smooth_mass, double a, int *status)
Definition: ccl_massfunc.c:624
void ccl_cosmology_set_status_message(ccl_cosmology *cosmo, const char *status_message,...)
Definition: ccl_core.c:792
#define CCL_ERROR_CONC_DV
Definition: ccl_error.h:32
float pow(float base, unsigned long int exp)
Definition: precision.hpp:39
ccl_configuration config
Definition: ccl_core.h:125
double Dv_BryanNorman(ccl_cosmology *cosmo, double a, int *status)
Definition: ccl_massfunc.c:37
void ccl_raise_exception(int err, const char *msg,...)
Definition: ccl_error.c:35
double ccl_halomodel_matter_power ( ccl_cosmology cosmo,
double  k,
double  a,
int *  status 
)

Computes the halo model density-density power spectrum as the sum of two- and one-halo terms.

Parameters
cosmocosmology object containing parameters
kwavenumber in units of Mpc^{-1}
ascale factor normalised to a=1 today
statusStatus flag: 0 if there are no errors, non-zero otherwise
Returns
halomodel_matter_power: halo-model power spectrum, P(k), units of Mpc^{3}

Definition at line 314 of file ccl_halomod.c.

References ccl_onehalo_matter_power(), and ccl_twohalo_matter_power().

Referenced by compare_halomod().

314  {
315 
316  // Standard sum of two- and one-halo terms
317  return ccl_twohalo_matter_power(cosmo, k, a, status)+ccl_onehalo_matter_power(cosmo, k, a, status);
318 
319 }
double ccl_onehalo_matter_power(ccl_cosmology *cosmo, double k, double a, int *status)
Definition: ccl_halomod.c:304
double ccl_twohalo_matter_power(ccl_cosmology *cosmo, double k, double a, int *status)
Definition: ccl_halomod.c:277
double ccl_onehalo_matter_power ( ccl_cosmology cosmo,
double  k,
double  a,
int *  status 
)

Computes the halo model density-density power spectrum one-halo term.

Parameters
cosmocosmology object containing parameters
kwavenumber in units of Mpc^{-1}
ascale factor normalised to a=1 today
statusStatus flag: 0 if there are no errors, non-zero otherwise
Returns
1halo_matter_power: halo-model one-halo matter power spectrum, P(k), units of Mpc^{3}

Definition at line 304 of file ccl_halomod.c.

References one_halo_integral().

Referenced by ccl_halomodel_matter_power().

304  {
305 
306  return one_halo_integral(cosmo, k, a, status);
307 
308 }
static double one_halo_integral(ccl_cosmology *cosmo, double k, double a, int *status)
Definition: ccl_halomod.c:174
double ccl_twohalo_matter_power ( ccl_cosmology cosmo,
double  k,
double  a,
int *  status 
)

Computes the halo model density-density power spectrum two-halo term.

Parameters
cosmocosmology object containing parameters
kwavenumber in units of Mpc^{-1}
ascale factor normalised to a=1 today
statusStatus flag: 0 if there are no errors, non-zero otherwise
Returns
2halo_matter_power: halo-model two-halo matter power spectrum, P(k), units of Mpc^{3}

Definition at line 277 of file ccl_halomod.c.

References ccl_linear_matter_power(), ccl_nfw, Dv_BryanNorman(), HM_MMIN, two_halo_integral(), and window_function().

Referenced by ccl_halomodel_matter_power().

277  {
278 
279  // Get the integral
280  double I2h = two_halo_integral(cosmo, k, a, status);
281 
282  // The addative correction is the missing part of the integral below the lower-mass limit
283  double A = 1.-two_halo_integral(cosmo, 0., a, status);
284 
285  // Virial overdensity for haloes
286  double odelta = Dv_BryanNorman(cosmo, a, status);
287 
288  // ...multiplied by the ratio of window functions
289  double W1 = window_function(cosmo, HM_MMIN, k, a, odelta, ccl_nfw, status);
290  double W2 = window_function(cosmo, HM_MMIN, 0., a, odelta, ccl_nfw, status);
291  A = A*W1/W2;
292 
293  // Add the additive correction to the calculated integral
294  I2h = I2h+A;
295 
296  return ccl_linear_matter_power(cosmo, k, a, status)*I2h*I2h;
297 
298 }
#define HM_MMIN
Definition: ccl_halomod.h:6
static double two_halo_integral(ccl_cosmology *cosmo, double k, double a, int *status)
Definition: ccl_halomod.c:237
double ccl_linear_matter_power(ccl_cosmology *cosmo, double k, double a, int *status)
Definition: ccl_power.c:1506
static double window_function(ccl_cosmology *cosmo, double m, double k, double a, double odelta, ccl_win_label label, int *status)
Definition: ccl_halomod.c:119
double Dv_BryanNorman(ccl_cosmology *cosmo, double a, int *status)
Definition: ccl_massfunc.c:37