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-2017 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 "parser.h"
6 #include "cosmology.h"
7 #include "radius.h"
8 #include "rfield.h"
9 
10 void ParseCMB(double z,
11  long int *nqh)
12 {
13  double a,
14  rlogl;
15 
16  DEBUG_ENTRY( "ParseCMB()" );
17 
18  /* check that stack of shape and luminosity specifications
19  * is parallel, stop if not - this happens is background comes
20  * BETWEEN another set of shape and luminosity commands */
21  if( rfield.nShape != *nqh )
22  {
23  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" );
24  fprintf( ioQQQ, " Sorry.\n" );
26  }
27 
28  /* put in a black body */
29  strcpy( rfield.chSpType[rfield.nShape], "BLACK" );
30  /* >>chng 03 may 23, CMB temp from 2.756 to 2.725 */
31  rfield.slope[rfield.nShape] = (CMB_TEMP*(1. + z));
32  rfield.cutoff[rfield.nShape][0] = 0.;
33  rfield.cutoff[rfield.nShape][1] = 0.;
34  strcpy( rfield.chSpNorm[*nqh], "LUMI" );
35  a = log10(rfield.slope[rfield.nShape]);
36  rlogl = log10(4.*STEFAN_BOLTZ) + 4.*a;
37  strcpy( rfield.chRSpec[*nqh], "SQCM" );
38  rfield.range[*nqh][0] = rfield.emm();
39  rfield.range[*nqh][1] = rfield.egamry();
40  rfield.totpow[*nqh] = rlogl;
41  /* this is an isotropic radiation field */
42  rfield.lgBeamed[*nqh] = false;
44 
45  /* set radius to very large value if not already set */
46  /* >>chng 01 jul 24, from Radius == 0 to this, as per PvH comments */
47  if( !radius.lgRadiusKnown )
48  {
50  }
51 
52  ++rfield.nShape;
53  ++*nqh;
54  if( *nqh >= LIMSPC )
55  {
56  fprintf( ioQQQ, " Too many continua entered; increase LIMSPC\n" );
58  }
59 
60  /* this flag says that CMB has been set */
61  rfield.lgCMB_set = true;
62  return;
63 }
double emm() const
Definition: mesh.h:84
double Radius
Definition: radius.h:31
bool lgBeamed[LIMSPC]
Definition: rfield.h:296
double exp10(double x)
Definition: cddefines.h:1383
double totpow[LIMSPC]
Definition: rfield.h:286
char chRSpec[LIMSPC][5]
Definition: rfield.h:333
FILE * ioQQQ
Definition: cddefines.cpp:7
double cutoff[LIMSPC][3]
Definition: rfield.h:286
double range[LIMSPC][2]
Definition: rfield.h:329
const int LIMSPC
Definition: rfield.h:20
double slope[LIMSPC]
Definition: rfield.h:286
bool lgCMB_set
Definition: rfield.h:108
t_rfield rfield
Definition: rfield.cpp:9
#define EXIT_FAILURE
Definition: cddefines.h:168
Illuminate::IlluminationType Illumination[LIMSPC]
Definition: rfield.h:302
#define cdEXIT(FAIL)
Definition: cddefines.h:484
void ParseCMB(double z, long int *nqh)
Definition: parse_CMB.cpp:10
bool lgRadiusKnown
Definition: radius.h:121
char chSpNorm[LIMSPC][5]
Definition: rfield.h:333
t_radius radius
Definition: radius.cpp:5
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:729
double egamry() const
Definition: mesh.h:88
#define CMB_TEMP
Definition: cosmology.h:10
int fprintf(const Output &stream, const char *format,...)
Definition: service.cpp:1217
long int nShape
Definition: rfield.h:308
double rdfalt
Definition: radius.h:129
char chSpType[LIMSPC][6]
Definition: rfield.h:333