CAMB/Cobaya: modifications with dark energy background

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Post Reply
Zhuangfei Wang
Posts: 27
Joined: October 09 2021
Affiliation: Simon Fraser University

CAMB/Cobaya: modifications with dark energy background

Post by Zhuangfei Wang » August 19 2022

Hello:

I am trying to implement a new way of computing dark energy background using the reconstruction method, basically to get grhov_t and gpresv_t in CAMB using a new subroutine, say 'MGCAMB_DarkEnergy', and then the function 'dtauda' in equations.f90 will need to call it to get alternative calculation of background dark energy part. This method requires filling in some arrays from some new parameters that are read in from .ini files in advance, and this filling procedure is called subroutine 'reconstruction_arr' in my code. Therefore, I am having a question on where I should put this subroutine 'reconstruction_arr' in CAMB so that it will be executed before dtauda. At first, I thought about putting it in subroutine cmbmain and outside the loops for wavenumber and time, but found out that function dtauda is actually called eariler than cmbmain so the code would break down, which was kind of surprising to me because dtauda should be executed in a loop of time, which should be a very internal procedure. Then later I put it('reconstruction_arr') within subroutine 'CAMB_GetResults' in camb.f90, and then it worked. (Although it may not be the best location to be set)

However, when I use the same modified CAMB with Cobaya, it looks like the procedure 'reconstruction_arr' wasn't actually executed and the run failed. Is it because subroutine 'CAMB_GetResults' is not called by Cobaya directly? If so, is there any suggestion on a better place to put the procedure 'reconstruction_arr', so that is it executed eariler than dtauda in equations.f90, but still seen and called by Cobaya to make the code work? FYI, the modified camb works for Cobaya without this new implementation of dark energy, so the reading and exposing of the new parameters should be OK, and the problem should be only related to the procedure 'reconstruction_arr'.

Sorry that the question might be long and so specific. Many thanks for your help in advance.

Zhuangfei

Antony Lewis
Posts: 1872
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

Re: CAMB/Cobaya: modifications with dark energy background

Post by Antony Lewis » August 20 2022

You can inherit from the provided dark energy classes and use the _ReadParam method to load settings and _Init to initialize before running.

Zhuangfei Wang
Posts: 27
Joined: October 09 2021
Affiliation: Simon Fraser University

Re: CAMB/Cobaya: modifications with dark energy background

Post by Zhuangfei Wang » August 23 2022

Thanks Antony!

Zhuangfei

Luis Escamilla
Posts: 1
Joined: February 13 2023
Affiliation: ICF-UNAM

Re: CAMB/Cobaya: modifications with dark energy background

Post by Luis Escamilla » February 13 2023

Hi Antony and Zhuangfei!

I am having the same problem, I modified the DarkEnergyInterface.f90 and when using CAMB_GetResults it works, but not with Cobaya. Can you elaborate more with the solution? It's just that I am quite new with Cobaya and I do not know how to inherit from other Dark Energy classes, how to use the _ReadParam method and how to use _Init to initialize before running.

Sorry if my question seems simple.

Thanks in advance!
L. Escamilla

Post Reply