cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
parse_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 "cosmology.h"
6 #include "parser.h"
7 #include "rfield.h"
8 
10 {
11  realnum param;
12 
13  DEBUG_ENTRY( "ParseCosmology()" );
14 
15  cosmology.lgDo = true;
16 
17  // Use Sobolev optical depths
18  strcpy( rfield.chDffTrns, "SOB" );
19 
20  /* set an omega parameter */
21  if( p.nMatch("OMEG") )
22  {
23  param = (realnum)p.FFmtRead();
24 
25  if( p.nMatch( "BARY") )
26  {
27  cosmology.omega_baryon = param;
28  }
29  else if( p.nMatch( "RADI") )
30  {
31  cosmology.omega_rad = param;
32  }
33  else if( p.nMatch( "MATT") )
34  {
35  cosmology.omega_matter = param;
36  }
37  else if( p.nMatch( "LAMB") )
38  {
39  cosmology.omega_lambda = param;
40  }
41  else if( p.nMatch( " K ") || p.nMatch( "CURV") )
42  {
43  cosmology.omega_k = param;
44  }
45  else
46  {
47  fixit("must terminate clause safely. what should it do?");
48  TotalInsanity();
49  }
50  }
51  else if( p.nMatch("HUBB") )
52  {
53  param = (realnum)p.FFmtRead();
54 
55  cosmology.h = param;
56 
57  if( param <= 0 || param > 1.1 )
58  {
59  fprintf( ioQQQ," This sets the variable h, which has units 100 km/s/Mpc, and is typically 0.71\n" );
60  }
61  }
62 
63  return;
64 }
bool nMatch(const char *chKey) const
Definition: parser.h:150
realnum h
Definition: cosmology.h:38
double FFmtRead(void)
Definition: parser.cpp:472
NORETURN void TotalInsanity(void)
Definition: service.cpp:971
char chDffTrns[4]
Definition: rfield.h:217
FILE * ioQQQ
Definition: cddefines.cpp:7
bool lgDo
Definition: cosmology.h:44
Definition: parser.h:43
void ParseCosmology(Parser &p)
t_rfield rfield
Definition: rfield.cpp:9
float realnum
Definition: cddefines.h:124
realnum omega_baryon
Definition: cosmology.h:31
realnum omega_lambda
Definition: cosmology.h:31
realnum omega_k
Definition: cosmology.h:31
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:723
t_cosmology cosmology
Definition: cosmology.cpp:8
realnum omega_rad
Definition: cosmology.h:31
int fprintf(const Output &stream, const char *format,...)
Definition: service.cpp:1121
#define fixit(a)
Definition: cddefines.h:417
realnum omega_matter
Definition: cosmology.h:31