NonLinear Module Source file:halofit

Dependencies

Subroutines
  • allocate_LUT(lut, n)
    Allocates memory for the HMcode look-up HM_tables
  • assign_HM_cosmology(this, State, cosm)
  • calculate_nowiggle(k, z, Pk, Pk_nw, cosm)
    Calculate the normalised no wiggle power spectrum at a range of k and a Comes from the Eisenstein & Hu approximation
    • REAL(dl) INTENT(IN) :: k(:)
    • REAL(dl) INTENT(IN) :: z
    • REAL(dl) INTENT(IN) :: Pk(:)
    • REAL(dl) ALLOCATABLE, INTENT(OUT) :: Pk_nw(:)
    • HM_cosmology INTENT(IN)  :: cosm
  • calculate_psmooth(k, z, Pk, Pk_smt, cosm)
    Calculate the normalised smoothed power spectrum at a range of k
    • REAL(dl) INTENT(IN) :: k(:)
    • REAL(dl) INTENT(IN) :: z
    • REAL(dl) INTENT(IN) :: Pk(:)
    • REAL(dl) ALLOCATABLE, INTENT(OUT) :: Pk_smt(:)
    • HM_cosmology INTENT(IN)  :: cosm
  • fill_growtab(cosm)
    Fills a table of values of the scale-independent growth function
  • fill_plintab(CAMB_PK, iz, cosm)
    Fills internal HMcode HM_tables for the linear power spectrum at z=0
  • fill_sigtab(this, cosm)
  • fill_table(min, max, arr, n)
    Fills array 'arr' in equally spaced intervals
    • REAL(dl) INTENT(IN) :: min
    • REAL(dl) INTENT(IN) :: max
    • REAL(dl) ALLOCATABLE :: arr(:)
    • INTEGER INTENT(IN) :: n
  • fit_cubic(a, b, c, d, x1, y1, x2, y2, x3, y3, x4, y4)
    Given xi, yi i=1,2,3,4 fits a cubic between these points
    • REAL(dl) INTENT(OUT) :: a
    • REAL(dl) INTENT(OUT) :: b
    • REAL(dl) INTENT(OUT) :: c
    • REAL(dl) INTENT(OUT) :: d
    • REAL(dl) INTENT(IN) :: x1
    • REAL(dl) INTENT(IN) :: y1
    • REAL(dl) INTENT(IN) :: x2
    • REAL(dl) INTENT(IN) :: y2
    • REAL(dl) INTENT(IN) :: x3
    • REAL(dl) INTENT(IN) :: y3
    • REAL(dl) INTENT(IN) :: x4
    • REAL(dl) INTENT(IN) :: y4
  • fit_line(a0, a1, x1, y1, x2, y2)
    Given xi, yi i=1,2 fits a line between these points
    • REAL(dl) INTENT(OUT) :: a0
    • REAL(dl) INTENT(OUT) :: a1
    • REAL(dl) INTENT(IN) :: x1
    • REAL(dl) INTENT(IN) :: y1
    • REAL(dl) INTENT(IN) :: x2
    • REAL(dl) INTENT(IN) :: y2
  • fit_quadratic(a0, a1, a2, x1, y1, x2, y2, x3, y3)
    Given xi, yi i=1,2,3 fits a quadratic between these points
    • REAL(dl) INTENT(OUT) :: a0
    • REAL(dl) INTENT(OUT) :: a1
    • REAL(dl) INTENT(OUT) :: a2
    • REAL(dl) INTENT(IN) :: x1
    • REAL(dl) INTENT(IN) :: y1
    • REAL(dl) INTENT(IN) :: x2
    • REAL(dl) INTENT(IN) :: y2
    • REAL(dl) INTENT(IN) :: x3
    • REAL(dl) INTENT(IN) :: y3
  • init_wiggle(cosm)
    Isolate the power spectrum wiggle
  • initialise_HM_cosmology(this, CAMB_PK, cosm, iz)
  • ode_growth(xi, ti, tf, acc, vi, x, v, t, imeth, cosm)
    Solves 2nd order ODE x''(t) from ti to tf and writes out array of x, v, t values
    • REAL(dl)  :: xi
    • REAL(dl)  :: ti
    • REAL(dl)  :: tf
    • REAL(dl)  :: acc
    • REAL(dl)  :: vi
    • REAL(dl) ALLOCATABLE :: x(:)
    • REAL(dl) ALLOCATABLE :: v(:)
    • REAL(dl) ALLOCATABLE :: t(:)
    • INTEGER  :: imeth
    • HM_cosmology   :: cosm
  • PKequal(State, redshift, w_lam, wa_ppf, w_hf, wa_hf)
    used by halofit_casarini: arXiv:0810.0190, arXiv:1601.07230
    • CAMBdata   :: State
    • real(dl)  :: redshift
    • real(dl)  :: w_lam
    • real(dl)  :: wa_ppf
    • real(dl)  :: w_hf
    • real(dl)  :: wa_hf
  • reverse(n, arry, output)
    This reverses the contents of arry!
    • INTEGER INTENT(IN) :: n
    • REAL(dl) INTENT(IN) :: arry(n)
    • REAL(dl) ALLOCATABLE, intent(OUT) :: output(:)
  • smooth_array_Gaussian(x, f, sigma)
    Smooth an array f(x) using a Gaussian kernel
    • REAL(dl) INTENT(IN) :: x(:) x coordinates
    • REAL(dl) INTENT(INOUT) :: f(:) Array to smooth
    • REAL(dl) INTENT(IN) :: sigma Width of smoothing Gaussian
  • wint(itf, CAMB_Pk, r, sig, d1, d2)
    • integer intent(in) :: itf
    • MatterPowerData   :: CAMB_Pk
    • real(dl)  :: r
    • real(dl)  :: sig
    • real(dl)  :: d1
    • real(dl)  :: d2
Functions
  • REAL(dl)
    AH(z, cosm)
    The Hubble acceleration function \ddot{a}/a
  • REAL(dl)
    baryonify_wk(wk, m, lut, cosm)
    Change halo window to account for feedback mass loss and star formation
  • REAL(dl)
    Ci(x)
    Calculates the 'cosine integral' function Ci(x)
    • REAL(dl) INTENT(IN) :: x
  • REAL(dl)
    cosmic_density(cosm)
    The z=0 cosmological matter density
  • REAL(dl)
    dc_Mead(z, cosm)
    delta_c fitting function from Mead (2017; 1606.05345)
  • REAL(dl)
    Dv_Mead(z, cosm)
    Delta_v fitting function from Mead (2017; 1606.05345)
  • REAL(dl)
    f_Mead(x, y, p0, p1, p2, p3)
    Equation A3 in Mead (2017)
    • REAL(dl) INTENT(IN) :: x
    • REAL(dl) INTENT(IN) :: y
    • REAL(dl) INTENT(IN) :: p0
    • REAL(dl) INTENT(IN) :: p1
    • REAL(dl) INTENT(IN) :: p2
    • REAL(dl) INTENT(IN) :: p3
  • REAL(dl)
    f_star(lut, cosm)
  • REAL(dl)
    fd(v)
    d'=f(d) in ODE solver
    • REAL(dl) INTENT(IN) :: v
  • REAL(dl)
    find(n, x, xtab, ytab, iorder, ifind, imeth)
    Given two arrays x and y this routine interpolates to find the y_i value at position x_i
    • INTEGER INTENT(IN) :: n
    • REAL(dl) INTENT(in) :: x
    • REAL(dl) INTENT(IN) :: xtab(n)
    • REAL(dl) INTENT(IN) :: ytab(n)
    • INTEGER INTENT(IN) :: iorder
    • INTEGER INTENT(IN) :: ifind
    • INTEGER INTENT(IN) :: imeth
  • REAL(dl)
    find_pk(k, itype, cosm)
    Look-up and interpolation for P(k,z=0)
    • REAL(dl) INTENT(IN) :: k
    • INTEGER INTENT(IN) :: itype
    • HM_cosmology INTENT(IN)  :: cosm
  • REAL(dl)
    fv(d, v, a, cosm)
    v'=f(v) in ODE solver
    • REAL(dl) INTENT(IN) :: d
    • REAL(dl) INTENT(IN) :: v
    • REAL(dl) INTENT(IN) :: a
    • HM_cosmology INTENT(IN)  :: cosm
  • REAL(dl)
    gnu(nu)
    Select the mass function
    • REAL(dl) INTENT(IN) :: nu
  • REAL(dl)
    grow(z, cosm)
    Finds the scale-independent growth fuction at redshift z
  • REAL(dl)
    growint(z, cosm)
    Integrates between a and b until desired accuracy is reached Stores information to reduce function calls
  • REAL(dl)
    growint_integrand(a, cosm)
    Integrand for the approximate growth integral
  • REAL(dl)
    gst(nu)
    Sheth & Tormen (1999) mass function!
    • REAL(dl) INTENT(IN) :: nu
  • REAL(dl)
    halo_mass_fraction(m, lut, cosm)
    Simple baryon model where high-mass haloes have a mass fraction of 1 and low-mass haloes have Omega_c/Omega_m This also accounts for massive neutrinos since it is written in terms of Om_c and Om_b (rather than Om_m) TODO: Could just precompute this once for each M in the halomod init function
  • REAL(dl)
    Hubble2(z, cosm)
    This calculates the dimensionless squared hubble parameter at redshift z (H/H_0)^2! Ignores contributions from radiation (not accurate at high z, but consistent with simulations)!
  • INTEGER
    int_split(n, x, xtab)
    Finds the position of the value in the table by continually splitting it in half
    • INTEGER INTENT(IN) :: n
    • REAL(dl) INTENT(IN) :: x
    • REAL(dl) INTENT(IN) :: xtab(n)
  • REAL(dl)
    integrate(a, b, y, z, itype, cosm, acc, iorder, f)
    Integrates between a and b until desired accuracy is reached Stores information to reduce function calls
    • REAL(dl) INTENT(IN) :: a
    • REAL(dl) INTENT(IN) :: b
    • REAL(dl) INTENT(IN) :: y
    • REAL(dl) INTENT(IN) :: z
    • INTEGER INTENT(IN) :: itype
    • HM_cosmology INTENT(IN)  :: cosm
    • REAL(dl) INTENT(IN) :: acc
    • INTEGER INTENT(IN) :: iorder
    • FUNCTION  :: f(x, y, z, itype, cosm)
  • REAL(dl)
    inttab(n1, n2, x, y, iorder)
    Integrates tables y(x)dx
    • INTEGER INTENT(IN) :: n1
    • INTEGER INTENT(IN) :: n2
    • REAL(dl) INTENT(IN) :: x(:)
    • REAL(dl) INTENT(IN) :: y(:)
    • INTEGER INTENT(IN) :: iorder
  • REAL(dl)
    Lagrange_polynomial(n, x, xv, yv)
    Computes the result of the nth order Lagrange polynomial at point x, L(x)
    • INTEGER INTENT(IN) :: n
    • REAL(dl) INTENT(IN) :: x
    • REAL(dl) INTENT(IN) :: xv(n+1)
    • REAL(dl) INTENT(IN) :: yv(n+1)
  • INTEGER
    linear_table_integer(n, x, xtab)
    Assuming the table is exactly linear this gives you the integer position
    • INTEGER INTENT(IN) :: n
    • REAL(dl) INTENT(IN) :: x
    • REAL(dl) INTENT(IN) :: xtab(n)
  • REAL(dl)
    m_baryon(lut, cosm)
  • REAL(dl)
    mass(c)
    This calculates the (normalised) mass of a halo of concentration c The 'normalised' mass is that divided by the prefactor r_s^3 4*pi rho_n where rho_n is the profile normalisation [i.e, rho=rho_n/((r/r_s)*(1.+r/r_s)^2]
    • REAL(dl) INTENT(IN) :: c
  • REAL(dl)
    mass_r(r, cosm)
    Calcuates the average mass enclosed at co-moving radius r
  • REAL(dl)
    neff(this, cosm, lut)
  • REAL(dl)
    neff_integrand(t, R, z, itype, cosm)
    This is the integrand for the velocity dispersion integral
    • REAL(dl) INTENT(IN) :: t
    • REAL(dl) INTENT(IN) :: R
    • REAL(dl) INTENT(IN) :: z
    • INTEGER INTENT(IN) :: itype
    • HM_cosmology INTENT(IN)  :: cosm
  • REAL(dl)
    Omega_cold_hm(z, cosm)
    This calculates omega_cold variations with z (no neutrinos)
  • real(dl)
    omega_m(om_m0, om_v0, aa, wval, waval)
    • real(dl)  :: om_m0
    • real(dl)  :: om_v0
    • real(dl)  :: aa
    • real(dl)  :: wval
    • real(dl)  :: waval
  • REAL(dl)
    Omega_m_hm(z, cosm)
    This calculates omega_m variations with z!
  • real(dl)
    omega_v(aa, om_m0, om_v0, wval, waval)
    • real(dl)  :: aa
    • real(dl)  :: om_m0
    • real(dl)  :: om_v0
    • real(dl)  :: wval
    • real(dl)  :: waval
  • REAL
    p_dewiggle(k, z, p_linear, sigv, cosm)
    Call the dewiggled power spectrum, which is linear but with damped wiggles
    • REAL(dl) INTENT(IN) :: k
    • REAL(dl) INTENT(IN) :: z
    • REAL(dl) INTENT(IN) :: p_linear
    • REAL(dl) INTENT(IN) :: sigv
    • HM_cosmology INTENT(IN)  :: cosm
  • REAL(dl)
    p_lin(itype, cosm)
    Looks up the value for the linear power spectrum
  • REAL
    Pk_nowiggle(k, cosm)
    Calculates the un-normalised no-wiggle power spectrum Comes from the Eisenstein & Hu approximation
  • REAL(dl)
    r_nl(lut)
    Calculates R_nl, defined by nu(R_nl)=1., nu=dc/sigma(R)
  • REAL(dl)
    radius_m(m, cosm)
    Calculates the co-moving radius that encloses a mass 'm' in the homogeneous Universe
  • INTEGER
    search_int(n, x, xtab)
    Does a stupid search through the table from beginning to end to find integer
    • INTEGER INTENT(IN) :: n
    • REAL(dl) INTENT(IN) :: x
    • REAL(dl) INTENT(IN) :: xtab(n)
  • REAL(dl)
    Si(x)
    Calculates the 'sine integral' function Si(x)
    • REAL(dl) INTENT(IN) :: x
  • REAL(dl)
    sigma_integral(r, z, itype, cosm)
    Gets sigma(R)
    • REAL(dl) INTENT(IN) :: r
    • REAL(dl) INTENT(IN) :: z
    • INTEGER INTENT(IN) :: itype
    • HM_cosmology INTENT(IN)  :: cosm
  • REAL(dl)
    sigma_integrand(t, R, z, itype, cosm)
    The integrand for the sigma(R) integrals
    • REAL(dl) INTENT(IN) :: t
    • REAL(dl) INTENT(IN) :: R
    • REAL(dl) INTENT(IN) :: z
    • INTEGER INTENT(IN) :: itype
    • HM_cosmology INTENT(IN)  :: cosm
  • REAL(dl)
    sigma_lut(r, z, cosm)
    Finds sigma_cold(R) from look-up table
    • REAL(dl) INTENT(IN) :: r
    • REAL(dl) INTENT(IN) :: z
    • HM_cosmology INTENT(IN)  :: cosm
  • REAL(dl)
    sigmaV(R, z, itype, cosm)
    • REAL(dl) INTENT(IN) :: R
    • REAL(dl) INTENT(IN) :: z
    • INTEGER INTENT(IN) :: itype
    • HM_cosmology INTENT(IN)  :: cosm
  • REAL(dl)
    sigmaV_integrand(t, R, z, itype, cosm)
    This is the integrand for the velocity dispersion integral
    • REAL(dl) INTENT(IN) :: t
    • REAL(dl) INTENT(IN) :: R
    • REAL(dl) INTENT(IN) :: z
    • INTEGER INTENT(IN) :: itype
    • HM_cosmology INTENT(IN)  :: cosm
  • INTEGER
    table_integer(n, x, xtab, imeth)
    Chooses between ways to find the integer location below some value in an array
    • INTEGER INTENT(IN) :: n
    • REAL(dl) INTENT(IN) :: x
    • REAL(dl) INTENT(IN) :: xtab(n)
    • INTEGER INTENT(IN) :: imeth
  • REAL(dl)
    Tcb_Tcbnu_ratio(k, z, cosm)
    Calculates the ratio of T(k) for cold vs. all matter Uses approximations in Eisenstein & Hu (1999; arXiv 9710252) Note that this assumes that there are exactly 3 species of neutrinos with Nnu<=3 of these being massive, and with the mass split evenly between the number of massive species.
    • REAL(dl) INTENT(IN) :: k
    • REAL(dl) INTENT(IN) :: z
    • HM_cosmology   :: cosm
  • REAL
    Tk_nw(k, cosm)
    No-wiggle transfer function from Eisenstein & Hu: astro-ph:9709112
    • REAL(dl) INTENT(IN) :: k Wavenumber [h/Mpc]
    • HM_cosmology INTENT(IN)  :: cosm
  • REAL(dl)
    w_de_hm(z, cosm)
    The dark energy w(a) function
  • REAL(dl)
    win(k, rv, c)
    Selects the halo window function (k-space halo profile)
    • REAL(dl) INTENT(IN) :: k
    • REAL(dl) INTENT(IN) :: rv
    • REAL(dl) INTENT(IN) :: c
  • REAL(dl)
    winnfw(k, rv, c)
    The analytic Fourier Transform of the NFW profile; note W(k->0)=1
    • REAL(dl) INTENT(IN) :: k
    • REAL(dl) INTENT(IN) :: rv
    • REAL(dl) INTENT(IN) :: c
  • REAL(dl)
    wk_tophat(x)
    The normlaised Fourier Transform of a top-hat
    • REAL(dl) INTENT(IN) :: x
  • REAL(dl)
    wk_tophat_deriv(x)
    The derivative of a normlaised Fourier Transform of a spherical top-hat
    • REAL(dl) INTENT(IN) :: x
  • REAL(dl)
    X_de(z, cosm)
    The time evolution for dark energy: rho_de=rho_de,0 * X(a) X(a)=1 for LCDM but changes for other models