cloudy trunk
Loading...
Searching...
No Matches
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
11void 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 */
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}
FILE * ioQQQ
Definition: cddefines.cpp:7
#define EXIT_FAILURE
Definition: cddefines.h:140
#define cdEXIT(FAIL)
Definition: cddefines.h:434
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:684
#define CMB_TEMP
Definition: cosmology.h:10
@ SYMMETRIC
Definition: rfield.h:30
void ParseCMB(double z, long int *nqh)
Definition: parse_CMB.cpp:11
UNUSED const double STEFAN_BOLTZ
Definition: physconst.h:210
t_radius radius
Definition: radius.cpp:5
t_rfield rfield
Definition: rfield.cpp:8
const int LIMSPC
Definition: rfield.h:18
double rdfalt
Definition: radius.h:124
bool lgRadiusKnown
Definition: radius.h:116
double Radius
Definition: radius.h:25
char chSpNorm[LIMSPC][5]
Definition: rfield.h:351
long int nShape
Definition: rfield.h:322
char chSpType[LIMSPC][6]
Definition: rfield.h:353
char chRSpec[LIMSPC][5]
Definition: rfield.h:352
bool lgCMB_set
Definition: rfield.h:124
double slope[LIMSPC]
Definition: rfield.h:301
realnum emm
Definition: rfield.h:49
realnum egamry
Definition: rfield.h:52
bool lgBeamed[LIMSPC]
Definition: rfield.h:310
double range[LIMSPC][2]
Definition: rfield.h:347
double cutoff[LIMSPC][3]
Definition: rfield.h:302
Illuminate::IlluminationType Illumination[LIMSPC]
Definition: rfield.h:316
double totpow[LIMSPC]
Definition: rfield.h:300