-
Notifications
You must be signed in to change notification settings - Fork 0
/
BoltzmannSolver.jl
79 lines (73 loc) · 2.48 KB
/
BoltzmannSolver.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
"""
Initializeclassy(cosmo::w0waCDMCosmology)
This function, given a [`w0waCDMCosmology`](@ref), returns the
[`classyParams`](@ref) correctly initialized.
"""
function Initializeclassy(cosmo::w0waCDMCosmology)
classyParamsDict = Dict("output" => "mPk",
"non linear"=> "halofit",
"Omega_b"=> cosmo.ΩB,
"Omega_cdm"=> cosmo.ΩM-cosmo.ΩB-
cosmo.Mν/(93.14*(cosmo.H0/100)^2),
"N_ur"=> 2.0328,
"h"=> cosmo.H0/100.,
"sigma8" => cosmo.σ8,
"n_s" => cosmo.ns,
"m_ncdm" => cosmo.Mν,
"P_k_max_1/Mpc" => 50.,
"z_max_pk" => 5.,
"use_ppf" => "yes",
"w0_fld" => cosmo.w0,
"Omega_k" => cosmo.Ωk,
"Omega_fld" => cosmo.ΩDE,
"wa_fld" => cosmo.wa,
"cs2_fld" => 1.,
"N_ncdm" => 1,
"tau_reio" => 0.058)
classyparams = classyParams(classyParamsDict = classyParamsDict)
return classyparams
end
function Initializeclassy(Flatw0waCDMCosmology::Flatw0waCDMCosmology)
classyParamsDict = Dict("output" => "mPk",
"non linear"=> "halofit",
"Omega_b"=> Flatw0waCDMCosmology.ΩB,
"Omega_cdm"=> Flatw0waCDMCosmology.ΩM-Flatw0waCDMCosmology.ΩB-
Flatw0waCDMCosmology.Mν/(93.14*(Flatw0waCDMCosmology.H0/100)^2),
"N_ur"=> 2.0328,
"h"=> Flatw0waCDMCosmology.H0/100.,
"sigma8" => Flatw0waCDMCosmology.σ8,
"n_s" => Flatw0waCDMCosmology.ns,
"m_ncdm" => Flatw0waCDMCosmology.Mν,
"P_k_max_1/Mpc" => 50.,
"z_max_pk" => 5.,
"use_ppf" => "yes",
"w0_fld" => Flatw0waCDMCosmology.w0,
"Omega_k" => 0,
"Omega_fld" => 1-Flatw0waCDMCosmology.ΩM,
"wa_fld" => Flatw0waCDMCosmology.wa,
"cs2_fld" => 1.,
"N_ncdm" => 1,
"tau_reio" => 0.058)
classyparams = classyParams(classyParamsDict = classyParamsDict)
return classyparams
end
"""
EvaluatePowerSpectrum!(classyParams:: classyParams, cosmogrid::CosmologicalGrid,
pmm::PowerSpectrum)
This function runs classy to evaluate the Matter Power Spectrum over the ``k-z``
grid specified in [`CosmologicalGrid`](@ref)
"""
function EvaluatePowerSpectrum!(classyParams:: classyParams,
cosmogrid::CosmologicalGrid, pmm::PowerSpectrum)
cosmo = classy.Class()
cosmo.set(classyParams.classyParamsDict)
cosmo.compute()
for (idxz, myz) in enumerate(cosmogrid.ZArray)
for (idxk, myk) in enumerate(cosmogrid.KArray)
pmm.PowerSpectrumLinArray[idxk, idxz] =
cosmo.pk_lin(myk, myz)
pmm.PowerSpectrumNonlinArray[idxk, idxz] =
cosmo.pk(myk, myz)
end
end
end