CAMBmain Module Source file:cmbmain


This code evolves the linearized perturbation equations of general relativity,
the Boltzmann equations and the fluid equations for perturbations
of a Friedmann-Robertson-Walker universe with a supplied system of gauge-dependent equation
in a modules called GaugeInterface.  The sources for the line of sight integral are
computed at sampled times during the evolution for various of wavenumbers. The sources
are then interpolated to a denser wavenumber sampling for computing the line of
sight integrals of the form Integral d(conformal time) source_k * bessel_k_l.
For flat models the bessel functions are interpolated from a pre-computed table, for
non-flat models the hyperspherical Bessel functions are computed by integrating their
differential equation. Both phases ('Evolution' and 'Integration') can do separate
wavenumbers in parallel.


The time variable is conformal  time dtau = dt/a(t) and the spatial dependence is Fourier transformed
with q = sqrt(k**2 + (|m|+1)K), comoving distances are x = r/a(t), with a(t) = 1 today.
The units of both length and time are Mpc.


Many elements are part of derived types (to make thread safe or to allow non-sequential code use
CP = CAMB parameters
EV = Time evolution variables
IV = Source integration variables
CT = Cl transfer data
MT = matter transfer data

Classes

Subroutines
  • CalcLimberScalCls(CTrans)
  • CalcScalarSources(EV, taustart)
  • CalcScalCls(CTrans)
  • CalcScalCls2(CTrans)
    Calculate C_ll' for non-isotropic models Run with l_sample_boost = 50 to get every l not used in normal CAMB
  • CalcTensCls(CTrans, GetInitPowers)
  • CalcTensorSources(EV, taustart)
  • CalcVecCls(CTrans, GetInitPowers)
  • CalcVectorSources(EV, taustart)
  • ClTransferToCl(ActiveState)
  • DoCurvedOlverIntegration(IV, ThisCT, j, l, nu)
    Not used, just for accuracy checking
  • DoFlatIntegration(IV, ThisCT, llmax)
  • DoNearFlatIntegration(IV, ThisCT, j, l, nu, near_flat_time_weight)
    • IntegrationVars   :: IV
    • ClTransferData   :: ThisCT
    • integer intent(in) :: j
    • integer intent(in) :: l
    • real(dl) intent(in) :: nu
    • real(dl) intent(in) :: near_flat_time_weight(IV%SourceSteps)
  • DoNearFlatSmallChiIntegration(IV, ThisCT, j, l, nu, near_flat_time_weight)
    • IntegrationVars   :: IV
    • ClTransferData   :: ThisCT
    • integer intent(in) :: j
    • integer intent(in) :: l
    • real(dl) intent(in) :: nu
    • real(dl) intent(in) :: near_flat_time_weight(IV%SourceSteps)
  • DoRangeInt(IV, nstart, nend, j, l, chiDisp, dtau, nu, chi, y1, out)
    Non-flat version. Returns chi at the end of the integral, where the integral stops, not necessarily at nend. Integrates source*phi from nstart to nend. phi is obtained from Numerov stepping of the hyperspherical Bessel ODE, bootstrapped by Olver evaluations, or by direct Olver evaluation when too many Numerov substeps would be needed. dtau is the spacing of the equally spaced time steps.
    • IntegrationVars intent(in)  :: IV
    • integer intent(in) :: nstart
    • integer intent(in) :: nend
    • integer intent(in) :: j
    • integer intent(in) :: l
    • real(dl) intent(in) :: chiDisp
    • real(dl) intent(in) :: dtau
    • real(dl) intent(in) :: nu
    • real(dl) intent(inout) :: chi
    • real(dl) intent(inout) :: y1
    • real(dl) intent(out) :: out(ThisSources%SourceNum)
  • DoRangeIntTensor(IV, l, nstart, nend, nu, dtau, chi, chiDisp, y1, out)
    Tensor analogue of DoRangeInt: integrates source*phi for steps nstart to nend. phi is obtained from Numerov stepping of the hyperspherical Bessel ODE, bootstrapped by two Olver evaluations (at chi and chi+delchi). dtau is the spacing of the timesteps (they must be equally spaced). (The direct-Olver high-substep path in DoRangeInt is not needed here: the denser tensor time sampling and lower tensor k range keep nSubSteps well below the gate.)
    • IntegrationVars   :: IV
    • integer  :: l
    • integer  :: nstart
    • integer  :: nend
    • real(dl)  :: nu
    • real(dl)  :: dtau
    • real(dl)  :: chi
    • real(dl)  :: chiDisp
    • real(dl)  :: y1
    • real(dl)  :: out(ThisSources%SourceNum)
  • DoSourceIntegration(IV, ThisCT)
    for particular wave number q
  • DoSourcek(q_ix, EV)
  • FillDirectOlverPhiVals(l, K, isgn, nIntSteps, nu, dchisource, sgn, chiDispTop, minphi, chi, y1, phi_vals, last_ix)
    Fill phi at each source time step by direct Olver evaluation, rather than Numerov stepping the hyperspherical Bessel ODE on a finer chi grid. The caller has already set phi_vals(1) from y1 at the incoming chi; chi = 0 on exit signals the cut-off. The Numerov loop's derivative-sign test is not needed here (it guarded against Numerov instability in the dissipative tail); the smallness cut alone suffices.
    • integer intent(in) :: l
    • integer intent(in) :: K
    • integer intent(in) :: isgn
    • integer intent(in) :: nIntSteps
    • real(dl) intent(in) :: nu
    • real(dl) intent(in) :: dchisource
    • real(dl) intent(in) :: sgn
    • real(dl) intent(in) :: chiDispTop
    • real(dl) intent(in) :: minphi
    • real(dl) intent(inout) :: chi
    • real(dl) intent(out) :: y1
    • real(dl) intent(out) :: phi_vals(:)
    • integer intent(out) :: last_ix
  • FillShiftedNuPhiVals(j, l, nIntSteps, nu, chi_start, dchisource, sgn, phi_vals, y1, chi)
    • integer intent(in) :: j
    • integer intent(in) :: l
    • integer intent(in) :: nIntSteps
    • real(dl) intent(in) :: nu
    • real(dl) intent(in) :: chi_start
    • real(dl) intent(in) :: dchisource
    • real(dl) intent(in) :: sgn
    • real(dl) intent(out) :: phi_vals(nIntSteps + 1)
    • real(dl) intent(inout) :: y1
    • real(dl) intent(inout) :: chi
  • FillSmallChiPhiVals(j, l, nIntSteps, nu, chi_start, dchisource, sgn, phi_vals, y1, chi)
    • integer intent(in) :: j
    • integer intent(in) :: l
    • integer intent(in) :: nIntSteps
    • real(dl) intent(in) :: nu
    • real(dl) intent(in) :: chi_start
    • real(dl) intent(in) :: dchisource
    • real(dl) intent(in) :: sgn
    • real(dl) intent(out) :: phi_vals(nIntSteps + 1)
    • real(dl) intent(inout) :: y1
    • real(dl) intent(inout) :: chi
  • GetInitPowerArrayTens(numks, pows, ks)
    • integer intent(in) :: numks
    • real(dl)  :: pows(numks)
    • real(dl)  :: ks(numks)
  • GetInitPowerArrayVec(numks, pows, ks)
    • integer intent(in) :: numks
    • real(dl)  :: pows(numks)
    • real(dl)  :: ks(numks)
  • GetLimberTransfers(ThisCT)
  • GetTransfer(EV, tau)
  • InitVars(ActiveState)
  • IntegrateSourcesBessels(IV, ThisCT, l, j, nu)
  • IntegrationVars_Init(IV)
  • InterpolateSources(IV)
  • SetClosedkValuesFromArr(R, forInt)
    • TRanges intent(inout) :: R
    • logical intent(in) :: forInt
  • SetkValuesForInt(ThisCT)
  • SourceToTransfers(ThisCT, q_ix)
  • TimeSourcesToCl(ThisCT)
Functions
  • real(dl)
    GetTauStart(q)
    • real(dl) intent(in) :: q
  • real(dl)
    HypersphericalPhiOnsetChi(l, K, nu)
    • integer intent(in) :: l
    • integer intent(in) :: K
    • real(dl) intent(in) :: nu
  • real(dl)
    NearFlatIntegrationBoost()
  • real(dl)
    ShiftedNuBesselTableMaxEtak(lmax, base_etak)
    • integer intent(in) :: lmax
    • real(dl) intent(in) :: base_etak
  • logical
    UseLimber(l)
    Calculate lensing potential power using Limber rather than j_l integration even when sources calculated as part of temperature calculation (Limber better on small scales unless step sizes made much smaller) This affects speed, esp. of non-flat case
    • integer  :: l
  • logical
    UseNearFlatSmallChiApprox(l, nu, chi_max, boost_scale)
    • integer intent(in) :: l
    • real(dl) intent(in) :: nu
    • real(dl) intent(in) :: chi_max
    • real(dl) intent(in) :: boost_scale
  • logical
    UseShiftedNuNearFlatIntegration(l, nu, chi_max, boost_scale)
    • integer intent(in) :: l
    • real(dl) intent(in) :: nu
    • real(dl) intent(in) :: chi_max
    • real(dl) intent(in) :: boost_scale