00001 /* This file is part of Cloudy and is copyright (C)1978-2013 by Gary J. Ferland and 00002 * others. For conditions of distribution and use see copyright notice in license.txt */ 00003 /*ParseCosmology parse cosmological parameters and options */ 00004 #include "cddefines.h" 00005 #include "radius.h" 00006 #include "rfield.h" 00007 #include "parse.h" 00008 #include "physconst.h" 00009 #include "cosmology.h" 00010 00011 t_cosmology cosmology; 00012 00013 realnum GetHubbleFactor(realnum z) 00014 { 00015 realnum H_z, H_z_squared; 00016 00017 DEBUG_ENTRY( "GetHubbleFactor()" ); 00018 00019 /* NB - the factor of (1e5/MEGAPARSEC) converts from km/s/Mpc to km/s/km */ 00020 H_z_squared = POW2(cosmology.H_0 * (realnum)(1e5/MEGAPARSEC)) * ( 00021 cosmology.omega_lambda + 00022 cosmology.omega_matter * POW3( 1.f + z ) + 00023 cosmology.omega_rad * POW4( 1.f + z ) + 00024 cosmology.omega_k * POW2( 1.f + z ) ); 00025 00026 H_z = sqrt( H_z_squared ); 00027 00028 return H_z; 00029 } 00030 00031 realnum GetDensity(realnum z) 00032 { 00033 realnum density; 00034 00035 DEBUG_ENTRY( "GetHubbleFactor()" ); 00036 00037 fixit(); // this should be abund.aprim[1] by default, but controlled by command line option 00038 cosmology.f_He = 0.079f; 00039 00040 /* from Switzer & Hirata 2007, equation 2 */ 00041 density = 1.123e-5f * (cosmology.omega_baryon*cosmology.h*cosmology.h) / (1.f + 3.9715f*cosmology.f_He) * 00042 pow( 1.f + z, (realnum)3.f ); 00043 00044 return density; 00045 }