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-2022 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  /* turn off collisional ionization */
219  atmdat.lgCollIonOn = false;
220  }
221 
222  else if( p.nMatch("LEVE") )
223  {
224  /* turn off the set of level 2 lines, safe for lower densities
225  * this is the upper limit to the counter that is always used,
226  * so no loops will ever occur */
227  /* >>chng 06 mar 04 from -1 to 0 so that size_t is zero in state put & get */
228  /*nWindLine = -1;*/
229  nWindLine = 0;
230  }
231 
232  /* various no line options */
233  else if( p.nMatch("LINE") && !p.nMatch(" OTS") && !p.nMatch("OUTW") )
234  {
235  if( p.nMatch("DIFF") && p.nMatch("PUMP") )
236  {
237  /* no diffuse line pumping,
238  * turn off pumping of lines by diffuse continuum*/
239  rfield.DiffPumpOn = 0.;
240  fprintf( ioQQQ, " This option is disabled.\n Sorry.\n" );
242  }
243  else if( p.nMatch("TRAN") )
244  {
245  /* no line transfer command */
246  rfield.lgDoLineTrans = false;
247  }
248  else if( p.nMatch("ISOT") && p.nMatch("CONT") && p.nMatch("SUBT") )
249  {
250  /* do NOT subtract continuum from reported line fluxes & emissivities */
251  save.lgSubtrCont = false;
252  }
253  else
254  {
255  /* missing no line option */
256  fprintf( ioQQQ, " There has to be an option on the NO LINE command.\n" );
257  fprintf( ioQQQ, " The options are 'DIFFUSE PUMP', 'TRANSFER',"
258  " and 'ISOTROPIC CONTINUUM SUBTRACTION'.\n Sorry.\n" );
260  }
261  }
262 
263 
264  else if( p.nMatch("OPAC") && p.nMatch("REEVAL") )
265  {
266  /* don't constantly reevaluate the opacities */
267  rfield.lgOpacityReevaluate = false;
268  }
269 
270  else if( p.nMatch("IONI") && p.nMatch("REEVAL") )
271  {
272  /* "no ionization reevaluation" - don't constantly reevaluate the ionization */
273  rfield.lgIonizReevaluate = false;
274  }
275 
276  /* options to kill ots components as debugging aids */
277  else if( p.nMatch(" OTS") )
278  {
279  if( p.nMatch(" LYA") )
280  {
281  /* turn off Lya ots rates - for debugging oscillations */
282  rfield.lgLyaOTS = false;
283  }
284 
285  else if( p.nMatch("HEII") )
286  {
287  /* turn off Lya ots rates - for debugging oscillations */
288  rfield.lgHeIIOTS = false;
289  }
290 
291  else if( p.nMatch("LINE") )
292  {
293  /* turn off line ots rates - for debugging oscillations */
294  rfield.lgKillOTSLine = true;
295  }
296  }
297 
298  /* options to kill outward compoents as a debugging aid */
299  else if( p.nMatch("OUTW") )
300  {
301  if( p.nMatch("LINE") )
302  {
303  /* turn off Lya ots rates - for debugging oscillations */
304  rfield.lgKillOutLine = true;
305  }
306  else if( p.nMatch("CONT") )
307  {
308  /* turn off Lya ots rates - for debugging oscillations */
309  rfield.lgKillOutCont = true;
310  }
311  }
312  else if( p.nMatch("MOLE") )
313  {
314  /* disable molecule formation, first option is to turn off only high Z part */
315  if( p.nMatch("HEAV") )
316  {
317  /* turn off only Z>=2 molecules */
318  mole_global.lgNoHeavyMole = true;
319  }
320  else
321  {
322  mole_global.lgNoMole = true;
323  }
324  phycon.lgPhysOK = false;
325  }
326 
327  else if( p.nMatch("PHOT") )
328  {
329  /* disable photoionization */
330  ionbal.lgPhotoIoniz_On = false;
331  phycon.lgPhysOK = false;
332  }
333 
334  else if( p.nMatch("RADI") )
335  {
336  /* don't include line radiation pressure */
337  pressure.lgLineRadPresOn = false;
338  }
339 
340  else if( p.nMatch("RECO") )
341  {
342  /* disable compton recoil of bound electrons - "no recoil ioniz" */
343  ionbal.lgCompRecoil = false;
344  phycon.lgPhysOK = false;
345  }
346 
347  else if( p.nMatch("SCAT") && p.nMatch("OPAC"))
348  {
349  /* no scattering opacity, for Compton thick spherical geometry */
350  opac.lgScatON = false;
351  }
352 
353  else if( p.nMatch("SCAT") && p.nMatch("ESCA"))
354  {
355  /* no electron scattering contribution to line escape probs */
356  rt.lgElecScatEscape = false;
357  }
358 
359  else if( p.nMatch("SECO") )
360  {
361  /* turn off secondary electron ionizations */
362  secondaries.lgSecOFF = true;
363  phycon.lgPhysOK = false;
364  }
365 
366  else if( p.nMatch("SPOT") )
367  {
368  /* no on-the-spot; turn on all ground state rec */
369  opac.otsmin = 1.;
370  }
371 
372  else if( p.nMatch("STAR") )
373  {
374  /* no stark broadening */
375  rt.lgStarkON = false;
376  phycon.lgPhysOK = false;
377  }
378 
379  else if( p.nMatch("STAT") )
380  {
381  /* no static opacities - constantly reevaluate them */
382  opac.lgOpacStatic = false;
383  }
384 
385  else if( p.nMatch("TEPR") )
386  {
387  /* no tepredictor */
388  /* turn off prediction of next zone's temperature, as guessed in ZoneStart */
389  thermal.lgPredNextTe = false;
390  }
391 
392  else if( p.nMatch("THRE") )
393  {
394  /* turn off Cota's three body rec subroutine */
395  ionbal.lgNoCota = true;
396  phycon.lgPhysOK = false;
397  }
398 
399  else if( p.nMatch("TIME") )
400  {
401  /* don't print anything with a time, so that we can expect
402  * perfect agreement between separate runs */
403  prt.lgPrintTime = false;
404  }
405 
406  else if( p.nMatch(" UTA") )
407  {
408  fprintf( ioQQQ, "Obsolete command. Please use SET UTA OFF instead.\n" );
409  cdEXIT( EXIT_FAILURE );
410  }
411 
412  /* the no vary command is parsed well before we get to this point,
413  * but we have to do something here or the parser will say that
414  * no command existed on the command line */
415  else if( p.nMatch("VARY") )
416  {
417  /* this is a no-nothing, picked up to stop optimizer */
418  ((void)0);
419  }
420 
421  else
422  {
423  /* end of else if trap */
424  fprintf( ioQQQ," I do not recognize a keyword on this NO ... command.\n");
425  p.PrintLine(ioQQQ);
426  fprintf( ioQQQ, " Sorry.\n");
428  }
429 
430  /* this option, if keyword (OK) appears, then do not set warning */
431  if( p.nMatch("(OK)") )
432  {
433  /* say that physical conditions are actually ok */
434  phycon.lgPhysOK = true;
435  }
436  return;
437 }
realnum otsmin
Definition: opacity.h:314
bool nMatch(const char *chKey) const
Definition: parser.h:150
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:498
bool lgKillOutLine
Definition: rfield.h:417
t_opac opac
Definition: opacity.cpp:5
t_hyperfine hyperfine
Definition: hyperfine.cpp:5
bool lgPhotoIoniz_On
Definition: ionbal.h:117
bool lgMETALS
Definition: dynamics.h:92
bool lgUseFileOpac
Definition: opacity.h:209
bool lgOpacityFine
Definition: rfield.h:404
t_phycon phycon
Definition: phycon.cpp:6
bool lgScatON
Definition: opacity.h:196
bool lgKillOutCont
Definition: rfield.h:420
bool lgIonizReevaluate
Definition: rfield.h:110
bool lgKillOTSLine
Definition: rfield.h:423
bool lgCollIonOn
Definition: atmdat.h:349
bool lgQHeatOn
Definition: grainvar.h:489
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:93
Definition: parser.h:43
bool lgISO[NISO]
Definition: dynamics.h:89
bool lgHeIIOTS
Definition: rfield.h:414
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:410
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:482
bool lgGrainPhysicsOn
Definition: grainvar.h:479
bool lgPrintTime
Definition: prt.h:161
long nWindLine
Definition: cdinit.cpp:19
t_prt prt
Definition: prt.cpp:14
bool lgDoLineTrans
Definition: rfield.h:99
bool lgOpacStatic
Definition: opacity.h:153
bool lgWD01
Definition: grainvar.h:479
bool lgStarkON
Definition: rt.h:211
int lgGrainIonRecom
Definition: ionbal.h:226
bool lgOpacityReevaluate
Definition: rfield.h:103
const int ipH_LIKE
Definition: iso.h:64
bool lgLineRadPresOn
Definition: pressure.h:117
string chOutputFile
Definition: save.h:439
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:723
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:153
bool lgInducProcess
Definition: rfield.h:233
int fprintf(const Output &stream, const char *format,...)
Definition: service.cpp:1121
bool lgCTOn
Definition: atmdat.h:325
int PrintLine(FILE *fp) const
Definition: parser.h:206
bool lgNoCota
Definition: ionbal.h:236
bool lgNoHeavyMole
Definition: mole.h:328
realnum DiffPumpOn
Definition: rfield.h:207
GrainVar gv
Definition: grainvar.cpp:5
t_secondaries secondaries
Definition: secondaries.cpp:5
bool lgSubtrCont
Definition: save.h:312
t_save save
Definition: save.cpp:5
bool lgNoMole
Definition: mole.h:325
bool lgFreeOn
Definition: coolheavy.h:35
bool lgComptonOn
Definition: rfield.h:279
bool lgDColOn
Definition: grainvar.h:494
t_rt rt
Definition: rt.cpp:5