cloudy
trunk
Loading...
Searching...
No Matches
source
cosmology.cpp
Go to the documentation of this file.
1
/* This file is part of Cloudy and is copyright (C)1978-2013 by Gary J. Ferland and
2
* others. For conditions of distribution and use see copyright notice in license.txt */
3
/*ParseCosmology parse cosmological parameters and options */
4
#include "
cddefines.h
"
5
#include "
radius.h
"
6
#include "
rfield.h
"
7
#include "
parse.h
"
8
#include "
physconst.h
"
9
#include "
cosmology.h
"
10
11
t_cosmology
cosmology
;
12
13
realnum
GetHubbleFactor
(
realnum
z)
14
{
15
realnum
H_z, H_z_squared;
16
17
DEBUG_ENTRY
(
"GetHubbleFactor()"
);
18
19
/* NB - the factor of (1e5/MEGAPARSEC) converts from km/s/Mpc to km/s/km */
20
H_z_squared =
POW2
(
cosmology
.H_0 * (
realnum
)(1e5/
MEGAPARSEC
)) * (
21
cosmology
.omega_lambda +
22
cosmology
.omega_matter *
POW3
( 1.f + z ) +
23
cosmology
.omega_rad *
POW4
( 1.f + z ) +
24
cosmology
.omega_k *
POW2
( 1.f + z ) );
25
26
H_z = sqrt( H_z_squared );
27
28
return
H_z;
29
}
30
31
realnum
GetDensity
(
realnum
z)
32
{
33
realnum
density;
34
35
DEBUG_ENTRY
(
"GetHubbleFactor()"
);
36
37
fixit
();
// this should be abund.aprim[1] by default, but controlled by command line option
38
cosmology
.f_He = 0.079f;
39
40
/* from Switzer & Hirata 2007, equation 2 */
41
density = 1.123e-5f * (
cosmology
.omega_baryon*
cosmology
.h*
cosmology
.h) / (1.f + 3.9715f*
cosmology
.f_He) *
42
pow( 1.f + z, (
realnum
)3.f );
43
44
return
density;
45
}
cddefines.h
POW3
#define POW3
Definition
cddefines.h:936
POW2
#define POW2
Definition
cddefines.h:929
realnum
float realnum
Definition
cddefines.h:103
POW4
#define POW4
Definition
cddefines.h:943
DEBUG_ENTRY
#define DEBUG_ENTRY(funcname)
Definition
cddefines.h:684
fixit
void fixit(void)
Definition
service.cpp:991
cosmology
t_cosmology cosmology
Definition
cosmology.cpp:11
GetHubbleFactor
realnum GetHubbleFactor(realnum z)
Definition
cosmology.cpp:13
GetDensity
realnum GetDensity(realnum z)
Definition
cosmology.cpp:31
cosmology.h
parse.h
physconst.h
MEGAPARSEC
UNUSED const double MEGAPARSEC
Definition
physconst.h:141
radius.h
rfield.h
t_cosmology
Definition
cosmology.h:23
Generated by
1.14.0