cloudy  trunk
parse_coronal.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 /*ParseCoronal parse parameters off coronal equilibrium command */
4 #include "cddefines.h"
5 #include "rfield.h"
6 #include "thermal.h"
7 #include "input.h"
8 #include "optimize.h"
9 #include "phycon.h"
10 #include "radius.h"
11 #include "dynamics.h"
12 #include "parser.h"
13 #include "atmdat.h"
14 
15 /*ParseCoronal parse parameters off coronal equilibrium command */
17 {
18  double a;
19 
20  DEBUG_ENTRY( "ParseCoronal()" );
21 
22  /* use coronal command to establish initial conditions in a cooling
23  * time-varying cloud */
24  if( p.nMatch( "INIT" ) && p.nMatch( "TIME" ) )
25  {
27  if( p.nMatch( "TRAC" ) )
28  dynamics.lgTracePrint = true;
29  }
30 
31  /* coronal equilibrium; set constant temperature to number on line */
34 
35  // kinetic temperatures for a given ion are higher for coronal equilibrium
36  // simulations - large Fe chianti models are needed to get the full cooling
37  // tests show that this mainly affects the cooling around 1e7 K.
38  // the other elements included in Chianti hardly affect the cooling so
39  // are not changed
41  {
44  }
45 
46  a = p.FFmtRead();
47  if( p.lgEOL() )
48  {
49  fprintf( ioQQQ, " There should be a temperature on this line.\n" );
51  }
52 
53  /* numbers less than or equal to 10 are the log of the temperature */
54  if( (a <= 10. && !p.nMatch("LINE")) || p.nMatch(" LOG") )
55  {
56  thermal.ConstTemp = (realnum)pow(10.,a);
57  }
58  else
59  {
61  }
62 
63  /* check temperature bounds */
65  {
67  fprintf( ioQQQ, " PROBLEM Te too low, reset to %g K.\n",
69  }
71  {
73  fprintf( ioQQQ, " PROBLEM Te too high, reset to %g K.\n",
75  }
76 
77  /* now simulate a LASER line */
78  strcpy( rfield.chSpType[rfield.nShape], "LASER" );
79  /* scan off the laser's energy ion Rydbergs */
81  /* default width is 0.05 */
82  rfield.cutoff[rfield.nShape][0] = 0.05;
83 
84  /* simulate an ionization parameter line */
85  strcpy( rfield.chRSpec[p.m_nqh], "SQCM" );
86  strcpy( rfield.chSpNorm[p.m_nqh], "IONI" );
87 
88  /* >>chng 96 jun 17, to stop mole network from crashing */
89  /* >>chng 05 aug 15, this sets ionization parameter, in test case ism_hot_brems the
90  * value of 1e-10 was enough to dominate the ionization of he-like N - it's ionization
91  * then jumped due to large optical depth in the continuum - change U from -10 to -15 */
92  /* >>chng 05 aug 16, this very strongly affected the coll_t4 sim - apparently there
93  * was a significant photoionization contribution from the -10 continuum,
94  * this was close to a 'no photoionization' case, but lower further to insure
95  * no photo contribution
96  * chang from -15 to -20 */
97  rfield.totpow[p.m_nqh] = -20.f;
98 
99  ++rfield.nShape;
100  if( rfield.nShape >= LIMSPC )
101  {
102  /* too many continua were entered */
103  fprintf( ioQQQ, " Too many continua entered; increase LIMSPC\n" );
105  }
106  ++p.m_nqh;
107  if( p.m_nqh >= LIMSPC )
108  {
109  /* too many continua were entered */
110  fprintf( ioQQQ, " Too many continua entered; increase LIMSPC\n" );
112  }
113 
114  /* set R to large value if U specified but R is not */
115  /* set radius to very large value if not already set */
116  /* >>chng 01 jul 24, from Radius == 0 to this, as per PvH comments */
117  if( !radius.lgRadiusKnown )
118  {
119  radius.Radius = pow(10.,radius.rdfalt);
120  }
121 
122  /* vary option */
123  if( optimize.lgVarOn )
124  {
125  /* no luminosity options on vary */
127  strcpy( optimize.chVarFmt[optimize.nparm], "COROnal equilibrium %f LOG" );
129  strcat( optimize.chVarFmt[optimize.nparm], " TIME INIT" );
130 
131  /* pointer to where to write */
133 
134  /* log of temp will be pointer */
136  optimize.vincr[optimize.nparm] = 0.1f;
137  optimize.varang[optimize.nparm][0] = (realnum)log10(1.00001*phycon.TEMP_LIMIT_LOW);
139  ++optimize.nparm;
140  }
141  return;
142 }
thermal.h
t_rfield::totpow
double totpow[LIMSPC]
Definition: rfield.h:300
Parser::nMatch
bool nMatch(const char *chKey) const
Definition: parser.h:135
t_optimize::vincr
realnum vincr[LIMPAR]
Definition: optimize.h:191
Parser::FFmtRead
double FFmtRead(void)
Definition: parser.cpp:353
t_optimize::nparm
long int nparm
Definition: optimize.h:201
t_input::nRead
long int nRead
Definition: input.h:49
rfield
t_rfield rfield
Definition: rfield.cpp:8
ioQQQ
FILE * ioQQQ
Definition: cddefines.cpp:7
realnum
float realnum
Definition: cddefines.h:103
rfield.h
t_dynamics::lgTracePrint
bool lgTracePrint
Definition: dynamics.h:177
t_atmdat::nChiantiMaxLevelsFe
long nChiantiMaxLevelsFe
Definition: atmdat.h:212
t_optimize::lgVarOn
bool lgVarOn
Definition: optimize.h:203
phycon
t_phycon phycon
Definition: phycon.cpp:6
t_rfield::chSpType
char chSpType[LIMSPC][6]
Definition: rfield.h:353
ParseCoronal
void ParseCoronal(Parser &p)
Definition: parse_coronal.cpp:16
LIMSPC
const int LIMSPC
Definition: rfield.h:18
t_phycon::TEMP_LIMIT_LOW
const double TEMP_LIMIT_LOW
Definition: phycon.h:111
dynamics.h
input
t_input input
Definition: input.cpp:12
t_rfield::cutoff
double cutoff[LIMSPC][3]
Definition: rfield.h:302
t_atmdat::nChiantiCollLevelsFe
const long nChiantiCollLevelsFe
Definition: atmdat.h:224
t_rfield::slope
double slope[LIMSPC]
Definition: rfield.h:301
atmdat.h
t_thermal::lgTemperatureConstant
bool lgTemperatureConstant
Definition: thermal.h:32
t_radius::lgRadiusKnown
bool lgRadiusKnown
Definition: radius.h:116
radius
t_radius radius
Definition: radius.cpp:5
optimize
t_optimize optimize
Definition: optimize.cpp:5
t_optimize::vparm
realnum vparm[LIMEXT][LIMPAR]
Definition: optimize.h:188
t_optimize::chVarFmt
char chVarFmt[LIMPAR][FILENAME_PATH_LENGTH_2]
Definition: optimize.h:263
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
Parser
Definition: parser.h:31
t_thermal::ConstTemp
realnum ConstTemp
Definition: thermal.h:44
cddefines.h
t_radius::Radius
double Radius
Definition: radius.h:25
thermal
t_thermal thermal
Definition: thermal.cpp:5
optimize.h
t_radius::rdfalt
double rdfalt
Definition: radius.h:124
t_optimize::nvarxt
long int nvarxt[LIMPAR]
Definition: optimize.h:194
radius.h
t_atmdat::nChiantiCollLevels
const long nChiantiCollLevels
Definition: atmdat.h:226
cdEXIT
#define cdEXIT(FAIL)
Definition: cddefines.h:434
Parser::lgEOL
bool lgEOL(void) const
Definition: parser.h:98
t_optimize::varang
realnum varang[LIMPAR][2]
Definition: optimize.h:198
t_atmdat::lgChiantiLevelsSet
bool lgChiantiLevelsSet
Definition: atmdat.h:216
parser.h
t_atmdat::nChiantiMaxLevels
long nChiantiMaxLevels
Definition: atmdat.h:214
dynamics
t_dynamics dynamics
Definition: dynamics.cpp:44
t_optimize::nvfpnt
long int nvfpnt[LIMPAR]
Definition: optimize.h:195
Parser::m_nqh
long int m_nqh
Definition: parser.h:41
t_rfield::nShape
long int nShape
Definition: rfield.h:322
t_thermal::lgTemperatureConstantCommandParsed
bool lgTemperatureConstantCommandParsed
Definition: thermal.h:38
phycon.h
atmdat
t_atmdat atmdat
Definition: atmdat.cpp:6
t_phycon::TEMP_LIMIT_HIGH
const double TEMP_LIMIT_HIGH
Definition: phycon.h:113
t_rfield::chSpNorm
char chSpNorm[LIMSPC][5]
Definition: rfield.h:351
t_dynamics::lg_coronal_time_init
bool lg_coronal_time_init
Definition: dynamics.h:93
input.h
DEBUG_ENTRY
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:684