Hi,
Seems I managed an "in the middle solution". When using CAMB only, the tabulated option works well and the subroutines/functions called are in the order:
DarkEnergy_ReadParams(Ini)
wde
............................
init_background
dtauda
grho_de
dtauda
grho_de
..........................
(And so on) There are more specifications in between, but this is enough to see the problem.
Now, while running in CosmoMC, the routines called are:
init_background
dtauda
grho_de
ERROR STOP: bad xa input in splint
So, what happens is that while trying to run with CosmoMC, the file with the data is never read, nor is there a call to wde to assign the data file to the arrays used by the program. That's why when dtauda calls grho_de, who in turns calls wde with all the values zero and later calls cubicsplint, it gives the "bad xa in splint error":
h = xa(khi) - xa(klo) = 0
if (h.eq.0) stop 'bad xa input in splint'
What I tried to do first is to add calls in init_background to the subroutine DarkEnergy_ReadParams(Ini) but this was very troublesome, seems like I am not handling the Ini type correctly. Then I tried to open the file with another number inside init_background but it turned very, very slow. So I modify in this way:
subroutine init_background
use LambdaGeneral
is_cosmological_constant = .not. use_tabulated_w .and. wlam==−1_dl .and. wa_ppf==0._dl
appf(1) = .1
nw_ppf=0
do i=1,nwmax−1
appf(i+1) = appf(i) + .1
wppf(i) = wlam+wa_ppf*(1 - appf(i))
appf(i)=dlog(appf(i))
enddo
call setddwa
call interpolrde
cs2_lam = 1
call setcgammappf
end subroutine init_background
So what I've got is that even if I have the option use_tabulated_w as True, I am not reading from a file but I am filling the needed arrays from an equation of state (this was a test run, only ten elements in the array and I am using a different equation of state but that does not matter).
So now, while running with CosmoMC it does:
init_background (plus reads the arrays with the needed information)
dtauda
grho_de
.................
(And so on)
The error "bad xa in splint" doesn't appear anymore because when cubicsplint is called it actually has values different from zero. I Have done short test runs with this modification in CosmoMC and runs fine.
On another note, it seems a bit strange that while choosing use_w_tabulated as False, the results of CAMB seem to be independent of the equation of state, you can assign anything to wde in the function wde (I am talking about the original version of equations_ppf.f90 included in the latest versions of the program) and the results are the same. This option does run in CosmoMC but I find it a bit worrying. However, the changes to init_background kind of merge together both cases: you specify your equation of state but you bild an array with it.
CosmoMC: Problem with adding new parameters
-
- Posts: 13
- Joined: July 25 2013
- Affiliation: ROE at University of Edinburgh