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)
234 stars 290 forks source link

Problem with a background fluid with w->0 at early times #305

Open deltasata opened 4 years ago

deltasata commented 4 years ago

In the dark sector I am adding an extra fluid which behaves like CDM (w_fld -> 0 as z>>0) at early times. The sound speed for this fluid is set to 1 (no clustering). I changed CLASS correctly and background calculation matches well with analytical solutions. However, I am getting an error from the perturbation.c: Error in perturb_init =>perturb_init(L:547) :condition (w_fld_ini >= 0.) is true; The fluid is meant to be negligible at early time, and unimportant for defining the initial conditions of other species. You are using parameters for which this assumption may break down, since at early times you have w_fld(a--->0) = 0.000000e+00 >= 0

When I set cs2_fld = 1 I expect the fluid has no contribution in perturbation calculations other than simply changing the background expansion. Why this error is placed there?

If I simply change the perturbation.c file (line 545) as: class_test(w_fld_ini >= 0., ........ to

class_test(w_fld_ini >0., ........ the error goes away, but would this change cause any problem, either in computation or in physics part? As expected I want to use it with montepython.

Thanks in advance.

Nandancosmos commented 3 years ago

Hi, I am having the same problem. Have you found some fix to it?

ThomasTram commented 3 years ago

Hi

Yes, this error is there for a reason: if w=0 when imposing initial conditions, one needs to be careful. First, rho_fld should be added to rho_m in the beginning of perturb_initial_conditions(). Then, inside the if (pba->use_ppf == _FALSE_) { you should work out if the initial conditions still hold.

I will not guarantee that this is the only things you need to do, you need to check for yourselves :)

Cheers, Thomas