Closed emiliobellini closed 2 years ago
Indeed, this was annoying! We also saw it recently, and this will be fixed in the minor release 3.1.2 due this afternoon. Thanks for noticing!
Now, the values of ppt->k_max_for_pk
and ppr->nonlinear_min_k_max
will be kept separate in the code. This allows another change: the function .get_pk_and_k_and_z() will return the P(k) only up to ppt->k_max_for_pk, and not up to the MAX(,) of the previous two numbers. It makes more sense this way. Thanks for noticing!
Fantastic!
Hi all, in the latest version of Class (after 2.9) there is a minor bug with the value of "k_max_for_pk" when you ask for nonlinear spectra.
Basically, whenever the user specify P_k_max_1/Mpc or P_k_max_h/Mpc, this value overwrites the "nonlinear_min_k_max" value.
This is beacuse k_max is first inferred in the input_read_parameters_nonlinear function, and only after that the parameters P_k_max_1/Mpc and P_k_max_h/Mpc are read in input_read_parameters_spectra.
A clean and quick workaround is to replace if (flag1 == TRUE){ ppt->k_max_for_pk=param1*pba->h; } if (flag2 == TRUE){ ppt->k_max_for_pk=param2; }
with if (flag1 == TRUE){ ppt->k_max_for_pk=MAX(ppt->k_max_for_pk,param1*pba->h); } if (flag2 == TRUE){ ppt->k_max_for_pk=MAX(ppt->k_max_for_pk,param2); }
Unless you want to read P_k_max_h/Mpc in input_read_parameters_nonlinear or even in input_read_parameters_general (it could make sense to have there the initial scale factor, together with k_min and k_max, but this depends on you)
Cheers, Emilio