00001
00002
00003
00004 #include "cddefines.h"
00005 #include "hmi.h"
00006 #include "h2.h"
00007 #include "h2_priv.h"
00008 #include "parser.h"
00009 #include "thirdparty.h"
00010 #include "deuterium.h"
00011
00012
00013 void ParseAtomH2(Parser &p )
00014 {
00015 long int j;
00016
00017 DEBUG_ENTRY( "ParseAtomH2()" );
00018
00019 fixit();
00020
00021
00022
00023
00024
00025
00026 diatomics *diatom = NULL;
00027
00028 if( p.nMatch(" H2 " ) )
00029 {
00030 diatom = &h2;
00031
00032
00033
00034 j = (long int)p.FFmtRead();
00035 if( j != 2 )
00036 {
00037 fprintf( ioQQQ, " Something is wrong with the order of the numbers on this line.\n" );
00038 fprintf( ioQQQ, " The first number I encounter should be a 2.\n Sorry.\n" );
00039 cdEXIT(EXIT_FAILURE);
00040 }
00041 }
00042 else if( p.nMatch(" HD " ) )
00043 {
00044 diatom = &hd;
00045
00046 deut.lgElmtOn = true;
00047 }
00048
00049
00050 diatom->lgEnabled = true;
00051
00052 if( p.nMatch("LEVE") )
00053 {
00054
00055
00056
00057
00058
00059 if( !diatom->lgREAD_DATA )
00060 {
00061 diatom->n_elec_states = (long int)p.FFmtRead();
00062 if( p.lgEOL() )
00063 {
00064 if( p.nMatch("LARG") )
00065 {
00066
00067 diatom->n_elec_states = N_ELEC;
00068 }
00069 else
00070 {
00071 p.NoNumb("number of electronic levels");
00072 }
00073 }
00074
00075
00076 if( diatom->n_elec_states < 3 )
00077 {
00078 fprintf( ioQQQ, " This would be too few electronic levels - resetting to 3.\n" );
00079 diatom->n_elec_states = 3;
00080 }
00081
00082 else if( diatom->n_elec_states > N_ELEC )
00083 {
00084 fprintf( ioQQQ,
00085 " This would be too many levels, the limit is %i.\n" ,
00086 N_ELEC);
00087 cdEXIT(EXIT_FAILURE);
00088 }
00089 }
00090 }
00091
00092 else if( p.nMatch("LIMI") )
00093 {
00094
00095
00096 diatom->H2_to_H_limit = p.FFmtRead();
00097 if( p.lgEOL() )
00098 {
00099
00100 if( p.nMatch( " OFF" ) )
00101 {
00102
00103 diatom->H2_to_H_limit = -1.;
00104 }
00105 else
00106 {
00107 p.NoNumb( "limit to the H2 / Htot ratio" );
00108 }
00109 }
00110 else
00111 {
00112
00113
00114 if( diatom->H2_to_H_limit <= 0. )
00115 diatom->H2_to_H_limit = pow(10., diatom->H2_to_H_limit);
00116 }
00117 }
00118 else if( p.nMatch("GBAR" ) )
00119 {
00120
00121
00122 if( p.nMatch(" OFF" ) )
00123 {
00124 diatom->lgColl_gbar = false;
00125 }
00126 else if( p.nMatch(" ON " ) )
00127 {
00128 diatom->lgColl_gbar = true;
00129 }
00130 else
00131 {
00132 fprintf( ioQQQ,
00133 " The gbar approximation must be off (\" OFF\") or on (\" ON \").\n");
00134 cdEXIT(EXIT_FAILURE);
00135 }
00136 }
00137
00138 else if( p.nMatch("COLL" ) )
00139 {
00140
00141 if( p.nMatch("DISS" ) )
00142 {
00143
00144 if( p.nMatch(" ON " ) )
00145 {
00146
00147 diatom->lgColl_dissoc_coll = true;
00148 }
00149 else
00150 {
00151
00152 diatom->lgColl_dissoc_coll = false;
00153 }
00154 }
00155
00156
00157
00158
00159 else if( p.nMatch("ORTH" ) && p.nMatch("PARA" ) )
00160 {
00161
00162 if( p.nMatch(" ON " ) )
00163 {
00164
00165 diatom->lgH2_ortho_para_coll_on = true;
00166 }
00167 else
00168 {
00169
00170
00171 diatom->lgH2_ortho_para_coll_on = false;
00172 }
00173 }
00174
00175
00176 else if( p.nMatch("GRAI" ) )
00177 {
00178
00179 if( p.nMatch(" ON" ) )
00180 {
00181
00182 diatom->lgH2_grain_deexcitation = true;
00183 }
00184 else
00185 {
00186
00187 diatom->lgH2_grain_deexcitation = false;
00188 }
00189 }
00190 else if( p.nMatch(" HE " ) )
00191 {
00192
00193
00194
00195 if( p.nMatch(" NEW" ) || p.nMatch("ORNL" ) )
00196 {
00197
00198 diatom->lgH2_He_ORNL = true;
00199 diatom->coll_source[1].filename = "coll_rates_He_ORNL.dat";
00200 }
00201 else if( p.nMatch(" OLD" ) || p.nMatch("BOUR" ) )
00202 {
00203
00204
00205
00206 diatom->lgH2_He_ORNL = false;
00207 diatom->coll_source[1].filename = "coll_rates_He_LeBourlot.dat";
00208 }
00209 else
00210 {
00211 fprintf( ioQQQ,
00212 " I did not find a keyword on this ATOM H2 HE command - I know about the keys ORNL and Le BOURlot\n");
00213 cdEXIT(EXIT_FAILURE);
00214 }
00215 }
00216
00217
00218 else if( p.nMatch("ORH2" ) )
00219 {
00220
00221
00222
00223 if( p.nMatch("ORNL" ) )
00224 {
00225
00226 diatom->lgH2_ORH2_ORNL = true;
00227 diatom->coll_source[2].filename = "coll_rates_H2ortho_ORNL.dat";
00228 }
00229 else if( p.nMatch("BOUR" ) )
00230 {
00231
00232
00233
00234 diatom->lgH2_ORH2_ORNL = false;
00235 diatom->coll_source[2].filename = "coll_rates_H2ortho_LeBourlot.dat";
00236 }
00237 else
00238 {
00239 fprintf( ioQQQ,
00240 " I did not find a keyword on this ATOM H2 ohH2 command - I know about the keys ORNL and Le BOURlot\n");
00241 cdEXIT(EXIT_FAILURE);
00242 }
00243 }
00244
00245 else if( p.nMatch("PAH2" ) )
00246 {
00247
00248
00249
00250 if( p.nMatch("ORNL" ) )
00251 {
00252
00253 diatom->lgH2_PAH2_ORNL = true;
00254 diatom->coll_source[3].filename = "coll_rates_H2para_ORNL.dat";
00255 }
00256 else if( p.nMatch("BOUR" ) )
00257 {
00258
00259
00260
00261 diatom->lgH2_PAH2_ORNL = false;
00262 diatom->coll_source[3].filename = "coll_rates_H2para_LeBourlot.dat";
00263 }
00264 else
00265 {
00266 fprintf( ioQQQ,
00267 " I did not find a keyword on this ATOM H2 paH2 command - I know about the keys ORNL and Le BOURlot\n");
00268 cdEXIT(EXIT_FAILURE);
00269 }
00270 }
00271
00272 else
00273 {
00274
00275 if( p.nMatch(" ON " ) )
00276 {
00277
00278 diatom->lgColl_deexec_Calc = true;
00279 }
00280 else
00281 {
00282
00283 diatom->lgColl_deexec_Calc = false;
00284 }
00285 }
00286 }
00287
00288
00289 else if( p.nMatch("MATR" ) && !p.nMatch("TRAC" ) )
00290 {
00291
00292
00293 long numLevels = (long)p.FFmtRead();
00294 if( p.nMatch(" ALL") )
00295 {
00296
00297
00298
00299 numLevels = -1;
00300 }
00301 else if( p.lgEOL() && !(p.nMatch(" OFF") || p.nMatch("NONE") ) )
00302 {
00303
00304 fprintf( ioQQQ,
00305 " The total number of levels used in the matrix solver must be entered, or keywords ALL or NONE entered.\n Sorry.\n");
00306 cdEXIT(EXIT_FAILURE);
00307 }
00308
00309 diatom->set_numLevelsMatrix( numLevels );
00310
00311
00312
00313 }
00314 else if( p.nMatch(" LTE" ) )
00315 {
00316
00317 diatom->lgLTE = true;
00318 }
00319
00320 else if( p.nMatch("TRAC" ) )
00321 {
00322
00323
00324
00325
00326
00327
00328
00329 if( p.nMatch("FINA" ) )
00330 {
00331
00332 diatom->nTRACE = diatom->n_trace_final;
00333 }
00334 else if( p.nMatch("ITER" ) )
00335 {
00336
00337 diatom->nTRACE = diatom->n_trace_iterations;
00338 }
00339 else if( p.nMatch("FULL" ) )
00340 {
00341
00342 diatom->nTRACE = diatom->n_trace_full;
00343 }
00344 else if( p.nMatch("MATR" ) )
00345 {
00346
00347 diatom->nTRACE = diatom->n_trace_matrix;
00348 }
00349 else
00350 {
00351
00352 diatom->nTRACE = diatom->n_trace_full;
00353 }
00354 }
00355 else if( p.nMatch("NOIS" ) )
00356 {
00357 unsigned int iseed;
00358
00359 diatom->lgH2_NOISE = true;
00360 diatom->lgH2_NOISECOSMIC = true;
00361
00362
00363 diatom->xMeanNoise = p.FFmtRead();
00364 if( p.lgEOL() )
00365 diatom->xMeanNoise = 0.;
00366
00367
00368 diatom->xSTDNoise = p.FFmtRead();
00369 if( p.lgEOL() )
00370 diatom->xSTDNoise = 0.5;
00371
00372
00373
00374 iseed = (unsigned int)p.FFmtRead();
00375
00376 if( iseed > 0 )
00377 {
00378
00379 init_genrand( iseed );
00380 }
00381 else
00382 {
00383 init_genrand( (unsigned)time( NULL ) );
00384 }
00385 }
00386
00387 else if( p.nMatch("THER" ) )
00388 {
00389
00390
00391 if( p.nMatch("SIMP" ) )
00392 {
00393 hmi.lgH2_Thermal_BigH2 = false;
00394 }
00395 else if( p.nMatch("FULL" ) )
00396 {
00397
00398 hmi.lgH2_Thermal_BigH2 = true;
00399 }
00400 }
00401
00402 else if( p.nMatch("CHEM" ) )
00403 {
00404
00405
00406
00407 if( p.nMatch("SIMP" ) )
00408 {
00409 hmi.lgH2_Chemistry_BigH2 = false;
00410 }
00411 else if( p.nMatch("FULL" ) )
00412 {
00413
00414 hmi.lgH2_Chemistry_BigH2 = true;
00415 }
00416 }
00417
00418
00419
00420 return;
00421 }