lesgourg / class_public

Public repository of the Cosmic Linear Anisotropy Solving System (master for the most recent version of the standard code; GW_CLASS to include Cosmic Gravitational Wave Background anisotropies; classnet branch for acceleration with neutral networks; ExoCLASS branch for exotic energy injection; class_matter branch for FFTlog)
230 stars 285 forks source link

`k_output_values` does not follow the gauge of computation #298

Open lingyuanji opened 4 years ago

lingyuanji commented 4 years ago

The mode evolutions obtained from k_output_values in the initial file do not follow the gauge of computation. No matter what gauge is specified in the initial file (i.e. newtonian or synchronous), the mode evolutions are always the same.

However, the transfer functions obtained from output = mTk appear to follow the gauge of computation. Moreover, when gauge = newtonian, the mode evolutions fromk_output_values at z = 0 are the same as the transfer function for all k. This seem to imply that no matter what gauge is set, k_output_values always follow newtonian gauge.

So what is the gauge of mode evolutions obtained using k_output_values?

tsmith2 commented 4 years ago

With help from Vivian Poulin I have figured out where this happens in the code: it is in the 'perturb_print_variables' and starts with the comment: "/ converting synchronous variables to newtonian ones /". By commenting this out you can get synchronous gauge mode evolution.

lingyuanji commented 4 years ago

Thanks for providing this workaround! But I think the desired behavior of the code probably is that all outputs should be consistent with gauge. So I will leave this issue open in case the developers would like to have it as a reminder.

anirbandas89 commented 2 years ago

I stumbled upon the same issue of gauge in k_output_values. I agree with @lingyuanji that the output should be consistent with the user input. I believe this can be fixed by simply changing "if (ppt->gauge == synchronous)" to "if (ppt->gauge == newtonian)" in the gauge transformation section.