Background Universe

Some of the most basics quantities in cosmology are the Hubble factor $H(z)$ and the comoving distance $\chi(z)$. In this section are presented the functions which evaluate them.

Hubble factor

CosmoCentral.ComputeAdimensionalHubbleFactorFunction
ComputeAdimensionalHubbleFactor(z::Float64, w0waCDMCosmology::w0waCDMCosmology)

This function, given the value of the cosmological parameters, evaluate the Adimensional Hubble Factor for $w_0 w_a$CDM cosmologies. The analitycal expression is given by:

\[E(z)=\sqrt{\Omega_M(1+z)^3+\Omega_R(1+z)^4+ \Omega_{DE}(1+z)^{3(1+w_0+w_a)}\exp(-3w_a \frac{z}{1+z})+\Omega_k(1+z)^2}\]

Warning

This expression is valid only for the CPL parameterization of the Dark Energy Equation of State.

source
CosmoCentral.ComputeHubbleFactorFunction
ComputeHubbleFactor(z::Float64, AbstractCosmology::AbstractCosmology)

This function, given the value of the cosmological parameters, evaluate the Hubble Factor for $w_0 w_a$CDM cosmologies, whose expression is given by

\[H(z)=H_0\sqrt{\Omega_M(1+z)^3+\Omega_R(1+z)^4+ \Omega_{DE}(1+z)^{3(1+w_0+w_a)}\exp(-3w_a \frac{z}{1+z})+\Omega_k(1+z)^2}\]

source

Distances

CosmoCentral.ComputeχFunction
Computeχ(z::Float64, AbstractCosmology::AbstractCosmology)

This function, given the value of the cosmological parameters, evaluate the Comoving Distance χ. It is evaluated as:

\[\chi(z)=\frac{c}{H_0}\int_0^z \frac{dz'}{E(z')}\]

source

BackgroundQuantities

In order to store them in a convenient way, we use a structure, CosmoCentral.BackgroundQuantities, which contains all the background quantities

CosmoCentral.BackgroundQuantitiesType
BackgroundQuantities(HZArray::Vector{Float64}, χZArray::Vector{Float64}),
DZArray::Vector{Float64}

This struct contains the arrays with the values of the Hubble parameter $H(z)$ and the comoving distance $\chi(z)$.

source

Utils

A useful function, regarding the background quantities, is CosmoCentral.ComputeBackgroundQuantitiesGrid!. It computes the background quantities over the redshift grid.

Here we show how to calculate $H(z)$ and $\chi(z)$ over the redshift grid, then we plot them

#instantiate background quantities and compute them
BackgroundQuantities = CosmoCentral.BackgroundQuantities(HZArray=
zeros(length(CosmologicalGrid.ZArray)),
χZArray=zeros(length(CosmologicalGrid.ZArray)))
CosmoCentral.ComputeBackgroundQuantitiesGrid!(CosmologicalGrid,
BackgroundQuantities, w0waCDMCosmology)

pH = plot(CosmologicalGrid.ZArray, BackgroundQuantities.HZArray./ w0waCDMCosmology.H0,
ylabel = L"E(z)")
pχ = plot(CosmologicalGrid.ZArray, BackgroundQuantities.χZArray,
ylabel = L"\chi(z)\, \left[\mathrm{Mpc}\right]", xlabel= L"z")
plot(pH, pχ, layout = (2, 1), legend = false)

We also want to show that this code is fast. In this particular example, we are going to compute $H(z)$ and $\chi(z)$ on a redshift grid of 500 points

BackgroundQuantities = CosmoCentral.BackgroundQuantities(HZArray=
zeros(length(CosmologicalGrid.ZArray)),
χZArray=zeros(length(CosmologicalGrid.ZArray)))
@benchmark CosmoCentral.ComputeBackgroundQuantitiesGrid!(CosmologicalGrid,
BackgroundQuantities, w0waCDMCosmology)
BenchmarkTools.Trial: 2693 samples with 1 evaluation.
 Range (min … max):  1.505 ms …  18.084 ms  ┊ GC (min … max): 0.00% … 87.59%
 Time  (median):     1.758 ms               ┊ GC (median):    0.00%
 Time  (mean ± σ):   1.849 ms ± 956.071 μs  ┊ GC (mean ± σ):  3.55% ±  6.21%

          ▁ ▅▃▄▄▇█▆▃▂▁                                         
  ▃▃▅▅▆▆▇█████████████▆▆▅▅▄▄▄▅▅▄▄▄▃▃▃▃▃▂▂▂▂▂▂▃▂▂▁▂▂▂▂▂▁▂▁▁▂▁▂ ▄
  1.51 ms         Histogram: frequency by time         2.5 ms <

 Memory estimate: 492.95 KiB, allocs estimate: 22551.