cmbant / CAMB

Code for Anisotropies in the Microwave Background
https://camb.info/
Other
194 stars 144 forks source link

Different non-linear matter power spectra for different variables #91

Open alexander-mead opened 4 years ago

alexander-mead commented 4 years ago
# Import CAMB
import camb

# Set parameters
pars = camb.CAMBparams()
pars.set_cosmology(H0=67.5, ombh2=0.022, omch2=0.122, mnu=0.07)
pars.set_matter_power([0.], kmax=100., nonlinear=True)
pars.NonLinearModel.set_params(halofit_version='mead')

# Do the calculation
data = camb.get_results(pars)

# Get the power spectrum at some wavenumber
_, _, Pk_tot = data.get_nonlinear_matter_power_spectrum(params=pars, var1='delta_tot', var2='delta_tot')
_, _, Pk_cdm = data.get_nonlinear_matter_power_spectrum(params=pars, var1='delta_cdm', var2='delta_cdm')
print(Pk_tot[0][160], Pk_cdm[0][160])

If I run the above code I get the following printed out: 810.7663200215078 820.4239789024388

I'm confused by the fact that these numbers are different, since the HMcode model for the non-linear power spectrum only calculates the result for the total matter power spectrum, and has not been calibrated for the non-linear CDM-CDM power spectrum, or anything else like that.

I checked and the two results are also different if halofit_version='takahashi' and HALOFIT was also only calibrated to provide the total matter power spectrum.

In principle, one ought to be able to calculate the non-linear (cross) power for any combination of var1 and var2, but the above models have not been calibrated to do this. I'm not sure what either calculation would be doing when either var1 or var2 is set to delta_cdm. Should an error message be generated instead of a result?

cmbant commented 4 years ago

Yes, it at assumes all sources scale the same way (by the ratio of the nonlinear to nonlinear that you do calculate). Clearly it's wrong, though it will be right in the linear limit and approximately correct in most cases. In principle there should be separate results for each density and the velocity (the latter is implemented in SecondOrderPK but only used for high-redshift 21cm).