cloudy
trunk
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
source
cosmology.cpp
Go to the documentation of this file.
1
/* This file is part of Cloudy and is copyright (C)1978-2022 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 "
physconst.h
"
6
#include "
cosmology.h
"
7
8
t_cosmology
cosmology
;
9
10
realnum
GetHubbleFactor
(
realnum
z)
11
{
12
realnum
H_z, H_z_squared;
13
14
DEBUG_ENTRY
(
"GetHubbleFactor()"
);
15
16
/* NB - the factor of (1e5/MEGAPARSEC) converts from km/s/Mpc to km/s/km */
17
H_z_squared =
POW2
(cosmology.
H_0
* (
realnum
)(1e5/MEGAPARSEC)) * (
18
cosmology.
omega_lambda
+
19
cosmology.
omega_matter
*
POW3
( 1.f + z ) +
20
cosmology.
omega_rad
*
POW4
( 1.f + z ) +
21
cosmology.
omega_k
*
POW2
( 1.f + z ) );
22
23
H_z = sqrt( H_z_squared );
24
25
return
H_z;
26
}
27
28
realnum
GetDensity
(
realnum
z)
29
{
30
realnum
density
;
31
32
DEBUG_ENTRY
(
"GetDensity()"
);
33
34
fixit
(
"Cosmological He fraction should be abund.aprim[1] by default, but controlled by command line option"
);
35
cosmology.
f_He
= 0.079f;
36
37
/* from Switzer & Hirata 2007, equation 2 */
38
density = 1.123e-5f * (cosmology.
omega_baryon
*cosmology.
h
*cosmology.
h
) / (1.f + 3.9715f*cosmology.
f_He
) *
39
pow3
( 1.f + z );
40
41
return
density
;
42
}
GetDensity
realnum GetDensity(realnum z)
Definition:
cosmology.cpp:28
t_cosmology::h
realnum h
Definition:
cosmology.h:38
t_cosmology
Definition:
cosmology.h:23
cosmology.h
pow3
T pow3(T a)
Definition:
cddefines.h:988
t_cosmology::H_0
realnum H_0
Definition:
cosmology.h:38
POW2
#define POW2
Definition:
cddefines.h:979
t_cosmology::f_He
realnum f_He
Definition:
cosmology.h:42
realnum
float realnum
Definition:
cddefines.h:124
t_cosmology::omega_baryon
realnum omega_baryon
Definition:
cosmology.h:31
t_cosmology::omega_lambda
realnum omega_lambda
Definition:
cosmology.h:31
t_cosmology::omega_k
realnum omega_k
Definition:
cosmology.h:31
density
double density(const genericState &gs)
Definition:
generic_state.cpp:27
cddefines.h
DEBUG_ENTRY
#define DEBUG_ENTRY(funcname)
Definition:
cddefines.h:723
cosmology
t_cosmology cosmology
Definition:
cosmology.cpp:8
t_cosmology::omega_rad
realnum omega_rad
Definition:
cosmology.h:31
GetHubbleFactor
realnum GetHubbleFactor(realnum z)
Definition:
cosmology.cpp:10
fixit
#define fixit(a)
Definition:
cddefines.h:417
physconst.h
POW3
#define POW3
Definition:
cddefines.h:986
t_cosmology::omega_matter
realnum omega_matter
Definition:
cosmology.h:31
POW4
#define POW4
Definition:
cddefines.h:993
Generated by
1.8.5