cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 }
double Radius
Definition: radius.h:22
bool lgBeamed[LIMSPC]
Definition: rfield.h:310
double totpow[LIMSPC]
Definition: rfield.h:300
char chRSpec[LIMSPC][5]
Definition: rfield.h:351
realnum emm
Definition: rfield.h:49
FILE * ioQQQ
Definition: cddefines.cpp:7
double cutoff[LIMSPC][3]
Definition: rfield.h:300
double range[LIMSPC][2]
Definition: rfield.h:347
const int LIMSPC
Definition: rfield.h:18
realnum egamry
Definition: rfield.h:52
double slope[LIMSPC]
Definition: rfield.h:300
const double STEFAN_BOLTZ
Definition: physconst.h:210
bool lgCMB_set
Definition: rfield.h:124
t_rfield rfield
Definition: rfield.cpp:8
#define EXIT_FAILURE
Definition: cddefines.h:144
Illuminate::IlluminationType Illumination[LIMSPC]
Definition: rfield.h:316
#define cdEXIT(FAIL)
Definition: cddefines.h:438
void ParseCMB(double z, long int *nqh)
Definition: parse_CMB.cpp:11
bool lgRadiusKnown
Definition: radius.h:116
char chSpNorm[LIMSPC][5]
Definition: rfield.h:351
t_radius radius
Definition: radius.cpp:5
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:688
#define CMB_TEMP
Definition: cosmology.h:10
long int nShape
Definition: rfield.h:322
double rdfalt
Definition: radius.h:124
char chSpType[LIMSPC][6]
Definition: rfield.h:351