I'd like to ask how one should modify equations.f90 file in CAMB to add new features and species in general cases.
when I modify CAMB and add new species, I follow this recipe but it seems that there's a case that I can't get the result that I want.
But I'm not sure these steps are right as I'm using CAMB after a too long time.
So I'd like to check them just in case.
Could you please let me know if there is anything wrong with the steps?
- This is how I modify 'equation.f90' file
1. add new indexes for additional equations in module 'GaugeInterface,' line 43,44 like the following:
(note that all the line number here is based on the original file, not the modified one)
Code: Select all
integer, parameter :: basic_num_eqns = 6 ! originally 4 ! line 43
integer, parameter :: ix_etak=1, ix_clxc=2, ix_clxb=3, ix_vb=4, ix_new_one=5, ix_new_two=6 !Scalar array indices for each quantity
! ix_new_one and ix_new_two are the new species
i) after the line 1769,
Code: Select all
integer, parameter :: i_clxg=1,i_clxr=2,i_clxc=3, i_clxb=4, &
i_qg=5,i_qr=6,i_vb=7,i_pir=8, i_eta=9, i_aj3r=10,i_clxde=11,i_vde=12, & ! line 1769
i_new_one=13, i_new_two=14
Code: Select all
initv(1,i_eta)=-chi*2*EV%Kf(1)*(1 - x2/12*(-10._dl/Rp15 + EV%Kf(1))) ! line 1856
initv(1,i_new_one)=(###corresponding IC###)
initv(1,i_new_two)=(###corresponding IC###)
Code: Select all
! Baryons
y(ix_clxb)=InitVec(i_clxb)
y(ix_vb)=InitVec(i_vb) !line 1927
! new species
y(ix_new_one)=InitVec(i_new_one)
y(ix_new_two)=InitVec(i_new_two)
i) first, after the line 2176, add the variables
Code: Select all
real(dl) dgrho_de, dgq_de, cs2_de ! line 2176
real(dl) new_one, new_two ! new species
real(dl) new_var ! new variable
new_var=CP%new_var ! read input from inifile
Code: Select all
! Baryon variables
clxb=ay(ix_clxb)
vb=ay(ix_vb) ! line 2196
! new species
new_one=ay(ix_new_one)
new_two=ay(ix_new_two)
! first CDM, baryon, and then add new species following the order defined in line 44
Code: Select all
! Baryon equation of motion.
clxbdot=-k*(z+vb)
ayprime(ix_clxb)=clxbdot ! line 2311
! new species equation
new_one = (###new equation###)
new_two = (###new equation###)
! first CDM, baryon, and then add new species following the order defined in line 44
Plus, is this order mandatory in CAMB code?)
iv) add other features you want to add in:
for example,
Code: Select all
! 8*pi*a*a*SUM[rho_i*clx_i] - radiation terms
dgrho=dgrho + grhog_t*clxg+grhor_t*clxr + new_one/a ! line 2272
Code: Select all
! CDM equation of motion
clxcdot=-k*z
ayprime(ix_clxc)=clxcdot - k*new_one/new_two ! line 2307
(p.s. I note that this question is originally a subquestion of this question(viewtopic.php?f=11&t=3495).
I wrote my post too briefly and I thought I should explain more in detail to provide information to others so that someone may answer my post.
However, it seems to me that this question is worth treating another independent question so that others may refer to this post when modifying CAMB, and hence I write the question as a general one.)