cloudy trunk
Loading...
Searching...
No Matches
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
12
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
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}
#define POW3
Definition cddefines.h:936
#define POW2
Definition cddefines.h:929
float realnum
Definition cddefines.h:103
#define POW4
Definition cddefines.h:943
#define DEBUG_ENTRY(funcname)
Definition cddefines.h:684
void fixit(void)
Definition service.cpp:991
t_cosmology cosmology
Definition cosmology.cpp:11
realnum GetHubbleFactor(realnum z)
Definition cosmology.cpp:13
realnum GetDensity(realnum z)
Definition cosmology.cpp:31
UNUSED const double MEGAPARSEC
Definition physconst.h:141