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