cloudy  trunk
parse_CMB.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 /*ParseCMB parse parameters from fireball command */
4 #include "cddefines.h"
5 #include "cosmology.h"
6 #include "radius.h"
7 #include "rfield.h"
8 #include "parser.h"
9 #include "physconst.h"
10 
11 void ParseCMB(double z,
12  long int *nqh)
13 {
14  double a,
15  rlogl;
16 
17  DEBUG_ENTRY( "ParseCMB()" );
18 
19  /* check that stack of shape and luminosity specifications
20  * is parallel, stop if not - this happens is background comes
21  * BETWEEN another set of shape and luminosity commands */
22  if( rfield.nShape != *nqh )
23  {
24  fprintf( ioQQQ, " This command has come between a previous ordered pair of continuum shape and luminosity commands.\n Reorder the commands to complete each continuum specification before starting another.\n" );
25  fprintf( ioQQQ, " Sorry.\n" );
27  }
28 
29  /* put in a black body */
30  strcpy( rfield.chSpType[rfield.nShape], "BLACK" );
31  /* >>chng 03 may 23, CMB temp from 2.756 to 2.725 */
32  rfield.slope[rfield.nShape] = (CMB_TEMP*(1. + z));
33  rfield.cutoff[rfield.nShape][0] = 0.;
34  rfield.cutoff[rfield.nShape][1] = 0.;
35  strcpy( rfield.chSpNorm[*nqh], "LUMI" );
36  a = log10(rfield.slope[rfield.nShape]);
37  rlogl = log10(4.*STEFAN_BOLTZ) + 4.*a;
38  strcpy( rfield.chRSpec[*nqh], "SQCM" );
39  rfield.range[*nqh][0] = rfield.emm;
40  rfield.range[*nqh][1] = rfield.egamry;
41  rfield.totpow[*nqh] = rlogl;
42  /* this is an isotropic radiation field */
43  rfield.lgBeamed[*nqh] = false;
45 
46  /* set radius to very large value if not already set */
47  /* >>chng 01 jul 24, from Radius == 0 to this, as per PvH comments */
48  if( !radius.lgRadiusKnown )
49  {
50  radius.Radius = pow(10.,radius.rdfalt);
51  }
52 
53  ++rfield.nShape;
54  ++*nqh;
55  if( *nqh >= LIMSPC )
56  {
57  fprintf( ioQQQ, " Too many continua entered; increase LIMSPC\n" );
59  }
60 
61  /* this flag says that CMB has been set */
62  rfield.lgCMB_set = true;
63  return;
64 }
t_rfield::totpow
double totpow[LIMSPC]
Definition: rfield.h:300
rfield
t_rfield rfield
Definition: rfield.cpp:8
ioQQQ
FILE * ioQQQ
Definition: cddefines.cpp:7
STEFAN_BOLTZ
const UNUSED double STEFAN_BOLTZ
Definition: physconst.h:210
rfield.h
t_rfield::chSpType
char chSpType[LIMSPC][6]
Definition: rfield.h:353
LIMSPC
const int LIMSPC
Definition: rfield.h:18
t_rfield::cutoff
double cutoff[LIMSPC][3]
Definition: rfield.h:302
t_rfield::slope
double slope[LIMSPC]
Definition: rfield.h:301
t_radius::lgRadiusKnown
bool lgRadiusKnown
Definition: radius.h:116
radius
t_radius radius
Definition: radius.cpp:5
EXIT_FAILURE
#define EXIT_FAILURE
Definition: cddefines.h:140
t_rfield::egamry
realnum egamry
Definition: rfield.h:52
t_rfield::chRSpec
char chRSpec[LIMSPC][5]
Definition: rfield.h:352
cddefines.h
t_radius::Radius
double Radius
Definition: radius.h:25
Illuminate::SYMMETRIC
@ SYMMETRIC
Definition: rfield.h:30
t_radius::rdfalt
double rdfalt
Definition: radius.h:124
t_rfield::Illumination
Illuminate::IlluminationType Illumination[LIMSPC]
Definition: rfield.h:316
radius.h
ParseCMB
void ParseCMB(double z, long int *nqh)
Definition: parse_CMB.cpp:11
t_rfield::lgCMB_set
bool lgCMB_set
Definition: rfield.h:124
cdEXIT
#define cdEXIT(FAIL)
Definition: cddefines.h:434
CMB_TEMP
#define CMB_TEMP
Definition: cosmology.h:10
cosmology.h
t_rfield::lgBeamed
bool lgBeamed[LIMSPC]
Definition: rfield.h:310
t_rfield::range
double range[LIMSPC][2]
Definition: rfield.h:347
parser.h
physconst.h
t_rfield::nShape
long int nShape
Definition: rfield.h:322
t_rfield::emm
realnum emm
Definition: rfield.h:49
t_rfield::chSpNorm
char chSpNorm[LIMSPC][5]
Definition: rfield.h:351
DEBUG_ENTRY
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:684