00001 /* This file is part of Cloudy and is copyright (C)1978-2013 by Gary J. Ferland and 00002 * others. For conditions of distribution and use see copyright notice in license.txt */ 00003 /*ParseDont parse the dont command - do not do something */ 00004 #include "cddefines.h" 00005 #include "taulines.h" 00006 #include "opacity.h" 00007 #include "phycon.h" 00008 #include "secondaries.h" 00009 #include "pressure.h" 00010 #include "prt.h" 00011 #include "coolheavy.h" 00012 #include "thermal.h" 00013 #include "rfield.h" 00014 #include "dynamics.h" 00015 #include "mole.h" 00016 #include "rt.h" 00017 #include "hmi.h" 00018 #include "atomfeii.h" 00019 #include "yield.h" 00020 #include "ionbal.h" 00021 #include "atmdat.h" 00022 #include "grainvar.h" 00023 #include "hyperfine.h" 00024 #include "parser.h" 00025 00026 void ParseDont(Parser &p ) 00027 { 00028 DEBUG_ENTRY( "ParseDont()" ); 00029 00030 if( (p.nMatch( "21CM" ) || p.nMatch( "21 CM" )) && 00031 p.nMatch( " LYA" ) && p.nMatch( "PUMP" ) ) 00032 { 00033 /* no Lya 21 cm pump turns off 21 cm pumping of Lya */ 00034 hyperfine.lgLya_pump_21cm = false; 00035 } 00036 else if( p.nMatch("ADVE") ) 00037 { 00038 /* turn off different aspects of advection */ 00039 if( p.nMatch("H-LI") ) 00040 { 00041 /* advection for the H-like ion sequence */ 00042 dynamics.lgISO[ipH_LIKE] = 0; 00043 } 00044 else if( p.nMatch("HE-L") ) 00045 { 00046 /* advection for the He-like ion sequence */ 00047 dynamics.lgISO[ipHE_LIKE] = 0; 00048 } 00049 else if( p.nMatch("META") ) 00050 { 00051 /* advection for the everything else - those done in ion_solver */ 00052 dynamics.lgMETALS = 0; 00053 } 00054 else if( p.nMatch("COOL") ) 00055 { 00056 /* turn off cooling - heating due to advection */ 00057 dynamics.lgCoolHeat = 0; 00058 } 00059 else 00060 { 00061 /* no sub option, so turn them all off */ 00062 dynamics.lgISO[ipH_LIKE] = 0; 00063 dynamics.lgISO[ipHE_LIKE] = 0; 00064 dynamics.lgMETALS = 0; 00065 } 00066 00067 } 00068 00069 else if( p.nMatch("AUGE") ) 00070 { 00071 /* turn off auger effect by killing its block data */ 00072 t_yield::Inst().kill_yield(); 00073 phycon.lgPhysOK = false; 00074 } 00075 00076 else if( p.nMatch("BUFF") ) 00077 { 00078 /* NO BUFFERING turn off buffered io for standard output, 00079 * used to get output when code crashes */ 00080 00081 /* >>chng 06 jun 28, moved handling of NO BUFFERING command to cdRead, PvH */ 00082 00083 /* stderr may be a preprocessor macro, so lets be really careful here */ 00084 FILE *test = stderr; 00085 if( ioQQQ != test ) 00086 { 00087 /* this should really say stdout and not stderr ! */ 00088 fprintf( ioQQQ, " ioQQQ did not point to stdout, ignored NO BUFFERING command.\n" ); 00089 } 00090 00091 } 00092 00093 else if( p.nMatch("CHAR") ) 00094 { 00095 /* turn off all charge transfer interactions */ 00096 atmdat.lgCTOn = false; 00097 phycon.lgPhysOK = false; 00098 } 00099 00100 else if( p.nMatch("CTHE") ) 00101 { 00102 /* turn off charge transfer heating */ 00103 atmdat.HCharHeatOn = 0.; 00104 phycon.lgPhysOK = false; 00105 } 00106 00107 else if( p.nMatch("COMP") ) 00108 { 00109 /* turn off both recoil ionization and compton heating of free electron */ 00110 rfield.lgComptonOn = false; 00111 phycon.lgPhysOK = false; 00112 } 00113 00114 else if( p.nMatch("FEII") ) 00115 { 00116 /* turn off feii ly-alpha pumping - rate evaluated in FeIILyaPump */ 00117 FeII.lgLyaPumpOn = false; 00118 phycon.lgPhysOK = false; 00119 } 00120 00121 else if( p.nMatch("FILE") && p.nMatch("OPAC") ) 00122 { 00123 /* no file opacities, generate them on the fly even if file present */ 00124 opac.lgUseFileOpac = false; 00125 } 00126 00127 else if( p.nMatch("FINE") && p.nMatch("OPAC") ) 00128 { 00129 /* no fine opacities */ 00130 rfield.lgOpacityFine = false; 00131 } 00132 00133 else if( p.nMatch("FINE") ) 00134 { 00135 /* turn off fine structure optical depths */ 00136 rt.lgFstOn = false; 00137 phycon.lgPhysOK = false; 00138 } 00139 00140 else if( p.nMatch("FREE") ) 00141 { 00142 /* turn off free free heating and cooling */ 00143 CoolHeavy.lgFreeOn = false; 00144 phycon.lgPhysOK = false; 00145 } 00146 00147 else if( p.nMatch("GRAI") ) 00148 { 00149 if( p.nMatch("NEUT") ) 00150 { 00151 /* turn off ion grain recombination "NO GRAIN NEUTRALIZATION" */ 00152 ionbal.lgGrainIonRecom = false; 00153 phycon.lgPhysOK = false; 00154 } 00155 else if( p.nMatch("GAS ") && p.nMatch("COLL") && p.nMatch("ENER") ) 00156 { 00157 /* turn off grain - gas collisional energy exchange 00158 * "NO GRAIN GAS COLLISIONAL ENERGY EXCHANGE " */ 00159 gv.lgDColOn = false; 00160 phycon.lgPhysOK = false; 00161 } 00162 else if( p.nMatch("ELEC") ) 00163 { 00164 /* turn off grain contributions to electrons "NO GRAIN ELECTRONS" */ 00165 gv.lgGrainElectrons = false; 00166 phycon.lgPhysOK = false; 00167 } 00168 else if( p.nMatch("MOLE") ) 00169 { 00170 /* turn off capture of molecules on grain surfaces "NO GRAIN MOLECULES" */ 00171 mole_global.lgGrain_mole_deplete = false; 00172 phycon.lgPhysOK = false; 00173 } 00174 else if( p.nMatch("QHEA") ) 00175 { 00176 /* turn off quantum heating of grains "NO GRAIN QHEAT" */ 00177 gv.lgQHeatOn = false; 00178 phycon.lgPhysOK = false; 00179 } 00180 else if( p.nMatch("X-RA") ) 00181 { 00182 /* revert to WD01 physics "NO GRAIN X-RAY TREATMENT" */ 00183 gv.lgWD01 = true; 00184 } 00185 else if( p.nMatch("PHYSICS") ) 00186 { 00187 /* turn off grain physics "NO GRAIN PHYSICS" */ 00188 gv.lgGrainPhysicsOn = false; 00189 phycon.lgPhysOK = false; 00190 } 00191 else 00192 { 00193 fprintf( ioQQQ, " No key recognized on this line.\n" ); 00194 cdEXIT(EXIT_FAILURE); 00195 } 00196 } 00197 00198 /* no induced processes */ 00199 else if( p.nMatch("INDU") ) 00200 { 00201 /* turn off induced recombination, stimulated emission, 00202 * continuum fluorescent excitation of lines, 00203 * stimulated emission correction to optical depths attenuation */ 00204 rfield.lgInducProcess = false; 00205 } 00206 00207 /* no collisional ionization */ 00208 else if( p.nMatch("COLL") && p.nMatch("IONI") ) 00209 { 00210 fixit(); // This variable doesn't do anything! 00211 00212 /* turn off collisional ionization */ 00213 atmdat.lgCollIonOn = false; 00214 fprintf( ioQQQ, " This option is not working.\n Sorry.\n" ); 00215 cdEXIT(EXIT_FAILURE); 00216 } 00217 00218 else if( p.nMatch("LEVE") ) 00219 { 00220 /* turn off the set of level 2 lines, safe for lower densities 00221 * this is the upper limit to the counter that is always used, 00222 * so no loops will ever occur */ 00223 /* >>chng 06 mar 04 from -1 to 0 so that size_t is zero in state put & get */ 00224 /*nWindLine = -1;*/ 00225 nWindLine = 0; 00226 } 00227 00228 /* various no line options */ 00229 else if( p.nMatch("LINE") && !p.nMatch(" OTS") && !p.nMatch("OUTW") ) 00230 { 00231 if( p.nMatch("DIFF") && p.nMatch("PUMP") ) 00232 { 00233 /* no diffuse line pumping, 00234 * turn off pumping of lines by diffuse continuum*/ 00235 rfield.DiffPumpOn = 0.; 00236 fprintf( ioQQQ, " This option is disabled.\n Sorry.\n" ); 00237 cdEXIT(EXIT_FAILURE); 00238 } 00239 else if( p.nMatch("TRAN") ) 00240 { 00241 /* no line transfer command */ 00242 rfield.lgDoLineTrans = false; 00243 } 00244 else 00245 { 00246 /* missing no line option */ 00247 fprintf( ioQQQ, " There has to be an option on the NO LINE command.\n" ); 00248 fprintf( ioQQQ, " The options are DIFFUSE PUMP and TRANSFER.\n Sorry.\n" ); 00249 cdEXIT(EXIT_FAILURE); 00250 } 00251 } 00252 00253 00254 else if( p.nMatch("OPAC") && p.nMatch("REEVAL") ) 00255 { 00256 /* don't constantly reevaluate the opacities */ 00257 rfield.lgOpacityReevaluate = false; 00258 } 00259 00260 else if( p.nMatch("IONI") && p.nMatch("REEVAL") ) 00261 { 00262 /* "no ionization reevaluation" - don't constantly reevaluate the ionization */ 00263 rfield.lgIonizReevaluate = false; 00264 } 00265 00266 /* options to kill ots components as debugging aids */ 00267 else if( p.nMatch(" OTS") ) 00268 { 00269 if( p.nMatch(" LYA") ) 00270 { 00271 /* turn off Lya ots rates - for debugging oscillations */ 00272 rfield.lgLyaOTS = false; 00273 } 00274 00275 else if( p.nMatch("HEII") ) 00276 { 00277 /* turn off Lya ots rates - for debugging oscillations */ 00278 rfield.lgHeIIOTS = false; 00279 } 00280 00281 else if( p.nMatch("LINE") ) 00282 { 00283 /* turn off line ots rates - for debugging oscillations */ 00284 rfield.lgKillOTSLine = true; 00285 } 00286 } 00287 00288 /* options to kill outward compoents as a debugging aid */ 00289 else if( p.nMatch("OUTW") ) 00290 { 00291 if( p.nMatch("LINE") ) 00292 { 00293 /* turn off Lya ots rates - for debugging oscillations */ 00294 rfield.lgKillOutLine = true; 00295 } 00296 else if( p.nMatch("CONT") ) 00297 { 00298 /* turn off Lya ots rates - for debugging oscillations */ 00299 rfield.lgKillOutCont = true; 00300 } 00301 } 00302 else if( p.nMatch("MOLE") ) 00303 { 00304 /* disable molecule formation, first option is to turn off only high Z part */ 00305 if( p.nMatch("HEAV") ) 00306 { 00307 /* turn off only Z>=2 molecules */ 00308 mole_global.lgNoHeavyMole = true; 00309 } 00310 else 00311 { 00312 mole_global.lgNoMole = true; 00313 } 00314 phycon.lgPhysOK = false; 00315 } 00316 00317 else if( p.nMatch("PHOT") ) 00318 { 00319 /* disable photoionization */ 00320 ionbal.lgPhotoIoniz_On = false; 00321 phycon.lgPhysOK = false; 00322 } 00323 00324 else if( p.nMatch("RADI") ) 00325 { 00326 /* don't include line radiation pressure */ 00327 pressure.lgLineRadPresOn = false; 00328 } 00329 00330 else if( p.nMatch("RECO") ) 00331 { 00332 /* disable compton recoil of bound electrons - "no recoil ioniz" */ 00333 ionbal.lgCompRecoil = false; 00334 phycon.lgPhysOK = false; 00335 } 00336 00337 else if( p.nMatch("SCAT") && p.nMatch("OPAC")) 00338 { 00339 /* no scattering opacity, for Compton thick spherical geometry */ 00340 opac.lgScatON = false; 00341 } 00342 00343 else if( p.nMatch("SCAT") && p.nMatch("ESCA")) 00344 { 00345 /* no electron scattering contribution to line escape probs */ 00346 rt.lgElecScatEscape = false; 00347 } 00348 00349 else if( p.nMatch("SECO") ) 00350 { 00351 /* turn off secondary electron ionizations */ 00352 secondaries.lgSecOFF = true; 00353 phycon.lgPhysOK = false; 00354 } 00355 00356 else if( p.nMatch("SPOT") ) 00357 { 00358 /* no on-the-spot; turn on all ground state rec */ 00359 opac.otsmin = 1.; 00360 } 00361 00362 else if( p.nMatch("STAR") ) 00363 { 00364 /* no stark broadening */ 00365 rt.lgStarkON = false; 00366 phycon.lgPhysOK = false; 00367 } 00368 00369 else if( p.nMatch("STAT") ) 00370 { 00371 /* no static opacities - constantly reevaluate them */ 00372 opac.lgOpacStatic = false; 00373 } 00374 00375 else if( p.nMatch("TEPR") ) 00376 { 00377 /* no tepredictor */ 00378 /* turn off prediction of next zone's temperature, as guessed in ZoneStart */ 00379 thermal.lgPredNextTe = false; 00380 } 00381 00382 else if( p.nMatch("THRE") ) 00383 { 00384 /* turn off Cota's three body rec subroutine */ 00385 ionbal.lgNoCota = true; 00386 phycon.lgPhysOK = false; 00387 } 00388 00389 else if( p.nMatch("TIME") ) 00390 { 00391 /* don't print anything with a time, so that we can expect 00392 * perfect agreement between separate runs */ 00393 prt.lgPrintTime = false; 00394 } 00395 00396 else if( p.nMatch(" UTA") ) 00397 { 00398 /* turn off ALL inner shell absorption ionization */ 00399 ionbal.lgInnerShellLine_on = false; 00400 phycon.lgPhysOK = false; 00401 } 00402 00403 /* the no vary command is parsed well before we get to this point, 00404 * but we have to do something here or the parser will say that 00405 * no command existed on the command line */ 00406 else if( p.nMatch("VARY") ) 00407 { 00408 /* this is a no-nothing, picked up to stop optimizer */ 00409 ((void)0); 00410 } 00411 00412 else 00413 { 00414 /* end of else if trap */ 00415 fprintf( ioQQQ," I do not recognize a keyword on this NO ... command.\n"); 00416 p.PrintLine(ioQQQ); 00417 fprintf( ioQQQ, " Sorry.\n"); 00418 cdEXIT(EXIT_FAILURE); 00419 } 00420 00421 /* this option, if keyword (OK) appears, then do not set warning */ 00422 if( p.nMatch("(OK)") ) 00423 { 00424 /* say that physical conditions are actually ok */ 00425 phycon.lgPhysOK = true; 00426 } 00427 return; 00428 }