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

New fluid #425

Open SafaeCosmology opened 3 years ago

SafaeCosmology commented 3 years ago

Hi all, I tried to add a new fluid with a new equation of state (like CLP and EDE), but I get the following error:

_Computing sources Error in perturb_init =>perturb_init(L:564) :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 wfld(a--->0) = 0.000000e+00 >= 0

if anyone can help me, thank you in advance.

lesgourg commented 3 years ago

Hi @SafaeCosmology! In this case, I think that the error message is explicit. It seems that your new fluid has w(a-->0)=0. So, at early times, it behaves as matter, and it has a background density which is probably not negligible with respect to that of baryons and cdm. CLASS assumes by default that you are not in such a case. For a wide class of fluids with w(0)<0, the initial density of the fluid is negligible w.r.t baryons, cdm, photons and neutrinos. Then, the initial conditions for the fluid are not very relevant. CLASS fixes them using the attractor solution for dark energy detailed in a paper by Ballesteros & Lesgourgues [1004.5509]. Even if these do not exactly apply in a given model, it does not matter, because the fluid will be attracted towards its attractor solution anyway, and the initial conditions for baryons, cdm, photons, neutrinos will be independent of the fluid. But in your case, this is probably not true. Then, the adiabatic initial conditions for baryons, cdm, photons, neutrinos and the fluid need to be derived altogether, reproducing calculations like in Ma & Berschinger, but with one more species involved.(Looking at 1004.5509 may also help? Maybe also 1012.0569 if you want to go second order?). You should then properly do the math, then implement the new ICs in the function perturbations_initial_conditions(), and then you can safely comment out the test that produced the above error message. Or, if you are sure that in your model these ICs for the fluid do not matter, just comment out the test and rerun. This test is just a safeguard. Then you will see if the code works or complains about equations impossible to solve. If it does, the ICs are probably the problem.

SafaeCosmology commented 3 years ago

Thank you very much sir for your help.

Kshitizpandey123 commented 5 months ago

To add a new fluid do we just add the new dark energy e.o.s as a new case in the background_w_fld()? What other places do we need to modify?

If not, what do I need to do to analyze the CMB data in the light of a new Dark Energy model? Pls help!