FML
Main.cpp
Go to the documentation of this file.
1#include <FML/Math/Math.h>
4
9
10int main(){
11 const bool verbose = true;
12
13 //===================================================
14 // Define cosmological parameters and functions
15 // Cosmology functions E = H(x)/H0, x = log(a)
16 //===================================================
17 const double w0 = -1.0;
18 const double wa = 0.0;
19 const double mu0 = 0.0;
20 const double mua = 0.0;
21 const double OmegaM = 0.295;
22 const double OmegaLambda = 1-OmegaM;
23 const Func1 Eofx = [OmegaM,OmegaLambda,w0,wa](double x) -> double {
24 const double a = std::exp(x);
25 return std::sqrt( OmegaM * std::exp(-3.0*x) +
26 OmegaLambda * std::exp(3.0 * wa * (a - 1) - 3 * (1 + w0 + wa) * x));
27 };
28 const Func1 OmegaMofx = [OmegaM,Eofx](double x) -> double {
29 return OmegaM*std::exp(-3.0*x)/std::pow(Eofx(x),2);
30 };
31 const Func1 logEprimeofx = [OmegaM,OmegaLambda,w0,wa,Eofx](double x) -> double {
32 const double E = Eofx(x);
33 const double a = std::exp(x);
34 return 1.0 / (2.0 * E * E) * (-3.0 * OmegaM / (a * a * a) +
35 OmegaLambda * std::exp(3.0 * wa * (a - 1) - 3 * (1 + w0 + wa) * x) *
36 (3.0 * wa * a - 3.0 * (1 + w0 + wa)));
37 };
38 const Func1 muofx = [mu0,mua,Eofx](double x) -> double {
39 const double E = Eofx(x);
40 const double a = std::exp(x);
41 return 1.0 + (mu0+mua*(1.0-a)) / (E*E);
42 };
43 const Func1 wofx = [w0,wa](double x) -> double {
44 const double a = std::exp(x);
45 return w0 + wa*(1-a);
46 };
47
48 //===================================================
49 // Set up the spherical collapse model
50 //===================================================
52 Eofx,
53 OmegaMofx,
54 logEprimeofx,
55 muofx,
56 wofx);
57 scm.info();
58
59 //===================================================
60 // Fetch linear P(k,z=0)
61 //===================================================
62 const double pofk_normalization = 1.0;
63 std::string filename_pofk = "pofk_lin.txt";
64 const double xinputpofk = 0.0;
65 Spline logDelta_of_logk_spline;
67 filename_pofk,
68 logDelta_of_logk_spline,
69 pofk_normalization);
70
72
73 //===================================================
74 // Set up the halomodel
75 //===================================================
76 double z = 0.0;
77 bool hmcode = true;
78 std::string label = "testrun";
79 HaloModel hm(
80 scm,
81 logDelta_of_logk_spline,
82 xinputpofk,
83 hmcode,
84 verbose);
85 hm.verbose = true;
87
88 // Output to file
89 hm.output_pofk ( "pofk_" + label + "_z" + std::to_string(z) + ".txt");
90 hm.output_nofM ( "nofM_" + label + "_z" + std::to_string(z) + ".txt");
91 hm.output_deltac( "sph_" + label + "_z" + std::to_string(z) + ".txt");
92
93 hm.info();
94}
95
96
int main()
Definition: Main.cpp:5
FML::COSMOLOGY::SPHERICALCOLLAPSE::SphericalCollapseModel SphericalCollapseModel
Definition: Main.cpp:5
FML::COSMOLOGY::HALOMODEL::HaloModel HaloModel
Definition: Main.cpp:7
FML::COSMOLOGY::SPHERICALCOLLAPSE::Func1 Func1
Definition: Main.cpp:6
const double OmegaM
Definition: Main.cpp:65
Class for computing the standard halomodel predictions for plus or just doing spherical collapse.
Definition: Halomodel.h:62
void output_nofM(std::string filename, double Mmin=1e8, double Mmax=1e16, int npts_M=100) const
Definition: Halomodel.cpp:1080
void compute_at_redshift(double zcollapse)
Definition: Halomodel.cpp:752
void output_deltac(std::string filename, double zmin=0.0, double zmax=10.0, int npts_z=100) const
Definition: Halomodel.cpp:1038
void output_pofk(std::string filename, double kmin=1e-5, double kmax=100, int npts_k=1000) const
Definition: Halomodel.cpp:1110
The class contains all the info about the model needed to run the spherical collapse and halomodel Co...
This is a wrapper class for easy use of GSL splines It is (OpenMP) thread safe as long as splines are...
Definition: Spline.h:80
void read_pofk_file(const std::string filename_pofk, Spline &logDelta_of_logk_spline, double normalization, int col_k, int col_pofk)
Definition: Halomodel.cpp:61
std::function< double(double)> Func1
const double exp
Definition: Global.h:259
float wa
Definition: example.py:11
bool verbose
Definition: example.py:19
float mua
Definition: example.py:13
float z
Definition: example.py:56
float w0
Definition: example.py:10
bool hmcode
Definition: example.py:18
float mu0
Definition: example.py:12
x
Definition: test.py:18