Gong-Bo Zhao ICG, Portsmouth May, 2010 Play with CAMB/CosmoMC
Gong-Bo ZhaoICG, Portsmouth
May, 2010
Play with CAMB/CosmoMC
Why CAMB/CosmoMC?
2
Very efficientWell-structured (modulised) -- easy to
tweak and hackWell-supported – cosmocoffee.infoPopular – mainstream numeric tool in
cosmology
ICG PhD lectures May, 2010
This 4.5-hr course is to …
3
Show you how to run CAMB/CosmoMCLink CAMB equations to Ma&Bertschinger ‘96
Show several useful examples of hacking CAMB -- dynamical dark energy, modified gravity
Guide you how to modify CAMB/CosmoMC for your own research purpose
Show you useful numerical tricks extensively used in CAMB
ICG PhD lectures May, 2010
This course is not on …
4
Theory (see Kazuya, Rob and Cyril’s lectures)Fortran programming (See Numerical Recipe)
ICG PhD lectures May, 2010
Warming-ups
5
Download, compile and run CAMBcamb.infomake clean; make all./camb params.ini
Change model parameters in params.ini and make CMB, P(k) plots change cosmo. paramsadd neutrinosdo CMB lensingdo vector and tensor modescompare with Wayne Hu’s plots athttp://background.uchicago.edu/~whu/metaanim.html
ICG PhD lectures May, 2010
Analyze the code using “understand for fortran”
http://www.scitools.com/download/(choose the free 15-day trial version)
Look into the code…
Structure of CAMB
Messy? Not really!!
7 ICG PhD lectures May, 2010
Structure of CAMB
preparation
core
output results
8 ICG PhD lectures May, 2010
Structure of CAMB_GetResults
9 ICG PhD lectures May, 2010
Structure of CMBmain
10 ICG PhD lectures May, 2010
Structure of CMBmain
11 ICG PhD lectures May, 2010
CAMB language A,B,C
12€
Background : grho = 8πGρa2, adotoa =a'
a=
da /dτ
a, tau = conformal time
δT μν : dgrho = 8πGa2 ρ i
i
∑ δi, dgq = 8πGa2 (ρ i
i
∑ + pi)v i
clxc = δc, clxb = δb, clxq = δDE
δGμν : etak = ηk, z = h' /(2k), sigma =h'+6η '
2k
ICG PhD lectures May, 2010
CAMB vs. M+B ’96 astro-ph/9506072
€
η'k = dgq/2 η 'k 2 = 4πGa2(ρ + P )θ
clxcdot = − kz δ 'c = −1
2h'
z = (0.5dgrho/k +ηk)/adotoa k 2η −1
2
a'
ah' = 4πGa2δT0
0
sigma = z +1.5dgq/k 2 σ =h'+6η '
2k
Differential equations to evolve in CAMBDifferential equations to evolve in CAMB
Constraint equations (algebraic)Constraint equations (algebraic)
Hacking 1: Dynamical DE
14
Task: Default CAMB only works for constant w.
Modify it to implement the CPL parametrisa-tion, i.e. w(a)=w0+wa(1-a)
and calculate the luminosity distance, CMB and P(k) for a model of {-1.5, +(-)0.4}. Compare your spectra with that of the LCDM model.
ICG PhD lectures May, 2010
Start the game!
15
Spot the dark energy stuff in CAMBWe need w(a), dw/da, Int {[1+w(a)]dlna} Files to hack: equations.f90, inidriver.F90Subroutine/functions to hack: dtauda, fderivs, outputChange the background and the DE perturbation equations!!
ICG PhD lectures May, 2010
Background evolution
16
For constant w (default CAMB) grhoa2=grhoa2+grhov*a2**2For functional w (hacked) grhoa2=grhoa2+grhov*Funcofw(a,..)*a2
€
ρX = ρ X0 exp{−3
1
a
∫ [1+ w(a')]d ln a'}
ICG PhD lectures May, 2010
function Funcofw(a,deriv) implicit none real(dl) a, Funcofw, a0 real(dl) w0, wa integer deriv if (a .lt. 1.d-8) then a0 = 1.d-8 else a0 = a end if
if (deriv==0) then Funcofw = w0+wa*(1.d0-a0) else if (deriv ==1) then Funcofw = -wa*a0 else if (deriv ==2) then Funcofw = a0**(2.d0 - 3.d0*(1.d0+w0+wa))*exp(3.d0*wa*(a0-1.d0)) end if end function Funcofw
17 ICG PhD lectures May, 2010
Output
18
In inidriver.F90
open(unit=50,file=‘dL_SN.dat’) do i=1, 1000 zz(i)=1.7d0+dble(i-1)/dble(1000-1) write(50,'(100e15.6)') zz(i),
5*log10((1+zz(i)) & **2*AngularDiameterDistance(zz(i)))+25 end doclose(50)
ICG PhD lectures May, 2010
DE perturbation equations
20
ayprime(EV%w_ix)= -3*adotoa*(cs2_lam-Funcofw(a,0))*(clxq+3*adotoa*& (1+Funcofw(a,0))*vq/k) -(1+Funcofw(a,0))*k*vq -& (1+Funcofw(a,0))*k*z -3*adotoa*adotoa*Funcofw(a,1)*vq/k
ayprime(EV%w_ix+1) = -adotoa*(1-3*cs2_lam)*vq + k*cs2_lam*clxq/(1+Funcofw(a,0))
ICG PhD lectures May, 2010
21 ICG PhD lectures May, 2010
Output Dark Energy perturbation DE(), vDE() at k=10-3 Mpc-1
23
Note that in CAMB language DE = y(EV%w_ix) vDE = y(EV%w_ix+1)
Uncomment the stuff in cmbmain.f90,
EV%q=1.d-3; EV%q2=EV%q**2 tol1=tol/exp(AccuracyBoost-1) do j=1,6000 tauend = taustart * exp(j/6000._dl*log(CP%tau0/taustart)) call
GaugeInterface_EvolveScal(EV,tau,y,tauend,tol1,ind,c,w) write (*,’(4E15.5)') tauend,1/y(1)-1, y(EV%w_ix) ,y(EV
%w_ix+1) end do stop
ICG PhD lectures May, 2010
Weller and Lewis, 2003
Singularity?!
26
Output CMB Cl’s for the model w0=-1.5, wa=+1.0 to see what happens.
This singularity stems from the fact that w crosses -1. Technically, it’s due to the term of dw/dz/(1+w).
No-Go Theorem: The w for single fluid (scalar field) cannot cross -1 in GR! For proof, see Appendix of astro-ph/0703202.
Solution: astro-ph/0507482 (quintom scenario),
or arXiv:0808.3125 (PPF implementation) ICG PhD lectures May, 2010
27 ICG PhD lectures May, 2010
29 ICG PhD lectures May, 2010
Generalize our hacked code to make it work for an
arbitrary w(z).
One further step?
Leave it to you guys to play with it for fun!!
Hacking 2: TO BE OR NOT TO BE ??-- MODIFY CAMB TO WORK IN MODIFIED GRAVITY
31
Task
Default CAMB only works in GR. Modify it to implement MG. Reproduce the plots on my website.
http://userweb.port.ac.uk/~zhaog/MGCAMB.html
ICG PhD lectures May, 2010
Universe is Accelerating
Scalar-tensor gravity(e.g. Chameleon, f(R)…)
DGP, Degravitation
…
32
Dark Matter
Atoms
€
Λ ?!
Indistinguishable at the background levelNeed to study the structure growth to break the degeneracy
Linear perturbation in FRW universe
33
General RelativityModified Gravity
What to do technically?
34
Given (a,k) and (a,k)we need to solve
k2(a,k) 4G a2(a,k)
in the synchronous gauge, which is used in CAMB.Note that
ICG PhD lectures May, 2010
35 ICG PhD lectures May, 2010
So we have
Finally, we have (for details, see Appendix of 0809.3791),
36
Note that in default CAMB, overdensity for different speciesand metric perturbation in synchronous gauge are actually evolved, and other Einstein equations are used as constraint equations (see this slide).
In MG, we need to evolve and and get from constraint equations.
To add one more variable to evolve in CAMB, we need to define it, set initial condition for it, and change fderivs and output properly.
See how to modify the code in the lecture.
ICG PhD lectures May, 2010
37 ICG PhD lectures May, 2010
€
μ(a,k) =1+ α 1k
2as
1+ α 2k2as
, γ(a,k) =1+ β1k
2as
1+ β 2k2as
38 ICG PhD lectures May, 2010
Fit your own parameters using CosmoMC
39
CosmoMC fits your model parameters to data by exploring the parameter space in a smart way (Metropolis-Hastings algorithm). It calls CAMB to calculate the theoretical spectra of a model, and compare to data.
ICG PhD lectures May, 2010
How to add your own parameter to CosmoMC?
40
Tell CosmoMC your parameters’ names in CMB_Cls_simple.f90
Define them in cmbtype.f90Map them in params_CMB.f90Change the # of parameters in settings.f90Done!!See the example in the lecture!!
ICG PhD lectures May, 2010
41 ICG PhD lectures May, 2010
Astro-ph/0511625
Useful references
42
Camb.info; cosmologist.info/cosmomc/Cosmocoffee.infoM+B: astro-ph/9506072Jussi’s ICG lectures: www.icg.port.ac.uk/~valiviij/Numerical Recipe: www.nr.comPlotting software: OriginPro, Matlab, IDL, gnuplot
ICG PhD lectures May, 2010
Have fun!!
43 ICG PhD lectures May, 2010