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)
220 stars 291 forks source link

Primordial bug fix #514

Open Jobilthomas opened 1 year ago

Jobilthomas commented 1 year ago

This is a bug fix for 'int primordial_inflation_find_phi_pivot' from primordial.c.

Errors

In the case epsilon<1 that starts from line 2853 target, aH_ratio_after_small_epsilon and a_ratio_after_small_epsilon have their value zero from their initialization.

phi_small_epsilon corresponding to small_epsilon(0.1) hasn't been found for the case epsilon<1.

Since we intend to find phi corresponding to small_epsilon, the 'if' condition of line 2576 has to be
'epsilon > ppr->primordial_inflation_small_epsilon' instead of 'epsilon > 1'.

Fixes

Since everything from line 2596 to 2849 is common for both 'epsilon>o.1' and 'epsilon<0.1', I took these parts out of 'if' condition.

Added code to find phi_left and phi_right for 'epsilon<0.1' (which is 'else' of the if condition) just after line 2593.

Removed everything from line 2853 to 3044 as the purpose of this part is already taken care of when we made line 2596 to 2849 common.