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 /*ParseTest parse the test command */ 00004 #include "cddefines.h" 00005 #include "atomfeii.h" 00006 #include "input.h" 00007 #include "assertresults.h" 00008 #include "parse.h" 00009 00010 void ParseTest(char *chCard , 00011 long int *nqh, 00012 realnum *ar1, 00013 bool lgDSet) 00014 { 00015 char chStuff[INPUT_LINE_LENGTH]; 00016 00017 DEBUG_ENTRY( "ParseTest()" ); 00018 00019 /* do a smoke test - 00020 * generate test input stream for rapid testing of code */ 00021 00022 /* optional keyword PRINT will cause all the commands to be printed */ 00023 int nPrintTest = nMatch("PRIN" , chCard ); 00024 00025 /* option to turn on the H2 molecule */ 00026 if( nMatch(" H2 ",chCard) ) 00027 { 00028 /* this will both enable the molecule and also set the threshold for actually 00029 * computing it to a very low value, so that it is actually used in ionized gas */ 00030 sprintf( chStuff , "ATOM H2 LIMIT -20 " ); 00031 if( nPrintTest ) 00032 fprintf(ioQQQ , "%s\n" , chStuff ); 00033 ParseAtomH2(chStuff); 00034 } 00035 00036 /* this is option to also turn on large FeII atom */ 00037 if( nMatch("FEII",chCard) || nMatch("FE II",chCard) ) 00038 { 00039 sprintf( chStuff , "ATOM FEII " ); 00040 if( nPrintTest ) 00041 fprintf(ioQQQ , "%s\n" , chStuff ); 00042 ParseAtomFeII(chStuff); 00043 } 00044 00045 /* use largest possible hydrogen atom */ 00046 if( nMatch("LARG",chCard) ) 00047 { 00048 sprintf( chStuff , "ATOM H-LIKE ELEMENT HYDROGEN LEVELS LIMIT " ); 00049 if( nPrintTest ) 00050 fprintf(ioQQQ , "%s\n" , chStuff ); 00051 ParseAtomISO(ipH_LIKE,chStuff); 00052 } 00053 00054 if( nMatch("MOLE",chCard) ) 00055 { 00056 # if 0 00057 /* hydrogen density */ 00058 sprintf( chStuff , "TRACE TEMPERATURE CONVERGENCE " ); 00059 if( nPrintTest ) 00060 fprintf(ioQQQ , "%s\n" , chStuff ); 00061 ParseTrace(chStuff); 00062 # endif 00063 00064 /* hydrogen density */ 00065 sprintf( chStuff , "HDEN 5 " ); 00066 if( nPrintTest ) 00067 fprintf(ioQQQ , "%s\n" , chStuff ); 00068 ParseHDEN(chStuff); 00069 00070 /* make a constant temperature model */ 00071 sprintf( chStuff , "CONSTANT TEMPER 50K " ); 00072 if( nPrintTest ) 00073 fprintf(ioQQQ , "%s\n" , chStuff ); 00074 ParseConstant(chStuff); 00075 00076 /* continuum to include full energy range */ 00077 sprintf( chStuff , "TABLE ISM " ); 00078 if( nPrintTest ) 00079 fprintf(ioQQQ , "%s\n" , chStuff ); 00080 ParseTable( nqh,chStuff, ar1); 00081 00082 /* extinguish this continuum */ 00083 sprintf( chStuff , "EXTINGUISH 23 " ); 00084 if( nPrintTest ) 00085 fprintf(ioQQQ , "%s\n" , chStuff ); 00086 ParseExtinguish( chStuff ); 00087 00088 /* stop in second zone, so we do use the zone increment logic */ 00089 sprintf( chStuff , "STOP ZONE 2 " ); 00090 if( nPrintTest ) 00091 fprintf(ioQQQ , "%s\n" , chStuff ); 00092 ParseStop(chStuff); 00093 00094 /* set thickness */ 00095 sprintf( chStuff , "SET DR 0 " ); 00096 if( nPrintTest ) 00097 fprintf(ioQQQ , "%s\n" , chStuff ); 00098 ParseSet(chStuff); 00099 00100 /* do Case B so lyman line pumping of H is not important */ 00101 sprintf( chStuff , "CASE B " ); 00102 if( nPrintTest ) 00103 fprintf(ioQQQ , "%s\n" , chStuff ); 00104 ParseCaseB(chStuff); 00105 00106 /* set cosmic rays */ 00107 sprintf( chStuff , "COSMIC RAY BACKGROUND " ); 00108 if( nPrintTest ) 00109 fprintf(ioQQQ , "%s\n" , chStuff ); 00110 ParseCosmicRays(chStuff); 00111 00112 /* add grains and ism abundances */ 00113 sprintf( chStuff , "ABUNDANCES ISM " ); 00114 if( nPrintTest ) 00115 fprintf(ioQQQ , "%s\n" , chStuff ); 00116 ParseAbundances(chStuff , lgDSet); 00117 00118 /* add grains and ism abundances */ 00119 sprintf( chStuff , "CONSTANT GRAIN TEMPERATURE 20K " ); 00120 if( nPrintTest ) 00121 fprintf(ioQQQ , "%s\n" , chStuff ); 00122 ParseConstant(chStuff); 00123 00124 /* create series of assert commands */ 00125 sprintf( input.chCARDCAPS , "ASSERT EDEN 0.528 " ); 00126 if( nPrintTest ) 00127 fprintf(ioQQQ , "%s\n" , input.chCARDCAPS ); 00128 ParseAssertResults(); 00129 00130 /* create series of assert commands */ 00131 sprintf( input.chCARDCAPS , "ASSERT MOLECULAR FRACTION H2 -1.193 " ); 00132 if( nPrintTest ) 00133 fprintf(ioQQQ , "%s\n" , input.chCARDCAPS ); 00134 ParseAssertResults(); 00135 00136 /* create series of assert commands */ 00137 sprintf( input.chCARDCAPS , "ASSERT COLUMN CO 1.214 " ); 00138 if( nPrintTest ) 00139 fprintf(ioQQQ , "%s\n" , input.chCARDCAPS ); 00140 ParseAssertResults(); 00141 00142 /* create series of assert commands */ 00143 sprintf( input.chCARDCAPS , "ASSERT EDEN 0.528 " ); 00144 if( nPrintTest ) 00145 fprintf(ioQQQ , "%s\n" , input.chCARDCAPS ); 00146 ParseAssertResults(); 00147 00148 /* create series of assert commands */ 00149 sprintf( input.chCARDCAPS , "ASSERT HYDROGEN 1 TEMPERATURE 50K " ); 00150 if( nPrintTest ) 00151 fprintf(ioQQQ , "%s\n" , input.chCARDCAPS ); 00152 ParseAssertResults(); 00153 } 00154 00155 else 00156 { 00157 /* hydrogen density */ 00158 sprintf( chStuff , "HDEN 4 " ); 00159 if( nPrintTest ) 00160 fprintf(ioQQQ , "%s\n" , chStuff ); 00161 ParseHDEN(chStuff); 00162 00163 /* make a constant temperature model */ 00164 sprintf( chStuff , "CONSTANT TEMPER 4 " ); 00165 if( nPrintTest ) 00166 fprintf(ioQQQ , "%s\n" , chStuff ); 00167 ParseConstant(chStuff); 00168 00169 /* continuum to include full energy range */ 00170 sprintf( chStuff , "TABLE AGN " ); 00171 if( nPrintTest ) 00172 fprintf(ioQQQ , "%s\n" , chStuff ); 00173 ParseTable( nqh,chStuff, ar1); 00174 00175 /* set ionization parameter */ 00176 sprintf( chStuff , "IONIZATION PARAMETER -2 " ); 00177 if( nPrintTest ) 00178 fprintf(ioQQQ , "%s\n" , chStuff ); 00179 ParseIonPar( nqh,chStuff, ar1); 00180 00181 /* use old abundances */ 00182 sprintf( chStuff , "ABUNDANCES OLD SOLAR 84 " ); 00183 if( nPrintTest ) 00184 fprintf(ioQQQ , "%s\n" , chStuff ); 00185 ParseAbundances(chStuff,lgDSet); 00186 00187 /* >>chng 02 apr 19, add this */ 00188 /* set total Lyman continuum depth - this is to prevent caution 00189 * that Lyman continuum was thin but expected to be thick */ 00190 sprintf( chStuff , "STOP LYMAN OPTICAL -4 " ); 00191 if( nPrintTest ) 00192 fprintf(ioQQQ , "%s\n" , chStuff ); 00193 ParseStop(chStuff); 00194 00195 /* stop in second zone, so we do use the zone increment logic */ 00196 sprintf( chStuff , "STOP ZONE 2 " ); 00197 if( nPrintTest ) 00198 fprintf(ioQQQ , "%s\n" , chStuff ); 00199 ParseStop(chStuff); 00200 00201 /* set thickness */ 00202 sprintf( chStuff , "SET DR 0 " ); 00203 if( nPrintTest ) 00204 fprintf(ioQQQ , "%s\n" , chStuff ); 00205 ParseSet(chStuff); 00206 00207 /* create series of assert commands */ 00208 sprintf( input.chCARDCAPS , "ASSERT HYDROGEN 1 IONIZATION -3.040 " ); 00209 if( nPrintTest ) 00210 fprintf(ioQQQ , "%s\n" , input.chCARDCAPS ); 00211 ParseAssertResults(); 00212 00213 sprintf( input.chCARDCAPS , "ASSERT HELIUM 2 IONIZATION -1.067 " ); 00214 if( nPrintTest ) 00215 fprintf(ioQQQ , "%s\n" , input.chCARDCAPS ); 00216 ParseAssertResults(); 00217 00218 sprintf( input.chCARDCAPS , "ASSERT CARBON 2 IONIZATION -2.301 " ); 00219 if( nPrintTest ) 00220 fprintf(ioQQQ , "%s\n" , input.chCARDCAPS ); 00221 ParseAssertResults(); 00222 00223 /*>>chng 06 dec 01, from -0.653 to -0.560. Badnell DR by default */ 00224 sprintf( input.chCARDCAPS , "ASSERT CARBON 3 IONIZATION -0.560 " ); 00225 if( nPrintTest ) 00226 fprintf(ioQQQ , "%s\n" , input.chCARDCAPS ); 00227 ParseAssertResults(); 00228 00229 /*>>chng 06 dec 01, from -0.348 to -0.373. Badnell DR by default */ 00230 sprintf( input.chCARDCAPS , "ASSERT CARBON 4 IONIZATION -0.373 " ); 00231 if( nPrintTest ) 00232 fprintf(ioQQQ , "%s\n" , input.chCARDCAPS ); 00233 ParseAssertResults(); 00234 00235 /*>>chng 06 dec 01, from -0.490 to -0.530. Badnell DR by default */ 00236 sprintf( input.chCARDCAPS , "ASSERT CARBON 5 IONIZATION -0.530 " ); 00237 if( nPrintTest ) 00238 fprintf(ioQQQ , "%s\n" , input.chCARDCAPS ); 00239 ParseAssertResults(); 00240 00241 /*>>chng 06 dec 01, from -0.800 to -0.861. Badnell DR by default */ 00242 sprintf( input.chCARDCAPS , "ASSERT OXYGEN 3 IONIZATION -0.861 " ); 00243 if( nPrintTest ) 00244 fprintf(ioQQQ , "%s\n" , input.chCARDCAPS ); 00245 ParseAssertResults(); 00246 00247 /*>>chng 06 dec 01, from -0.180 to -0.157. Badnell DR by default */ 00248 sprintf( input.chCARDCAPS , "ASSERT OXYGEN 4 IONIZATION -0.157 " ); 00249 if( nPrintTest ) 00250 fprintf(ioQQQ , "%s\n" , input.chCARDCAPS ); 00251 ParseAssertResults(); 00252 00253 /*>>chng 06 dec 01, from -0.770 to -0.808. Badnell DR by default */ 00254 sprintf( input.chCARDCAPS , "ASSERT OXYGEN 5 IONIZATION -0.808 " ); 00255 if( nPrintTest ) 00256 fprintf(ioQQQ , "%s\n" , input.chCARDCAPS ); 00257 ParseAssertResults(); 00258 00259 /* >>chng 02 apr 19, from 0.7258 to 0.946, due to adding Lyman cont depth */ 00260 /* >>chng 07 oct 22, from 0.946 to 1.108, resolve l-levels of h-like sequence */ 00261 sprintf( input.chCARDCAPS , "ASSERT LINE \"CA B\" 4861 1.108 " ); 00262 if( nPrintTest ) 00263 fprintf(ioQQQ , "%s\n" , input.chCARDCAPS ); 00264 /* must have copy of this in chOrgCard, which is used by the routine to get lab */ 00265 strcpy( input.chOrgCard , input.chCARDCAPS); 00266 ParseAssertResults(); 00267 00268 /* >>chng 02 apr 19, from 2.4603 to 3.25, due to adding Lyman cont depth 00269 * >>chng 06 nov 17, asserted value from 3.25 to 3.11, drift over last year */ 00270 /* >>chng 06 dec 01, from 3.11 to 2.72. Badnell DR by default */ 00271 /* >>chng 07 oct 22, from 2.72 to 3.18, resolve l-levels of h-like sequence */ 00272 sprintf( input.chCARDCAPS , "ASSERT LINE \"O 3\" 5007 3.18 " ); 00273 if( nPrintTest ) 00274 fprintf(ioQQQ , "%s\n" , input.chCARDCAPS ); 00275 /* must have copy of this in chOrgCard, which is used by the routine to get lab */ 00276 strcpy( input.chOrgCard , input.chCARDCAPS); 00277 ParseAssertResults(); 00278 00279 sprintf( input.chCARDCAPS , "ASSERT HTOT -15.011" ); 00280 if( nPrintTest ) 00281 fprintf(ioQQQ , "%s\n" , input.chCARDCAPS ); 00282 ParseAssertResults(); 00283 } 00284 return; 00285 }