cloudy trunk
|
00001 /* This file is part of Cloudy and is copyright (C)1978-2008 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 "parse.h" 00025 00026 void ParseDont(char *chCard ) 00027 { 00028 DEBUG_ENTRY( "ParseDont()" ); 00029 00030 if( (nMatch( "21CM" , chCard ) || nMatch( "21 CM" , chCard )) && 00031 nMatch( " LYA" , chCard ) && nMatch( "PUMP" , chCard ) ) 00032 { 00033 /* no Lya 21 cm pump turns off 21 cm pumping of Lya */ 00034 hyperfine.lgLya_pump_21cm = false; 00035 } 00036 else if( nMatch("ADVE",chCard) ) 00037 { 00038 /* turn off different aspects of advection */ 00039 if( nMatch("H-LI",chCard) ) 00040 { 00041 /* advection for the H-like ion sequence */ 00042 dynamics.lgISO[ipH_LIKE] = 0; 00043 } 00044 else if( nMatch("HE-L",chCard) ) 00045 { 00046 /* advection for the He-like ion sequence */ 00047 dynamics.lgISO[ipHE_LIKE] = 0; 00048 } 00049 else if( nMatch("META",chCard) ) 00050 { 00051 /* advection for the everything else - those done in ion_solver */ 00052 dynamics.lgMETALS = 0; 00053 } 00054 else if( nMatch("COOL",chCard) ) 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( nMatch("AUGE",chCard) ) 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( nMatch("BUFF",chCard) ) 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( nMatch("CHAR",chCard) ) 00094 { 00095 /* turn off all charge transfer interactions */ 00096 atmdat.lgCTOn = false; 00097 phycon.lgPhysOK = false; 00098 } 00099 00100 else if( nMatch("CTHE",chCard) ) 00101 { 00102 /* turn off charge transfer heating */ 00103 atmdat.HCharHeatOn = 0.; 00104 phycon.lgPhysOK = false; 00105 } 00106 00107 else if( nMatch("COMP",chCard) ) 00108 { 00109 /* turn off both recoil ionization and compton heating of free electron */ 00110 rfield.comoff = 0.; 00111 phycon.lgPhysOK = false; 00112 } 00113 00114 else if( nMatch("FEII",chCard) ) 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( nMatch("FILE",chCard) && nMatch("OPAC",chCard) ) 00122 { 00123 /* no file opacities, generate them on the fly even if file present */ 00124 opac.lgUseFileOpac = false; 00125 } 00126 00127 else if( nMatch("FINE",chCard) && nMatch("OPAC",chCard) ) 00128 { 00129 /* no fine opacities */ 00130 rfield.lgOpacityFine = false; 00131 } 00132 00133 else if( nMatch("FINE",chCard) ) 00134 { 00135 /* turn off fine structure optical depths */ 00136 rt.lgFstOn = false; 00137 phycon.lgPhysOK = false; 00138 } 00139 00140 else if( nMatch("FREE",chCard) ) 00141 { 00142 /* turn off free free heating and cooling */ 00143 CoolHeavy.lgFreeOn = false; 00144 phycon.lgPhysOK = false; 00145 } 00146 00147 else if( nMatch("GRAI",chCard) ) 00148 { 00149 if( nMatch("NEUT",chCard) ) 00150 { 00151 /* turn off ion grain recombination "NO GRAIN NEUTRALIZATION" */ 00152 ionbal.lgGrainIonRecom = false; 00153 phycon.lgPhysOK = false; 00154 } 00155 else if( nMatch("GAS ",chCard) && nMatch("COLL",chCard) && nMatch("ENER",chCard) ) 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( nMatch("ELEC",chCard) ) 00163 { 00164 /* turn off grain contributions to electrons "NO GRAIN ELECTRONS" */ 00165 gv.lgGrainElectrons = false; 00166 phycon.lgPhysOK = false; 00167 } 00168 else if( nMatch("MOLE",chCard) ) 00169 { 00170 /* turn off capture of molecules on grain surfaces "NO GRAIN MOLECULES" */ 00171 mole.lgGrain_mole_deplete = false; 00172 phycon.lgPhysOK = false; 00173 } 00174 else if( nMatch("QHEA",chCard) ) 00175 { 00176 /* turn off quantum heating of grains "NO GRAIN QHEAT" */ 00177 gv.lgQHeatOn = false; 00178 phycon.lgPhysOK = false; 00179 } 00180 else if( nMatch("X-RA",chCard) ) 00181 { 00182 /* revert to WD01 physics "NO GRAIN X-RAY TREATMENT" */ 00183 gv.lgWD01 = true; 00184 } 00185 else if( nMatch("PHYSICS",chCard) ) 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( nMatch("INDU",chCard) ) 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( nMatch("COLL",chCard) && nMatch("IONI",chCard) ) 00209 { 00210 /* turn off collisional ionization */ 00211 atmdat.lgCollIonOn = false; 00212 } 00213 00214 else if( nMatch("LEVE",chCard) ) 00215 { 00216 /* turn off the set of level 2 lines, safe for lower densities 00217 * this is the upper limit to the counter that is always used, 00218 * so no loops will ever occur */ 00219 /* >>chng 06 mar 04 from -1 to 0 so that size_t is zero in state put & get */ 00220 /*nWindLine = -1;*/ 00221 nWindLine = 0; 00222 } 00223 00224 /* various no line options */ 00225 else if( nMatch("LINE",chCard) && !nMatch(" OTS",chCard) ) 00226 { 00227 if( nMatch("DIFF",chCard) && nMatch("PUMP",chCard) ) 00228 { 00229 /* no diffuse line pumping, 00230 * turn off pumping of lines by diffuse continuum*/ 00231 rfield.DiffPumpOn = 0.; 00232 } 00233 else if( nMatch("TRAN",chCard) ) 00234 { 00235 /* no line transfer command */ 00236 rfield.lgDoLineTrans = false; 00237 } 00238 else 00239 { 00240 /* missing no line option */ 00241 fprintf( ioQQQ, " There has to be an option on the NO LINE command.\n" ); 00242 fprintf( ioQQQ, " The optinoas are DIFFUSE PUMP and TRANSFER.\n Sorry.\n" ); 00243 cdEXIT(EXIT_FAILURE); 00244 } 00245 } 00246 00247 00248 else if( nMatch("OPAC",chCard) && nMatch("REEVAL",chCard) ) 00249 { 00250 /* don't constantly reevaluate the opacities */ 00251 rfield.lgOpacityReevaluate = false; 00252 } 00253 00254 else if( nMatch("IONI",chCard) && nMatch("REEVAL",chCard) ) 00255 { 00256 /* "no ionization reevaluation" - don't constantly reevaluate the ionization */ 00257 rfield.lgIonizReevaluate = false; 00258 } 00259 00260 /* options to kill ots components as debugging aids */ 00261 else if( nMatch(" OTS",chCard) ) 00262 { 00263 if( nMatch(" LYA",chCard) ) 00264 { 00265 /* turn off Lya ots rates - for debugging oscillations */ 00266 rfield.lgLyaOTS = false; 00267 } 00268 00269 else if( nMatch("HEII",chCard) ) 00270 { 00271 /* turn off Lya ots rates - for debugging oscillations */ 00272 rfield.lgHeIIOTS = false; 00273 } 00274 00275 else if( nMatch("LINE",chCard) ) 00276 { 00277 /* turn off line ots rates - for debugging oscillations */ 00278 rfield.lgKillOTSLine = true; 00279 } 00280 } 00281 00282 /* options to kill outward compoents as a debugging aid */ 00283 else if( nMatch("OUTW",chCard) ) 00284 { 00285 if( nMatch("LINE",chCard) ) 00286 { 00287 /* turn off Lya ots rates - for debugging oscillations */ 00288 rfield.lgKillOutLine = true; 00289 } 00290 else if( nMatch("CONT",chCard) ) 00291 { 00292 /* turn off Lya ots rates - for debugging oscillations */ 00293 rfield.lgKillOutCont = true; 00294 } 00295 } 00296 else if( nMatch("MOLE",chCard) ) 00297 { 00298 /* disable molecule formation, first option is to turn off only H2 part */ 00299 if( nMatch(" H2 ",chCard) ) 00300 { 00301 /* turn off only H2 */ 00302 hmi.lgNoH2Mole = true; 00303 } 00304 else if( nMatch(" CO ",chCard) ) 00305 { 00306 /* turn off CO network */ 00307 co.lgNoCOMole = true; 00308 } 00309 else 00310 { 00311 /* turn off both CO and H2 networks */ 00312 hmi.lgNoH2Mole = true; 00313 co.lgNoCOMole = true; 00314 } 00315 phycon.lgPhysOK = false; 00316 } 00317 00318 else if( nMatch("PHOT",chCard) ) 00319 { 00320 /* disable photoionization */ 00321 ionbal.lgPhotoIoniz_On = false; 00322 phycon.lgPhysOK = false; 00323 } 00324 00325 else if( nMatch("RADI",chCard) ) 00326 { 00327 /* don't include line radiation pressure */ 00328 pressure.lgLineRadPresOn = false; 00329 } 00330 00331 else if( nMatch("RECO",chCard) ) 00332 { 00333 /* disable compton recoil of bound electrons - "no recoil ioniz" */ 00334 ionbal.lgCompRecoil = false; 00335 phycon.lgPhysOK = false; 00336 } 00337 00338 else if( nMatch("SCAT",chCard) && nMatch("OPAC",chCard)) 00339 { 00340 /* no scattering opacity, for Compton thick spherical geometry */ 00341 opac.lgScatON = false; 00342 } 00343 00344 else if( nMatch("SCAT",chCard) && nMatch("ESCA",chCard)) 00345 { 00346 /* no electron scattering contribution to line escape probs */ 00347 rt.lgElecScatEscape = false; 00348 } 00349 00350 else if( nMatch("SECO",chCard) ) 00351 { 00352 /* turn off secondary electron ionizations */ 00353 secondaries.lgSecOFF = true; 00354 phycon.lgPhysOK = false; 00355 } 00356 00357 else if( nMatch("SPOT",chCard) ) 00358 { 00359 /* no on-the-spot; turn on all ground state rec */ 00360 opac.otsmin = 1.; 00361 } 00362 00363 else if( nMatch("STAR",chCard) ) 00364 { 00365 /* no stark broadening */ 00366 rt.lgStarkON = false; 00367 phycon.lgPhysOK = false; 00368 } 00369 00370 else if( nMatch("STAT",chCard) ) 00371 { 00372 /* no static opacities - constantly reevaluate them */ 00373 opac.lgOpacStatic = false; 00374 } 00375 00376 else if( nMatch("TEPR",chCard) ) 00377 { 00378 /* no tepredictor */ 00379 /* turn off prediction of next zone's temperature, as guessed in ZoneStart */ 00380 thermal.lgPredNextTe = false; 00381 } 00382 00383 else if( nMatch("THRE",chCard) ) 00384 { 00385 /* turn off Cota's three body rec subroutine */ 00386 ionbal.lgNoCota = true; 00387 phycon.lgPhysOK = false; 00388 } 00389 00390 else if( nMatch("TIME",chCard) ) 00391 { 00392 /* don't print anything with a time, so that we can expect 00393 * perfect agreement between separate runs */ 00394 prt.lgPrintTime = false; 00395 } 00396 00397 else if( nMatch(" UTA",chCard) ) 00398 { 00399 /* turn off ALL inner shell absorption ionization */ 00400 ionbal.lgInnerShellLine_on = false; 00401 phycon.lgPhysOK = false; 00402 } 00403 00404 /* the no vary command is parsed well before we get to this point, 00405 * but we have to do something here or the parser will say that 00406 * no command existed on the command line */ 00407 else if( strncmp(chCard , "NO VARY" , 7 ) == 0 ) 00408 { 00409 /* this is a no-nothing, picked up to stop optimizer */ 00410 ((void)0); 00411 } 00412 00413 else 00414 { 00415 /* end of else if trap */ 00416 fprintf( ioQQQ, 00417 " I do not recognize a keyword on this NO ... command.\n %s\n Sorry.\n" , 00418 chCard); 00419 cdEXIT(EXIT_FAILURE); 00420 } 00421 00422 /* this option, if keyword (OK) appears, then do not set warning */ 00423 if( nMatch("(OK)",chCard) ) 00424 { 00425 /* say that physical conditions are actually ok */ 00426 phycon.lgPhysOK = true; 00427 } 00428 return; 00429 }