GLAMERDOC++
Gravitational Lensing Code Library
Loading...
Searching...
No Matches
COSMOLOGY Class Reference

The cosmology and all the functions required to calculated quantities based on the cosmology. More...

#include <cosmo.h>

Public Member Functions

 COSMOLOGY (CosmoParamSet cosmo_p=CosmoParamSet::WMAP5yr)
 
 COSMOLOGY (double omegam, double omegal, double h, double w=-1, double wa=0, bool justdistances=false)
 if justdistances== true
 
 COSMOLOGY (const COSMOLOGY &cosmo)
 
COSMOLOGYoperator= (const COSMOLOGY &cosmo)
 
CosmoParamSet ParamSet ()
 
void ParamSet (std::string &s)
 
void PrintCosmology (short physical=0) const
 Print cosmological parameters.
 
std::string print (short physical=0) const
 Print cosmological parameters.
 
double rcurve () const
 Curvature radius in Mpc.
 
double coorDist (double zo, double z) const
 The coordinate distance in units Mpc. This is the radial distance found by integrating 1/H(z). This is NOT the comoving angular size distance if the universe is not flat.
 
double coorDist (double z) const
 
double radDist (double zo, double z) const
 Non-comoving radial distance in units Mpc also known as the lookback time. This is coorDist only integrated with the scale factor a=1/(1+z).
 
double radDist (double z) const
 
double angDist (double zo, double z) const
 The angular size distance in units Mpc.
 
double angDist (double z) const
 
double lumDist (double zo, double z) const
 The bolometric luminosity distance in units Mpc.
 
double lumDist (double z) const
 
double d_coorDist_dOmo (double zo, double z) const
 derivative of coordinate distance with respect to Omo in flat cosmology. Useful for Fisher matrix calculations
 
double d_coorDist_dw (double zo, double z) const
 derivative of coordinate distance with respect to w. Useful for Fisher matrix calculations
 
double d_coorDist_dw1 (double zo, double z) const
 derivative of coordinate distance with respect to w1. Useful for Fisher matrix calculations
 
double DRradius (double zo, double z, double pfrac)
 Comoving Dyer-Roeder angular size distance for lambda=0.
 
double DRradius2 (double zo, double z)
 Comoving Dyer-Roeder angular size distance for lambda=0 and pfrac = 1 (all matter in particles)
 
double invCoorDist (double d) const
 The inverse of the coordinate distance in units Mpc, returning redshift. It works within interpolation range.
 
double invRadDist (double d) const
 The inverse of the coordinate distance in units Mpc, works within interpolation range.
 
double invComovingDist (double d) const
 The inverse of the angular size distance in units Mpc, works within interpolation range.
 
double scalefactor (double rad) const
 The scale factor, a = 1/(1+z), as a function of radius in Mpc.
 
double Omegam (double z) const
 Matter density parameter at redshift z.
 
double rho_crit_comoving (double z) const
 comoving critical density in M_sun/Mpc^3
 
double drdz (double x) const
 
double drdz_dark (double x) const
 
double dark_factor (double x) const
 
double delta_c () const
 the critical over density
 
double DeltaVir (double z, int caseunit=0) const
 Virial overdensity.
 
double Deltao (double m) const
 
double time (double z) const
 Return the time from the Big Bang in Gyr at a given redshift z.
 
double nonlinMass (double z) const
 
double power_normalize (double sigma8)
 Set the linear normalization for the power spectrum.
 
double power_linear (double k, double z)
 Linear power spectrum P(k,z)/a^2.
 
double Dgrowth (double z) const
 Linear growth factor normalized to 1 at z=0.
 
double powerCDMz (double k, double z)
 powerCDM.c calculates the nonlinear P(k,z)/a(r)^2
 
double psdfdm (double z, double m, int caseunit=0)
 Press-Schechter halo mass function - default $ \frac{1}{\overline{\rho}_{comoving}}\frac{dN}{d\ln M} $ i.e. fraction of mass or if caseunit==1 the $ \frac{dN}{dlogM} $.
 
double halo_bias (double m, double z, int t=0)
 Halo bias, uses formalism by Mo-White.
 
double stdfdm (double z, double m, int caseunit=0)
 Sheth-Tormen mass function.
 
double powerlawdfdm (double z, double m, double alpha, int caseunit=0)
 Power-law mass function.
 
double haloNumberDensity (double m, double z, double a, int t, double alpha=0.0)
 The cumulative comoving number density of haloes with mass larger than m (in solar masses) at redshift z; if the dummy argument a is given, the mass function times m^a is integrated. If a is omitted, a default of zero is assumed. The dummy argument type specifies which type of mass function is to be used, 0 PS, 1 ST or 2 power-law (in this case also the slope alpha can be set as an additional parameter)
 
double CorrelationFunction (double radius, double redshift, double k_max=100, double k_min=1.0e-3)
 Dark matter correlation function.
 
double haloNumberDensityOnSky (double m, double z1, double z2, int t, double alpha=0.0)
 Number of halos with mass larger than m (in solar masses) between redshifts z1 and z2 per square degree.
 
double haloNumberInBufferedCone (double mass, double z1, double z2, double fov, double buffer, int type, double alpha=0.0)
 The number of halos in a buffered cone between redshift z1 and z2.
 
double haloMassInBufferedCone (double mass, double z1, double z2, double fov, double buffer, int type, double alpha=0.0)
 Total mass contained in halos in a buffered cone between redshift z1 and z2.
 
double TopHatVariance (double m) const
 Mass variance $ S(m)=\sigma^2(m) $. This uses a fitting formula for the CDM model which might not be perfectly accurate. See TopHatVarianceR() for an alternative.
 
double TopHatVarianceR (double R, double z)
 Variance within a spherical top-hat filter of size R (Mpc), $ S(R)=\sigma^2(R) $, at redshift z.
 
double TopHatVarianceM (double M, double z)
 Variance within a spherical top-hat filter at mass scale M at redshift z.
 
double getTimefromDeltaC (double dc)
 Return the time from the Big Bang in Gyr given $ \delta_c/D_+ $.
 
double getZfromDeltaC (double dc)
 Return the redshift given $ \delta_c/D_+ $.
 
void sethubble (double ht)
 accesser functions:
 
double gethubble () const
 
double getHubble () const
 Hubble parameter in 1/Mpc units.
 
void setindex (double nn)
 Primordial spectral index, renormalizes P(k) to keep sig8 fixed.
 
double getindex () const
 
void setOmega_matter (double Omega_matter, bool FLAT=false)
 Omega matter, renormalizes P(k) to keep sig8 fixed.
 
double getOmega_matter () const
 
void setOmega_lambda (double Omega_lambda, bool FLAT=false)
 Omega lambda, renormalizes P(k) to keep sig8 fixed.
 
double getOmega_lambda () const
 
void setOmega_baryon (double Omega_baryon)
 Omega baryon, renormalizes P(k) to keep sig8 fixed.
 
double getOmega_baryon () const
 
void setOmega_neutrino (double Omega_neutrino)
 Omega neutrino, renormalizes P(k) to keep sig8 fixed.
 
double getOmega_neutrino () const
 
void setNneutrino (double Nneutrino)
 Number of neutrino species, renormalizes P(k) to keep sig8 fixed.
 
double getNneutrino () const
 
void setW (double w)
 Dark energy equation of state parameter p/rho = w + w_1 (1+z)
 
double getW () const
 
void setW1 (double w)
 
double getW1 () const
 
void setdndlnk (double w)
 Running of primordial spectral index, P(k)_primordial \propto pow(k/h,n+dndlnk*log(k)), renormalizes P(k) to keep sig8 fixed.
 
double getdndlnk () const
 
void setgamma (double gamm)
 Alternative to w for dark energy/ alt. grav. structure evolution.
 
double getgamma () const
 
void setDEtype (short tt)
 
short getDEtype () const
 
void setSigma8 (double my_sig8)
 
double getSigma8 () const
 
void dzdangDist (double D, double z[], double dzdD[])
 
double totalMassDensityinHalos (int t, double alpha, double m_min, double z, double z1, double z2)
 The halo total surface mass density in haloes with mass larger than m_min (solar masses) in the redshift bin [z1,z2] and projected to redhisft z in solar mass / proper Mpc^2.
 
void setInterpolation (double z_interp, std::size_t n_interp)
 set interpolation range and number of points
 
double SigmaCrit (double zlens, double zsource) const
 The lensing critical density in Msun / Mpc^2.
 

Protected Types

typedef double(COSMOLOGY::*) pt2MemFunc(double) const
 
typedef double(COSMOLOGY::*) pt2MemFuncNonConst(double)
 

Protected Member Functions

void SetConcordenceCosmology (CosmoParamSet cosmo_p)
 Sets cosmology to WMAP 2009 model. This is done automatically in the constructor.
 
double ddrdzdOmo (double x) const
 
double ddrdzdw (double x) const
 
double ddrdzdw1 (double x) const
 
double powerEH (double k, double z)
 The power spectrum from Eisinstein & Hu with neutrinos but no BAO.
 
double powerEHv2 (double k)
 This is the power spectrum from Eisinstein & Hu with BAO but no neutrinos

 
double powerloc (double k, double z)
 The linear power spectrum without growth factor growth factor should be normalized to 1 at z=0.
 
double npow (double k)
 Logorithmic slope of the power spectrum.
 
double normL (double lgk)
 
double gradius (double R, double rd) const
 Incorporates curvature for angular size distance.
 
double DpropDz (double z)
 
double dsigdM (double m)
 Derivative of $ \sigma(m) $ in CDM model.
 
double timeEarly (double a) const
 
double dNdz (double z)
 
double nintegrateDcos (pt2MemFunc func, double a, double b, double tols) const
 
double trapzdDcoslocal (pt2MemFunc func, double a, double b, int n, double *s2) const
 
void polintD (double xa[], double ya[], int n, double x, double *y, double *dy) const
 
double nintegrateDcos (pt2MemFuncNonConst func, double a, double b, double tols)
 
double trapzdDcoslocal (pt2MemFuncNonConst func, double a, double b, int n, double *s2)
 
double dfridrDcos (pt2MemFunc func, double x, double h, double *err)
 
double f4 (double u) const
 
short TFmdm_set_cosm_change_z (double redshift)
 
short TFmdm_set_cosm ()
 
double TFmdm_onek_mpc (double kk)
 
double TFmdm_onek_hmpc (double kk)
 
void setinternals ()
 
void TFset_parameters (double omega0hh, double f_baryon, double Tcmb)
 
double TFfit_onek (double k, double *tf_baryon, double *tf_cdm)
 
void calc_interp_dist ()
 
double interp (const std::vector< double > &table, double z) const
 
double invert (const std::vector< double > &table, double f_z) const
 

Protected Attributes

CosmoParamSet cosmo_set
 
bool init_structure_functions
 
double h
 Hubble paremters in units of 100 km/s/Mpc.
 
double n
 Primordial spectral index.
 
double Omo
 Omega matter, dark matter + baryons.
 
double Oml
 Omega lambda.
 
double Omb
 Omega baryon.
 
double Omnu
 Omega neutrino.
 
double Nnu
 Number of neutrino species.
 
double ww
 Dark energy equation of state parameter p/rho = ww + ww_1 (1+z)
 
double ww1
 Dark energy equation of state parameter p/rho = ww + ww_1 (1+z)
 
double dndlnk
 Running of primordial spectral index, P(k)_primordial \propto pow(k/h,n+dndlnk*log(k))
 
double gamma
 Alternative to w for dark energy/ alt. grav. structure evolution.
 
short darkenergy
 
double A
 
double sig8
 
double Rtophat
 
double ztmp
 
int nbin
 
std::vector< double > vDeltaCz
 
std::vector< double > vlz
 
std::vector< double > vt
 
int ni
 
std::vector< float > xf
 
std::vector< float > wf
 
double f_baryon
 
double f_bnu
 
double f_cb
 
double f_cdm
 
double f_hdm
 
double alpha_gamma
 
double alpha_nu
 
double beta_c
 
double num_degen_hdm
 
double growth_k0
 
double growth_to_z0
 
double k_equality
 
double obhh
 
double omega_curv
 
double omega_lambda_z
 
double omega_matter_z
 
double omhh
 
double onhh
 
double p_c
 
double p_cb
 
double sound_horizon_fit
 
double theta_cmb
 
double y_drag
 
double z_drag
 
double z_equality
 
double R_drag
 
double R_equality
 
double sound_horizon
 
double k_silk
 
double alpha_c
 
double alpha_b
 
double beta_b
 
double beta_node
 
double k_peak
 
int tmp_type
 
double tmp_alpha
 
double tmp_mass
 
double tmp_a
 
double z_interp
 
std::size_t n_interp
 
std::vector< double > redshift_interp
 
std::vector< double > coorDist_interp
 
std::vector< double > radDist_interp
 

Detailed Description

The cosmology and all the functions required to calculated quantities based on the cosmology.

This class is used to store the cosmological parameters, calculate cosmological distances, calculate the power spectrum of density fluctuations and the mass function of halos.

As set now, there are no baryon acoustic oscillations in the power spectrum, but this can be changed at the expense of not including neutrinos.

Constructor & Destructor Documentation

◆ COSMOLOGY()

COSMOLOGY::COSMOLOGY ( double omegam,
double omegal,
double h,
double w = -1,
double wa = 0,
bool justdistances = false )

if justdistances== true

Parameters
justdistancesif true the internals needed calculate structure formation will not be calculated making constructuion faster

Member Function Documentation

◆ angDist()

double COSMOLOGY::angDist ( double zo,
double z ) const

The angular size distance in units Mpc.

Converts angles to proper distance NOT comoving distance.

curviture scale

◆ CorrelationFunction()

double COSMOLOGY::CorrelationFunction ( double radius,
double redshift,
double k_max = 100,
double k_min = 1.0e-3 )

Dark matter correlation function.

This integrates powerCDMz() to get the correlation function as a function of comoving radius. Care should be taken that the right range of k is integrated over if the radius is very small or large.

◆ DeltaVir()

double COSMOLOGY::DeltaVir ( double z,
int caseunit = 0 ) const

Virial overdensity.

Parameters
zredshift
caseunitby default uses the Brayan and Norman fit, if equal to 1 uses the fit by Felix Stšhr

◆ gradius()

double COSMOLOGY::gradius ( double R,
double rd ) const
protected

Incorporates curvature for angular size distance.

Parameters
Rthe curvature radius
rdthe coordinate

◆ halo_bias()

double COSMOLOGY::halo_bias ( double m,
double z,
int type = 0 )

Halo bias, uses formalism by Mo-White.

by default it gives the halo bias by Mo-White type=1 returns the Sheth-Tormen 99 while setting type=2 the Sheth-Mo-Tormen 2001 bias

Parameters
mhalo mass in solar masses
zredshift
type(0) Mo & White bias (1) Sheth-Tormen 99 (2) Sheth-Mo-Tormen 2001

◆ haloMassInBufferedCone()

double COSMOLOGY::haloMassInBufferedCone ( double mass,
double z1,
double z2,
double fov,
double buffer,
int type,
double alpha = 0.0 )

Total mass contained in halos in a buffered cone between redshift z1 and z2.

A buffered cone is a cone with an extra perpendicular fixed physical distance added (area(z) = pi*(\theta D + buffer*(1+z))^2). This geometry is useful for reducing edge effects which can be particularly bad a low redshift for small cones.

Parameters
massminimum mass
z1lower redshift limit
z2higher redshift limit
fovfield of view of cone in steradians
bufferbuffer length in physical Mpc (not comoving)
typeThe flag type specifies which type of mass function is to be used, 0 PS or 1 ST
alphaslope of power law mass function if type==2

◆ haloNumberDensity()

double COSMOLOGY::haloNumberDensity ( double m,
double z,
double a,
int type,
double alpha = 0.0 )

The cumulative comoving number density of haloes with mass larger than m (in solar masses) at redshift z; if the dummy argument a is given, the mass function times m^a is integrated. If a is omitted, a default of zero is assumed. The dummy argument type specifies which type of mass function is to be used, 0 PS, 1 ST or 2 power-law (in this case also the slope alpha can be set as an additional parameter)

Parameters
mminimum mass of halos in Msun
zredshift
amoment of mass function that is wanted
typemass function type: 0 Press-Schecter, 1 Sheth-Torman, 2 power-law
alphaexponent of power law if type==2

◆ haloNumberDensityOnSky()

double COSMOLOGY::haloNumberDensityOnSky ( double mass,
double z1,
double z2,
int type,
double alpha = 0.0 )

Number of halos with mass larger than m (in solar masses) between redshifts z1 and z2 per square degree.

Parameters
massminimum mass
z1lower redshift limit
z2higher redshift limit
typeThe flag type specifies which type of mass function is to be used, 0 PS or 1 ST
alphaslope of power law mass function if type==2

◆ haloNumberInBufferedCone()

double COSMOLOGY::haloNumberInBufferedCone ( double mass,
double z1,
double z2,
double fov,
double buffer,
int type,
double alpha = 0.0 )

The number of halos in a buffered cone between redshift z1 and z2.

A buffered cone is a cone with an extra perpendicular fixed physical distance added (area(z) = pi*(\theta D + buffer*(1+z))^2). This geometry is useful for reducing edge effects which can be particularly bad a low redshift for small cones.

Parameters
massminimum mass in Msun
z1lower redshift limit
z2higher redshift limit
fovfield of view of cone in steradians
bufferbuffer length in physical Mpc (not comoving)
typeThe flag type specifies which type of mass function is to be used, 0 PS or 1 ST
alphaslope of power law mass function if type==2

◆ invRadDist()

double COSMOLOGY::invRadDist ( double d) const

The inverse of the coordinate distance in units Mpc, works within interpolation range.

The inverse of the radial distance in units Mpc, returning redshift. It works within interpolation range.

◆ power_normalize()

double COSMOLOGY::power_normalize ( double sigma8)

Set the linear normalization for the power spectrum.

This function keeps the internal normalization parameters in sync. The normalization should not be changed in any other way.

◆ powerCDMz()

double COSMOLOGY::powerCDMz ( double k,
double z )

powerCDM.c calculates the nonlinear P(k,z)/a(r)^2

The method of Peacock & Dodds 1996 is used to convert the linear power spectrum into the nonlinear one. This could be updated to a more recent nonlinear power spectrum

Parameters
kscale in the Fourier space
zredshift

◆ powerlawdfdm()

double COSMOLOGY::powerlawdfdm ( double z,
double m,
double alpha,
int caseunit = 0 )

Power-law mass function.

Parameters
zredshift
mmass
alphaslope (almost 1/6 for LCDM and cluster-size haloes)
caseunitif equal to 1 return the number density per unit mass

◆ psdfdm()

double COSMOLOGY::psdfdm ( double z,
double m,
int caseunit = 0 )

Press-Schechter halo mass function - default $ \frac{1}{\overline{\rho}_{comoving}}\frac{dN}{d\ln M} $ i.e. fraction of mass or if caseunit==1 the $ \frac{dN}{dlogM} $.

Parameters
zredshift
mmass
caseunitif equal to 1 return the comoving number density per unit mass

◆ rcurve()

double COSMOLOGY::rcurve ( ) const

Curvature radius in Mpc.

curvature scale

◆ sethubble()

void COSMOLOGY::sethubble ( double ht)
inline

accesser functions:

Hubble paremters in units of 100 km/s/Mpc, renormalizes P(k) to keep sig8 fixed

◆ stdfdm()

double COSMOLOGY::stdfdm ( double z,
double m,
int caseunit = 0 )

Sheth-Tormen mass function.

Parameters
zredshift
mmass
caseunitif equal to 1 return the number density per unit mass TODO: Carlo, why aren't the other options explained?

◆ TopHatVarianceM()

double COSMOLOGY::TopHatVarianceM ( double M,
double z )

Variance within a spherical top-hat filter at mass scale M at redshift z.

The variance is found through directly integrating linear power spectrum.

◆ TopHatVarianceR()

double COSMOLOGY::TopHatVarianceR ( double R,
double z )

Variance within a spherical top-hat filter of size R (Mpc), $ S(R)=\sigma^2(R) $, at redshift z.

The variance is found through directly integrating linear power spectrum.

◆ totalMassDensityinHalos()

double COSMOLOGY::totalMassDensityinHalos ( int type,
double alpha,
double m_min,
double z,
double z1,
double z2 )

The halo total surface mass density in haloes with mass larger than m_min (solar masses) in the redshift bin [z1,z2] and projected to redhisft z in solar mass / proper Mpc^2.

Parameters
typechoice of mass function, 0 Press-Shechter, 1 Sheth-Tormen, 2 Power-law
alphaslope of power law mass function if type==2
m_minminimum halo mass in Msun

The documentation for this class was generated from the following files: