cloudy  trunk
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
atmdat_lines_setup.cpp
Go to the documentation of this file.
1 /* This file is part of Cloudy and is copyright (C)1978-2008 by Gary J. Ferland and
2  * others. For conditions of distribution and use see copyright notice in license.txt */
3 /*lines_setup convert level 1 and level 2 line parameters and pointers into internal form
4  * used by code, line data were read in by atmdat_readin */
5 #include "cddefines.h"
6 #include "physconst.h"
7 #include "lines_service.h"
8 #include "prt.h"
9 #include "taulines.h"
10 #include "opacity.h"
11 #include "lines.h"
12 
13 /* following used for generating array indices to level1 lines,
14  * start process, use it, then end */
15 STATIC void initFindLevLine( void );
16 STATIC long ipFindLevLine( realnum , long , long );
17 STATIC void endFindLevLine( void );
18 
19 void lines_setup(void)
20 {
21  long int i, J;
22 
23  static bool lgFirst = true;
24  bool lgSane;
25 
26  DEBUG_ENTRY( "lines_setup()" );
27 
28  /* this routine takes the line parameters in the wind block data and sorts
29  * them into what is needed for the actual line optical depth arrays */
30 
33  /* this is the dummy line */
34  TauLines[0].WLAng = 0.;
35  TauLines[0].Lo->g = 0;
36  TauLines[0].Hi->g = 0.;
37  TauLines[0].Emis->gf = 0.;
38  TauLines[0].EnergyWN = 0.;
39  TauLines[0].Hi->IonStg = 0;
40  TauLines[0].Hi->nelem = 0;
41  /* this is an impossible value of iRedisFun */
42  TauLines[0].Emis->iRedisFun = 0;
43  TauLines[0].Emis->Aul = 0.;
44 
45  /* the first valid line is [0] since zero is the dummy */
46  if( TauLines[1].EnergyWN <= 0. )
47  {
48  fprintf( ioQQQ, " PROBLEM Insane value for TauLines array.\n" );
49  fprintf( ioQQQ, " Was block data LineData linked in??\n" );
50  fprintf( ioQQQ, " Check that it compiled OK (it probably did not).\n" );
51  TotalInsanity();
52  }
53 
54  /* check that all lines have valid data */
55  lgSane = true;
56  for( i=1; i <= nLevel1; i++ )
57  {
58 
59  if( TauLines[i].Lo->g <= 0. )
60  {
61  fprintf( ioQQQ, " routine lines_setup, insane lower stat wght\n" );
62  fprintf( ioQQQ, " line index is %5ld\n", i );
63  lgSane = false;
64  }
65 
66  if( TauLines[i].Hi->g <= 0. )
67  {
68  fprintf( ioQQQ, " routine lines_setup, insane upper stat wght\n" );
69  fprintf( ioQQQ, " line index is %5ld\n", i );
70  lgSane = false;
71  }
72 
73  if( TauLines[i].EnergyWN <= 0. )
74  {
75  fprintf( ioQQQ, " routine lines_setup, insane energy WN\n" );
76  fprintf( ioQQQ, " line index is %5ld\n", i );
77  lgSane = false;
78  }
79 
80  if( TauLines[i].Hi->IonStg <= 0 )
81  {
82  fprintf( ioQQQ, " routine lines_setup, insane ioniz stage\n" );
83  fprintf( ioQQQ, " line index is %5ld\n", i );
84  lgSane = false;
85  }
86 
87  if( TauLines[i].Hi->nelem <= 0 || TauLines[i].Hi->nelem > (int)LIMELM )
88  {
89  fprintf( ioQQQ, " routine lines_setup, insane Nelem\n" );
90  fprintf( ioQQQ, " line index is %5ld\n", i );
91  lgSane = false;
92  }
93 
94  if( TauLines[i].Hi->IonStg > TauLines[i].Hi->nelem )
95  {
96  fprintf( ioQQQ, " routine lines_setup, insane IonStg>Nelem\n" );
97  fprintf( ioQQQ, " line index is %5ld\n", i );
98  lgSane = false;
99  }
100 
101  if( TauLines[i].Emis->iRedisFun == 0 )
102  {
103  fprintf( ioQQQ, " routine lines_setup, insane line redis fcn\n" );
104  fprintf( ioQQQ, " line index is %5ld\n", i );
105  lgSane = false;
106  }
107 
108  /* use energies for wavelengths in air if wl not forced with wl number on line */
109  /* >>chng 03 oct 07, only make correction for index ref if
110  * if wl was not already set - this is an option to allow
111  * the printed wl to be specified in the level1.dat file */
112  if( TauLines[i].WLAng <= 0. )
113  {
114  /* make following an air wavelength */
115  TauLines[i].WLAng =
116  (realnum)(1.0e8/
117  TauLines[i].EnergyWN/
118  RefIndex( TauLines[i].EnergyWN));
119  }
120  {
121  /*@-redef@*/
122  enum{DEBUG_LOC=false};
123  /*@+redef@*/
124  if( DEBUG_LOC )
125  {
126  char chString[10];
127  chIonLbl(chString,&TauLines[i]);
128  fprintf( ioQQQ,"%s ", chString );
129  prt_wl( ioQQQ , TauLines[i].WLAng );
130  fprintf(ioQQQ,"\n");
131  }
132  }
133  }
134 
135  if( !lgSane )
136  {
137  fprintf( ioQQQ, " Insane value for line arrays encountered.\n" );
138  fprintf( ioQQQ, " Was block data lines linked in??\n" );
139  fprintf( ioQQQ, " Were errors intreoducted into the line array?\n" );
140  ShowMe();
141  cdEXIT(EXIT_FAILURE);
142  }
143 
144  /* set up array to store hits for each line */
145  initFindLevLine( );
146 
147  /* in following calls to ipFindLevLine the numbers are the integer wavelength
148  * used in the printout, the ion stage, and the atomic number */
149 
150  /* carbon line optical depth data */
151  ipT1656 = ipFindLevLine( 1656 , 1 , 6 );
152 
153  ipT9830 = ipFindLevLine( 9830 , 1 , 6 );
154 
155  ipT8727 = ipFindLevLine( 8727 , 1 , 6 );
156 
157  ipC2_2325 = ipFindLevLine( 2325 , 2 , 6 );
158  ipC2_2324 = ipFindLevLine( 2324 , 2 , 6 );
159  ipC2_2329 = ipFindLevLine( 2329 , 2 , 6 );
160  ipC2_2328 = ipFindLevLine( 2328 , 2 , 6 );
161  ipC2_2327 = ipFindLevLine( 2327 , 2 , 6 );
162 
163  ipT1335 = ipFindLevLine( 1335 , 2 , 6 );
164 
165  ipT1909 = ipFindLevLine( 1910 , 3 , 6 );
166 
167  ipT977 = ipFindLevLine( 977 , 3 , 6 );
168 
169  ipT1550 = ipFindLevLine( 1551 , 4 , 6 );
170 
171  ipT1548 = ipFindLevLine( 1548 , 4 , 6 );
172 
173  ipT386 = ipFindLevLine( 386 , 3 , 6 );
174 
175  ipT310 = ipFindLevLine( 310 , 3 , 6 );
176 
177  /*CIII* 1175, lower level = upper level of 1909*/
178  ipc31175 = ipFindLevLine( 1176 , 3 , 6 );
179 
180  ipT291 = ipFindLevLine( 291 , 3 , 6 );
181 
182  ipT280 = ipFindLevLine( 280 , 3 , 6 );
183 
184  ipT274 = ipFindLevLine( 274 , 3 , 6 );
185 
186  ipT270 = ipFindLevLine( 270 , 3 , 6 );
187 
188  ipT312 = ipFindLevLine( 312 , 4 , 6 );
189 
190  /*carbon fine structure lines added by Jim Kingdon*/
191  ipT610 = ipFindLevLine( 6092000 , 1 , 6 );
192 
193  ipT370 = ipFindLevLine( 3697000 , 1 , 6 );
194 
195  ipT157 = ipFindLevLine( 1576000 , 2 , 6 );
196 
197  /*nitrogen line optical depth data*/
198  ipT1085 = ipFindLevLine( 1085 , 2 , 7 );
199 
200  ipN3_1749 = ipFindLevLine( 1749 , 3 , 7 );
201  ipN3_1747 = ipFindLevLine( 1747 , 3 , 7 );
202  ipN3_1754 = ipFindLevLine( 1754 , 3 , 7 );
203  ipN3_1752 = ipFindLevLine( 1752 , 3 , 7 );
204  ipN3_1751 = ipFindLevLine( 1751 , 3 , 7 );
205 
206  ipT990 = ipFindLevLine( 991 , 3 , 7 );
207 
208  ipT1486 = ipFindLevLine( 1486 , 4 , 7 );
209 
210  ipT765 = ipFindLevLine( 765 , 4 , 7 );
211 
212  ipT1243 = ipFindLevLine( 1243 , 5 , 7 );
213 
214  ipT1239 = ipFindLevLine( 1239 , 5 , 7 );
215 
216  ipT374g = ipFindLevLine( 373 , 3 , 7 );
217 
218  /*this is the stronger of the two lines*/
219  ipT374x = ipFindLevLine( 374 , 3 , 7 );
220 
221  ipT1200 = ipFindLevLine( 1200 , 1 , 7 );
222 
223  ipT2140 = ipFindLevLine( 2141 , 2 , 7 );
224 
225  ipT671 = ipFindLevLine( 671 , 2 , 7 );
226 
227  ipT315 = ipFindLevLine( 315 , 3 , 7 );
228 
229  ipT324 = ipFindLevLine( 324 , 3 , 7 );
230 
231  ipT333 = ipFindLevLine( 333 , 3 , 7 );
232 
233  ipT209 = ipFindLevLine( 209 , 5 , 7 );
234 
235  /*fine structure lines */
236  /*[N II] 121.7*/
237  ipT122 = ipFindLevLine( 1217000 , 2 , 7 );
238 
239  /*[N II] 205.4*/
240  ipT205 = ipFindLevLine( 2054000 , 2 , 7 );
241 
242  /*big disagreement in A for this line, other val is 2x larger*/
243  /*see review in DEO Seaton 70th birthday*/
244  ipT57 = ipFindLevLine( 572100 , 3 , 7 );
245 
246  /*oxygen line optical depth data*/
247  ipT6300 = ipFindLevLine( 6300 , 1 , 8 );
248 
249  ipT6363 = ipFindLevLine( 6363 , 1 , 8 );
250 
251  /*A from NISt 96*/
252  ipT5577 = ipFindLevLine( 5577 , 1 , 8 );
253 
254  ipT834 = ipFindLevLine( 833.8f , 2 , 8 );
255 
256  ipT1661 = ipFindLevLine( 1661 , 3 , 8 );
257 
258  ipT1666 = ipFindLevLine( 1666 , 3 , 8 );
259 
260  ipT835 = ipFindLevLine( 835 , 3 , 8 );
261 
262  ipO4_1400 = ipFindLevLine( 1400 , 4 , 8 );
263  ipO4_1397 = ipFindLevLine( 1397 , 4 , 8 );
264  ipO4_1407 = ipFindLevLine( 1407 , 4 , 8 );
265  ipO4_1405 = ipFindLevLine( 1405 , 4 , 8 );
266  ipO4_1401 = ipFindLevLine( 1401 , 4 , 8 );
267 
268  ipT789 = ipFindLevLine( 789 , 4 , 8 );
269 
270  ipT630 = ipFindLevLine( 630 , 5 , 8 );
271 
272  /*start OI 6 level atom*/
273  ipT1304 = ipFindLevLine( 1304 , 1 , 8 );
274 
275  ipT1039 = ipFindLevLine( 1039 , 1 , 8 );
276 
277  ipT8446 = ipFindLevLine( 8446 , 1 , 8 );
278 
279  ipT4368 = ipFindLevLine( 4368 , 1 , 8 );
280 
281  ipTOI13 = ipFindLevLine( 13200 , 1 , 8 );
282 
283  ipTOI11 = ipFindLevLine( 11300 , 1 , 8 );
284 
285  ipTOI29 = ipFindLevLine( 29000 , 1 , 8 );
286 
287  ipTOI46 = ipFindLevLine( 46000 , 1 , 8 );
288 
289  ipTO1025 = ipFindLevLine( 1025 , 1 , 8 );
290 
291  /*end of OI 6 level atom*/
292 
293  ipT304 = ipFindLevLine( 304 , 3 , 8 );
294 
295  ipT1214 = ipFindLevLine( 1218 , 5 , 8 );
296 
297  ipT150 = ipFindLevLine( 150 , 6 , 8 );
298 
299  /*fine structure lines*/
300  /*[O I] 146 microns*/
301  ipT146 = ipFindLevLine( 1455300 , 1 , 8 );
302 
303  /*[O I] 63 microns*/
304  ipT63 = ipFindLevLine( 631700 , 1 , 8 );
305 
306  /*[O III] 88.3564 m*/
307  ipTO88 = ipFindLevLine( 883300 , 3 , 8 );
308 
309  /*[O III] 51.8145*/
310  ipT52 = ipFindLevLine( 518000 , 3 , 8 );
311 
312  /*[O IV] 25.89mic, A from*/
313  ipT26 = ipFindLevLine( 258800 , 4 , 8 );
314 
315  ipT1032 = ipFindLevLine( 1032 , 6 , 8 );
316 
317  ipT1037 = ipFindLevLine( 1037.6f , 6 , 8 );
318 
319  /*fluorine*/
320  /*f ii 29.33 mic*/
321  ipF0229 = ipFindLevLine( 293300 , 2 , 9 );
322 
323  /*f ii 67.2 mic*/
324  ipF0267 = ipFindLevLine( 672000 , 2 , 9 );
325 
326  /*f iv 44.07 mic*/
327  ipF444 = ipFindLevLine( 440700 , 4 , 9 );
328 
329  /*f iv 25.83 mic*/
330  ipF425 = ipFindLevLine( 258300 , 4 , 9 );
331 
332  /*neon*/
333  ipT770 = ipFindLevLine( 770.4f , 8 , 10 );
334 
335  ipT780 = ipFindLevLine( 780.3f , 8 , 10 );
336 
337  /*[Ne VI] 7.652 micron*/
338  ipxNe0676 = ipFindLevLine( 76520 , 6 , 10 );
339 
340  ipT895 = ipFindLevLine( 895 , 7 , 10 );
341 
342  ipT88 = ipFindLevLine( 88 , 8 , 10 );
343 
344  /*fine structure lines */
345  /*[Ne II] 12.8*/
346  ipTNe13 = ipFindLevLine( 128100 , 2 , 10 );
347 
348  /*[Ne III] 36.013 m*/
349  ipTNe36 = ipFindLevLine( 360140 , 3 , 10 );
350 
351  /*[Ne III] 15.56 m*/
352  ipTNe16 = ipFindLevLine( 155500 , 3 , 10 );
353 
354  /*[Ne V] 14.32 m*/
355  ipTNe14 = ipFindLevLine( 143200 , 5 , 10 );
356 
357  /*[Ne V] 24.318 m*/
358  ipTNe24 = ipFindLevLine( 243100 , 5 , 10 );
359 
360  /*sodium line optical depth data*/
361  ipT5895 = ipFindLevLine( 5891.9f , 1 , 11 );
362 
363  /*[Na III] 7.3177mic*/
364  ipfsNa373 = ipFindLevLine( 73200 , 3 , 11 );
365 
366  /*[Na IV] 9.039 mic*/
367  ipfsNa490 = ipFindLevLine( 90390 , 4 , 11 );
368 
369  /*[Na IV] 21.29 mic*/
370  ipfsNa421 = ipFindLevLine( 212900 , 4 , 11 );
371 
372  /*[Na VI] 14.40 mic*/
373  ipxNa6143 = ipFindLevLine( 144000 , 6 , 11 );
374 
375  /*[Na VI] 8.611 mic*/
376  ipxNa6862 = ipFindLevLine( 86110 , 6 , 11 );
377 
378  /*[Na VII] 4.68 micron*/
379  ipxNa0746 = ipFindLevLine( 46800 , 7 , 11 );
380 
381  /*magnesium line optical depth data*/
382  ipMgI2853 = ipFindLevLine( 2853 , 1 , 12 );
383 
384  ipMgI2026 = ipFindLevLine( 2026 , 1 , 12 );
385 
386  ipT2796 = ipFindLevLine( 2795.5f , 2 , 12 );
387 
388  ipT2804 = ipFindLevLine( 2802.7f , 2 , 12 );
389 
390  ipT705 = ipFindLevLine( 705 , 9 , 12 );
391 
392  ipT4561 = ipFindLevLine( 4561 , 1 , 12 );
393 
394  /*[Mg V] 1325, 3-1 in three level atom*/
395  ipxMg51325 = ipFindLevLine( 1325 , 5 , 12 );
396 
397  /*[Mg V] 2417, 3-2 in three level atom*/
398  ipxMg52417 = ipFindLevLine( 2417 , 5 , 12 );
399 
400  /*[Mg V] 2855, 2-1 in three level atom, really 2928, 2782*/
401  ipxMg52855 = ipFindLevLine( 2855 , 5 , 12 );
402 
403  /*[Mg VII] 1325, 3-1 in three level atom*/
404  ipxMg71190 = ipFindLevLine( 1190 , 7 , 12 );
405 
406  /*[Mg VII] 2261, 3-2 in three level atom*/
407  ipxMg72261 = ipFindLevLine( 2261 , 7 , 12 );
408 
409  /*[Mg VII] 2569, 2-1 in three level atom, really 2509, 2629*/
410  ipxMg72569 = ipFindLevLine( 2569 , 7 , 12 );
411 
412  /*[Mg VIII] 3.03 micron*/
413  ipxMg08303 = ipFindLevLine( 30300 , 8 , 12 );
414 
415  /*the Mg X 615 li seq doublet*/
416  ipTMg610 = ipFindLevLine( 609.8f , 10 , 12 );
417 
418  ipTMg625 = ipFindLevLine( 625 , 10 , 12 );
419 
420  ipT58 = ipFindLevLine( 57.9f , 10 , 12 );
421 
422  /*Mg IV 4.487m*/
423  ipTMg4 = ipFindLevLine( 44850 , 4 , 12 );
424 
425  /*[Mg V] 13.52*/
426  ipTMg14 = ipFindLevLine( 135200 , 5 , 12 );
427 
428  /*[Mg V] 5.610*/
429  ipTMg6 = ipFindLevLine( 56100 , 5 , 12 );
430 
431  /*[Mg VII] 9.033 mic*/
432  ipfsMg790 = ipFindLevLine( 90330 , 7 , 12 );
433 
434  /*[Mg VII] 5.503 mic7 , 12 );*/
435  ipfsMg755 = ipFindLevLine( 55030 , 7 , 12 );
436 
437  /* aluminum line optical depth data */
438  ipAlI3957 = ipFindLevLine( 3957 , 1 , 13 );
439 
440  ipAlI3090 = ipFindLevLine( 3090 , 1 , 13 );
441 
442  ipT1855 = ipFindLevLine( 1855 , 3 , 13 );
443 
444  ipT1863 = ipFindLevLine( 1863 , 3 , 13 );
445 
446  ipT2670 = ipFindLevLine( 2670 , 2 , 13 );
447 
448  /*[Al V] 2.905 mic*/
449  ipAl529 = ipFindLevLine( 29052 , 5 , 13 );
450 
451  /*[Al VI] 3.66 mic*/
452  ipAl6366 = ipFindLevLine( 36600 , 6 , 13 );
453 
454  /*[Al VI] 9.116 mic*/
455  ipAl6912 = ipFindLevLine( 91160 , 6 , 13 );
456 
457  /*[Al VIII] 5.848 mic*/
458  ipAl8575 = ipFindLevLine( 58480 , 8 , 13 );
459 
460  /*[Al VIII] 3.69 mic*/
461  ipAl8370 = ipFindLevLine( 36900 , 8 , 13 );
462 
463  /*[Al IX] 2.04 micron*/
464  ipAl09204 = ipFindLevLine( 20400 , 9 , 13 );
465 
466  ipT639 = ipFindLevLine( 639 , 10 , 13 );
467 
468  /*Al XI 550, 568 Li seq doublet */
469  ipTAl550 = ipFindLevLine( 550 , 11 , 13 );
470 
471  ipTAl568 = ipFindLevLine( 568 , 11 , 13 );
472 
473  ipTAl48 = ipFindLevLine( 48 , 11 , 13 );
474 
475  /*silicon line optical depth data*/
476  ipSi1_130m = ipFindLevLine( 1295823.0f , 1 , 14 );
477  ipSi1_68m = ipFindLevLine( 683995.25f , 1 , 14 );
478 
479  ipSii2518 = ipFindLevLine( 2518 , 1 , 14 );
480 
481  ipSii2215 = ipFindLevLine( 2215 , 1 , 14 );
482 
483  ipSi2_2334 = ipFindLevLine( 2334 , 2 , 14 );
484  ipSi2_2329 = ipFindLevLine( 2329 , 2 , 14 );
485  ipSi2_2350 = ipFindLevLine( 2350 , 2 , 14 );
486  ipSi2_2344 = ipFindLevLine( 2344 , 2 , 14 );
487  ipSi2_2336 = ipFindLevLine( 2336 , 2 , 14 );
488 
489  ipT1808 = ipFindLevLine( 1813.99f , 2 , 14 );
490 
491  ipT1207 = ipFindLevLine( 1207 , 3 , 14 );
492 
493  ipT1895 = ipFindLevLine( 1892 , 3 , 14 );
494 
495  ipT1394 = ipFindLevLine( 1394 , 4 , 14 );
496 
497  ipT1403 = ipFindLevLine( 1403 , 4 , 14 );
498 
499  ipT1527 = ipFindLevLine( 1531 , 2 , 14 );
500 
501  ipT1305 = ipFindLevLine( 1307.7f , 2 , 14 );
502 
503  ipT1260 = ipFindLevLine( 1263.3f , 2 , 14 );
504 
505  /*[Si VI] 1.9641mic*/
506  ipSi619 = ipFindLevLine( 19631 , 6 , 14 );
507 
508  /*[Si X] 1.43 micron*/
509  ipSi10143 = ipFindLevLine( 14300 , 10 , 14 );
510 
511  /* Si X] ll 621.1, 611.7, 598.6 */
512  ipSi10_606 = ipFindLevLine( 606 , 10 , 14 );
513 
514  ipTSi499 = ipFindLevLine( 499 , 12 , 14 );
515 
516  ipTSi521 = ipFindLevLine( 521 , 12 , 14 );
517 
518  ipTSi41 = ipFindLevLine( 41 , 12 , 14 );
519 
520  /*[Si II] 34.8 mic*/
521  ipTSi35 = ipFindLevLine( 348140 , 2 , 14 );
522 
523  /*[Si VII] 2.481*/
524  ipTSi25 = ipFindLevLine( 24810 , 7 , 14 );
525 
526  /*[Si VII] 6.4922*/
527  ipTSi65 = ipFindLevLine( 64920 , 7 ,14 );
528 
529  /*[Si IX] 2.585 mic*/
530  ipTSi3 = ipFindLevLine( 25840 , 9 , 14 );
531 
532  /*[Si IX] 3.929 mic*/
533  ipTSi4 = ipFindLevLine( 39290 , 9 , 14 );
534 
535  /*phosphorus line data*/
536  /*P II 60.64 mic*/
537  ipP0260 = ipFindLevLine( 606400 , 2 , 15 );
538 
539  /*P II 32.87 mic*/
540  ipP0233 = ipFindLevLine( 328700 , 2 , 15 );
541 
542  /*P III 17.885 mic*/
543  ipP0318 = ipFindLevLine( 178850 , 3 , 15 );
544 
545  /*P VII 1.3745 mic*/
546  ipP713 = ipFindLevLine( 13745 , 7 , 15 );
547 
548  /*P VIII 4.85 mic*/
549  ipP848 = ipFindLevLine( 48500 , 8 , 15 );
550 
551  /*P VIII 1.735 mic*/
552  ipP817 = ipFindLevLine( 17350 , 8 , 15 );
553 
554  /*P X 2.708 mic*/
555  ipP1027 = ipFindLevLine( 27080 , 10 , 15 );
556 
557  /*P X 1.868*/
558  ipP1018 = ipFindLevLine( 18680 , 10 , 15 );
559 
560  /*sulphur line optical depth data*/
561  ipS1_25m = ipFindLevLine( 251947.453f , 1 , 16 );
562  ipS1_56m = ipFindLevLine( 562909.625f , 1 , 16 );
563 
564  ipT1256 = ipFindLevLine( 1256 , 2 , 16 );
565 
566  ipT1194 = ipFindLevLine( 1197.55f , 3 , 16 );
567 
568  ipTS1720 = ipFindLevLine( 1720 , 3 , 16 );
569 
570  ipS4_1405 = ipFindLevLine( 1405 , 4 , 16 );
571  ipS4_1398 = ipFindLevLine( 1398 , 4 , 16 );
572  ipS4_1424 = ipFindLevLine( 1424 , 4 , 16 );
573  ipS4_1417 = ipFindLevLine( 1417 , 4 , 16 );
574  ipS4_1407 = ipFindLevLine( 1406 , 4 , 16 );
575 
576  ipT1198 = ipFindLevLine( 1198 , 5 , 16 );
577 
578  ipT786 = ipFindLevLine( 786.47f , 5 , 16 );
579 
580  ipT933 = ipFindLevLine( 933.38f , 6 , 16 );
581 
582  ipT944 = ipFindLevLine( 944.52f , 6 , 16 );
583 
584  /*[S VIII] 9913*/
585  ipfsS810 = ipFindLevLine( 9913 , 8 , 16 );
586 
587  /*[S IX] 1.252 mic*/
588  ipfsS912 = ipFindLevLine( 12520 , 9 , 16 );
589 
590  /*[S IX] 3.755 mic*/
591  ipfsS938 = ipFindLevLine( 37550 , 9 , 16 );
592 
593  /*[S XI] 1.9201 mic*/
594  ipfsS1119 = ipFindLevLine( 19201 , 11 , 16 );
595 
596  /*[S XI] 1.3927 mic*/
597  ipfsS1114 = ipFindLevLine( 13927 , 11 , 16 );
598 
599  /*S XII 7536*/
600  /*this is a vacuum wavelength*/
601  ipfsS1207 = ipFindLevLine( 7611 , 12 , 16 );
602 
603  /* >>chng 03 sep 27, group of lines moved from expion */
604  ipS12_520 = ipFindLevLine( 520 , 12 , 16 );
605 
606  ipTSu418 = ipFindLevLine( 418 , 14 , 16 );
607 
608  ipTSu446 = ipFindLevLine( 446 , 14 , 16 );
609 
610  ipTSu30 = ipFindLevLine( 30 , 14 , 16 );
611 
612  /*fine structure lines added in by Jim Kingdon*/
613  ipTS19 = ipFindLevLine( 186700 , 3 , 16 );
614 
615  /*[S III] 33.48*/
616  ipTS34 = ipFindLevLine( 334700 , 3 , 16 );
617 
618  ipTS11 = ipFindLevLine( 105100 , 4 , 16 );
619 
620  /*chlorine line optical depth data*/
621 
622  /* Cl 1 mic */
623  ipCl1_11m = ipFindLevLine( 113296.3984f , 1 , 17 );
624 
625  /*Cl II 14.3678 mic*/
626  ipfsCl214 = ipFindLevLine( 144000 , 2 , 17 );
627 
628  /*Cl II 33.281 mic*/
629  ipfsCl233 = ipFindLevLine( 333000 , 2 , 17 );
630 
631  /*[Cl 4] 20.354 mic*/
632  ipCl04203 = ipFindLevLine( 204000 , 4 , 17 );
633 
634  /*[Cl 4] 11.741 mic*/
635  ipCl04117 = ipFindLevLine( 117000 ,4 , 17 );
636 
637  /*Cl IX 7334A*/
638  ipCl973 = ipFindLevLine( 7334 , 9 , 17 );
639 
640  /*Cl X 3.05 mic*/
641  ipCl1030 = ipFindLevLine( 30500 , 10 , 17 );
642 
643  /*Cl X 9332*/
644  ipCl1092 = ipFindLevLine( 9332 , 10 , 17 );
645 
646  /*argon line optical depth data*/
647  /*Ar XVI*/
648  ipT354 = ipFindLevLine( 354 , 16 , 18 );
649 
650  /*Ar XVI*/
651  ipT389 = ipFindLevLine( 389 , 16 , 18 );
652 
653  /*Ar XVI*/
654  ipT25 = ipFindLevLine( 25 , 16 , 18 );
655 
656  /*argon fine structure lines*/
657  /*[Ar II]*/
658  ipTAr7 = ipFindLevLine( 69800 , 2 , 18 );
659 
660  /*[Ar III] 9.0 mic*/
661  ipTAr9 = ipFindLevLine( 90000 , 3 , 18 );
662 
663  /*[Ar III] 21.83 mic*/
664  ipTAr22 = ipFindLevLine( 218300 , 3 , 18 );
665 
666  /*[Ar V] 13.1 mic*/
667  ipTAr13 = ipFindLevLine( 131000 , 5 , 18 );
668 
669  /*[Ar V] 8.0 mic*/
670  ipTAr8 = ipFindLevLine( 80000 , 5 , 18 );
671 
672  /*[Ar VI] 4.53 micron*/
673  ipAr06453 = ipFindLevLine( 45300 , 6 , 18 );
674 
675  /*Ar X 5533*/
676  ipAr1055 = ipFindLevLine( 5533 , 10 , 18 );
677 
678  /*[Ar XI] 2.619 mic*/
679  ipAr1126 = ipFindLevLine( 26190 , 11 , 18 );
680 
681  /*[Ar XI] 6917.5*/
682  ipAr1178 = ipFindLevLine( 6917 , 11 , 18 );
683 
684  /*potasium - really should split into two*/
685  ipKI7745 = ipFindLevLine( 7676.2f , 1 , 19 );
686 
687  /*[K III] 4.62 micron*/
688  ipxK03462 = ipFindLevLine( 46200 , 3 , 19 );
689 
690  /*[K IV] 5.982 micron*/
691  ipxK04598 = ipFindLevLine( 59800 , 4 , 19 );
692 
693  /*[K IV] 15.39 micron4 , 19 );*/
694  ipxK04154 = ipFindLevLine( 153900 , 4 , 19 );
695 
696  /* [K VI] 8.823 micron */
697  ipxK06882 = ipFindLevLine( 88200 , 6 , 19 );
698 
699  /*[K VI] 5.575 micron6 */
700  ipxK06557 = ipFindLevLine( 55700 , 6 , 19 );
701 
702  /*[K VII] 3.19 micron7 , 19 );*/
703  ipxK07319 = ipFindLevLine( 31905 , 7 , 19 );
704 
705  /* [K XI] 4249.99 A */
706  ipxK11425 = ipFindLevLine( 4250 , 11 , 19 );
707 
708  /*calcium line optical depth data*/
709  ipCaI4228 = ipFindLevLine( 4228 , 1 , 20 );
710 
711  ipT3934 = ipFindLevLine( 3934 , 2 , 20 );
712 
713  ipT3969 = ipFindLevLine( 3969 , 2 , 20 );
714 
715  ipT8498 = ipFindLevLine( 8498 , 2 , 20 );
716 
717  ipT8542 = ipFindLevLine( 8542 , 2 , 20 );
718 
719  ipT8662 = ipFindLevLine( 8662 , 2 , 20 );
720 
721  ipT7291 = ipFindLevLine( 7291 , 2 , 20 );
722 
723  ipT7324 = ipFindLevLine( 7324 , 2 , 20 );
724 
725  ipTCa345 = ipFindLevLine( 345 , 18 , 20 );
726 
727  ipTCa19 = ipFindLevLine( 19 , 18 , 20 );
728 
729  /*[Ca IV] 3.21 min*/
730  ipTCa3 = ipFindLevLine( 32100 , 4 , 20 );
731 
732  ipTCa12 = ipFindLevLine( 114000 , 5 , 20 );
733 
734  ipTCa4 = ipFindLevLine( 41500 , 5 , 20 );
735 
736  /*[Ca VII] 4.09 micron*/
737  ipCa0741 = ipFindLevLine( 40900 , 7 , 20 );
738 
739  /*[Ca VII] 6.15 micron*/
740  ipCa0761 = ipFindLevLine( 61500 , 7 , 20 );
741 
742  /*[Ca VIII] 2.32 micron*/
743  ipCa08232 = ipFindLevLine( 23200 , 8 , 20 );
744 
745  /*[Ca 12] 3328.78 A */
746  ipCa12333 = ipFindLevLine( 3329 , 12 , 20 );
747 
748  /* Ca 18 302 */
749  ipTCa302 = ipFindLevLine( 302 , 18 , 20 );
750 
751  /*scandium data*/
752  /*[Sc V] 2.31 micron*/
753  ipSc05231 = ipFindLevLine( 23100 , 5 , 21 );
754 
755  /*[Sc 13] 2637.97 A */
756  ipSc13264 = ipFindLevLine( 2638 , 13 , 21 );
757 
758  /*Titanium data*/
759  /*[Ti VI] 1.72 micron*/
760  ipTi06172 = ipFindLevLine( 17200 , 6 , 22 );
761 
762  /*[Ti 14] 2117.79 A */
763  ipTi14212 = ipFindLevLine( 2118 , 14 , 22 );
764 
765  /*Vanadium data*/
766  /*[V VII] 1.30 micron*/
767  ipVa07130 = ipFindLevLine( 13000 , 7 , 23 );
768 
769  /*[V 15] 1721.38 A */
770  ipVa15172 = ipFindLevLine( 1721 , 15 , 23 );
771 
772  /*Chromium data*/
773  /*[Cr VIII] 1.01 micron*/
774  ipCr08101 = ipFindLevLine( 10100 , 8 , 24 );
775 
776  /*[Cr 16] 1410.60 A*/
777  ipCr16141 = ipFindLevLine( 1411 , 16 , 24 );
778 
779  /*Manganese data*/
780  /*[Mn IX] 7968.5A*/
781  ipxMn0979 = ipFindLevLine( 7968 , 9 , 25 );
782 
783  /*[Mn 17] 1169.59 A */
784  ipxMn1712 = ipFindLevLine( 1170 , 17 , 25 );
785 
786  /*iron Fe line optical depth data*/
787 
788  /* [Fe I] ground term */
789  ipFe1_24m = ipFindLevLine( 240359.546f , 1 , 26 );
790  ipFe1_35m = ipFindLevLine( 347043.25f , 1 , 26 );
791  ipFe1_54m = ipFindLevLine( 542946.5625f , 1 , 26 );
792  ipFe1_111m = ipFindLevLine( 1111549.25f , 1 , 26 );
793 
794  ipFeI3884 = ipFindLevLine( 3884 , 1 , 26 );
795 
796  ipFeI3729 = ipFindLevLine( 3729 , 1 , 26 );
797 
798  ipFeI3457 = ipFindLevLine( 3457 , 1 , 26 );
799 
800  ipFeI3021 = ipFindLevLine( 3021 , 1 , 26 );
801 
802  ipFeI2966 = ipFindLevLine( 2966 , 1 , 26 );
803 
804  /*>>chng 03 oct 07, chng wl from 2360 to 2400, the value
805  * before cnhg of feii lines to stuc */
806  ipTuv3 = ipFindLevLine( 2400 , 2 , 26 );
807 
808  ipTr48 = ipFindLevLine( 6200 , 2 , 26 );
809 
810  ipTFe16 = ipFindLevLine( 1080 , 2 , 26 );
811 
812  ipTFe26 = ipFindLevLine( 1500 , 2 , 26 );
813 
814  ipTFe34 = ipFindLevLine( 11500 , 2 , 26 );
815 
816  ipTFe35 = ipFindLevLine( 2500 , 2 , 26 );
817 
818  ipTFe46 = ipFindLevLine( 2300 , 2 , 26 );
819 
820  ipTFe56 = ipFindLevLine( 8900 , 2 , 26 );
821 
822  ipT1122 = ipFindLevLine( 1125.8f , 3 , 26 );
823 
824  /* [Fe VII] 9.53 mic, A */
825  ipFe0795 = ipFindLevLine( 95100, 7 , 26 );
826 
827  /* [Fe VII] 7.81 mic, A */
828  ipFe0778 = ipFindLevLine( 78100, 7 , 26 );
829 
830  ipT245 = ipFindLevLine( 245 , 9 , 26 );
831 
832  /*this is pump line for upper level of [FeX] 6375*/
833  ipT352 = ipFindLevLine( 352 , 10 , 26 );
834 
835  ipFe106375 = ipFindLevLine( 6373.3f , 10 , 26 );
836 
837  /*actually three lines contributing here, important for coronal pumping */
838  /*following is whole multiplet average*/
839  ipT353 = ipFindLevLine( 353 , 11 , 26 );
840 
841  /* >>chng 05 dec 19, go to 5 level Fe 11 */
842  /*ipTFe07 = ipFindLevLine( 7892 , 11 , 26 );
843  ipTFe61 = ipFindLevLine( 60827 , 11 , 26 );*/
844 
845  /*[Fe XIII] 1.07 microns
846  ipFe1310 = ipFindLevLine( 10700 , 13 , 26 );*/
847 
848  /*[Fe XIII] 1.08 microns
849  ipFe1311 = ipFindLevLine( 10800 , 13 , 26 );*/
850 
851  /* N-seq [Fe20] 721, 578A */
852  ipTFe20_721 = ipFindLevLine( 721 , 20 , 26 );
853  ipTFe20_578 = ipFindLevLine( 578 , 20 , 26 );
854 
855  /* boron sequence fe iron lines */
856  /*>>chng 00 oct 26 added these lines */
857  ipFe22_247 = ipFindLevLine( 247 , 22 , 26 );
858  ipFe22_217 = ipFindLevLine( 217 , 22 , 26 );
859  ipFe22_348 = ipFindLevLine( 348 , 22 , 26 );
860  ipFe22_292 = ipFindLevLine( 292 , 22 , 26 );
861  ipFe22_253 = ipFindLevLine( 253 , 22 , 26 );
862  ipFe22_846 = ipFindLevLine( 846 , 22 , 26 );
863 
864  ipT347 = ipFindLevLine( 347 , 14 , 26 );
865 
866  ipT192 = ipFindLevLine( 192 , 24 , 26 );
867 
868  ipT255 = ipFindLevLine( 255 , 24 , 26 );
869 
870  ipT11 = ipFindLevLine( 11 , 24 , 26 );
871 
872  ipT191 = ipFindLevLine( 1786 , 2 , 26 );
873 
874 
875  /* [Fe 18] 974.86 A */
876  ipFe18975 = ipFindLevLine( 974 , 18 , 26 );
877 
878  ipTFe23 = ipFindLevLine( 2299 , 21 , 26 );
879 
880  ipTFe13 = ipFindLevLine( 1354 , 21 , 26 );
881 
882  /* Cobalt data */
883  /* [Co XI] 5168.A */
884  ipCo11527 = ipFindLevLine( 5168 , 11 , 27 );
885 
886  /* Nickel data */
887  ipNi1_7m = ipFindLevLine( 75046.164f , 1 , 28 );
888  ipNi1_11m = ipFindLevLine( 113044.031f , 1 , 28 );
889 
890  /* [Ni XII] 4230.8A */
891  ipxNi1242 = ipFindLevLine( 4230 , 12 , 28 );
892 
893  /* Zinc data */
894  /* Zn 04 3.625 microns */
895  ipZn04363 = ipFindLevLine( 36250 , 4 , 30 );
896 
897  /* flush the line list, freeing the extra storage and checking that all
898  * lines have been claimed */
899  endFindLevLine( );
900 
904  /* next initialize entire array to dangerously large negative numbers */
905  for( J=0; J< nCORotate; ++J )
906  {
907  /* this is the rotation constant for CO, from
908  * >>refer mco rot Emerson, D., 1996, Interpreting Astronomical Spectgra, p289 */
909  /* this is B in cm^-1 units */
910  realnum BC12O16=1.9313f;
911  /* permanent dipole moment in Debyes */
912  realnum dpC12O16 = 0.1111f;
913  realnum BC13O16=2.0202f;
914  /* permanent dipole moment in Debyes */
915  realnum dpC13O16 = 0.11046f;
916 
917  /* statistical weights of lower and upper levels */
918  C12O16Rotate[J].Lo->g = 2.f*J+1.f;
919  C12O16Rotate[J].Hi->g = 2.f*(J+1.f)+1.f;
920 
921  C13O16Rotate[J].Lo->g = 2.f*J+1.f;
922  C13O16Rotate[J].Hi->g = 2.f*(J+1.f)+1.f;
923 
924  /* energy of the J+1 to J transition */
925  C12O16Rotate[J].EnergyWN = 2.f * BC12O16 * (J+1.f);
926  C12O16Rotate[J].WLAng = 1.e8f/C12O16Rotate[J].EnergyWN;
927  C13O16Rotate[J].EnergyWN = 2.f * BC13O16 * (J+1.f);
928  C13O16Rotate[J].WLAng = 1.e8f/C13O16Rotate[J].EnergyWN;
929 
930  /* this is special flag for CO - these are used in velset (in tfidle.c) to
931  * set doppler velocities for species */
932  C12O16Rotate[J].Hi->nelem = LIMELM+1;
933  C13O16Rotate[J].Hi->nelem = LIMELM+2;
934  /* this will make spaces instead of an ion integer */
935  C12O16Rotate[J].Hi->IonStg = 2;
936  C13O16Rotate[J].Hi->IonStg = 3;
937 
938  /* A */
939  C12O16Rotate[J].Emis->Aul = 2.508e-6f *POW2(dpC12O16)*POW3(BC12O16)*POW2(J+1.f)*POW2(J+1.f)/(2.f*J+3.f);
940  C13O16Rotate[J].Emis->Aul = 2.508e-6f *POW2(dpC13O16)*POW3(BC13O16)*POW2(J+1.f)*POW2(J+1.f)/(2.f*J+3.f);
941  /* special flag saying not evaluated, find from Aul later */
942  C12O16Rotate[J].Emis->gf = -1.f;
943  C13O16Rotate[J].Emis->gf = -1.f;
944  C12O16Rotate[J].Lo->Pop = 0.;
945  C13O16Rotate[J].Lo->Pop = 0.;
946  C12O16Rotate[J].Hi->Pop = 0.;
947  C13O16Rotate[J].Hi->Pop = 0.;
948  /* >>chng 01 may 29, from PRD to CRD */
950  /* >>chng 01 may 29, from PRD to CRD */
956  C12O16Rotate[J].Emis->ColOvTot = 0.;
957  C13O16Rotate[J].Emis->ColOvTot = 0.;
958  /* outward optical depth */
959  C12O16Rotate[J].Emis->TauTot = 1e20f;
960  C13O16Rotate[J].Emis->TauTot = 1e20f;
961  /* escape probability */
962  C12O16Rotate[J].Emis->Pesc = 1.;
963  C13O16Rotate[J].Emis->Pesc = 1.;
964  /* inward part of line */
965  C12O16Rotate[J].Emis->FracInwd = 1.f;
966  C13O16Rotate[J].Emis->FracInwd = 1.f;
967  /* destruction probability */
968  C12O16Rotate[J].Emis->Pdest = 0.;
969  C13O16Rotate[J].Emis->Pdest = 0.;
970  C12O16Rotate[J].Emis->Pelec_esc = 0.;
971  C13O16Rotate[J].Emis->Pelec_esc = 0.;
972  /* line pumping rate */
973  C12O16Rotate[J].Emis->pump = 0.;
974  C13O16Rotate[J].Emis->pump = 0.;
975  /* population of lower level */
976  C12O16Rotate[J].Lo->Pop = 0.;
977  C13O16Rotate[J].Lo->Pop = 0.;
978  /* population of upper level */
979  C12O16Rotate[J].Hi->Pop = 0.;
980  C13O16Rotate[J].Hi->Pop = 0.;
981  /* population of lower level with correction for stim emission */
982  C12O16Rotate[J].Emis->PopOpc = 0.;
983  C13O16Rotate[J].Emis->PopOpc = 0.;
984  /* following two heat exchange excitation, deexcitation */
985  C12O16Rotate[J].Coll.cool = 0.;
986  C12O16Rotate[J].Coll.heat = 0.;
987  C13O16Rotate[J].Coll.cool = 0.;
988  C13O16Rotate[J].Coll.heat = 0.;
989  /* intensity of line */
990  C12O16Rotate[J].Emis->xIntensity = 0.;
991  C13O16Rotate[J].Emis->xIntensity = 0.;
992  /* number of photons emitted in line */
993  C12O16Rotate[J].Emis->phots = 0.;
994  C13O16Rotate[J].Emis->phots = 0.;
995  /* OTS rates */
996  C12O16Rotate[J].Emis->ots = 0.;
997  C13O16Rotate[J].Emis->ots = 0.;
998  }
999 
1000 
1001  /* only do this one time, and only if number of atom_level2 lines is positive */
1002  if( lgFirst && nWindLine>0)
1003  {
1004 
1005  lgFirst = false;
1006  /* these are the massive set of op lines, with g-bar approx cs
1007  * confirm that input data are valid */
1008 
1009  for( i=0; i < nWindLine; i++ )
1010  {
1011  /* this information was read in in createdata */
1012  ASSERT( TauLine2[i].Hi->nelem > 0 );
1013  ASSERT( TauLine2[i].Hi->nelem <= (int)LIMELM );
1014 
1015  ASSERT( TauLine2[i].Hi->IonStg > 0 );
1016  ASSERT( TauLine2[i].Hi->IonStg <= (int)LIMELM );
1017 
1018  ASSERT( TauLine2[i].Lo->g >0. );
1019 
1020  ASSERT( TauLine2[i].Hi->g > 0. );
1021 
1022  /* check that energy is positive*/
1023  ASSERT( TauLine2[i].EnergyWN > 0 );
1024 
1025  /* TauLine2[i].Emis->gf this is gf if positive, A if negative */
1026  /* test whether a or gf entered, convert A to gf */
1027  if( TauLine2[i].Emis->gf < 0. )
1028  {
1029  /* convert A (=-gf) into real gf */
1030  TauLine2[i].Emis->gf *= (realnum)((-TauLine2[i].Hi->g)/TRANS_PROB_CONST/POW2(TauLine2[i].EnergyWN));
1031  }
1032 
1033  /*now put into standard format */
1034  TauLine2[i].WLAng = 1.e8f/TauLine2[i].EnergyWN;
1035  TauLine2[i].Lo->Pop = 0.;
1036  TauLine2[i].Hi->Pop = 0.;
1037  TauLine2[i].Emis->iRedisFun = ipPRD;
1038 
1039  /* these are line optical depth arrays
1040  * inward optical depth */
1041  TauLine2[i].Emis->TauIn = opac.taumin;
1042  TauLine2[i].Emis->TauCon = opac.taumin;
1043  TauLine2[i].Emis->ColOvTot = 0.;
1044  /* outward optical depth */
1045  TauLine2[i].Emis->TauTot = 1e20f;
1046  /* escape probability */
1047  TauLine2[i].Emis->Pesc = 1.;
1048  /* inward part of line */
1049  TauLine2[i].Emis->FracInwd = 1.;
1050  /* destruction probability */
1051  TauLine2[i].Emis->Pdest = 0.;
1052  TauLine2[i].Emis->Pelec_esc = 0.;
1053  /* line pumping rate */
1054  TauLine2[i].Emis->pump = 0.;
1055  /* population of lower level */
1056  TauLine2[i].Lo->Pop = 0.;
1057  /* population of upper level */
1058  TauLine2[i].Hi->Pop = 0.;
1059  /* population of lower level with correction for stim emission */
1060  TauLine2[i].Emis->PopOpc = 0.;
1061  /* following two heat exchange excitation, deexcitation */
1062  TauLine2[i].Coll.cool = 0.;
1063  TauLine2[i].Coll.heat = 0.;
1064  /* intensity of line */
1065  TauLine2[i].Emis->xIntensity = 0.;
1066  /* number of photons emitted in line */
1067  TauLine2[i].Emis->phots = 0.;
1068  /* ots rate */
1069  TauLine2[i].Emis->ots = 0.;
1070  }
1071  }
1072 
1073  for( i=0; i < nUTA; i++ )
1074  {
1075  /* this information was read in in createdata */
1076  ASSERT( UTALines[i].Hi->nelem > 0 );
1077  ASSERT( UTALines[i].Hi->nelem <= (int)LIMELM );
1078 
1079  ASSERT( UTALines[i].Hi->IonStg > 0 );
1080  ASSERT( UTALines[i].Hi->IonStg <= (int)LIMELM );
1081 
1082  ASSERT( UTALines[i].Lo->g > 0. );
1083 
1084  ASSERT( UTALines[i].Hi->g > 0. );
1085 
1086  /* check that energy is positive*/
1087  ASSERT( UTALines[i].EnergyWN > 0 );
1088 
1089  UTALines[i].Lo->Pop = 0.;
1090  UTALines[i].Hi->Pop = 0.;
1091  UTALines[i].Emis->iRedisFun = ipPRD;
1092 
1093  /* these are line optical depth arrays
1094  * inward optical depth */
1095  UTALines[i].Emis->TauIn = opac.taumin;
1096  UTALines[i].Emis->TauCon = opac.taumin;
1097  UTALines[i].Emis->ColOvTot = 0.;
1098  /* outward optical depth */
1099  UTALines[i].Emis->TauTot = 1e20f;
1100  /* escape probability */
1101  UTALines[i].Emis->Pesc = 1.;
1102  /* inward part of line */
1103  UTALines[i].Emis->FracInwd = 1.;
1104  /* destruction probability */
1105  UTALines[i].Emis->Pdest = 0.;
1106  UTALines[i].Emis->Pelec_esc = 0.;
1107  /* line pumping rate */
1108  UTALines[i].Emis->pump = 0.;
1109  /* population of lower level */
1110  UTALines[i].Lo->Pop = 0.;
1111  /* population of upper level */
1112  UTALines[i].Hi->Pop = 0.;
1113  /* population of lower level with correction for stim emission */
1114  UTALines[i].Emis->PopOpc = 0.;
1115  /* following two heat exchange excitation, deexcitation */
1116  UTALines[i].Coll.cool = 0.;
1117  /* heat is the net heat per pump and was set when data read in
1118  * this is different from other lines with this structure
1119  UTALines[i].Coll.heat = 0.;*/
1120  /* intensity of line */
1121  UTALines[i].Emis->xIntensity = 0.;
1122  /* number of photons emitted in line */
1123  UTALines[i].Emis->phots = 0.;
1124  UTALines[i].Emis->ots = 0.;
1125  }
1126 
1127  for( i=0; i < nHFLines; i++ )
1128  {
1129  /* this information was read in in createdata */
1130  ASSERT( HFLines[i].Hi->nelem > 0 );
1131  ASSERT( HFLines[i].Hi->nelem <= (int)LIMELM );
1132 
1133  ASSERT( HFLines[i].Hi->IonStg > 0 );
1134  ASSERT( HFLines[i].Hi->IonStg <= (int)LIMELM );
1135 
1136  ASSERT( HFLines[i].Lo->g > 0. );
1137 
1138  ASSERT( HFLines[i].Hi->g > 0. );
1139 
1140  /* check that energy is positive*/
1141  ASSERT( HFLines[i].EnergyWN > 0 );
1142 
1143  /* HFLines[i].Emis->gf this is gf if positive, A if negative */
1144  /* test whether a or gf entered, convert A to gf */
1145  if( HFLines[i].Emis->gf < 0. )
1146  {
1147  /* convert A (=-gf) into real gf */
1148  HFLines[i].Emis->gf *= (realnum)(-HFLines[i].Hi->g/TRANS_PROB_CONST/POW2(HFLines[i].EnergyWN));
1149  }
1150 
1151  /*now put into standard format */
1152  HFLines[i].WLAng = 1.e8f/HFLines[i].EnergyWN;
1153  HFLines[i].Lo->Pop = 0.;
1154  HFLines[i].Hi->Pop = 0.;
1155  /* change from partial to complete redistribution */
1156  HFLines[i].Emis->iRedisFun = ipCRD;
1157 
1158  /* these are line optical depth arrays
1159  * inward optical depth */
1160  HFLines[i].Emis->TauIn = opac.taumin;
1161  HFLines[i].Emis->TauCon = opac.taumin;
1162  HFLines[i].Emis->ColOvTot=0;
1163  /* outward optical depth */
1164  HFLines[i].Emis->TauTot = 1e20f;
1165  /* escape probability */
1166  HFLines[i].Emis->Pesc = 1.;
1167  /* inward part of line */
1168  HFLines[i].Emis->FracInwd = 1.;
1169  /* destruction probability */
1170  HFLines[i].Emis->Pdest = 0.;
1171  HFLines[i].Emis->Pelec_esc = 0.;
1172  /* line pumping rate */
1173  HFLines[i].Emis->pump = 0.;
1174  /* population of lower level */
1175  HFLines[i].Lo->Pop = 0.;
1176  /* population of upper level */
1177  HFLines[i].Hi->Pop = 0.;
1178  /* population of lower level with correction for stim emission */
1179  HFLines[i].Emis->PopOpc = 0.;
1180  /* following two heat exchange excitation, deexcitation */
1181  HFLines[i].Coll.cool = 0.;
1182  HFLines[i].Coll.heat = 0.;
1183  /* intensity of line */
1184  HFLines[i].Emis->xIntensity = 0.;
1185  /* number of photons emitted in line */
1186  HFLines[i].Emis->phots = 0.;
1187  HFLines[i].Emis->ots = 0.;
1188  }
1189  return;
1190 }
1191 
1192 /* following used to save whether lines have been claimed by a pointer */
1193 static int *lev2set;
1194 
1195 /*generate pointer to level 1 line using wavelengtgh, ion, element */
1197  /* realnum ID wavelength, in angstroms */
1198  realnum wl ,
1199  /* state of ionization, 1 for neutral atom */
1200  long ion ,
1201  /* element number, 1 for H, 26 for Fe */
1202  long nelem)
1203 {
1204  long i;/* use for counter in for loop */
1205 
1206  DEBUG_ENTRY( "ipFindLevLine()" );
1207 
1208  ASSERT( wl > 0. );
1209  ASSERT( ion > 0 );
1210  ASSERT( ion <= LIMELM );
1211  ASSERT( nelem > 0 );
1212  ASSERT( nelem <= LIMELM );
1213 
1214  /* look for the line */
1215  for( i=1; i<= nLevel1; ++i )
1216  {
1217  if( TauLines[i].Hi->nelem == (int)nelem &&
1218  TauLines[i].Hi->IonStg == (int)ion &&
1219  fabs( TauLines[i].WLAng - wl) <0.1 )
1220  {
1221  /* remember that we have hit this line */
1222  lev2set[i] = true;
1223  /* and return pointer to the label*/
1224  return i;
1225  }
1226  }
1227  fprintf(ioQQQ,
1228  " ipFindLevLine could not find a line with following properties:\n"
1229  " wavelength=%f\n"
1230  " ion stage =%li\n"
1231  " atomic num=%li\n",
1232  wl , ion, nelem );
1233  return -1;
1234 }
1235 
1237 {
1238  long i;
1239 
1240  DEBUG_ENTRY( "initFindLevLine()" );
1241 
1242  /* generate the array of ints to store true and false */
1243  lev2set = (int*)MALLOC( (size_t)(nLevel1+1)*sizeof(int) );
1244 
1245  /* set them all false, saying that they have not been claimed by
1246  * one of the line pointers */
1247  for( i=1; i<=nLevel1; ++i )
1248  lev2set[i] = false;
1249  return;
1250 }
1251 
1253 {
1254  long i;
1255  bool lgAbort_loc=false;
1256 
1257  DEBUG_ENTRY( "endFindLevLine()" );
1258 
1259  /* set them all false, saying that they have not been claimed by
1260  * one of the line pointers */
1261  for( i=1; i<=nLevel1; ++i )
1262  {
1263  if( !lev2set[i] )
1264  {
1265  fprintf(ioQQQ,"PROBLEM endFindLevLine warning; line %li not claimed\n",i);
1266  fprintf(ioQQQ,
1267  " line had the following properties:\n"
1268  " wavelength=%f\n"
1269  " ion stage =%i\n"
1270  " atomic num=%i\n",
1271  TauLines[i].WLAng ,
1272  TauLines[i].Hi->IonStg ,
1273  TauLines[i].Hi->nelem );
1274  lgAbort_loc = true;
1275  }
1276  }
1277 
1278  /* generate the array of ints to store true and false */
1279  free(lev2set);
1280 
1281  if( lgAbort_loc )
1282  {
1283  fprintf(ioQQQ," problems found entering the data. I live in lines_setup.c\n");
1284  cdEXIT(EXIT_FAILURE);
1285  }
1286  return;
1287 }

Generated for cloudy by doxygen 1.8.4