53 bool lgQuotesFound =
true;
54 if (p.
GetQuote(chString_quotes_lowercase,
false))
55 lgQuotesFound =
false;
62 cpu.i().setAssertAbort(
true);
94 " One of the keywords AS DR or CS must appear to change"
95 " the transition probabilities, dielectronic recombination rate,"
96 " or collision strength.\n Sorry.\n");
109 fprintf(
ioQQQ,
" No molecule was on this SET ATOMIC DATA command.\n Sorry.\n");
110 fprintf(
ioQQQ,
" Use SET ATOMIC DATA ION to change an ion.\n Sorry.\n");
114 if (strcmp(chMole,
"H2") == 0)
116 if (p.
nMatch(
" H ") && lgCS)
122 long int nYear = (long) p.
FFmtRead();
124 p.
NoNumb(
"collison data set (year)");
130 h2.lgH2_H_coll_07 =
false;
131 h2.coll_source[0].filename =
"coll_rates_H_99.dat";
133 else if (nYear == 2007)
138 h2.lgH2_H_coll_07 =
true;
139 h2.coll_source[0].filename =
"coll_rates_H_07.dat";
144 fprintf(
ioQQQ,
" the SET ATOMIC DATA MOLECULE H2"
145 " H CS command must have year 1999 or 2007.\n");
149 else if (p.
nMatch(
" HE ") && lgCS)
156 h2.lgH2_He_ORNL =
true;
157 h2.coll_source[1].filename =
"coll_rates_He_ORNL.dat";
159 else if( p.
nMatch(
"BOUR") )
164 h2.lgH2_He_ORNL =
false;
165 h2.coll_source[1].filename =
"coll_rates_He_LeBourlot.dat";
170 fprintf(
ioQQQ,
" the SET ATOMIC DATA MOLECULE H2"
171 "He CS command must have ORNL or Le BOURlot.\n");
177 fprintf(
ioQQQ,
" the SET ATOMIC DATA H2 CS command requires a collider keyword.\n" );
193 conv.lgUpdateCouplings =
true;
205 else if (p.
nMatch(
" DIMA"))
212 " \nPROBLEM Unrecognized set collisional ionization data option.\n");
213 fprintf(
ioQQQ,
" Valid options are Dima or Hybrid.\n");
214 fprintf(
ioQQQ,
" See Hazy 1 for details.\n");
228 else if( p.
nMatch(
"AD69" ) )
239 fprintf(
ioQQQ,
" There should have been an option on this SET H2 CONTinuum DISSociation command.\n" );
240 fprintf(
ioQQQ,
" consult Hazy to find valid options.\n Sorry.\n" );
253 p.
NoNumb(
"minimum charge transfer rate");
271 else if( p.
nMatch(
" OFF" ) )
307 else if( p.
nMatch(
" OFF" ) )
341 else if( p.
nMatch(
" OFF" ) )
356 " There should have been an option on this SET CHEMISTRY command.\n");
357 fprintf(
ioQQQ,
" consult Hazy to find valid options.\n Sorry.\n");
367 iso_ctrl.lgCollStrenThermAver =
false;
372 iso_ctrl.lgCollStrenThermAver =
true;
376 else if (p.
nMatch(
"COVE"))
392 else if (p.
nMatch(
"CSUP"))
399 p.
NoNumb(
"secondary ionization rate");
405 else if (p.
nMatch(
" D/H"))
425 p.
NoNumb(
"density tolerance");
427 if(
conv.GasPhaseAbundErrorAllowed <= 0. )
435 fprintf(
ioQQQ,
" The SET HO CHAR command is no longer supported.\n" );
441 fprintf(
ioQQQ,
" The SET HHE CHAR command is no longer supported.\n" );
445 else if( p.
nMatch(
"12C1") )
455 p.
NoNumb(
"12C to 13C abundance ratio");
457 if (
co.C12_C13_isotope_ratio_parsed <= 0. || p.
nMatch(
" LOG"))
459 co.C12_C13_isotope_ratio_parsed);
463 else if (p.
nMatch(
"DYNA"))
471 p.
NoNumb(
"advection length");
497 strcpy(
dynamics.chPresMode,
"subsonic");
499 else if (p.
nMatch(
"SUPE"))
502 strcpy(
dynamics.chPresMode,
"supersonic");
504 else if (p.
nMatch(
"STRO"))
507 strcpy(
dynamics.chPresMode,
"strongd");
509 else if (p.
nMatch(
"ORIG"))
512 strcpy(
dynamics.chPresMode,
"original");
518 strcpy(
dynamics.chPresMode,
"antishock");
523 p.
NoNumb(
"antishock depth");
529 strcpy(
dynamics.chPresMode,
"antishock-by-mach");
534 p.
NoNumb(
"antishock-by-mach");
536 else if (p.
nMatch(
"RELA"))
542 p.
NoNumb(
"relaxation cycles before start of dynamics");
543 else if (
dynamics.n_initial_relax < 2)
546 " First iteration to relax dynamics must be > 1."
547 "It was %li. Sorry.\n",
dynamics.n_initial_relax);
554 strcpy(
dynamics.chPresMode,
"shock");
572 " There should have been an option on this SET DYNAMICS command.\n");
573 fprintf(
ioQQQ,
" consult Hazy to find valid options.\n Sorry.\n");
578 else if (p.
nMatch(
"DIDZ"))
584 if (
radius.drChange <= 0.)
590 p.
NoNumb(
"largest optical depth allowed in zone");
595 else if (p.
nMatch(
"EDEN"))
606 p.
NoNumb(
"electron density error allowed");
609 if (
conv.EdenErrorAllowed < 0.)
611 conv.EdenErrorAllowed = pow(10.,
conv.EdenErrorAllowed);
614 else if(p.
nMatch(
"FRACTION"))
620 p.
NoNumb(
"electron density fraction");
623 if (
dense.EdenFraction <= 0. )
625 dense.EdenFraction = pow(10.,
dense.EdenFraction);
637 p.
NoNumb(
"electron density");
646 else if( p.
nMatch(
"GBAR"))
661 p.
NoNumb(
"ionization error allowed");
664 if (
conv.IonizErrorAllowed < 0.)
666 conv.IonizErrorAllowed = pow(10., (
double)
conv.IonizErrorAllowed);
693 " An element name must appear on this line\n Sorry.\n");
699 if (
rfield.fine_opac_nresolv < 1)
702 " The number of resolution elements within FWHM of line must appear\n Sorry.\n");
712 lower_limit = pow((
realnum) 10.f, lower_limit);
714 if (lower_limit > 0.2f)
717 " The fine continuum lower limit is quite high (%f Ryd). Please check.\n",
727 upper_limit = pow((
realnum) 10.f, upper_limit);
729 if (upper_limit < 10.f)
732 " The fine continuum upper limit is quite low (%f Ryd). Please check.\n",
752 p.
NoNumb(
"grain heating");
758 " A keyword must appear on the SET GRAIN line - options are HEAT \n Sorry.\n");
770 hmi.lgLeiden_Keep_ipMH2s =
false;
777 hmi.lgLeidenCRHack =
false;
788 else if (p.
nMatch(
" H2 "))
794 " The first number on this line must be the 2 in H2\n Sorry.\n");
805 "PROBLEM - *set H2 Solomon* has been changed to *set H2 small model*."
806 " This is OK for now but it may not work in a future version.\n");
811 hmi.chH2_small_model_type =
'T';
813 else if (p.
nMatch(
" BHT"))
818 hmi.chH2_small_model_type =
'H';
820 else if (p.
nMatch(
"BD96"))
825 hmi.chH2_small_model_type =
'B';
827 else if (p.
nMatch(
"ELWE"))
832 hmi.chH2_small_model_type =
'E';
837 " One of the keywords TH85, _BHT, BD96 or ELWErt must appear.\n Sorry.\n");
849 hmi.chGrainFormPump =
'D';
851 else if (p.
nMatch(
"TAKA"))
855 hmi.chGrainFormPump =
'T';
857 else if (p.
nMatch(
"THER"))
861 hmi.chGrainFormPump =
't';
866 " The grain form pump option is wrong.\n Sorry.\n");
872 else if (p.
nMatch(
"JURA"))
879 else if (p.
nMatch(
"CT02"))
884 else if (p.
nMatch(
"SN99"))
889 else if (p.
nMatch(
"RATE"))
896 hmi.rate_h2_form_grains_set = pow(10., p.
FFmtRead());
901 hmi.rate_h2_form_grains_set = 3e-17;
904 else if (p.
nMatch(
"SCAL"))
909 if (p.
nMatch(
" LOG") ||
hmi.ScaleJura < 0.)
914 p.
NoNumb(
"scale for Jura rate");
921 "SET H2 JURA SCALE %f LOG");
936 fprintf(
ioQQQ,
" The Jura rate option is wrong.\n Sorry.\n");
942 else if (p.
nMatch(
" TAD"))
946 p.
NoNumb(
"temperature for binding energy");
952 else if (p.
nMatch(
"FRAC"))
960 p.
NoNumb(
"H2 fractional abundance");
963 if (
hmi.H2_frac_abund_set <= 0.)
964 hmi.H2_frac_abund_set = pow(10.,
hmi.H2_frac_abund_set);
967 hmi.H2_frac_abund_set =
MIN2(0.49999,
hmi.H2_frac_abund_set);
979 p.
NoNumb(
"H2 formation scale");
982 if (
hmi.H2_formation_scale <= 0.)
983 hmi.H2_formation_scale = pow(10.,
hmi.H2_frac_abund_set);
991 else if (p.
nMatch(
"HCOR"))
995 p.
NoNumb(
"scale for H0 correction to e- collision rate");
998 else if (p.
nMatch(
" PAH"))
1004 gv.chPAH_abundance = chString_quotes_lowercase;
1006 else if (p.
nMatch(
"CONS"))
1009 gv.chPAH_abundance =
"CON";
1011 else if (p.
nMatch(
"BAKE"))
1015 gv.lgBakesPAH_heat =
true;
1022 " a string, or one of the keywords BAKES, or CONStant must appear.\n Sorry.");
1028 else if (p.
nMatch(
"PRES"))
1037 p.
NoNumb(
"pressure convergence tolerance");
1039 if (
conv.PressureErrorAllowed < 0.)
1041 conv.PressureErrorAllowed);
1043 else if( p.
nMatch(
"IONI") )
1050 p.
NoNumb(
"number of calls from pressure to ion solver");
1052 else if (
conv.limPres2Ioniz <= 0)
1054 fprintf(
ioQQQ,
" The limit must be greater than zero.\n Sorry.");
1064 " I didn\'t recognize a key on this SET PRESSURE line.\n");
1065 fprintf(
ioQQQ,
" The ones I know about are: CONVergence and IONIze.\n");
1069 else if (p.
nMatch(
"RECOMBIN"))
1072 if (p.
nMatch(
"DIELECTR"))
1079 for (
int ion = 0; ion <
LIMELM; ++ion)
1080 ionbal.DR_mean_scale[ion] = 0.;
1083 else if (p.
nMatch(
"SCALE"))
1091 " There must be at least one scale factor on the SET RECOMBIANTION MEAN command.\n");
1095 for (
int ion = 1; ion <
LIMELM; ++ion)
1099 ionbal.DR_mean_scale[ion]
1100 =
ionbal.DR_mean_scale[ion - 1];
1102 for (
int ion = 0; ion <
LIMELM; ++ion)
1104 if (
ionbal.DR_mean_scale[ion] < 0)
1107 " All scale factors on the SET RECOMBIANTION MEAN command must be >=0.\n");
1113 else if (p.
nMatch(
"NOISE"))
1124 fprintf(
ioQQQ,
" key OFF or NOISE must appear.\n");
1130 fprintf(
ioQQQ,
" key MEAN must appear.\n");
1137 " key DIELECTRonic must appear on set recombination command.\n");
1142 else if (p.
nMatch(
" DR "))
1154 p.
NoNumb(
"zone thickness");
1167 "\n Thicknesses less than about %.0e will NOT give accurate results. If tricking the code\n",
1171 " into computing emissivities instead of intensities, try to instead use a thickness of unity,\n");
1174 " and then multiply (divide) the results by the necessary thickness (product of densities).\n\n");
1181 " When using a relative dr, a fraction between 0 and 1 must be entered. Found: %g\n",
1187 else if (p.
nMatch(
"DRMA"))
1192 p.
NoNumb(
"maximum zone thickness");
1203 " When using a relative drmax, a fraction between 0 and 1 must be entered. Found: %g\n",
1214 p.
NoNumb(
"minimum zone thickness rel to depth");
1217 radius.sdrmin_rel_depth = pow(10.,
radius.sdrmin_rel_depth );
1219 if(
radius.sdrmin_rel_depth <= 0. ||
radius.sdrmin_rel_depth >= 1.)
1221 fprintf(
ioQQQ,
" When using a relative drmin, a fraction between 0 and 1 must be entered. Found: %g\n",
1222 radius.sdrmin_rel_depth );
1227 else if (p.
nMatch(
"DRMI"))
1232 p.
NoNumb(
"minimum zone thickness");
1242 fprintf(
ioQQQ,
" When using a relative drmin, a fraction between 0 and 1 must be entered. Found: %g\n",
1248 else if (p.
nMatch(
"FLXF"))
1254 p.
NoNumb(
"faintest continuum flux to consider");
1256 if (
rfield.FluxFaint < 0.)
1269 p.
NoNumb(
"line precision");
1274 " set line precision currently only works for up to 6 significant figures.\n");
1282 else if (p.
nMatch(
"NFNU"))
1304 prt.lgDiffuseInward = p.
nMatch(
"DIFFUSE_I")
1305 || p.
nMatch(
"DIFFUSE I");
1311 if (!(
prt.lgSourceReflected ||
prt.lgSourceTransmitted
1312 ||
prt.lgDiffuseInward ||
prt.lgDiffuseOutward))
1315 " set nFnu expects one or more of the following keywords:\n");
1316 fprintf(
ioQQQ,
" INCIDENT_REFLECTED, INCIDENT_TRANSMITTED, "
1317 "DIFFUSE_INWARD, DIFFUSE_OUTWARD\n");
1323 else if (p.
nMatch(
"IND2"))
1330 else if( p.
nMatch(
" OFF") )
1336 fprintf(
ioQQQ,
" set ind2 needs either ON or OFF.\n" );
1343 else if (p.
nMatch(
"SPECIES"))
1350 p.
NoNumb(
"the default collision strengths when no collision or radiative data are available");
1355 fprintf(
ioQQQ,
" SET SPECIES takes option GBAR.\n");
1360 else if (p.
nMatch(
"TEMP"))
1367 p.
NoNumb(
"temperature floor");
1376 fprintf(
ioQQQ,
" TE < %gK, reset to %gK.\n",
1377 phycon.TEMP_LIMIT_LOW, 1.0001 *
phycon.TEMP_LIMIT_LOW);
1384 " TE > %gK. Cloudy cannot handle this. Bailing out.\n",
1394 "SET TEMPERATURE FLOOR %f LOG");
1403 1.00001 *
phycon.TEMP_LIMIT_LOW);
1405 0.99999 *
phycon.TEMP_LIMIT_HIGH);
1418 p.
NoNumb(
"heating cooling tolerance");
1420 if (
conv.HeatCoolRelErrorAllowed <= 0.)
1423 conv.HeatCoolRelErrorAllowed);
1430 "\nI did not recognize a keyword on this SET TEMPERATURE command.\n");
1432 fprintf(
ioQQQ,
"The keywords are FLOOr and CONVergence.\n");
1437 else if (p.
nMatch(
"TEST"))
1443 else if (p.
nMatch(
"TRIM"))
1457 ionbal.lgTrimhiOn =
false;
1463 else if (p.
nMatch(
"LOWE"))
1489 p.
NoNumb(
"trimming parameter");
1494 fprintf(
ioQQQ,
" number must be negative since log\n");
1499 else if (p.
nMatch(
"SKIP"))
1505 p.
NoNumb(
"number of points to skip in save");
1509 else if (p.
nMatch(
" UTA"))
1518 ionbal.lgInnerShell_Gu06 =
false;
1525 ionbal.lgInnerShell_Gu06 =
true;
1528 else if (p.
nMatch(
"KISI"))
1533 ionbal.lgInnerShell_Kisielius =
false;
1538 ionbal.lgInnerShell_Kisielius =
true;
1543 else if (p.
nMatch(
"WEAKH"))
1550 p.
NoNumb(
"threshold on save heating and cooling");
1553 if (
save.WeakHeatCool < 0.)
1560 else if (p.
nMatch(
"KSHE"))
1566 p.
NoNumb(
"k-shell ionization opacity limit");
1577 fprintf(
ioQQQ,
" k-shell energy must be greater than 194 Ryd\n");
1582 else if (p.
nMatch(
"NCHR"))
1589 p.
NoNumb(
"number of charge states");
1593 long nChrg =
nint(val);
1594 if (nChrg < 2 || nChrg >
NCHU)
1597 " illegal value for number of charge states: %ld\n",
1599 fprintf(
ioQQQ,
" choose a value between 2 and %d\n",
NCHU);
1601 " or increase NCHS in grainvar.h and recompile\n");
1611 else if (p.
nMatch(
"NEGO"))
1614 opac.lgNegOpacIO =
true;
1617 else if (p.
nMatch(
"NEND"))
1629 p.
NoNumb(
"limit to zone number");
1632 for (
long i = 0; i <
iterations.iter_malloc; i++)
1638 "CAUTION - it will take a lot of memory to save"
1639 " results for %li zones. Is this many zones really necessary?\n",
1644 else if (p.
nMatch(
"TSQD"))
1652 p.
NoNumb(
"highest density in t^2 section of printout");
1657 else if (p.
nMatch(
"NMAP"))
1663 p.
NoNumb(
"steps in heating-cooling map");
1673 else if (p.
nMatch(
"PATH"))
1675 fprintf(
ioQQQ,
" The SET PATH command is no longer supported.\n");
1676 fprintf(
ioQQQ,
" Please set the correct path in the file path.h.\n");
1678 " Or set the environment variable CLOUDY_DATA_PATH.\n Sorry.\n");
1682 else if (p.
nMatch(
"PHFI"))
1688 p.
NoNumb(
"version of PHFIT");
1696 else if (ip == 1996)
1703 fprintf(
ioQQQ,
" Two possible values are 1995 and 1996.\n");
1717 " I didn\'t recognize a key on this SET SAVE HASH line.\n");
1726 if (strcmp(chString_quotes_lowercase,
"return") == 0)
1729 sprintf(
save.chHashString,
"\n");
1731 else if (strcmp(chString_quotes_lowercase,
"time") == 0)
1734 sprintf(
save.chHashString,
"TIME_DEP");
1739 strcpy(
save.chHashString, chString_quotes_lowercase);
1749 fprintf(
ioQQQ,
" the keyword C is no longer necessary since"
1750 " energy conservation is now supported by default.\n");
1753 else if (p.
nMatch(
"SUPP"))
1760 p.
NoNumb(
"line width or resolution");
1764 " line width or resolution must be greater than zero.\n");
1779 save.ResolutionAbs =
save.Resolution;
1782 else if (p.
nMatch(
"PREF"))
1784 if(
save.nsave > 0 )
1786 fprintf(
ioQQQ,
" The SET SAVE PREFIX command should precede all save commands.\n" );
1790 save.chFilenamePrefix = chString_quotes_lowercase;
1793 else if (p.
nMatch(
"FLUS"))
1796 save.lgFLUSH =
true;
1802 " There should have been an option on this command.\n");
1804 " Valid options for SET SAVE are summarized in Hazy 1 "
1805 "Miscellaneous commands.\n");
1807 " The SET PUNCHLWIDTH command is now SET SAVE LINE WIDTH.\n");
1813 else if (p.
nMatch(
"CONT"))
1825 "PROBLEM The set FeII continuum command must have"
1826 " three numbers, the lower and upper wavelength range in Angstroms"
1827 " and the number of bins to divide this into.\n");
1831 if (
FeII.feconwlLo >=
FeII.feconwlHi)
1833 fprintf(
ioQQQ,
"PROBLEM The first two numbers on the set "
1834 "FeII continuum command must be the lower and upper "
1835 "wavelength range in Angstroms and the first must be less "
1836 "than the second.\n");
1839 if (
FeII.nfe2con < 2)
1842 "PROBLEM The third number on the set FeII continuum "
1843 "command must be the number of bins to divide the range into and"
1844 " it must be greater than 1.\n");
1850 else if (p.
nMatch(
"RESO"))
1857 p.
NoNumb(
"continuum resolution scale");
1860 if (
continuum.ResolutionScaleFactor <= 0.)
1861 continuum.ResolutionScaleFactor = pow(10.,
1865 else if (p.
nMatch(
"SHIE"))
1878 else if (p.
nMatch(
"FEDE"))
1886 else if (p.
nMatch(
"FERL"))
1890 else if (p.
nMatch(
"NONE"))
1893 rt.nLineContShield = 0;
1898 " I didn\'t recognize a key on this SET CONTINUUM SHIELDing line.\n");
1900 " The ones I know about are: PESC, FEDErman, & FERLand.\n");
1908 " I didn\'t recognize a key on this SET CONTINUUM line.\n");
1910 " The ones I know about are: RESOlution and SHIEld.\n");
1917 fprintf(
ioQQQ,
" I didn\'t recognize a key on this SET command.\n");