cloudy  trunk
 All Data Structures Namespaces 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-2022 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 "lines.h"
7 #include "taulines.h"
8 #include "opacity.h"
9 #include "lines_service.h"
10 
11 void lines_setup(void)
12 {
13  static bool lgFirst = true;
14 
15  DEBUG_ENTRY( "lines_setup()" );
16 
17  /* only do this one time, and only if number of atom_level2 lines is positive */
18  if( lgFirst && nWindLine>0)
19  {
20  lgFirst = false;
21  /* these are the massive set of op lines, with g-bar approx cs
22  * confirm that input data are valid */
23 
24  for( long i=0; i < nWindLine; i++ )
25  {
26  /* this information was read in in createdata */
27  ASSERT( (*TauLine2[i].Hi()).nelem() > 0 );
28  ASSERT( (*TauLine2[i].Hi()).nelem() <= (int)LIMELM );
29 
30  ASSERT( (*TauLine2[i].Hi()).IonStg() > 0 );
31  ASSERT( (*TauLine2[i].Hi()).IonStg() <= (int)LIMELM );
32 
33  ASSERT( (*TauLine2[i].Lo()).g() >0. );
34 
35  ASSERT( (*TauLine2[i].Hi()).g() > 0. );
36 
37  /* check that energy is positive*/
38  ASSERT( TauLine2[i].EnergyWN() > 0 );
39 
40  /* TauLine2[i].Emis().gf() this is gf if positive, A if negative */
41  /* test whether a or gf entered, convert A to gf */
42  if( TauLine2[i].Emis().gf() < 0. )
43  {
44  /* convert A (=-gf) into real gf */
45  TauLine2[i].Emis().gf() *= (realnum)((-(*TauLine2[i].Hi()).g())/TRANS_PROB_CONST/POW2(TauLine2[i].EnergyWN()));
46  }
47 
48  /*now put into standard format */
49  TauLine2[i].WLAng() = 1.e8f/(TauLine2[i].EnergyWN() * RefIndex(TauLine2[i].EnergyWN()));
50  (*TauLine2[i].Lo()).Pop() = 0.;
51  (*TauLine2[i].Hi()).Pop() = 0.;
52  TauLine2[i].Emis().iRedisFun() = ipPRD;
53 
54  /* these are line optical depth arrays
55  * inward optical depth */
56  TauLine2[i].Emis().TauIn() = opac.taumin;
57  TauLine2[i].Emis().TauCon() = opac.taumin;
58  TauLine2[i].Emis().ColOvTot() = 0.;
59  /* outward optical depth */
60  TauLine2[i].Emis().TauTot() = 1e20f;
61  /* escape probability */
62  TauLine2[i].Emis().Pesc() = 1.;
63  /* inward part of line */
64  TauLine2[i].Emis().FracInwd() = 1.;
65  /* destruction probability */
66  TauLine2[i].Emis().Pdest() = 0.;
67  TauLine2[i].Emis().Pelec_esc() = 0.;
68  /* line pumping rate */
69  TauLine2[i].Emis().pump() = 0.;
70  /* population of lower level */
71  (*TauLine2[i].Lo()).Pop() = 0.;
72  /* population of upper level */
73  (*TauLine2[i].Hi()).Pop() = 0.;
74  /* population of lower level with correction for stim emission */
75  TauLine2[i].Emis().PopOpc() = 0.;
76  /* following two heat exchange excitation, deexcitation */
77  TauLine2[i].Coll().cool() = 0.;
78  TauLine2[i].Coll().heat() = 0.;
79  /* intensity of line */
80  TauLine2[i].Emis().xIntensity() = 0.;
81  TauLine2[i].Emis().xObsIntensity() = 0.;
82  /* ots rate */
83  TauLine2[i].Emis().ots() = 0.;
84  }
85  }
86 
87  for( size_t i=0; i < UTALines.size(); i++ )
88  {
89  /* this information was read in in createdata */
90  ASSERT( (*UTALines[i].Hi()).nelem() > 0 );
91  ASSERT( (*UTALines[i].Hi()).nelem() <= (int)LIMELM );
92 
93  ASSERT( (*UTALines[i].Hi()).IonStg() > 0 );
94  ASSERT( (*UTALines[i].Hi()).IonStg() <= (int)LIMELM );
95 
96  ASSERT( (*UTALines[i].Lo()).g() > 0. );
97 
98  ASSERT( (*UTALines[i].Hi()).g() > 0. );
99 
100  /* check that energy is positive*/
101  ASSERT( UTALines[i].EnergyWN() > 0 );
102 
103  (*UTALines[i].Lo()).Pop() = 0.;
104  (*UTALines[i].Hi()).Pop() = 0.;
105  UTALines[i].Emis().iRedisFun() = ipPRD;
106 
107  /* these are line optical depth arrays
108  * inward optical depth */
109  UTALines[i].Emis().TauIn() = opac.taumin;
110  UTALines[i].Emis().TauCon() = opac.taumin;
111  UTALines[i].Emis().ColOvTot() = 0.;
112  /* outward optical depth */
113  UTALines[i].Emis().TauTot() = 1e20f;
114  /* escape probability */
115  UTALines[i].Emis().Pesc() = 1.;
116  /* inward part of line */
117  UTALines[i].Emis().FracInwd() = 1.;
118  /* destruction probability */
119  UTALines[i].Emis().Pdest() = 0.;
120  UTALines[i].Emis().Pelec_esc() = 0.;
121  /* line pumping rate */
122  UTALines[i].Emis().pump() = 0.;
123  /* population of lower level */
124  (*UTALines[i].Lo()).Pop() = 0.;
125  /* population of upper level */
126  (*UTALines[i].Hi()).Pop() = 0.;
127  /* population of lower level with correction for stim emission */
128  UTALines[i].Emis().PopOpc() = 0.;
129  /* following two heat exchange excitation, deexcitation */
130  UTALines[i].Coll().cool() = 0.;
131  /* heat is the net heat per pump and was set when data read in
132  * this is different from other lines with this structure
133  UTALines[i].Coll().heat() = 0.;*/
134  /* intensity of line */
135  UTALines[i].Emis().xIntensity() = 0.;
136  UTALines[i].Emis().xObsIntensity() = 0.;
137  UTALines[i].Emis().ots() = 0.;
138  }
139 
140  for( size_t i=0; i < HFLines.size(); i++ )
141  {
142  /* this information was read in in createdata */
143  ASSERT( (*HFLines[i].Hi()).nelem() > 0 );
144  ASSERT( (*HFLines[i].Hi()).nelem() <= (int)LIMELM );
145 
146  ASSERT( (*HFLines[i].Hi()).IonStg() > 0 );
147  ASSERT( (*HFLines[i].Hi()).IonStg() <= (int)LIMELM );
148 
149  ASSERT( (*HFLines[i].Lo()).g() > 0. );
150 
151  ASSERT( (*HFLines[i].Hi()).g() > 0. );
152 
153  /* check that energy is positive*/
154  ASSERT( HFLines[i].EnergyWN() > 0 );
155  ASSERT( HFLines[i].Emis().Aul()>0 );
156  ASSERT( HFLines[i].Emis().damp()>0 );
157 
158  /* HFLines[i].Emis->gf() this is gf if positive, A if negative */
159  /* test whether a or gf entered, convert A to gf */
160  if( HFLines[i].Emis().gf() < 0. )
161  {
162  /* convert A (=-gf) into real gf */
163  HFLines[i].Emis().gf() *= (realnum)(-(*HFLines[i].Hi()).g()/TRANS_PROB_CONST/POW2(HFLines[i].EnergyWN()));
164  }
165 
166  /*now put into standard format */
167  HFLines[i].WLAng() = 1.e8f/HFLines[i].EnergyWN();
168  (*HFLines[i].Lo()).Pop() = 0.;
169  (*HFLines[i].Hi()).Pop() = 0.;
170  /* change from partial to complete redistribution */
171  HFLines[i].Emis().iRedisFun() = ipCRD;
172 
173  /* these are line optical depth arrays
174  * inward optical depth */
175  HFLines[i].Emis().TauIn() = opac.taumin;
176  HFLines[i].Emis().TauCon() = opac.taumin;
177  HFLines[i].Emis().ColOvTot()=0;
178  /* outward optical depth */
179  HFLines[i].Emis().TauTot() = 1e20f;
180  /* escape probability */
181  HFLines[i].Emis().Pesc() = 1.;
182  /* inward part of line */
183  HFLines[i].Emis().FracInwd() = 1.;
184  /* destruction probability */
185  HFLines[i].Emis().Pdest() = 0.;
186  HFLines[i].Emis().Pelec_esc() = 0.;
187  /* line pumping rate */
188  HFLines[i].Emis().pump() = 0.;
189  /* population of lower level */
190  (*HFLines[i].Lo()).Pop() = 0.;
191  /* population of upper level */
192  (*HFLines[i].Hi()).Pop() = 0.;
193  /* population of lower level with correction for stim emission */
194  HFLines[i].Emis().PopOpc() = 0.;
195  /* following two heat exchange excitation, deexcitation */
196  HFLines[i].Coll().cool() = 0.;
197  HFLines[i].Coll().heat() = 0.;
198  /* intensity of line */
199  HFLines[i].Emis().xIntensity() = 0.;
200  HFLines[i].Emis().xObsIntensity() = 0.;
201  HFLines[i].Emis().ots() = 0.;
202  }
203  return;
204 }
size_t size(void) const
Definition: transition.h:331
TransitionList UTALines("UTALines",&AnonStates)
t_opac opac
Definition: opacity.cpp:5
void lines_setup(void)
TransitionList HFLines("HFLines",&AnonStates)
double RefIndex(double EnergyWN)
TransitionList TauLine2("TauLine2",&AnonStates)
#define POW2
Definition: cddefines.h:979
const int ipCRD
Definition: cddefines.h:342
float realnum
Definition: cddefines.h:124
long nWindLine
Definition: cdinit.cpp:19
#define ASSERT(exp)
Definition: cddefines.h:613
const int LIMELM
Definition: cddefines.h:308
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:723
const int ipPRD
Definition: cddefines.h:340
realnum taumin
Definition: opacity.h:167
EmissionList & Emis()
Definition: transition.h:363