# 6.7. Cosmology (cosmo.h)¶

Contributions from the distribution of extragalactic haloes (as introduced in Section 6.1) require accounting for the cosmology. The module cosmo.h contains all cosmology-related functions, from the computation of the various cosmological distances to the evaluation of the halo mass function required by the intensity multiplier. A large fraction of the functions included in this module are a translation into \({\tt C}\) of Eiichiro Komatsu’s very useful Cosmology Routine Library in Fortran.

Note

In **CLUMPY**, the various options described in Section 7.3 allow to quickly check and plot various intermediate and final quantities presented below (cosmological distances, intensity multiplier, EBL absorption, or differential flux).

Note

The extragalactic calculation requires several imbricated integrals that would be very time consuming to compute if done naively (see Section 6.3). To optimise the nested integration, **CLUMPY** first tabulates the mass function and other cosmological quantities on a grid of masses and redshifts and then performs interpolations to obtain the results for any \((M,z)\) combination during integration. The range and resolution of the grid can be adjusted by the user in the main parameter file.

## 6.7.1. Cosmological distances¶

There are several ways to define distances in cosmology, whether one is interested in:

- the distance \(d_{\rm c}\) between two objects along the line of sight (comoving distance),
- the transverse distance \(d_{\rm trans}\) between two objects at the same redshift (transverse comoving distance),
- the physical size of an object given its observed angular size (angular diameter distance \(d_{\rm A}\)),
- the distance to link an observed flux to the intrinsic luminosity of a source (luminosity distance \(d_{\rm L}\)).

These well-known definitions depend on the cosmological parameters and redshift and are not repeated here, and we refer the interested user to Hogg (1999).

Note

**CLUMPY** initialises the computation of the extragalactic flux by tabulating the values of the various distance definitions on the redshift grid and the values of the mass function on the 2D \((M,z)\) grid. The resulting arrays are stored as global variables.

## 6.7.2. Intensity multiplier¶

For DM annihilations, the quantity \(\langle \delta^2(z) \rangle\) is computed according to the halo model approach (Ullio et al., 2002; Ando & Komatsu, 2003; Moliné et al., 2016). In this setup, the intensity multiplier from the inhomogeneous Universe is written as

\[\left\langle\delta^2(z)\right\rangle = \frac{1}{\overline{\varrho}^2_{\mathrm{m,0}}}\; \int {\rm d} M \frac{{\rm d} n}{{\rm d} M}(M,z)\times \mathcal{L}(M,z) \,,\]

where \(\overline{\varrho}_{\mathrm{m,\,0}}\) is today’s mean total matter density, \({{\rm d} n}/{\rm d} M\) the halo mass function, and \(\mathcal{L}(M,z)\) the one-halo luminosity discussed in Section 6.6.

Note

**CLUMPY** uses the previously tabulated values of \(\sigma(M,z)\), \(P_{\rm lin}(k,z=0)\), and \(D(z)\) to interpolate the mass function to the relevant mass and redshift and returns the corresponding intensity multiplier, but under the form \(d\delta^2/d\ln M\).

## 6.7.3. Halo mass function¶

The number density of extragalactic haloes \({{\rm d} n}/{{\rm d} M}\) in a given mass range at redshift \(z\) depends on the variance \(\sigma\) of the density fluctuations and on the multiplicity function \(f(\sigma,\,z)\) that encodes nonlinear structure formation,

(6.10)¶\[\frac{\mathrm{d}n}{\mathrm{d}M}(M,\,z) = f(\sigma,z)\; \frac{\overline{\varrho}_{\rm m,0}}{M}\, \frac{\mathrm{d}\ln \sigma^{-1}}{\mathrm{d}M}\,.\]

**CLUMPY** returns a vector of tabulated values of the mass function, but written as \(\mathrm{d}n/\mathrm{d}\ln M\) at a given redshift, for a given set of masses defined by the user in the main parameter file. The result for any mass is interpolated from these tabulated values.

Note

The multiplicity function \(f(\sigma, z)\) is generally fitted to numerical simulations. **CLUMPY** includes the parametrisations from a variety of simulations, considering only DM or including baryons and relying on different cosmologies. The available parametrizations are listed in and the user may select any one of these with a corresponding keyword (see for details).

## 6.7.4. \(\sigma(M,z)\) and \(P_{\rm lin}(k,0)\)¶

It is calculated from the linear matter power spectrum, \(P_{\rm lin}(k,z=0)\), according to

\[\sigma^2(M,\,z) = \frac{D(z)^2}{2\pi^2} \int P_{\rm lin}(k, z=0)\, \widehat{W}^2(kR)\,k^2\,\mathrm{d}k\,,\]

with \(R=[M/(\gamma_{\rm f}\,\overline{\varrho}_{\rm m,0})]^{1/3}\), the comoving scale radius of a collapsing sphere containing the mass \(M\). Different shapes of the sphere can be selected, expressed in \(k\)-space by

\[\begin{split}\widehat{W}(kR) &= 3\,(kR)^{-3} \,[\sin(kR) - kR \,\cos(kR)],\;\gamma_{\rm f} = \frac{4\pi}{3} \quad{\rm (top~hat)},\\ \widehat{W}(kR) &= \exp[- (kR)^2 / 2],\;\gamma_{\rm f} = (2\pi)^{3/2} \quad{\rm (Gaussian~window)},\\ \widehat{W}(kR) &= 1 - \theta(kR - 1),\;\gamma_{\rm f} = 6\pi^2 \quad{\rm (sharp-k~filter)}\,,\end{split}\]

with \(\theta\) the Heaviside step-function.

Note

For a given cosmology, **CLUMPY** loads the matter power spectrum from an existing file, the name of which should match a pattern obtained from the cosmological parameters. If the file does not exist, **CLUMPY** is interfaced with the **CLASS** code (Lesgourgues, 2011) to compute \(P_{\rm lin}(k,z=0)\) (which should have been previously installed by the user).

## 6.7.5. Growth factor \(D(z)\)¶

The growth factor, \(D(z) = g(z)/g(z=0)\) is defined from

(6.11)¶\[g(z) = \frac{5}{2}\times \frac{8\pi G}{3}\overline{\varrho}_{\rm m,0}\times H(z)\,\int_z^\infty \frac{1+z'}{H^3(z')}\,{\rm d} z'\,,\]

and it allows to compute the variance \(\sigma(M,z)\) at any redshift (\(G\) is the gravitational constant).

Note

**CLUMPY** computes the linear growth rate \(D(z)\), for a given redshift, using either the exact analytical solution above or the approximate (and faster to compute) formula of Carroll et al. (1992), depending on the user’s choice.