ODEGrowthFactor

class hmf.cosmology.growth_factor.ODEGrowthFactor(cosmo: FLRW, **model_parameters)[source]

Growth factor calculation that solves the full ODE.

The ODE solved here is given in many references, e.g. Peebles 1980 “The Large Scale Structure of the Universe”. The implementation here does not assume either flatness, a cosmological constant, or negligible radiation density, and so should be accurate for any FLRW cosmology.

Notes

The growth factor is calculated by solving the following ODE:

\[D''(a) + \left(\frac{H'(a)}{H(a)} + \frac{3}{a}\right) D'(a) - \frac{3}{2} \frac{\Omega_{m,0}}{a^5 H(a)^2}\right) D(a) = 0.\]

We use astropy to calculate \(H(a)\), and its derivative is computed via a spline fit, which ensures that the growth factor is calculated self-consistently with the cosmology.

The ODE is solved using scipy’s solve_ivp function, with initial conditions set in the radiation-dominated era, where \(D(a) \approx 2 a_{\rm eq}/3\) and \(D'(a) \approx 0\) (see the growth factor derivation documentation for details). Although these initial conditions are used for the ODE solution, the growth factor is ultimately normalised such that \(D^+(a=1) = 1\), so the final result is not sensitive to one effective choice of initial condition.

The growth rate is calculated by taking the derivative of the growth factor spline, which is equivalent to the expression given in many references, e.g. Carroll et al. 1992, eq. 30:

\[\frac{d\ln D^+}{d\ln a}.\]

In this class this is done using the spline derivative, on the spline of the growth factor itself, which ensures that the growth rate is consistent with the growth factor.

Since the ODE solution is numerical, it must be evaluated on a grid, and since it is solved as an initial value problem, the grid must start at some early time (well into radiation-domination). The parameters dlna and amin control the grid on which the ODE is solved, and so the accuracy of the solution. The grid is in log-space for the scale factor, and so dlna controls the step-size in log-space, while amin controls how far back in time the solution is calculated. The default values should be sufficient for most cosmologies.

Attributes

Methods

__init__(cosmo: FLRW, **model_parameters)
dlne_dlna(z)

Compute the derivative of ln(E(a)) with respect to ln(a).

This is useful for the growth factor, which has terms \(E'(a)/E(a) \equiv (1/a)*dlnE/dlna\) in its definition.

This implementation simply uses the exact definition from astropy of E(a) and writes down the derivative analytically.

classmethod get_models() dict[str, type]

Get a dictionary of all implemented models for this component.

growth_factor(z)

Compute the normalized growth factor, \(D(a) = D^+(a)/D^+(a=1)\).

Parameters:

z (array_like) – Redshift.

Returns:

gf – The growth factor at z.

Return type:

array_like

growth_factor_inverse(d)[source]

Inverse of the growth factor function, i.e. z as a function of growth factor.

Parameters:

d (float | np.ndarray) – The normalised growth factor

Returns:

The redshift corresponding to the given growth factor.

Return type:

float | np.ndarray

growth_rate(z) float | ndarray

Compute the growth rate, \(f(a) = d\ln D^+ / d\ln a\).

Parameters:

z (array_like) – Redshift.

Returns:

gr – The growth rate at z.

Return type:

array_like

radiation_density(z)

The fractional radiation density as a function of redshift.