CAMB v 1.1.3 - init_backgrounds subroutine

Use of Healpix, camb, CLASS, cosmomc, compilers, etc.
Post Reply
vivian sabla
Posts: 7
Joined: July 24 2019
Affiliation: Dartmouth College

CAMB v 1.1.3 - init_backgrounds subroutine

Post by vivian sabla » August 13 2020

Hi All,

I was wondering if anyone knew where to call the 'init_backgrounds' subroutine in CAMB_v1.1.3 in order to define new density components prior to the evolution of the background. In CAMB_v0, init_background was called when the other background parameters (grho...) are set in the ModelParams module. However, in CAMB_v1.1.3, init_backgrounds is never called and if you put it in by hand in the SetParams subroutine in results.f90 there are issues with referencing the standard background densities within the init_background subroutine.

Does anyone know where init_background should be called in CAMB_v1.1.3?

Thanks,
Vivian

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

Re: CAMB v 1.1.3 - init_backgrounds subroutine

Post by Antony Lewis » August 13 2020

init_backgrounds should be deleted, seems to be a relic. You'd probably want to add a call to your inialization code in CAMBdata_SetParams, at a suitable location depending on what if anything else it depends on. This is where the dark energy model etc are initialized. (if you are adding a dark energy component, just define a new DarkEnergy class instead).

vivian sabla
Posts: 7
Joined: July 24 2019
Affiliation: Dartmouth College

Re: CAMB v 1.1.3 - init_backgrounds subroutine

Post by vivian sabla » August 20 2020

Hi Antony,

Thank you for your response! I am attempting to do that now but I am running into an issue with calling the parameters that are set in CAMBdata_SetParams when I try to initialize my new parameters. Basically the way I initialize my new parameters is by evolving the background simultaneously with my components to create an array of density values versus scale factor. I call the numerical integration just after the Dark energy model is initialized in CAMBdata_SetParams. The subroutines for my numerical integration are defined in the results module and that is fine but I get a SIGSEGV error once I try to reference the "grho" parameters that are set in CAMBdata_SetParams. I think my error is with how I am referencing these grho parameters in my new subroutines.

How do you properly reference these parameters?

Thanks,
Vivian

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

Re: CAMB v 1.1.3 - init_backgrounds subroutine

Post by Antony Lewis » August 20 2020

grho parameters should be member of the current CAMBdata instance, if accessing them is giving an error you probably have a problem passing around your CAMBdata instance.

vivian sabla
Posts: 7
Joined: July 24 2019
Affiliation: Dartmouth College

Re: CAMB v 1.1.3 - init_backgrounds subroutine

Post by vivian sabla » August 20 2020

Code: Select all

 
 subroutine myderivs(this,n,x,fy,fyprime)
        use constants
        type(CAMBdata), intent(in) :: this 
        real(dl) OmegaR
        
        OmegaR = (this%grhog+this%grhornomass)/this%grhocrit
This is how I am passing CAMBdata to my subroutine. Could you explain what the correct way to call it is? This subroutine is called in CAMBdata_SetParams right after the dark energy is initialized.

Thank you for all your help!

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

Re: CAMB v 1.1.3 - init_backgrounds subroutine

Post by Antony Lewis » August 21 2020

If myderivs is part of the CAMBdata class this should be class(CAMBdata). If not, make sure it is in a module not an external function so the correct interface is known when called. Otherwise should be OK.

Post Reply