00001 /* This file is part of Cloudy and is copyright (C)1978-2010 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 realnum GetHubbleFactor(realnum z) 00012 { 00013 realnum H_z, H_z_squared; 00014 00015 DEBUG_ENTRY( "GetHubbleFactor()" ); 00016 00017 /* NB - the factor of (1e5/MEGAPARSEC) converts from km/s/Mpc to km/s/km */ 00018 H_z_squared = POW2(cosmology.H_0 * (realnum)(1e5/MEGAPARSEC)) * ( 00019 cosmology.omega_lambda + 00020 cosmology.omega_matter * POW3( 1.f + z ) + 00021 cosmology.omega_rad * POW4( 1.f + z ) + 00022 cosmology.omega_k * POW2( 1.f + z ) ); 00023 00024 H_z = sqrt( H_z_squared ); 00025 00026 return H_z; 00027 } 00028 00029 realnum GetDensity(realnum z) 00030 { 00031 realnum density; 00032 00033 DEBUG_ENTRY( "GetHubbleFactor()" ); 00034 00035 fixit(); // this should be abund.aprim[1] by default, but controlled by command line option 00036 cosmology.f_He = 0.079f; 00037 00038 /* from Switzer & Hirata 2007, equation 2 */ 00039 density = 1.123e-5f * (cosmology.omega_baryon*cosmology.h*cosmology.h) / (1.f + 3.9715f*cosmology.f_He) * 00040 pow( 1.f + z, (realnum)3.f ); 00041 00042 return density; 00043 }