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

code gets stuck with wildly fluctuating reionization histories #404

Open xiaohanzai opened 3 years ago

xiaohanzai commented 3 years ago

I'm trying to run some FlexKnot type of reionization histories (https://ui.adsabs.harvard.edu/abs/2018A%26A...617A..96M/abstract) with CLASS, using reio_inter. Since this kind of histories can very easily have wild ups and downs (e.g. Fig 2 of Millea & Bouchet), sometimes the code gets stuck and is not able to generate an EE power spectrum. I think the problem is more likely to occur when tau(z>15) is low, i.e. when the knots tend to pile up at z<15 and so the reionization histories may fluctuate wildly at z<15. I'm curious whether there is a way to get around this problem and let the code run successfully... Thanks a lot!

A brief summary of how I generate the reionization histories and run CLASS:

First randomly generate 5 knots with 6<z<30 and 0<electron fraction<1.08 and sort them. Then use PCHIP interpolation with these 5 knots and x_e(z=6)=1.08, x_e(z=30)=0 to get the full reionization history between z=6 and 30. Then I sample the reionization history with ~30 points, taking into account the locations of the knots so that the sampled reionization history has all the up and down features. Finally I use reio_inter in the parameter file and input the sampled reionization history to run CLASS.