Growth
d_growth2(a, d, Om, Ol)
:math:\vspace{-1mm}
Return :math:T[D_2](a)
for the second order growth factor, :math:D_2
,
for a given scale factor and respective linear growth factor. Here :math:T
is given by equation (A.1) of [temporalCOLA]_. One needs to precompute the
linear growth factor. :math:\Lambda\mathrm{CDM}
is assumed for this
calculation.
Arguments:
-
a
-- a float, giving the scale factor. -
d
-- a float, giving the linear growth factor ata
. -
Om
-- a float, giving the matter density, :math:\Omega_m
, today.
Return:
- A float giving :math:
T[D_2](a)
.
Source code in pycola3/growth.py
def d_growth2(a, d, Om, Ol):
"""
:math:`\\vspace{-1mm}`
Return :math:`T[D_2](a)` for the second order growth factor, :math:`D_2`,
for a given scale factor and respective linear growth factor. Here :math:`T`
is given by equation (A.1) of [temporalCOLA]_. One needs to precompute the
linear growth factor. :math:`\Lambda\mathrm{CDM}` is assumed for this
calculation.
**Arguments**:
* ``a`` -- a float, giving the scale factor.
* ``d`` -- a float, giving the linear growth factor at `a`.
* ``Om`` -- a float, giving the matter density, :math:`\Omega_m`, today.
**Return**:
* A float giving :math:`T[D_2](a)`.
"""
d2 = growth_2lpt(a, d, Om)
omega = Om / (Om + (1.0 - Om) * a * a * a)
return _q_factor(a, Om, Ol) * (d2 / a) * 2.0 * omega ** (6.0 / 11.0)
growth_2lpt(a, d, Om)
:math:\vspace{-1mm}
Return the second order growth factor for a given scale factor and
respective linear growth factor. One needs to precompute the latter.
:math:\Lambda\mathrm{CDM}
is assumed for this calculation.
Arguments:
-
a
-- a float, giving the scale factor. -
d
-- a float, giving the linear growth factor ata
. -
Om
-- a float, giving the matter density, :math:\Omega_m
, today.
Return:
- A float giving the second order growth factor.
Example::
>>> Om=0.275
>>> Ol=1.0-Om
>>> from growth import growth_factor_solution,growth_2lpt
>>> darr=growth_factor_solution(Om,Ol)
>>> from scipy import interpolate
>>> growth = interpolate.interp1d(darr[:,0].tolist(),darr[:,1].tolist(),
... kind='linear')
>>> a=0.3
>>> d=growth(a)
>>> growth_2lpt(a,d,Om)/d/d
0.99148941733187124
Source code in pycola3/growth.py
def growth_2lpt(a, d, Om):
"""
:math:`\\vspace{-1mm}`
Return the second order growth factor for a given scale factor and
respective linear growth factor. One needs to precompute the latter.
:math:`\Lambda\mathrm{CDM}` is assumed for this calculation.
**Arguments**:
* ``a`` -- a float, giving the scale factor.
* ``d`` -- a float, giving the linear growth factor at `a`.
* ``Om`` -- a float, giving the matter density, :math:`\Omega_m`, today.
**Return**:
* A float giving the second order growth factor.
**Example**::
>>> Om=0.275
>>> Ol=1.0-Om
>>> from growth import growth_factor_solution,growth_2lpt
>>> darr=growth_factor_solution(Om,Ol)
>>> from scipy import interpolate
>>> growth = interpolate.interp1d(darr[:,0].tolist(),darr[:,1].tolist(),
... kind='linear')
>>> a=0.3
>>> d=growth(a)
>>> growth_2lpt(a,d,Om)/d/d
0.99148941733187124
"""
# omega=Om/(Om+(1.0-Om)*a*a*a)
omega = 1.0 / (Om + (1.0 - Om) * a * a * a) # normalized
return d * d * omega ** (-1.0 / 143.0)
growth_factor_solution(Om, Ol)
:math:\vspace{-1mm}
Calculate the linear growth factor evolution for a given cosmology.
Arguments:
-
Om
-- a float, giving the matter density, :math:\Omega_m
, today. -
Ol
-- a float, giving the vacuum density, :math:\Omega_\Lambda
, today.
Return:
- an :math:
n\times 3
array containing :math:[a_i,D(a_i),T[D](a_i)]
for :math:i=1\dots n
in order of increasing scale factor :math:a
. Here, the linear growth factor is given by :math:D(a)
, while :math:T[D](a)
is given by equation (A.1) of [temporalCOLA]_. These arrays can be further interpolated if needed.
Source code in pycola3/growth.py
def growth_factor_solution(
Om, Ol
): # returns a,D(a),T[D] = Q(a)D'(a) where Q(a) = _q_factor()
"""
:math:`\\vspace{-1mm}`
Calculate the linear growth factor evolution for a given cosmology.
**Arguments**:
* ``Om`` -- a float, giving the matter density, :math:`\Omega_m`, today.
* ``Ol`` -- a float, giving the vacuum density, :math:`\Omega_\Lambda`, today.
**Return**:
* an :math:`n\\times 3` array containing
:math:`[a_i,D(a_i),T[D](a_i)]` for :math:`i=1\dots n` in
order of increasing scale factor :math:`a`. Here, the linear growth
factor is given by :math:`D(a)`, while :math:`T[D](a)` is given by
equation (A.1) of [temporalCOLA]_. These arrays can be further interpolated if needed.
"""
a = [
float(x) / 1000.0 for x in range(1, 1101)
] # go to slightly later times so that no problems with interpolation occur
amin = a[0]
v = integrate.odeint(
_growth_derivs, [amin, _q_factor(amin, Om, Ol)], a, args=(Om, Ol)
)
v /= v[
1001, 0
] # divide by growth factor at a=1. index=1000+1 depend on the a=[...] above
return np.append(np.array([a]).transpose(), v, 1)