/home66/gary/public_html/cloudy/c08_branch/source/atmdat_lines_setup.cpp

Go to the documentation of this file.
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 /*lines_setup convert level 1 and level 2 line parameters and pointers into internal form 
00004  * used by code, line data were read in by atmdat_readin */
00005 #include "cddefines.h"
00006 #include "physconst.h"
00007 #include "lines_service.h"
00008 #include "prt.h"
00009 #include "taulines.h"
00010 #include "opacity.h"
00011 #include "lines.h"
00012 
00013 /* following used for generating array indices to level1 lines,
00014  * start process, use it, then end */
00015 STATIC void initFindLevLine( void );
00016 STATIC long ipFindLevLine( realnum , long , long );
00017 STATIC void endFindLevLine( void );
00018 
00019 void lines_setup(void)
00020 {
00021         long int i, J;
00022 
00023         static bool lgFirst = true;
00024         bool lgSane;
00025 
00026         DEBUG_ENTRY( "lines_setup()" );
00027 
00028         /* this routine takes the line parameters in the wind block data and sorts
00029          * them into what is needed for the actual line optical depth arrays */
00030 
00033         /* this is the dummy line */
00034         TauLines[0].WLAng = 0.;
00035         TauLines[0].Lo->g = 0;
00036         TauLines[0].Hi->g = 0.;
00037         TauLines[0].Emis->gf = 0.;
00038         TauLines[0].EnergyWN = 0.;
00039         TauLines[0].Hi->IonStg = 0;
00040         TauLines[0].Hi->nelem = 0;
00041         /* this is an impossible value of iRedisFun */
00042         TauLines[0].Emis->iRedisFun = 0;
00043         TauLines[0].Emis->Aul = 0.;
00044 
00045         /* the first valid line is [0] since zero is the dummy */
00046         if( TauLines[1].EnergyWN <= 0. )
00047         {
00048                 fprintf( ioQQQ, " PROBLEM Insane value for TauLines array.\n" );
00049                 fprintf( ioQQQ, " Was block data LineData linked in??\n" );
00050                 fprintf( ioQQQ, " Check that it compiled OK (it probably did not).\n" );
00051                 TotalInsanity();
00052         }
00053 
00054         /* check that all lines have valid data */
00055         lgSane = true;
00056         for( i=1; i <= nLevel1; i++ )
00057         {
00058 
00059                 if( TauLines[i].Lo->g <= 0. )
00060                 {
00061                         fprintf( ioQQQ, "  routine lines_setup, insane lower stat wght\n" );
00062                         fprintf( ioQQQ, " line index is %5ld\n", i );
00063                         lgSane = false;
00064                 }
00065 
00066                 if( TauLines[i].Hi->g <= 0. )
00067                 {
00068                         fprintf( ioQQQ, "  routine lines_setup, insane upper stat wght\n" );
00069                         fprintf( ioQQQ, " line index is %5ld\n", i );
00070                         lgSane = false;
00071                 }
00072 
00073                 if( TauLines[i].EnergyWN <= 0. )
00074                 {
00075                         fprintf( ioQQQ, "  routine lines_setup, insane energy WN\n" );
00076                         fprintf( ioQQQ, " line index is %5ld\n", i );
00077                         lgSane = false;
00078                 }
00079 
00080                 if( TauLines[i].Hi->IonStg <= 0 )
00081                 {
00082                         fprintf( ioQQQ, "  routine lines_setup, insane ioniz stage\n" );
00083                         fprintf( ioQQQ, " line index is %5ld\n", i );
00084                         lgSane = false;
00085                 }
00086 
00087                 if( TauLines[i].Hi->nelem <= 0 || TauLines[i].Hi->nelem > (int)LIMELM )
00088                 {
00089                         fprintf( ioQQQ, "  routine lines_setup, insane Nelem\n" );
00090                         fprintf( ioQQQ, " line index is %5ld\n", i );
00091                         lgSane = false;
00092                 }
00093 
00094                 if( TauLines[i].Hi->IonStg > TauLines[i].Hi->nelem )
00095                 {
00096                         fprintf( ioQQQ, "  routine lines_setup, insane IonStg>Nelem\n" );
00097                         fprintf( ioQQQ, " line index is %5ld\n", i );
00098                         lgSane = false;
00099                 }
00100 
00101                 if( TauLines[i].Emis->iRedisFun == 0 )
00102                 {
00103                         fprintf( ioQQQ, "  routine lines_setup, insane line redis fcn\n" );
00104                         fprintf( ioQQQ, " line index is %5ld\n", i );
00105                         lgSane = false;
00106                 }
00107 
00108                 /* use energies for wavelengths in air if wl not forced with wl number on line */
00109                 /* >>chng 03 oct 07, only make correction for index ref if
00110                  * if wl was not already set - this is an option to allow
00111                  * the printed wl to be specified in the level1.dat file */
00112                 if( TauLines[i].WLAng <= 0. )
00113                 {
00114                         /* make following an air wavelength */
00115                         TauLines[i].WLAng = 
00116                                 (realnum)(1.0e8/
00117                         TauLines[i].EnergyWN/
00118                         RefIndex( TauLines[i].EnergyWN));
00119                 }
00120                 {
00121                         /*@-redef@*/
00122                         enum{DEBUG_LOC=false};
00123                         /*@+redef@*/
00124                         if( DEBUG_LOC  )
00125                         {
00126                                 char chString[10];
00127                                 chIonLbl(chString,&TauLines[i]);
00128                                 fprintf( ioQQQ,"%s ", chString );
00129                                 prt_wl( ioQQQ , TauLines[i].WLAng );
00130                                 fprintf(ioQQQ,"\n");
00131                         }
00132                 }
00133         }
00134 
00135         if( !lgSane )
00136         {
00137                 fprintf( ioQQQ, " Insane value for line arrays encountered.\n" );
00138                 fprintf( ioQQQ, " Was block data lines linked in??\n" );
00139                 fprintf( ioQQQ, " Were errors intreoducted into the line array?\n" );
00140                 ShowMe();
00141                 cdEXIT(EXIT_FAILURE);
00142         }
00143 
00144         /* set up array to store hits for each line */
00145         initFindLevLine( );
00146 
00147         /* in following calls to ipFindLevLine the numbers are the integer wavelength
00148          * used in the printout, the ion stage, and the atomic number */
00149 
00150         /* carbon line optical depth data */
00151         ipT1656 = ipFindLevLine( 1656 , 1 , 6 );
00152 
00153         ipT9830 = ipFindLevLine( 9830 , 1 , 6 );
00154 
00155         ipT8727 = ipFindLevLine( 8727 , 1 , 6 );
00156 
00157         ipC2_2325 = ipFindLevLine( 2325 , 2 , 6 );
00158         ipC2_2324 = ipFindLevLine( 2324 , 2 , 6 );
00159         ipC2_2329 = ipFindLevLine( 2329 , 2 , 6 );
00160         ipC2_2328 = ipFindLevLine( 2328 , 2 , 6 );
00161         ipC2_2327 = ipFindLevLine( 2327 , 2 , 6 );
00162 
00163         ipT1335 = ipFindLevLine( 1335 , 2 , 6 );
00164 
00165         ipT1909 = ipFindLevLine( 1910 , 3 , 6 );
00166 
00167         ipT977 = ipFindLevLine( 977 , 3 , 6 );
00168 
00169         ipT1550 = ipFindLevLine( 1551 , 4 , 6 );
00170 
00171         ipT1548 = ipFindLevLine( 1548 , 4 , 6 );
00172 
00173         ipT386 = ipFindLevLine( 386 , 3 , 6 );
00174 
00175         ipT310 = ipFindLevLine( 310 , 3 , 6 );
00176 
00177         /*CIII* 1175, lower level = upper level of 1909*/
00178         ipc31175 = ipFindLevLine( 1176 , 3 , 6 );
00179 
00180         ipT291 = ipFindLevLine( 291 , 3 , 6 );
00181 
00182         ipT280 = ipFindLevLine( 280 , 3 , 6 );
00183 
00184         ipT274 = ipFindLevLine( 274 , 3 , 6 );
00185 
00186         ipT270 = ipFindLevLine( 270 , 3 , 6 );
00187 
00188         ipT312 = ipFindLevLine( 312 , 4 , 6 );
00189 
00190         /*carbon fine structure lines added by Jim Kingdon*/
00191         ipT610 = ipFindLevLine( 6092000 , 1 , 6 );
00192 
00193         ipT370 = ipFindLevLine( 3697000 , 1 , 6 );
00194 
00195         ipT157 = ipFindLevLine( 1576000 , 2 , 6 );
00196 
00197         /*nitrogen line optical depth data*/
00198         ipT1085 = ipFindLevLine( 1085 , 2 , 7 );
00199 
00200         ipN3_1749 = ipFindLevLine( 1749 , 3 , 7 );
00201         ipN3_1747 = ipFindLevLine( 1747 , 3 , 7 );
00202         ipN3_1754 = ipFindLevLine( 1754 , 3 , 7 );
00203         ipN3_1752 = ipFindLevLine( 1752 , 3 , 7 );
00204         ipN3_1751 = ipFindLevLine( 1751 , 3 , 7 );
00205 
00206         ipT990 = ipFindLevLine( 991 , 3 , 7 );
00207 
00208         ipT1486 = ipFindLevLine( 1486 , 4 , 7 );
00209 
00210         ipT765 = ipFindLevLine( 765 , 4 , 7 );
00211 
00212         ipT1243 = ipFindLevLine( 1243 , 5 , 7 );
00213 
00214         ipT1239 = ipFindLevLine( 1239 , 5 , 7 );
00215 
00216         ipT374g = ipFindLevLine( 373 , 3 , 7 );
00217 
00218         /*this is the stronger of the two lines*/
00219         ipT374x = ipFindLevLine( 374 , 3 , 7 );
00220 
00221         ipT1200 = ipFindLevLine( 1200 , 1 , 7 );
00222 
00223         ipT2140 = ipFindLevLine( 2141 , 2 , 7 );
00224 
00225         ipT671 = ipFindLevLine( 671 , 2 , 7 );
00226 
00227         ipT315 = ipFindLevLine( 315 , 3 , 7 );
00228 
00229         ipT324 = ipFindLevLine( 324 , 3 , 7 );
00230 
00231         ipT333 = ipFindLevLine( 333 , 3 , 7 );
00232 
00233         ipT209 = ipFindLevLine( 209 , 5 , 7 );
00234 
00235         /*fine structure lines */
00236         /*[N II] 121.7*/
00237         ipT122 = ipFindLevLine( 1217000 , 2 , 7 );
00238 
00239         /*[N II] 205.4*/
00240         ipT205 = ipFindLevLine( 2054000 , 2 , 7 );
00241 
00242         /*big disagreement in A for this line, other val is 2x larger*/
00243         /*see review in DEO Seaton 70th birthday*/
00244         ipT57 = ipFindLevLine( 572100 , 3 , 7 );
00245 
00246         /*oxygen line optical depth data*/
00247         ipT6300 = ipFindLevLine( 6300 , 1 , 8 );
00248 
00249         ipT6363 = ipFindLevLine( 6363 , 1 , 8 );
00250 
00251         /*A from NISt 96*/
00252         ipT5577 = ipFindLevLine( 5577 , 1 , 8 );
00253 
00254         ipT834 = ipFindLevLine( 833.8f , 2 , 8 );
00255 
00256         ipT1661 = ipFindLevLine( 1661 , 3 , 8 );
00257 
00258         ipT1666 = ipFindLevLine( 1666 , 3 , 8 );
00259 
00260         ipT835 = ipFindLevLine( 835 , 3 , 8 );
00261 
00262         ipO4_1400 = ipFindLevLine( 1400 , 4 , 8 );
00263         ipO4_1397 = ipFindLevLine( 1397 , 4 , 8 );
00264         ipO4_1407 = ipFindLevLine( 1407 , 4 , 8 );
00265         ipO4_1405 = ipFindLevLine( 1405 , 4 , 8 );
00266         ipO4_1401 = ipFindLevLine( 1401 , 4 , 8 );
00267 
00268         ipT789 = ipFindLevLine( 789 , 4 , 8 );
00269 
00270         ipT630 = ipFindLevLine( 630 , 5 , 8 );
00271 
00272         /*start OI 6 level atom*/
00273         ipT1304 = ipFindLevLine( 1304 , 1 , 8 );
00274 
00275         ipT1039 = ipFindLevLine( 1039 , 1 , 8 );
00276 
00277         ipT8446 = ipFindLevLine( 8446 , 1 , 8 );
00278 
00279         ipT4368 = ipFindLevLine( 4368 , 1 , 8 );
00280 
00281         ipTOI13 = ipFindLevLine( 13200 ,  1 , 8 );
00282 
00283         ipTOI11 = ipFindLevLine( 11300 , 1 , 8 );
00284 
00285         ipTOI29 = ipFindLevLine( 29000 , 1 , 8 );
00286 
00287         ipTOI46 = ipFindLevLine( 46000 , 1 , 8 );
00288 
00289         ipTO1025 = ipFindLevLine( 1025 , 1 , 8 );
00290 
00291         /*end of OI 6 level atom*/
00292 
00293         ipT304 = ipFindLevLine( 304 , 3 , 8 );
00294 
00295         ipT1214 = ipFindLevLine( 1218 , 5 , 8 );
00296 
00297         ipT150 = ipFindLevLine( 150 , 6 , 8 );
00298 
00299         /*fine structure lines*/
00300         /*[O I] 146 microns*/
00301         ipT146 = ipFindLevLine( 1455300 , 1 , 8 );
00302 
00303         /*[O I] 63 microns*/
00304         ipT63 = ipFindLevLine( 631700 , 1 , 8 );
00305 
00306         /*[O III] 88.3564 m*/
00307         ipTO88 = ipFindLevLine( 883300 , 3 , 8 );
00308 
00309         /*[O III] 51.8145*/
00310         ipT52 = ipFindLevLine( 518000 , 3 , 8 );
00311 
00312         /*[O IV] 25.89mic, A from*/
00313         ipT26 = ipFindLevLine( 258800 , 4 , 8 );
00314 
00315         ipT1032 = ipFindLevLine( 1032 , 6 , 8 );
00316 
00317         ipT1037 = ipFindLevLine( 1037.6f , 6 , 8 );
00318 
00319         /*fluorine*/
00320         /*f ii 29.33 mic*/
00321         ipF0229 = ipFindLevLine( 293300 , 2 , 9 );
00322 
00323         /*f ii 67.2 mic*/
00324         ipF0267 = ipFindLevLine( 672000 , 2 , 9 );
00325 
00326         /*f iv 44.07 mic*/
00327         ipF444 = ipFindLevLine( 440700 , 4 , 9 );
00328 
00329         /*f iv 25.83 mic*/
00330         ipF425 = ipFindLevLine( 258300 , 4 , 9 );
00331 
00332         /*neon*/
00333         ipT770 = ipFindLevLine( 770.4f , 8 , 10 );
00334 
00335         ipT780 = ipFindLevLine( 780.3f , 8 , 10 );
00336 
00337         /*[Ne VI] 7.652 micron*/
00338         ipxNe0676 = ipFindLevLine( 76520 , 6 , 10 );
00339 
00340         ipT895 = ipFindLevLine( 895 , 7 , 10 );
00341 
00342         ipT88 = ipFindLevLine( 88 , 8 , 10 );
00343 
00344         /*fine structure lines */
00345         /*[Ne II] 12.8*/
00346         ipTNe13 = ipFindLevLine( 128100 , 2 , 10 );
00347 
00348         /*[Ne III] 36.013 m*/
00349         ipTNe36 = ipFindLevLine( 360140 , 3 , 10 );
00350 
00351         /*[Ne III] 15.56 m*/
00352         ipTNe16 = ipFindLevLine( 155500 , 3 , 10 );
00353 
00354         /*[Ne V] 14.32 m*/
00355         ipTNe14 = ipFindLevLine( 143200 , 5 , 10 );
00356 
00357         /*[Ne V] 24.318 m*/
00358         ipTNe24 = ipFindLevLine( 243100 , 5 , 10 );
00359 
00360         /*sodium line optical depth data*/
00361         ipT5895 = ipFindLevLine( 5891.9f , 1 , 11 );
00362 
00363         /*[Na III] 7.3177mic*/
00364         ipfsNa373 = ipFindLevLine( 73200 , 3 , 11 );
00365 
00366         /*[Na IV] 9.039 mic*/
00367         ipfsNa490 = ipFindLevLine( 90390 , 4 , 11 );
00368 
00369         /*[Na IV] 21.29 mic*/
00370         ipfsNa421 = ipFindLevLine( 212900 , 4 , 11 );
00371 
00372         /*[Na VI] 14.40 mic*/
00373         ipxNa6143 = ipFindLevLine( 144000 , 6 , 11 );
00374 
00375         /*[Na VI] 8.611 mic*/
00376         ipxNa6862 = ipFindLevLine( 86110 , 6 , 11 );
00377 
00378         /*[Na VII] 4.68 micron*/
00379         ipxNa0746 = ipFindLevLine( 46800 , 7 , 11 );
00380 
00381         /*magnesium line optical depth data*/
00382         ipMgI2853 = ipFindLevLine( 2853 , 1 , 12 );
00383 
00384         ipMgI2026 = ipFindLevLine( 2026 , 1 , 12 );
00385 
00386         ipT2796 = ipFindLevLine( 2795.5f , 2 , 12 );
00387 
00388         ipT2804 = ipFindLevLine( 2802.7f , 2 , 12 );
00389 
00390         ipT705 = ipFindLevLine( 705 , 9 , 12 );
00391 
00392         ipT4561 = ipFindLevLine( 4561 , 1 , 12 );
00393 
00394         /*[Mg V] 1325, 3-1 in three level atom*/
00395         ipxMg51325 = ipFindLevLine( 1325 , 5 , 12 );
00396 
00397         /*[Mg V] 2417, 3-2 in three level atom*/
00398         ipxMg52417 = ipFindLevLine( 2417 , 5 , 12 );
00399 
00400         /*[Mg V] 2855, 2-1 in three level atom, really 2928, 2782*/
00401         ipxMg52855 = ipFindLevLine( 2855 , 5 , 12 );
00402 
00403         /*[Mg VII] 1325, 3-1 in three level atom*/
00404         ipxMg71190 = ipFindLevLine( 1190 , 7 , 12 );
00405 
00406         /*[Mg VII] 2261, 3-2 in three level atom*/
00407         ipxMg72261 = ipFindLevLine( 2261 , 7 , 12 );
00408 
00409         /*[Mg VII] 2569, 2-1 in three level atom, really 2509, 2629*/
00410         ipxMg72569 = ipFindLevLine( 2569 , 7 , 12 );
00411 
00412         /*[Mg VIII] 3.03 micron*/
00413         ipxMg08303 = ipFindLevLine( 30300 , 8 , 12 );
00414 
00415         /*the Mg X 615 li seq doublet*/
00416         ipTMg610 = ipFindLevLine( 609.8f , 10 , 12 );
00417 
00418         ipTMg625 = ipFindLevLine( 625 , 10 , 12 );
00419 
00420         ipT58 = ipFindLevLine( 57.9f , 10 , 12 );
00421 
00422         /*Mg IV 4.487m*/
00423         ipTMg4 = ipFindLevLine( 44850 , 4 , 12 );
00424 
00425         /*[Mg V] 13.52*/
00426         ipTMg14 = ipFindLevLine( 135200 , 5 , 12 );
00427 
00428         /*[Mg V] 5.610*/
00429         ipTMg6 = ipFindLevLine( 56100 , 5 , 12 );
00430 
00431         /*[Mg VII] 9.033 mic*/
00432         ipfsMg790 = ipFindLevLine( 90330 , 7 , 12 );
00433 
00434         /*[Mg VII] 5.503 mic7 , 12 );*/
00435         ipfsMg755 = ipFindLevLine( 55030 , 7 , 12 );
00436 
00437         /* aluminum line optical depth data */
00438         ipAlI3957 = ipFindLevLine( 3957 , 1 , 13 );
00439 
00440         ipAlI3090 = ipFindLevLine( 3090 , 1 , 13 );
00441 
00442         ipT1855 = ipFindLevLine( 1855 , 3 , 13 );
00443 
00444         ipT1863 = ipFindLevLine( 1863 , 3 , 13 );
00445 
00446         ipT2670 = ipFindLevLine( 2670 , 2 , 13 );
00447 
00448         /*[Al V] 2.905 mic*/
00449         ipAl529 = ipFindLevLine( 29052 , 5 , 13 );
00450 
00451         /*[Al VI] 3.66 mic*/
00452         ipAl6366 = ipFindLevLine( 36600 , 6 , 13 );
00453 
00454         /*[Al VI] 9.116 mic*/
00455         ipAl6912 = ipFindLevLine( 91160 , 6 , 13 );
00456 
00457         /*[Al VIII] 5.848 mic*/
00458         ipAl8575 = ipFindLevLine( 58480 , 8 , 13 );
00459 
00460         /*[Al VIII] 3.69 mic*/
00461         ipAl8370 = ipFindLevLine( 36900 , 8 , 13 );
00462 
00463         /*[Al IX] 2.04 micron*/
00464         ipAl09204 = ipFindLevLine( 20400 , 9 , 13 );
00465 
00466         ipT639 = ipFindLevLine( 639 , 10 , 13 );
00467 
00468         /*Al XI 550, 568 Li seq doublet */
00469         ipTAl550 = ipFindLevLine( 550 , 11 , 13 );
00470 
00471         ipTAl568 = ipFindLevLine( 568 , 11 , 13 );
00472 
00473         ipTAl48 = ipFindLevLine( 48 , 11 , 13 );
00474 
00475         /*silicon line optical depth data*/
00476         ipSi1_130m = ipFindLevLine( 1295823.0f , 1 , 14 );
00477         ipSi1_68m = ipFindLevLine( 683995.25f , 1 , 14 );
00478 
00479         ipSii2518 = ipFindLevLine( 2518 , 1 , 14 );
00480 
00481         ipSii2215 = ipFindLevLine( 2215 , 1 , 14 );
00482 
00483         ipSi2_2334 = ipFindLevLine( 2334 , 2 , 14 );
00484         ipSi2_2329 = ipFindLevLine( 2329 , 2 , 14 );
00485         ipSi2_2350 = ipFindLevLine( 2350 , 2 , 14 );
00486         ipSi2_2344 = ipFindLevLine( 2344 , 2 , 14 );
00487         ipSi2_2336 = ipFindLevLine( 2336 , 2 , 14 );
00488 
00489         ipT1808 = ipFindLevLine( 1813.99f , 2 , 14 );
00490 
00491         ipT1207 = ipFindLevLine( 1207 , 3 , 14 );
00492 
00493         ipT1895 = ipFindLevLine( 1892 , 3 , 14 );
00494 
00495         ipT1394 = ipFindLevLine( 1394 , 4 , 14 );
00496 
00497         ipT1403 = ipFindLevLine( 1403 , 4 , 14 );
00498 
00499         ipT1527 = ipFindLevLine( 1531 , 2 , 14 );
00500 
00501         ipT1305 = ipFindLevLine( 1307.7f , 2 , 14 );
00502 
00503         ipT1260 = ipFindLevLine( 1263.3f , 2 , 14 );
00504 
00505         /*[Si VI] 1.9641mic*/
00506         ipSi619 = ipFindLevLine( 19631 , 6 , 14 );
00507 
00508         /*[Si X] 1.43 micron*/
00509         ipSi10143 = ipFindLevLine( 14300 , 10 , 14 );
00510 
00511         /* Si X] ll 621.1, 611.7, 598.6 */
00512         ipSi10_606 = ipFindLevLine( 606 , 10 , 14 );
00513 
00514         ipTSi499 = ipFindLevLine( 499 , 12 , 14 );
00515 
00516         ipTSi521 = ipFindLevLine( 521 , 12 , 14 );
00517 
00518         ipTSi41 = ipFindLevLine( 41 , 12 , 14 );
00519 
00520         /*[Si II] 34.8 mic*/
00521         ipTSi35 = ipFindLevLine( 348140 , 2 , 14 );
00522 
00523         /*[Si VII] 2.481*/
00524         ipTSi25 = ipFindLevLine( 24810 , 7 , 14 );
00525 
00526         /*[Si VII] 6.4922*/
00527         ipTSi65 = ipFindLevLine( 64920 , 7 ,14 );
00528 
00529         /*[Si IX] 2.585 mic*/
00530         ipTSi3 = ipFindLevLine( 25840 , 9 , 14 );
00531 
00532         /*[Si IX] 3.929 mic*/
00533         ipTSi4 = ipFindLevLine( 39290 , 9 , 14 );
00534 
00535         /*phosphorus line data*/
00536         /*P II 60.64 mic*/
00537         ipP0260 = ipFindLevLine( 606400 , 2 , 15 );
00538 
00539         /*P II 32.87 mic*/
00540         ipP0233 = ipFindLevLine( 328700 , 2 , 15 );
00541 
00542         /*P III 17.885 mic*/
00543         ipP0318 = ipFindLevLine( 178850 , 3 , 15 );
00544 
00545         /*P VII 1.3745 mic*/
00546         ipP713 = ipFindLevLine( 13745 , 7 , 15 );
00547 
00548         /*P VIII 4.85 mic*/
00549         ipP848 = ipFindLevLine( 48500 , 8 , 15 );
00550 
00551         /*P VIII 1.735 mic*/
00552         ipP817 = ipFindLevLine( 17350 , 8 , 15 );
00553 
00554         /*P X 2.708 mic*/
00555         ipP1027 = ipFindLevLine( 27080 ,  10 , 15 );
00556 
00557         /*P X 1.868*/
00558         ipP1018 = ipFindLevLine( 18680 , 10 , 15 );
00559 
00560         /*sulphur line optical depth data*/
00561         ipS1_25m = ipFindLevLine( 251947.453f , 1 , 16 );
00562         ipS1_56m = ipFindLevLine( 562909.625f , 1 , 16 );
00563 
00564         ipT1256 = ipFindLevLine( 1256 , 2 , 16 );
00565 
00566         ipT1194 = ipFindLevLine( 1197.55f , 3 , 16 );
00567 
00568         ipTS1720 = ipFindLevLine( 1720 , 3 , 16 );
00569 
00570         ipS4_1405 = ipFindLevLine( 1405 , 4 , 16 );
00571         ipS4_1398 = ipFindLevLine( 1398 , 4 , 16 );
00572         ipS4_1424 = ipFindLevLine( 1424 , 4 , 16 );
00573         ipS4_1417 = ipFindLevLine( 1417 , 4 , 16 );
00574         ipS4_1407 = ipFindLevLine( 1406 , 4 , 16 );
00575 
00576         ipT1198 = ipFindLevLine( 1198 , 5 , 16 );
00577 
00578         ipT786 = ipFindLevLine( 786.47f , 5 , 16 );
00579 
00580         ipT933 = ipFindLevLine( 933.38f , 6 , 16 );
00581 
00582         ipT944 = ipFindLevLine( 944.52f , 6 , 16 );
00583 
00584         /*[S VIII] 9913*/
00585         ipfsS810 = ipFindLevLine( 9913 , 8 , 16 );
00586 
00587         /*[S IX] 1.252 mic*/
00588         ipfsS912 = ipFindLevLine( 12520 , 9 , 16 );
00589 
00590         /*[S IX] 3.755 mic*/
00591         ipfsS938 = ipFindLevLine( 37550 , 9 , 16 );
00592 
00593         /*[S XI] 1.9201 mic*/
00594         ipfsS1119 = ipFindLevLine( 19201 , 11 , 16 );
00595 
00596         /*[S XI] 1.3927 mic*/
00597         ipfsS1114 = ipFindLevLine( 13927 , 11 , 16 );
00598 
00599         /*S XII 7536*/
00600         /*this is a vacuum wavelength*/
00601         ipfsS1207 = ipFindLevLine( 7611 , 12 , 16 );
00602 
00603         /* >>chng 03 sep 27,  group of lines moved from expion */
00604         ipS12_520 = ipFindLevLine( 520 , 12 , 16 );
00605 
00606         ipTSu418 = ipFindLevLine( 418 , 14 , 16 );
00607 
00608         ipTSu446 = ipFindLevLine( 446 , 14 , 16 );
00609 
00610         ipTSu30 = ipFindLevLine( 30 , 14 , 16 );
00611 
00612         /*fine structure lines added in by Jim Kingdon*/
00613         ipTS19 = ipFindLevLine( 186700 , 3 , 16 );
00614 
00615         /*[S III] 33.48*/
00616         ipTS34 = ipFindLevLine( 334700 , 3 , 16 );
00617 
00618         ipTS11 = ipFindLevLine( 105100 , 4 , 16 );
00619 
00620         /*chlorine line optical depth data*/
00621 
00622         /* Cl 1 mic */
00623         ipCl1_11m = ipFindLevLine( 113296.3984f , 1 , 17 );
00624 
00625         /*Cl II 14.3678 mic*/
00626         ipfsCl214 = ipFindLevLine( 144000 , 2 , 17 );
00627 
00628         /*Cl II 33.281 mic*/
00629         ipfsCl233 = ipFindLevLine( 333000 , 2 , 17 );
00630 
00631         /*[Cl 4] 20.354 mic*/
00632         ipCl04203 = ipFindLevLine( 204000 ,  4 , 17 );
00633 
00634         /*[Cl 4] 11.741 mic*/
00635         ipCl04117 = ipFindLevLine( 117000 ,4 , 17 );
00636 
00637         /*Cl IX 7334A*/
00638         ipCl973 = ipFindLevLine( 7334 , 9 , 17 );
00639 
00640         /*Cl X 3.05 mic*/
00641         ipCl1030 = ipFindLevLine( 30500 , 10 , 17 );
00642 
00643         /*Cl X 9332*/
00644         ipCl1092 = ipFindLevLine( 9332 , 10 , 17 );
00645 
00646         /*argon line optical depth data*/
00647         /*Ar XVI*/
00648         ipT354 = ipFindLevLine( 354 , 16 , 18 );
00649 
00650         /*Ar XVI*/
00651         ipT389 = ipFindLevLine( 389 , 16 , 18 );
00652 
00653         /*Ar XVI*/
00654         ipT25 = ipFindLevLine( 25 , 16 , 18 );
00655 
00656         /*argon fine structure lines*/
00657         /*[Ar II]*/
00658         ipTAr7 = ipFindLevLine( 69800 , 2 , 18 );
00659 
00660         /*[Ar III] 9.0 mic*/
00661         ipTAr9 = ipFindLevLine( 90000 , 3 , 18 );
00662 
00663         /*[Ar III] 21.83 mic*/
00664         ipTAr22 = ipFindLevLine( 218300 , 3 , 18 );
00665 
00666         /*[Ar V] 13.1 mic*/
00667         ipTAr13 = ipFindLevLine( 131000 , 5 , 18 );
00668 
00669         /*[Ar V] 8.0 mic*/
00670         ipTAr8 = ipFindLevLine( 80000 , 5 , 18 );
00671 
00672         /*[Ar VI] 4.53 micron*/
00673         ipAr06453 = ipFindLevLine( 45300 , 6 , 18 );
00674 
00675         /*Ar X 5533*/
00676         ipAr1055 = ipFindLevLine( 5533 , 10 , 18 );
00677 
00678         /*[Ar XI] 2.619 mic*/
00679         ipAr1126 = ipFindLevLine( 26190 , 11 , 18 );
00680 
00681         /*[Ar XI] 6917.5*/
00682         ipAr1178 = ipFindLevLine( 6917 , 11 , 18 );
00683 
00684         /*potasium - really should split into two*/
00685         ipKI7745 = ipFindLevLine( 7676.2f , 1 , 19 );
00686 
00687         /*[K III] 4.62 micron*/
00688         ipxK03462 = ipFindLevLine( 46200 , 3 , 19 );
00689 
00690         /*[K IV] 5.982 micron*/
00691         ipxK04598 = ipFindLevLine( 59800 , 4 , 19 );
00692 
00693         /*[K IV] 15.39 micron4 , 19 );*/
00694         ipxK04154 = ipFindLevLine( 153900 , 4 , 19 );
00695 
00696         /* [K VI] 8.823 micron */
00697         ipxK06882 = ipFindLevLine( 88200 , 6 , 19 );
00698 
00699         /*[K VI] 5.575 micron6 */
00700         ipxK06557 = ipFindLevLine( 55700 , 6 , 19 );
00701 
00702         /*[K VII] 3.19 micron7 , 19 );*/
00703         ipxK07319 = ipFindLevLine( 31905 , 7 , 19 );
00704 
00705         /* [K XI] 4249.99 A  */
00706         ipxK11425 = ipFindLevLine( 4250 , 11 , 19 );
00707 
00708         /*calcium line optical depth data*/
00709         ipCaI4228 = ipFindLevLine( 4228 , 1 , 20 );
00710 
00711         ipT3934 = ipFindLevLine( 3934 , 2 , 20 );
00712 
00713         ipT3969 = ipFindLevLine( 3969 , 2 , 20 );
00714 
00715         ipT8498 = ipFindLevLine( 8498 , 2 , 20 );
00716 
00717         ipT8542 = ipFindLevLine( 8542 , 2 , 20 );
00718 
00719         ipT8662 = ipFindLevLine( 8662 , 2 , 20 );
00720 
00721         ipT7291 = ipFindLevLine( 7291 ,  2 , 20 );
00722 
00723         ipT7324 = ipFindLevLine( 7324 ,  2 , 20 );
00724 
00725         ipTCa345 = ipFindLevLine( 345 , 18 , 20 );
00726 
00727         ipTCa19 = ipFindLevLine( 19 , 18 , 20 );
00728 
00729         /*[Ca IV] 3.21 min*/
00730         ipTCa3 = ipFindLevLine( 32100 , 4 , 20 );
00731 
00732         ipTCa12 = ipFindLevLine( 114000 , 5 , 20 );
00733 
00734         ipTCa4 = ipFindLevLine( 41500 , 5 , 20 );
00735 
00736         /*[Ca VII] 4.09 micron*/
00737         ipCa0741 = ipFindLevLine( 40900 , 7 , 20 );
00738 
00739         /*[Ca VII] 6.15 micron*/
00740         ipCa0761 = ipFindLevLine( 61500 , 7 , 20 );
00741 
00742         /*[Ca VIII] 2.32 micron*/
00743         ipCa08232 = ipFindLevLine( 23200 , 8 , 20 );
00744 
00745         /*[Ca 12] 3328.78 A */
00746         ipCa12333 = ipFindLevLine( 3329 , 12 , 20 );
00747 
00748         /* Ca 18 302 */
00749         ipTCa302 = ipFindLevLine( 302 , 18 , 20 );
00750 
00751         /*scandium data*/
00752         /*[Sc V] 2.31 micron*/
00753         ipSc05231 = ipFindLevLine( 23100 , 5 , 21 );
00754 
00755         /*[Sc 13] 2637.97 A */
00756         ipSc13264 = ipFindLevLine( 2638 , 13 , 21 );
00757 
00758         /*Titanium data*/
00759         /*[Ti VI] 1.72 micron*/
00760         ipTi06172 = ipFindLevLine( 17200 , 6 , 22 );
00761 
00762         /*[Ti 14] 2117.79 A */
00763         ipTi14212 = ipFindLevLine( 2118 , 14 , 22 );
00764 
00765         /*Vanadium data*/
00766         /*[V VII] 1.30 micron*/
00767         ipVa07130 = ipFindLevLine( 13000 , 7 , 23 );
00768 
00769         /*[V 15] 1721.38 A */
00770         ipVa15172 = ipFindLevLine( 1721 , 15 , 23 );
00771 
00772         /*Chromium data*/
00773         /*[Cr VIII] 1.01 micron*/
00774         ipCr08101 = ipFindLevLine( 10100 , 8 , 24 );
00775 
00776         /*[Cr 16] 1410.60 A*/
00777         ipCr16141 = ipFindLevLine( 1411 , 16 , 24 );
00778 
00779         /*Manganese data*/
00780         /*[Mn IX] 7968.5A*/
00781         ipxMn0979 = ipFindLevLine( 7968 , 9 , 25 );
00782 
00783         /*[Mn 17] 1169.59 A */
00784         ipxMn1712 = ipFindLevLine( 1170 , 17 , 25 );
00785 
00786         /*iron Fe line optical depth data*/
00787 
00788         /* [Fe I] ground term */
00789         ipFe1_24m = ipFindLevLine( 240359.546f , 1 , 26 );
00790         ipFe1_35m = ipFindLevLine( 347043.25f , 1 , 26 );
00791         ipFe1_54m = ipFindLevLine( 542946.5625f , 1 , 26 );
00792         ipFe1_111m = ipFindLevLine( 1111549.25f , 1 , 26 );
00793 
00794         ipFeI3884 = ipFindLevLine( 3884 , 1 , 26 );
00795 
00796         ipFeI3729 = ipFindLevLine( 3729 , 1 , 26 );
00797 
00798         ipFeI3457 = ipFindLevLine( 3457 ,  1 , 26 );
00799 
00800         ipFeI3021 = ipFindLevLine( 3021 ,  1 , 26 );
00801 
00802         ipFeI2966 = ipFindLevLine( 2966 ,  1 , 26 );
00803 
00804         /*>>chng 03 oct 07, chng wl from 2360 to 2400, the value
00805          * before cnhg of feii lines to stuc */
00806         ipTuv3 = ipFindLevLine( 2400 ,  2 , 26 );
00807 
00808         ipTr48 = ipFindLevLine( 6200 ,  2 , 26 );
00809 
00810         ipTFe16 = ipFindLevLine( 1080 ,  2 , 26 );
00811 
00812         ipTFe26 = ipFindLevLine( 1500 ,  2 , 26 );
00813 
00814         ipTFe34 = ipFindLevLine( 11500 ,  2 , 26 );
00815 
00816         ipTFe35 = ipFindLevLine( 2500 ,  2 , 26 );
00817 
00818         ipTFe46 = ipFindLevLine( 2300 ,  2 , 26 );
00819 
00820         ipTFe56 = ipFindLevLine( 8900 ,  2 , 26 );
00821 
00822         ipT1122 = ipFindLevLine( 1125.8f ,  3 , 26 );
00823 
00824         /* [Fe VII] 9.53 mic, A */
00825         ipFe0795 = ipFindLevLine( 95100,  7 , 26 );
00826 
00827         /* [Fe VII] 7.81 mic, A */
00828         ipFe0778 = ipFindLevLine( 78100, 7 , 26 );
00829 
00830         ipT245 = ipFindLevLine( 245 , 9 , 26 );
00831 
00832         /*this is pump line for upper level of [FeX] 6375*/
00833         ipT352 = ipFindLevLine( 352 , 10 , 26 );
00834 
00835         ipFe106375 = ipFindLevLine( 6373.3f , 10 , 26 );
00836 
00837         /*actually three lines contributing here, important for coronal pumping */
00838         /*following is whole multiplet average*/
00839         ipT353 = ipFindLevLine( 353 , 11 , 26 );
00840 
00841         /* >>chng 05 dec 19, go to 5 level Fe 11 */
00842         /*ipTFe07 = ipFindLevLine( 7892 , 11 , 26 );
00843         ipTFe61 = ipFindLevLine( 60827 , 11 , 26 );*/
00844 
00845         /*[Fe XIII] 1.07 microns
00846         ipFe1310 = ipFindLevLine( 10700 , 13 , 26 );*/
00847 
00848         /*[Fe XIII] 1.08 microns
00849         ipFe1311 = ipFindLevLine( 10800 , 13 , 26 );*/
00850 
00851         /* N-seq [Fe20] 721, 578A */
00852         ipTFe20_721 = ipFindLevLine( 721 , 20 , 26 );
00853         ipTFe20_578 = ipFindLevLine( 578 , 20 , 26 );
00854 
00855         /* boron sequence fe iron lines */
00856         /*>>chng 00 oct 26 added these lines */
00857         ipFe22_247 = ipFindLevLine( (realnum)247.2 , 22 , 26 );
00858         ipFe22_217 = ipFindLevLine( (realnum)217.3 , 22 , 26 );
00859         ipFe22_348 = ipFindLevLine( (realnum)349.3 , 22 , 26 );
00860         ipFe22_292 = ipFindLevLine( (realnum)292.4 , 22 , 26 );
00861         ipFe22_253 = ipFindLevLine( (realnum)253.2 , 22 , 26 );
00862         ipFe22_846 = ipFindLevLine( 846 , 22 , 26 );
00863 
00864         ipT347 = ipFindLevLine( 347 , 14 , 26 );
00865 
00866         ipT192 = ipFindLevLine( 192 , 24 , 26 );
00867 
00868         ipT255 = ipFindLevLine( 255 , 24 , 26 );
00869 
00870         ipT11 = ipFindLevLine( 11 , 24 , 26 );
00871 
00872         ipT191 = ipFindLevLine( 1786 , 2 , 26 );
00873 
00874 
00875         /* [Fe 18] 974.86 A */
00876         ipFe18975 = ipFindLevLine( 974 , 18 , 26 );
00877 
00878         ipTFe23 = ipFindLevLine( 2299 , 21 , 26 );
00879 
00880         ipTFe13 = ipFindLevLine( 1354 , 21 , 26 );
00881 
00882         /* Cobalt data */
00883         /* [Co XI] 5168.A */
00884         ipCo11527 = ipFindLevLine( 5168 , 11 , 27 );
00885 
00886         /* Nickel data */
00887         ipNi1_7m = ipFindLevLine( 75046.164f , 1 , 28 );
00888         ipNi1_11m = ipFindLevLine( 113044.031f , 1 , 28 );
00889 
00890         /* [Ni XII] 4230.8A */
00891         ipxNi1242 = ipFindLevLine( 4230 , 12 , 28 );
00892 
00893         /* Zinc data */
00894         /* Zn 04 3.625 microns */
00895         ipZn04363 = ipFindLevLine( 36250 , 4 , 30 );
00896 
00897         /* flush the line list, freeing the extra storage and checking that all
00898          * lines have been claimed */
00899         endFindLevLine( );
00900 
00904         /* next initialize entire array to dangerously large negative numbers */
00905         for( J=0; J< nCORotate; ++J )
00906         {
00907                 /* this is the rotation constant for CO, from 
00908                  * >>refer      mco     rot     Emerson, D., 1996, Interpreting Astronomical Spectgra, p289 */
00909                 /* this is B in cm^-1 units */
00910                 realnum BC12O16=1.9313f;
00911                 /* permanent dipole moment in Debyes */
00912                 realnum dpC12O16 = 0.1111f;
00913                 realnum BC13O16=2.0202f;
00914                 /* permanent dipole moment in Debyes */
00915                 realnum dpC13O16 = 0.11046f;
00916 
00917                 /* statistical weights of lower and upper levels */
00918                 C12O16Rotate[J].Lo->g = 2.f*J+1.f;
00919                 C12O16Rotate[J].Hi->g = 2.f*(J+1.f)+1.f;
00920 
00921                 C13O16Rotate[J].Lo->g = 2.f*J+1.f;
00922                 C13O16Rotate[J].Hi->g = 2.f*(J+1.f)+1.f;
00923 
00924                 /* energy of the J+1 to J transition */
00925                 C12O16Rotate[J].EnergyWN = 2.f * BC12O16 * (J+1.f);
00926                 C12O16Rotate[J].WLAng = 1.e8f/C12O16Rotate[J].EnergyWN;
00927                 C13O16Rotate[J].EnergyWN = 2.f * BC13O16 * (J+1.f);
00928                 C13O16Rotate[J].WLAng = 1.e8f/C13O16Rotate[J].EnergyWN;
00929 
00930                 /* this is special flag for CO - these are used in velset (in tfidle.c) to 
00931                  * set doppler velocities for species */
00932                 C12O16Rotate[J].Hi->nelem = LIMELM+1;
00933                 C13O16Rotate[J].Hi->nelem = LIMELM+2;
00934                 /* this will make spaces instead of an ion integer */
00935                 C12O16Rotate[J].Hi->IonStg = 2;
00936                 C13O16Rotate[J].Hi->IonStg = 3;
00937 
00938                 /* A */
00939                 C12O16Rotate[J].Emis->Aul = 2.508e-6f *POW2(dpC12O16)*POW3(BC12O16)*POW2(J+1.f)*POW2(J+1.f)/(2.f*J+3.f);
00940                 C13O16Rotate[J].Emis->Aul = 2.508e-6f *POW2(dpC13O16)*POW3(BC13O16)*POW2(J+1.f)*POW2(J+1.f)/(2.f*J+3.f);
00941                 /* special flag saying not evaluated, find from Aul later */
00942                 C12O16Rotate[J].Emis->gf = -1.f;
00943                 C13O16Rotate[J].Emis->gf = -1.f;
00944                 C12O16Rotate[J].Lo->Pop = 0.;
00945                 C13O16Rotate[J].Lo->Pop = 0.;
00946                 C12O16Rotate[J].Hi->Pop = 0.;
00947                 C13O16Rotate[J].Hi->Pop = 0.;
00948                 /* >>chng 01 may 29, from PRD to CRD */
00949                 C12O16Rotate[J].Emis->iRedisFun = ipCRD;
00950                 /* >>chng 01 may 29, from PRD to CRD */
00951                 C13O16Rotate[J].Emis->iRedisFun = ipCRD;
00952                 C12O16Rotate[J].Emis->TauIn = opac.taumin;
00953                 C13O16Rotate[J].Emis->TauIn = opac.taumin;
00954                 C12O16Rotate[J].Emis->TauCon = opac.taumin;
00955                 C13O16Rotate[J].Emis->TauCon = opac.taumin;
00956                 C12O16Rotate[J].Emis->ColOvTot = 0.;
00957                 C13O16Rotate[J].Emis->ColOvTot = 0.;
00958                 /* outward optical depth */
00959                 C12O16Rotate[J].Emis->TauTot = 1e20f;
00960                 C13O16Rotate[J].Emis->TauTot = 1e20f;
00961                 /* escape probability */
00962                 C12O16Rotate[J].Emis->Pesc = 1.;
00963                 C13O16Rotate[J].Emis->Pesc = 1.;
00964                 /* inward part of line */
00965                 C12O16Rotate[J].Emis->FracInwd = 1.f;
00966                 C13O16Rotate[J].Emis->FracInwd = 1.f;
00967                 /* destruction probability */
00968                 C12O16Rotate[J].Emis->Pdest = 0.;
00969                 C13O16Rotate[J].Emis->Pdest = 0.;
00970                 C12O16Rotate[J].Emis->Pelec_esc = 0.;
00971                 C13O16Rotate[J].Emis->Pelec_esc = 0.;
00972                 /* line pumping rate */
00973                 C12O16Rotate[J].Emis->pump = 0.;
00974                 C13O16Rotate[J].Emis->pump = 0.;
00975                 /* population of lower level */
00976                 C12O16Rotate[J].Lo->Pop = 0.;
00977                 C13O16Rotate[J].Lo->Pop = 0.;
00978                 /* population of upper level */
00979                 C12O16Rotate[J].Hi->Pop = 0.;
00980                 C13O16Rotate[J].Hi->Pop = 0.;
00981                 /* population of lower level with correction for stim emission */
00982                 C12O16Rotate[J].Emis->PopOpc = 0.;
00983                 C13O16Rotate[J].Emis->PopOpc = 0.;
00984                 /* following two heat exchange excitation, deexcitation */
00985                 C12O16Rotate[J].Coll.cool = 0.;
00986                 C12O16Rotate[J].Coll.heat = 0.;
00987                 C13O16Rotate[J].Coll.cool = 0.;
00988                 C13O16Rotate[J].Coll.heat = 0.;
00989                 /* intensity of line */
00990                 C12O16Rotate[J].Emis->xIntensity = 0.;
00991                 C13O16Rotate[J].Emis->xIntensity = 0.;
00992                 /* number of photons emitted in line */
00993                 C12O16Rotate[J].Emis->phots = 0.;
00994                 C13O16Rotate[J].Emis->phots = 0.;
00995                 /* OTS rates */
00996                 C12O16Rotate[J].Emis->ots = 0.;
00997                 C13O16Rotate[J].Emis->ots = 0.;
00998         }
00999 
01000 
01001         /* only do this one time, and only if number of atom_level2 lines is positive */
01002         if( lgFirst && nWindLine>0)
01003         { 
01004 
01005                 lgFirst = false;
01006                 /* these are the massive set of op lines, with g-bar approx cs
01007                  * confirm that input data are valid */
01008 
01009                 for( i=0; i < nWindLine; i++ )
01010                 {
01011                         /* this information was read in in createdata */
01012                         ASSERT( TauLine2[i].Hi->nelem > 0 );
01013                         ASSERT( TauLine2[i].Hi->nelem <= (int)LIMELM );
01014 
01015                         ASSERT( TauLine2[i].Hi->IonStg > 0 );
01016                         ASSERT( TauLine2[i].Hi->IonStg <= (int)LIMELM );
01017 
01018                         ASSERT( TauLine2[i].Lo->g >0. );
01019 
01020                         ASSERT( TauLine2[i].Hi->g > 0. );
01021 
01022                         /* check that energy is positive*/
01023                         ASSERT( TauLine2[i].EnergyWN > 0 );
01024 
01025                         /* TauLine2[i].Emis->gf this is gf if positive, A if negative */
01026                         /* test whether a or gf entered, convert A to gf */
01027                         if( TauLine2[i].Emis->gf < 0. )
01028                         {
01029                                 /* convert A (=-gf) into real gf */
01030                                 TauLine2[i].Emis->gf *= (realnum)((-TauLine2[i].Hi->g)/TRANS_PROB_CONST/POW2(TauLine2[i].EnergyWN));
01031                         }
01032 
01033                         /*now put into standard format */
01034                         TauLine2[i].WLAng = 1.e8f/TauLine2[i].EnergyWN;
01035                         TauLine2[i].Lo->Pop = 0.;
01036                         TauLine2[i].Hi->Pop = 0.;
01037                         TauLine2[i].Emis->iRedisFun = ipPRD;
01038 
01039                         /* these are line optical depth arrays
01040                          * inward optical depth */
01041                         TauLine2[i].Emis->TauIn = opac.taumin;
01042                         TauLine2[i].Emis->TauCon = opac.taumin;
01043                         TauLine2[i].Emis->ColOvTot = 0.;
01044                         /* outward optical depth */
01045                         TauLine2[i].Emis->TauTot = 1e20f;
01046                         /* escape probability */
01047                         TauLine2[i].Emis->Pesc = 1.;
01048                         /* inward part of line */
01049                         TauLine2[i].Emis->FracInwd = 1.;
01050                         /* destruction probability */
01051                         TauLine2[i].Emis->Pdest = 0.;
01052                         TauLine2[i].Emis->Pelec_esc = 0.;
01053                         /* line pumping rate */
01054                         TauLine2[i].Emis->pump = 0.;
01055                         /* population of lower level */
01056                         TauLine2[i].Lo->Pop = 0.;
01057                         /* population of upper level */
01058                         TauLine2[i].Hi->Pop = 0.;
01059                         /* population of lower level with correction for stim emission */
01060                         TauLine2[i].Emis->PopOpc = 0.;
01061                         /* following two heat exchange excitation, deexcitation */
01062                         TauLine2[i].Coll.cool = 0.;
01063                         TauLine2[i].Coll.heat = 0.;
01064                         /* intensity of line */
01065                         TauLine2[i].Emis->xIntensity = 0.;
01066                         /* number of photons emitted in line */
01067                         TauLine2[i].Emis->phots = 0.;
01068                         /* ots rate */
01069                         TauLine2[i].Emis->ots = 0.;
01070                 }
01071         }
01072 
01073         for( i=0; i < nUTA; i++ )
01074         {
01075                 /* this information was read in in createdata */
01076                 ASSERT( UTALines[i].Hi->nelem > 0 );
01077                 ASSERT( UTALines[i].Hi->nelem <= (int)LIMELM );
01078 
01079                 ASSERT( UTALines[i].Hi->IonStg > 0 );
01080                 ASSERT( UTALines[i].Hi->IonStg <= (int)LIMELM );
01081 
01082                 ASSERT( UTALines[i].Lo->g > 0. );
01083 
01084                 ASSERT( UTALines[i].Hi->g > 0. );
01085 
01086                 /* check that energy is positive*/
01087                 ASSERT( UTALines[i].EnergyWN > 0 );
01088 
01089                 UTALines[i].Lo->Pop = 0.;
01090                 UTALines[i].Hi->Pop = 0.;
01091                 UTALines[i].Emis->iRedisFun = ipPRD;
01092 
01093                 /* these are line optical depth arrays
01094                  * inward optical depth */
01095                 UTALines[i].Emis->TauIn = opac.taumin;
01096                 UTALines[i].Emis->TauCon = opac.taumin;
01097                 UTALines[i].Emis->ColOvTot = 0.;
01098                 /* outward optical depth */
01099                 UTALines[i].Emis->TauTot = 1e20f;
01100                 /* escape probability */
01101                 UTALines[i].Emis->Pesc = 1.;
01102                 /* inward part of line */
01103                 UTALines[i].Emis->FracInwd = 1.;
01104                 /* destruction probability */
01105                 UTALines[i].Emis->Pdest = 0.;
01106                 UTALines[i].Emis->Pelec_esc = 0.;
01107                 /* line pumping rate */
01108                 UTALines[i].Emis->pump = 0.;
01109                 /* population of lower level */
01110                 UTALines[i].Lo->Pop = 0.;
01111                 /* population of upper level */
01112                 UTALines[i].Hi->Pop = 0.;
01113                 /* population of lower level with correction for stim emission */
01114                 UTALines[i].Emis->PopOpc = 0.;
01115                 /* following two heat exchange excitation, deexcitation */
01116                 UTALines[i].Coll.cool = 0.;
01117                 /* heat is the net heat per pump and was set when data read in
01118                  * this is different from other lines with this structure 
01119                 UTALines[i].Coll.heat = 0.;*/
01120                 /* intensity of line */
01121                 UTALines[i].Emis->xIntensity = 0.;
01122                 /* number of photons emitted in line */
01123                 UTALines[i].Emis->phots = 0.;
01124                 UTALines[i].Emis->ots = 0.;
01125         }
01126 
01127         for( i=0; i < nHFLines; i++ )
01128         {
01129                 /* this information was read in in createdata */
01130                 ASSERT( HFLines[i].Hi->nelem > 0 );
01131                 ASSERT( HFLines[i].Hi->nelem <= (int)LIMELM );
01132 
01133                 ASSERT( HFLines[i].Hi->IonStg > 0 );
01134                 ASSERT( HFLines[i].Hi->IonStg <= (int)LIMELM );
01135 
01136                 ASSERT( HFLines[i].Lo->g > 0. );
01137 
01138                 ASSERT( HFLines[i].Hi->g > 0. );
01139 
01140                 /* check that energy is positive*/
01141                 ASSERT( HFLines[i].EnergyWN > 0 );
01142 
01143                 /* HFLines[i].Emis->gf this is gf if positive, A if negative */
01144                 /* test whether a or gf entered, convert A to gf */
01145                 if( HFLines[i].Emis->gf < 0. )
01146                 {
01147                         /* convert A (=-gf) into real gf */
01148                         HFLines[i].Emis->gf *= (realnum)(-HFLines[i].Hi->g/TRANS_PROB_CONST/POW2(HFLines[i].EnergyWN));
01149                 }
01150 
01151                 /*now put into standard format */
01152                 HFLines[i].WLAng = 1.e8f/HFLines[i].EnergyWN;
01153                 HFLines[i].Lo->Pop = 0.;
01154                 HFLines[i].Hi->Pop = 0.;
01155                 /* change from partial to complete redistribution */
01156                 HFLines[i].Emis->iRedisFun = ipCRD;
01157 
01158                 /* these are line optical depth arrays
01159                  * inward optical depth */
01160                 HFLines[i].Emis->TauIn = opac.taumin;
01161                 HFLines[i].Emis->TauCon = opac.taumin;
01162                 HFLines[i].Emis->ColOvTot=0;
01163                 /* outward optical depth */
01164                 HFLines[i].Emis->TauTot = 1e20f;
01165                 /* escape probability */
01166                 HFLines[i].Emis->Pesc = 1.;
01167                 /* inward part of line */
01168                 HFLines[i].Emis->FracInwd = 1.;
01169                 /* destruction probability */
01170                 HFLines[i].Emis->Pdest = 0.;
01171                 HFLines[i].Emis->Pelec_esc = 0.;
01172                 /* line pumping rate */
01173                 HFLines[i].Emis->pump = 0.;
01174                 /* population of lower level */
01175                 HFLines[i].Lo->Pop = 0.;
01176                 /* population of upper level */
01177                 HFLines[i].Hi->Pop = 0.;
01178                 /* population of lower level with correction for stim emission */
01179                 HFLines[i].Emis->PopOpc = 0.;
01180                 /* following two heat exchange excitation, deexcitation */
01181                 HFLines[i].Coll.cool = 0.;
01182                 HFLines[i].Coll.heat = 0.;
01183                 /* intensity of line */
01184                 HFLines[i].Emis->xIntensity = 0.;
01185                 /* number of photons emitted in line */
01186                 HFLines[i].Emis->phots = 0.;
01187                 HFLines[i].Emis->ots = 0.;
01188         }
01189         return;
01190 }
01191 
01192 /* following used to save whether lines have been claimed by a pointer */
01193 static int *lev2set;
01194 
01195 /*generate pointer to level 1 line using wavelengtgh, ion, element */
01196 STATIC long ipFindLevLine( 
01197                 /* realnum ID wavelength, in angstroms */
01198                 realnum wl , 
01199                 /* state of ionization, 1 for neutral atom */
01200                 long ion , 
01201                 /* element number, 1 for H, 26 for Fe */
01202                 long nelem)
01203 {
01204         long i;/* use for counter in for loop */
01205 
01206         DEBUG_ENTRY( "ipFindLevLine()" );
01207 
01208         ASSERT( wl > 0. );
01209         ASSERT( ion > 0 );
01210         ASSERT( ion <= LIMELM );
01211         ASSERT( nelem > 0 );
01212         ASSERT( nelem <= LIMELM );
01213 
01214         /* look for the line */
01215         for( i=1; i<= nLevel1; ++i )
01216         {
01217                 if( TauLines[i].Hi->nelem == (int)nelem &&
01218                   TauLines[i].Hi->IonStg == (int)ion &&
01219                   fabs( TauLines[i].WLAng - wl) <0.1 )
01220                 {
01221                         /* remember that we have hit this line */
01222                         lev2set[i] = true;
01223                         /* and return pointer to the label*/
01224                         return i;
01225                 }
01226         }
01227         fprintf(ioQQQ,
01228                 " ipFindLevLine could not find a line with following properties:\n"
01229                 " wavelength=%f\n"
01230                 " ion stage =%li\n"
01231                 " atomic num=%li\n",
01232                 wl , ion, nelem );
01233         return -1;
01234 }
01235 
01236 STATIC void initFindLevLine( void )
01237 {
01238         long i;
01239 
01240         DEBUG_ENTRY( "initFindLevLine()" );
01241 
01242         /* generate the array of ints to store true and false */
01243         lev2set = (int*)MALLOC( (size_t)(nLevel1+1)*sizeof(int) );
01244 
01245         /* set them all false, saying that they have not been claimed by
01246          * one of the line pointers */
01247         for( i=1; i<=nLevel1; ++i )
01248                 lev2set[i] = false;
01249         return;
01250 }
01251 
01252 STATIC void endFindLevLine( void )
01253 {
01254         long i;
01255         bool lgAbort_loc=false;
01256 
01257         DEBUG_ENTRY( "endFindLevLine()" );
01258 
01259         /* set them all false, saying that they have not been claimed by
01260          * one of the line pointers */
01261         for( i=1; i<=nLevel1; ++i )
01262         {
01263                 if( !lev2set[i] )
01264                 {
01265                         fprintf(ioQQQ,"PROBLEM endFindLevLine warning; line %li not claimed\n",i);
01266                         fprintf(ioQQQ,
01267                                 " line had the following properties:\n"
01268                                 " wavelength=%f\n"
01269                                 " ion stage =%i\n"
01270                                 " atomic num=%i\n",
01271                                 TauLines[i].WLAng ,
01272                                 TauLines[i].Hi->IonStg ,
01273                                 TauLines[i].Hi->nelem );  
01274                         lgAbort_loc = true;
01275                 }
01276         }
01277 
01278         /* generate the array of ints to store true and false */
01279         free(lev2set);
01280 
01281         if( lgAbort_loc )
01282         {
01283                 fprintf(ioQQQ," problems found entering the data.  I live in lines_setup.c\n");
01284                 cdEXIT(EXIT_FAILURE);
01285         }
01286         return;
01287 }

Generated on Mon Feb 16 12:01:12 2009 for cloudy by  doxygen 1.4.7