CAMB: upper limit for k_max?

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Post Reply
Tessa Baker
Posts: 2
Joined: September 30 2010
Affiliation: University of Oxford

CAMB: upper limit for k_max?

Post by Tessa Baker » November 15 2010

Hi,

I'm running a modified version of CAMB that has been producing some unexpected results at high k-values. To debug this I've experimented with increasing k_max in params.ini, which makes things look even worse. At really high k_max values (~20,000) the power spectra go haywire, but it really looks like numerical error.

I'm wondering if I've exceeded some maximum value of k for the stored Bessel functions. Does anyone know of such a k_max limit above which CAMB becomes unreliable?

Thanks,

Tessa Baker

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

Re: CAMB: upper limit for k_max?

Post by Antony Lewis » November 15 2010

I'll assume you are looking at output C_L (rather than the transfer function or matter power spectrum) and changing the k_eta_max_scalar parameter (which is [tex]k\times \eta_0\sim14000 k[/tex], not k).

The Bessel functions are generated on the fly to for the required range, so the maximum limit is not an issue (though accuracy may be).

However once you go well outside default settings you can expect to see problems, and should always check for stability to changing accuracy parameters (mosty accuracy_boost). For C_L the contributions from very high k are tiny, but you are going to have large numbers of highly oscillatory cancelling integrals that are very hard to calculate accurately numerically. For any standard calculation you never need to go anywhere near that high, even for CMB lensing (except conceivably B modes at very high precision).

You could make a plot of the spectrum as a function of k_eta_max_scalar if you want to check where the result is well converged but not giving large numerical errors. It should converge around k_eta_max_scalar=2 l_max_scalar, which is the default.

Tessa Baker
Posts: 2
Joined: September 30 2010
Affiliation: University of Oxford

CAMB: upper limit for k_max?

Post by Tessa Baker » November 16 2010

I realise I'm using extremely high k-values. I started increasing k_eta_max just to test my results, and was surprised to find that it had a large effect. The strange thing is that boosting the accuracy only makes the problem worse.

However, it does sound like these highly oscillatory integrals might still be the cause. Thanks very much for your help!

Post Reply