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)
225 stars 282 forks source link

how to use CLP model #483

Open ming-jian opened 2 years ago

ming-jian commented 2 years ago

Hi, everyone, I want to use the Planck2018 and Pantheon datasets to constrain the CLP dark energy model with w = w0_fld + wa_fld*(1-a). I set w0_fld = -0.9, wa_fld = 0.0 in explanatory.ini and montepython/input/base2018TTTEEE.param, Pantheon.param

data.parameters['w0_fld'] = [0, None, None, 0, 1, 'derived'] data.parameters['wa_fld'] = [0, None, None, 0, 1, 'derived']

However, it stops!

Traceback (most recent call last): File "home/zhang/montepython/sampler.py", line 795, in compute_lkl data.get_mcmc_parameters(['derived']) File "classy.pyx", line 1962, in classy.Class.get_current_derived_parameters classy.CosmoSevereError:

Error in Class: w0_fld was not recognized as a derived parameter

Please help me how to modify the codes to use the CLP dark energy model?

Irine0s commented 2 years ago

Try to add a line data.cosmo_arguments['fluid_equation_of_state'] = 'CLP' to your .param.

ming-jian commented 2 years ago

Try to add a line data.cosmo_arguments['fluid_equation_of_state'] = 'CLP' to your .param.

Dr. Irine0s, Thanks very much for your help !

Kshitizpandey123 commented 6 months ago

How should I proceed if I want to implement a different dark energy model? Please help!

ming-jian commented 6 months ago

In the class_public-3.2.1/source/background.c: you should modify:

Line 680: w_fld = your CLP model; Line 715: dw_over_da_fld = derivative of your CLP model; Line 738: *integralfld = integral \f$ \int{a}^{a0} da 3(1+w_{fld})/a \f$ of your CLP model

make clean make

In montepython_public-3.6\montepython_public-3.6\input\your_model.param you should add:

data.parameters['w0_fld'] = [-1.0, -2, 0, 0.04, 1, 'cosmo'] data.parameters['wa_fld'] = [ 0.0, -3, 3, 0.01, 1, 'cosmo']

data.cosmo_arguments['fluid_equation_of_state'] = 'CLP' data.cosmo_arguments['Omega_Lambda'] = 0.0

Kshitizpandey123 commented 6 months ago

Thank you so much! I totally missed including data.cosmo_arguments['fluid_equation_of_state'] = 'CLP'

SukanB commented 2 months ago

Hello @Kshitizpandey123 @ming-jian @Irine0s , Thank you for your suggestions here. I am trying to implement my own model of w_fld. I have incorporated successfully "Line 680: w_fld = your CLP model; Line 715: dw_over_da_fld = derivative of your CLP model;". However, it is a complicated parametrisation and therefore I cannot put directly "Line 738: *integralfld = integral \f$ \int{a}^{a0} da 3(1+w_{fld})/a \f$".

I have taken the suggestion of the authors there and tried to evaluate the integral numerically $ \int_{aini}^{a0} da 3(1+w{fld})/a \f$", but the run is showing background error. "Error running background_init =>background_init(L:847) :error in background_solve(ppr,pba); =>background_solve(L:1972) :error in generic_evolver(background_derivs, loga_ini, loga_final, pvecback_integration, used_in_output, pba->bi_size, &bpaw, ppr->tol_background_integration, ppr->smallest_allowed_variation, background_timescale, ppr->background_integration_stepsize, pba->loga_table, pba->bt_size, background_sources, ((void *)0), pba->error_message); =>evolver_ndf15(L:466) :condition (absh <= hmin) is true; Step size too small: step:5.15779e-14, minimum:5.15779e-14, in interval: [-32.2362:0]"

Moreover, my w_fld depends on a parameter, that I will finally vary, and the numerical value of *integral_fld = thus depends on the value of the parameter. It will be really helpful if you have any suggestion on how to fix this.