CLASSpp Manual
Cosmology reference and developer manual
Loading...
Searching...
No Matches
constants.h
Go to the documentation of this file.
1
2#ifndef CLASS_CONSTANTS_H
3#define CLASS_CONSTANTS_H
4
5#include <cmath> // pow(), used by the Omega <-> T_cmb helpers below
6
7#define _PI_ 3.1415926535897932384626433832795e0
9#define _PIHALF_ 1.57079632679489661923132169164e0
11#define _TWOPI_ 6.283185307179586476925286766559e0
13#define _SQRT2_ 1.41421356237309504880168872421e0
15#define _SQRT6_ 2.4494897427831780981972840747059e0
17#define _SQRT_PI_ 1.77245385090551602729816748334e0
19#define _E_ \
20 2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003059921817413596629043572900334295260595630738132328627943490763233829880753195251019011573834187930702154089149934884167509244761460668082264800168477411853742345442437107539077744992069551702761838606261331384583000752044933826560297606737113200709328709127443747047230696977209310141692836819025515108657463772111252389784425056953696
27
28#define _Mpc_over_m_ 3.085677581282e22
29/* remark: CAMB uses 3.085678e22: good to know if you want to compare with high accuracy */
30
31#define _Gyr_over_Mpc_ \
32 3.06601394e2
34#define _c_ 2.99792458e8
35#define _G_ 6.67428e-11
36#define _eV_ 1.602176487e-19
38/* parameters entering in Stefan-Boltzmann constant sigma_B */
39#define _k_B_ 1.3806504e-23
40#define _h_P_ 6.62606896e-34
41/* remark: sigma_B = 2 pi^5 k_B^4 / (15h^3c^2) = 5.670400e-8
42 = Stefan-Boltzmann constant in W/m^2/K^4 = Kg/K^4/s^3 */
43
45
52inline double Omega0gFromTcmb(double T_cmb, double h) {
53 const double sigma_B = 2. * pow(_PI_, 5) * pow(_k_B_, 4) / 15. / pow(_h_P_, 3) / pow(_c_, 2);
54 return (4. * sigma_B / _c_ * pow(T_cmb, 4.)) /
55 (3. * _c_ * _c_ * 1.e10 * h * h / _Mpc_over_m_ / _Mpc_over_m_ / 8. / _PI_ / _G_);
56}
57
59inline double TcmbFromOmega0g(double Omega0_g, double h) {
60 const double sigma_B = 2. * pow(_PI_, 5) * pow(_k_B_, 4) / 15. / pow(_h_P_, 3) / pow(_c_, 2);
61 return pow(Omega0_g *
62 (3. * _c_ * _c_ * 1.e10 * h * h / _Mpc_over_m_ / _Mpc_over_m_ / 8. / _PI_ / _G_) /
63 (4. * sigma_B / _c_),
64 0.25);
65}
66
67#endif // CLASS_CONSTANTS_H
#define _c_
Definition constants.h:34
#define _G_
Definition constants.h:35
double TcmbFromOmega0g(double Omega0_g, double h)
Definition constants.h:59
double Omega0gFromTcmb(double T_cmb, double h)
Definition constants.h:52
#define _PI_
Definition constants.h:7
#define _Mpc_over_m_
Definition constants.h:28