P(k) at high k depends on value of WantCls
The linear matter power spectrum at z=0 at very high k seems to depend on WantCls.
MWE:
import camb
kmax = 2000
H0=70.0
Omega_cdm0=0.25
Omega_b0=0.05
ns=0.96
As=2e-9
mnu=0.06
h = H0/100
cp = camb.CAMBparams()
cp.WantCls = True
cp.set_cosmology(H0=H0, ombh2=Omega_b0*h**2, omch2=Omega_cdm0*h**2, mnu=mnu)
cp.InitPower.set_params(As=As, ns=ns)
cp.set_matter_power(redshifts=[0], kmax=kmax)
results = camb.get_results(cp)
k_T, _, Pk_T = results.get_linear_matter_power_spectrum()
cp = camb.model.CAMBparams()
cp.WantCls = False
cp.set_cosmology(H0=H0, ombh2=Omega_b0*h**2, omch2=Omega_cdm0*h**2, mnu=mnu)
cp.InitPower.set_params(As=As, ns=ns)
cp.set_matter_power(redshifts=[0], kmax=kmax)
results = camb.get_results(cp)
k_F, _, Pk_F = results.get_linear_matter_power_spectrum()
import matplotlib.pyplot as plt
plt.loglog(k_T, Pk_T[0,:], label='WantCls=T')
plt.loglog(k_F, Pk_F[0,:], label='WantCls=F')
plt.xlim([1e1, 3000])
plt.xlabel(r'$k \, [{\rm Mpc}/h]^{-1}$', fontsize=16);
plt.ylabel(r'$P(k)\, [{\rm Mpc}/h]^{3}$', fontsize=16);
plt.legend(fontsize=16)
plt.savefig('Pk_WantCls_MWE.png')
Results in
The k sampling in both cases seems to be basically the same. Do you know what might be causing this?
It's something to do with reionization; if I set tau=0, both curves agree.
Perhaps this is physical? Reionization boosting the baryon temperature, which increases the sound speed and hence the baryon Jeans scale. But that would suppress matter clustering at a fixed scale, not enhance it?
Looks far too large to be physical, effect of (inaccurate linear) reion temp change is very small. (though this is crazy small scale, not sure I've looked much beyond 500) Not sure what it is though...
Possibly forcing WantCls is causing minuscule time steps that are then numerically unstable?
Could be; setting AccuracyBoost=3 causes dverk to return the error "unable to satisfy the error requirement with a particular step-size that is less than or equal to hmin, which may mean that tol is too small", which does suggest this regime is near the boundary of numerical stability. Obviously this has no practical consequences, I was just surprised that WantCls has any impact on P(k) at all.
I think the difference comes from WantCl=F turning off reionization, so it really is just an effect of reionization on the growth via the sound speed. Obviously CAMB can't calculate reionization temperature/pressures reliably, but maybe what it is doing is a bit inconsistent as a baseline - i.e. it is using the non-reionization gas temperature (from recfast) but the ionization fraction including reionization (https://github.com/cmbant/CAMB/blob/master/fortran/results.f90#L1939). Changing these lines to use the ionization fraction without reionization I think removes the discrepancy - i.e. the sound speed is then exactly as it would have been without reionization (https://github.com/cmbant/CAMB/pull/180).
As shown in PR (https://github.com/cmbant/CAMB/pull/180), looks like the sound speed was going negative, which is why the sign of the effect is different to what we expected.
Hmm interesting! I guess it's because the matter temperature is going negative.