CAMB: formula for matter power specturm

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Post Reply
Zhuangfei Wang
Posts: 27
Joined: October 09 2021
Affiliation: Simon Fraser University

CAMB: formula for matter power specturm

Post by Zhuangfei Wang » November 16 2022

Hello, maybe a simple question about the matter power spectrum. I am just having some trouble getting the exact formula of matter power spectrum from CAMB. If I am not mistaken, the expression I have in mind will be:

Code: Select all

outpower = (transfer_var1* transfer_var2)*2*pi*2*h^3/k^3*InitPower
based on the code in "Transfer_GetMatterPowerD" of result.f90:

Code: Select all

matpower(ik) = log(atransfer*k*const_pi*const_twopi*h**3)
However, in the same function, it also uses the calculations below before taking exponential to get the final outpower, which is sort of confusing to me. Could anyone help to explain the reason for these steps? Is my very first formula for PK too simplistic or wrong? Thanks.

Code: Select all

    do il=1, npoints
        xi=logmink + dlnkh*(il-1)
        if (xi < kvals(1)) then
        end if
        do while ((xi > kvals(llo+1)).and.(llo < MTrans%num_q_trans))
            if (llo >= MTrans%num_q_trans) exit
        end do
        if (llo == MTrans%num_q_trans) then
            lastix = il
        end if

        outpower(il) = a0*matpower(llo)+ b0*matpower(lhi)+((a0**3-a0)* ddmat(llo) &
    end do

    do while (lastix <= npoints)
        !Do linear extrapolation in the log
        !Obviouly inaccurate, non-linear etc, but OK if only using in tails of window functions
        outpower(lastix) = 2*outpower(lastix-1) - outpower(lastix-2)
        lastix = lastix+1
    end do

Antony Lewis
Posts: 1842
Joined: September 23 2004
Affiliation: University of Sussex

Re: CAMB: formula for matter power specturm

Post by Antony Lewis » November 16 2022

This is just spline interpolating onto a grid

Post Reply