cloudy  trunk
parse_dont.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 /*ParseDont parse the dont command - do not do something */
4 #include "cddefines.h"
5 #include "taulines.h"
6 #include "opacity.h"
7 #include "phycon.h"
8 #include "secondaries.h"
9 #include "pressure.h"
10 #include "prt.h"
11 #include "coolheavy.h"
12 #include "thermal.h"
13 #include "rfield.h"
14 #include "dynamics.h"
15 #include "mole.h"
16 #include "rt.h"
17 #include "hmi.h"
18 #include "atomfeii.h"
19 #include "yield.h"
20 #include "ionbal.h"
21 #include "atmdat.h"
22 #include "grainvar.h"
23 #include "hyperfine.h"
24 #include "save.h"
25 #include "parser.h"
26 
27 void ParseDont(Parser &p )
28 {
29  DEBUG_ENTRY( "ParseDont()" );
30 
31  if( (p.nMatch( "21CM" ) || p.nMatch( "21 CM" )) &&
32  p.nMatch( " LYA" ) && p.nMatch( "PUMP" ) )
33  {
34  /* no Lya 21 cm pump turns off 21 cm pumping of Lya */
35  hyperfine.lgLya_pump_21cm = false;
36  }
37  else if( p.nMatch("ADVE") )
38  {
39  /* turn off different aspects of advection */
40  if( p.nMatch("H-LI") )
41  {
42  /* advection for the H-like ion sequence */
43  dynamics.lgISO[ipH_LIKE] = 0;
44  }
45  else if( p.nMatch("HE-L") )
46  {
47  /* advection for the He-like ion sequence */
49  }
50  else if( p.nMatch("META") )
51  {
52  /* advection for the everything else - those done in ion_solver */
53  dynamics.lgMETALS = 0;
54  }
55  else if( p.nMatch("COOL") )
56  {
57  /* turn off cooling - heating due to advection */
58  dynamics.lgCoolHeat = 0;
59  }
60  else
61  {
62  /* no sub option, so turn them all off */
63  dynamics.lgISO[ipH_LIKE] = 0;
65  dynamics.lgMETALS = 0;
66  }
67 
68  }
69 
70  else if( p.nMatch("AUGE") )
71  {
72  /* turn off auger effect by killing its block data */
74  phycon.lgPhysOK = false;
75  }
76 
77  else if( p.nMatch("BUFF") )
78  {
79  /* NO BUFFERING turn off buffered io for standard output,
80  * used to get output when code crashes */
81 
82  /* >>chng 06 jun 28, moved handling of NO BUFFERING command to cdRead, PvH */
83 
84  /* stderr may be a preprocessor macro, so lets be really careful here */
85  FILE *test = stderr;
86  if( ioQQQ != test && save.chOutputFile.empty() )
87  {
88  /* this should really say stdout and not stderr ! */
89  fprintf( ioQQQ, " ignored NO BUFFERING command since it could not be done safely.\n" );
90  }
91 
92  }
93 
94  else if( p.nMatch("CHAR") )
95  {
96  /* turn off all charge transfer interactions */
97  atmdat.lgCTOn = false;
98  phycon.lgPhysOK = false;
99  }
100 
101  else if( p.nMatch("CTHE") )
102  {
103  /* turn off charge transfer heating */
104  atmdat.HCharHeatOn = 0.;
105  phycon.lgPhysOK = false;
106  }
107 
108  else if( p.nMatch("COMP") )
109  {
110  /* turn off both recoil ionization and compton heating of free electron */
111  rfield.lgComptonOn = false;
112  phycon.lgPhysOK = false;
113  }
114 
115  else if( p.nMatch("FEII") )
116  {
117  /* turn off feii ly-alpha pumping - rate evaluated in FeIILyaPump */
118  FeII.lgLyaPumpOn = false;
119  phycon.lgPhysOK = false;
120  }
121 
122  else if( p.nMatch("FILE") && p.nMatch("OPAC") )
123  {
124  /* no file opacities, generate them on the fly even if file present */
125  opac.lgUseFileOpac = false;
126  }
127 
128  else if( p.nMatch("FINE") && p.nMatch("OPAC") )
129  {
130  /* no fine opacities */
131  rfield.lgOpacityFine = false;
132  }
133 
134  else if( p.nMatch("FINE") )
135  {
136  /* turn off fine structure optical depths */
137  rt.lgFstOn = false;
138  phycon.lgPhysOK = false;
139  }
140 
141  else if( p.nMatch("FREE") )
142  {
143  /* turn off free free heating and cooling */
144  CoolHeavy.lgFreeOn = false;
145  phycon.lgPhysOK = false;
146  }
147 
148  else if( p.nMatch("GRAI") )
149  {
150  if( p.nMatch("NEUT") )
151  {
152  /* turn off ion grain recombination "NO GRAIN NEUTRALIZATION" */
153  ionbal.lgGrainIonRecom = false;
154  phycon.lgPhysOK = false;
155  }
156  else if( p.nMatch("GAS ") && p.nMatch("COLL") && p.nMatch("ENER") )
157  {
158  /* turn off grain - gas collisional energy exchange
159  * "NO GRAIN GAS COLLISIONAL ENERGY EXCHANGE " */
160  gv.lgDColOn = false;
161  phycon.lgPhysOK = false;
162  }
163  else if( p.nMatch("ELEC") )
164  {
165  /* turn off grain contributions to electrons "NO GRAIN ELECTRONS" */
166  gv.lgGrainElectrons = false;
167  phycon.lgPhysOK = false;
168  }
169  else if( p.nMatch("MOLE") )
170  {
171  /* turn off capture of molecules on grain surfaces "NO GRAIN MOLECULES" */
173  phycon.lgPhysOK = false;
174  }
175  else if( p.nMatch("QHEA") )
176  {
177  /* turn off quantum heating of grains "NO GRAIN QHEAT" */
178  gv.lgQHeatOn = false;
179  phycon.lgPhysOK = false;
180  }
181  else if( p.nMatch("X-RA") )
182  {
183  /* revert to WD01 physics "NO GRAIN X-RAY TREATMENT" */
184  gv.lgWD01 = true;
185  }
186  else if( p.nMatch("PHYSICS") )
187  {
188  /* turn off grain physics "NO GRAIN PHYSICS" */
189  gv.lgGrainPhysicsOn = false;
190  phycon.lgPhysOK = false;
191  }
192  else
193  {
194  fprintf( ioQQQ, " No key recognized on this line.\n" );
196  }
197  }
198 
199  /* no induced processes */
200  else if( p.nMatch("INDU") )
201  {
202  /* turn off induced recombination, stimulated emission,
203  * continuum fluorescent excitation of lines,
204  * stimulated emission correction to optical depths attenuation */
205  rfield.lgInducProcess = false;
206  }
207 
208  /* no collisional ionization */
209  else if( p.nMatch("COLL") && p.nMatch("IONI") )
210  {
211  fixit(); // This variable doesn't do anything!
212 
213  /* turn off collisional ionization */
214  atmdat.lgCollIonOn = false;
215  fprintf( ioQQQ, " This option is not working.\n Sorry.\n" );
217  }
218 
219  else if( p.nMatch("LEVE") )
220  {
221  /* turn off the set of level 2 lines, safe for lower densities
222  * this is the upper limit to the counter that is always used,
223  * so no loops will ever occur */
224  /* >>chng 06 mar 04 from -1 to 0 so that size_t is zero in state put & get */
225  /*nWindLine = -1;*/
226  nWindLine = 0;
227  }
228 
229  /* various no line options */
230  else if( p.nMatch("LINE") && !p.nMatch(" OTS") && !p.nMatch("OUTW") )
231  {
232  if( p.nMatch("DIFF") && p.nMatch("PUMP") )
233  {
234  /* no diffuse line pumping,
235  * turn off pumping of lines by diffuse continuum*/
236  rfield.DiffPumpOn = 0.;
237  fprintf( ioQQQ, " This option is disabled.\n Sorry.\n" );
239  }
240  else if( p.nMatch("TRAN") )
241  {
242  /* no line transfer command */
243  rfield.lgDoLineTrans = false;
244  }
245  else
246  {
247  /* missing no line option */
248  fprintf( ioQQQ, " There has to be an option on the NO LINE command.\n" );
249  fprintf( ioQQQ, " The options are DIFFUSE PUMP and TRANSFER.\n Sorry.\n" );
251  }
252  }
253 
254 
255  else if( p.nMatch("OPAC") && p.nMatch("REEVAL") )
256  {
257  /* don't constantly reevaluate the opacities */
258  rfield.lgOpacityReevaluate = false;
259  }
260 
261  else if( p.nMatch("IONI") && p.nMatch("REEVAL") )
262  {
263  /* "no ionization reevaluation" - don't constantly reevaluate the ionization */
264  rfield.lgIonizReevaluate = false;
265  }
266 
267  /* options to kill ots components as debugging aids */
268  else if( p.nMatch(" OTS") )
269  {
270  if( p.nMatch(" LYA") )
271  {
272  /* turn off Lya ots rates - for debugging oscillations */
273  rfield.lgLyaOTS = false;
274  }
275 
276  else if( p.nMatch("HEII") )
277  {
278  /* turn off Lya ots rates - for debugging oscillations */
279  rfield.lgHeIIOTS = false;
280  }
281 
282  else if( p.nMatch("LINE") )
283  {
284  /* turn off line ots rates - for debugging oscillations */
285  rfield.lgKillOTSLine = true;
286  }
287  }
288 
289  /* options to kill outward compoents as a debugging aid */
290  else if( p.nMatch("OUTW") )
291  {
292  if( p.nMatch("LINE") )
293  {
294  /* turn off Lya ots rates - for debugging oscillations */
295  rfield.lgKillOutLine = true;
296  }
297  else if( p.nMatch("CONT") )
298  {
299  /* turn off Lya ots rates - for debugging oscillations */
300  rfield.lgKillOutCont = true;
301  }
302  }
303  else if( p.nMatch("MOLE") )
304  {
305  /* disable molecule formation, first option is to turn off only high Z part */
306  if( p.nMatch("HEAV") )
307  {
308  /* turn off only Z>=2 molecules */
309  mole_global.lgNoHeavyMole = true;
310  }
311  else
312  {
313  mole_global.lgNoMole = true;
314  }
315  phycon.lgPhysOK = false;
316  }
317 
318  else if( p.nMatch("PHOT") )
319  {
320  /* disable photoionization */
321  ionbal.lgPhotoIoniz_On = false;
322  phycon.lgPhysOK = false;
323  }
324 
325  else if( p.nMatch("RADI") )
326  {
327  /* don't include line radiation pressure */
328  pressure.lgLineRadPresOn = false;
329  }
330 
331  else if( p.nMatch("RECO") )
332  {
333  /* disable compton recoil of bound electrons - "no recoil ioniz" */
334  ionbal.lgCompRecoil = false;
335  phycon.lgPhysOK = false;
336  }
337 
338  else if( p.nMatch("SCAT") && p.nMatch("OPAC"))
339  {
340  /* no scattering opacity, for Compton thick spherical geometry */
341  opac.lgScatON = false;
342  }
343 
344  else if( p.nMatch("SCAT") && p.nMatch("ESCA"))
345  {
346  /* no electron scattering contribution to line escape probs */
347  rt.lgElecScatEscape = false;
348  }
349 
350  else if( p.nMatch("SECO") )
351  {
352  /* turn off secondary electron ionizations */
353  secondaries.lgSecOFF = true;
354  phycon.lgPhysOK = false;
355  }
356 
357  else if( p.nMatch("SPOT") )
358  {
359  /* no on-the-spot; turn on all ground state rec */
360  opac.otsmin = 1.;
361  }
362 
363  else if( p.nMatch("STAR") )
364  {
365  /* no stark broadening */
366  rt.lgStarkON = false;
367  phycon.lgPhysOK = false;
368  }
369 
370  else if( p.nMatch("STAT") )
371  {
372  /* no static opacities - constantly reevaluate them */
373  opac.lgOpacStatic = false;
374  }
375 
376  else if( p.nMatch("TEPR") )
377  {
378  /* no tepredictor */
379  /* turn off prediction of next zone's temperature, as guessed in ZoneStart */
380  thermal.lgPredNextTe = false;
381  }
382 
383  else if( p.nMatch("THRE") )
384  {
385  /* turn off Cota's three body rec subroutine */
386  ionbal.lgNoCota = true;
387  phycon.lgPhysOK = false;
388  }
389 
390  else if( p.nMatch("TIME") )
391  {
392  /* don't print anything with a time, so that we can expect
393  * perfect agreement between separate runs */
394  prt.lgPrintTime = false;
395  }
396 
397  else if( p.nMatch(" UTA") )
398  {
399  /* turn off ALL inner shell absorption ionization */
400  ionbal.lgInnerShellLine_on = false;
401  phycon.lgPhysOK = false;
402  }
403 
404  /* the no vary command is parsed well before we get to this point,
405  * but we have to do something here or the parser will say that
406  * no command existed on the command line */
407  else if( p.nMatch("VARY") )
408  {
409  /* this is a no-nothing, picked up to stop optimizer */
410  ((void)0);
411  }
412 
413  else
414  {
415  /* end of else if trap */
416  fprintf( ioQQQ," I do not recognize a keyword on this NO ... command.\n");
417  p.PrintLine(ioQQQ);
418  fprintf( ioQQQ, " Sorry.\n");
420  }
421 
422  /* this option, if keyword (OK) appears, then do not set warning */
423  if( p.nMatch("(OK)") )
424  {
425  /* say that physical conditions are actually ok */
426  phycon.lgPhysOK = true;
427  }
428  return;
429 }
t_yield::kill_yield
void kill_yield()
Definition: yield.h:78
thermal.h
t_ionbal::lgCompRecoil
bool lgCompRecoil
Definition: ionbal.h:149
t_CoolHeavy::lgFreeOn
bool lgFreeOn
Definition: coolheavy.h:116
Parser::nMatch
bool nMatch(const char *chKey) const
Definition: parser.h:135
t_rfield::lgOpacityReevaluate
bool lgOpacityReevaluate
Definition: rfield.h:121
yield.h
ipHE_LIKE
const int ipHE_LIKE
Definition: iso.h:63
secondaries.h
Singleton< t_yield >::Inst
static t_yield & Inst()
Definition: cddefines.h:175
t_rfield::lgComptonOn
bool lgComptonOn
Definition: rfield.h:295
rfield
t_rfield rfield
Definition: rfield.cpp:8
ioQQQ
FILE * ioQQQ
Definition: cddefines.cpp:7
t_rfield::lgKillOTSLine
bool lgKillOTSLine
Definition: rfield.h:440
rfield.h
nWindLine
long nWindLine
Definition: cdinit.cpp:19
t_rfield::DiffPumpOn
realnum DiffPumpOn
Definition: rfield.h:217
mole.h
t_rt::lgElecScatEscape
bool lgElecScatEscape
Definition: rt.h:262
t_FeII::lgLyaPumpOn
bool lgLyaPumpOn
Definition: atomfeii.h:229
t_opac::lgScatON
bool lgScatON
Definition: opacity.h:183
phycon
t_phycon phycon
Definition: phycon.cpp:6
t_atmdat::HCharHeatOn
double HCharHeatOn
Definition: atmdat.h:156
t_dynamics::lgMETALS
bool lgMETALS
Definition: dynamics.h:86
t_rfield::lgLyaOTS
bool lgLyaOTS
Definition: rfield.h:427
GrainVar::lgGrainPhysicsOn
bool lgGrainPhysicsOn
Definition: grainvar.h:479
t_opac::lgOpacStatic
bool lgOpacStatic
Definition: opacity.h:140
t_rfield::lgOpacityFine
bool lgOpacityFine
Definition: rfield.h:421
t_dynamics::lgCoolHeat
bool lgCoolHeat
Definition: dynamics.h:89
t_dynamics::lgISO
bool lgISO[NISO]
Definition: dynamics.h:83
dynamics.h
opac
t_opac opac
Definition: opacity.cpp:5
atmdat.h
hyperfine
t_hyperfine hyperfine
Definition: hyperfine.cpp:5
GrainVar::lgGrainElectrons
bool lgGrainElectrons
Definition: grainvar.h:494
t_rfield::lgDoLineTrans
bool lgDoLineTrans
Definition: rfield.h:117
EXIT_FAILURE
#define EXIT_FAILURE
Definition: cddefines.h:140
Parser
Definition: parser.h:31
coolheavy.h
t_hyperfine::lgLya_pump_21cm
bool lgLya_pump_21cm
Definition: hyperfine.h:50
t_rfield::lgHeIIOTS
bool lgHeIIOTS
Definition: rfield.h:431
t_mole_global::lgNoHeavyMole
bool lgNoHeavyMole
Definition: mole.h:280
t_phycon::lgPhysOK
bool lgPhysOK
Definition: phycon.h:101
prt
t_prt prt
Definition: prt.cpp:10
cddefines.h
t_opac::lgUseFileOpac
bool lgUseFileOpac
Definition: opacity.h:196
t_opac::otsmin
realnum otsmin
Definition: opacity.h:294
t_mole_global::lgGrain_mole_deplete
bool lgGrain_mole_deplete
Definition: mole.h:308
GrainVar::lgQHeatOn
bool lgQHeatOn
Definition: grainvar.h:486
thermal
t_thermal thermal
Definition: thermal.cpp:5
t_rfield::lgIonizReevaluate
bool lgIonizReevaluate
Definition: rfield.h:128
t_rt::lgFstOn
bool lgFstOn
Definition: rt.h:256
hyperfine.h
GrainVar::lgDColOn
bool lgDColOn
Definition: grainvar.h:490
t_prt::lgPrintTime
bool lgPrintTime
Definition: prt.h:120
FeII
t_FeII FeII
Definition: atomfeii.cpp:5
hmi.h
t_rfield::lgKillOutCont
bool lgKillOutCont
Definition: rfield.h:437
ionbal
t_ionbal ionbal
Definition: ionbal.cpp:5
pressure.h
t_rt::lgStarkON
bool lgStarkON
Definition: rt.h:280
t_mole_global::lgNoMole
bool lgNoMole
Definition: mole.h:277
cdEXIT
#define cdEXIT(FAIL)
Definition: cddefines.h:434
t_secondaries::lgSecOFF
bool lgSecOFF
Definition: secondaries.h:40
save.h
t_ionbal::lgNoCota
bool lgNoCota
Definition: ionbal.h:239
prt.h
grainvar.h
rt.h
ionbal.h
parser.h
GrainVar::lgWD01
bool lgWD01
Definition: grainvar.h:475
secondaries
t_secondaries secondaries
Definition: secondaries.cpp:5
dynamics
t_dynamics dynamics
Definition: dynamics.cpp:44
t_rfield::lgKillOutLine
bool lgKillOutLine
Definition: rfield.h:434
t_ionbal::lgInnerShellLine_on
bool lgInnerShellLine_on
Definition: ionbal.h:175
gv
GrainVar gv
Definition: grainvar.cpp:5
rt
t_rt rt
Definition: rt.cpp:5
fixit
void fixit(void)
Definition: service.cpp:991
taulines.h
CoolHeavy
t_CoolHeavy CoolHeavy
Definition: coolheavy.cpp:5
pressure
t_pressure pressure
Definition: pressure.cpp:5
phycon.h
atmdat
t_atmdat atmdat
Definition: atmdat.cpp:6
t_thermal::lgPredNextTe
bool lgPredNextTe
Definition: thermal.h:28
t_atmdat::lgCTOn
bool lgCTOn
Definition: atmdat.h:177
t_pressure::lgLineRadPresOn
bool lgLineRadPresOn
Definition: pressure.h:157
opacity.h
t_atmdat::lgCollIonOn
bool lgCollIonOn
Definition: atmdat.h:200
t_ionbal::lgGrainIonRecom
int lgGrainIonRecom
Definition: ionbal.h:228
Parser::PrintLine
int PrintLine(FILE *fp) const
Definition: parser.h:204
t_ionbal::lgPhotoIoniz_On
bool lgPhotoIoniz_On
Definition: ionbal.h:116
t_save::chOutputFile
string chOutputFile
Definition: save.h:314
t_rfield::lgInducProcess
bool lgInducProcess
Definition: rfield.h:252
mole_global
t_mole_global mole_global
Definition: mole.cpp:6
atomfeii.h
DEBUG_ENTRY
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:684
ipH_LIKE
const int ipH_LIKE
Definition: iso.h:62
save
t_save save
Definition: save.cpp:5
ParseDont
void ParseDont(Parser &p)
Definition: parse_dont.cpp:27