cloudy  trunk
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
rt_tau_inc.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 /*RT_tau_inc increment optical depths once per zone, called after radius_increment */
4 #include "cddefines.h"
5 #include "taulines.h"
6 #include "iso.h"
7 #include "rfield.h"
8 #include "trace.h"
9 #include "dense.h"
10 #include "hyperfine.h"
11 #include "wind.h"
12 #include "prt.h"
13 #include "h2.h"
14 #include "hmi.h"
15 #include "opacity.h"
16 #include "radius.h"
17 #include "atomfeii.h"
18 #include "rt.h"
19 
20 /*RT_tau_inc increment optical depths once per zone, called after radius_increment */
21 void RT_tau_inc(void)
22 {
23 
24  long int i,
25  ipHi,
26  nelem,
27  ipLo,
28  ipISO;
29 
30  double factor;
31 
32  DEBUG_ENTRY( "RT_tau_inc()" );
33 
34  if( trace.lgTrace )
35  {
36  fprintf( ioQQQ, " RT_tau_inc called.\n" );
37  }
38 
39  /* call RT_line_all one last time in this zone, to get fine opacities defined */
40  RT_line_all( false , true);
41 
44  (1. - rfield.ContBoltz[hmi.iphmin-1]/ hmi.hmidep));
45 
46  /* prevent maser runaway */
47  rt.dTauMase = 0;
48  rt.mas_species = 0;
49  rt.mas_ion = 0;
50  rt.mas_hi = 0;
51  rt.mas_lo = 0;
52 
53  /* all lines in iso sequences */
54  for( ipISO=ipH_LIKE; ipISO<NISO; ++ipISO )
55  {
56  for( nelem=ipISO; nelem < LIMELM; nelem++ )
57  {
58  /* this is the parent ion, for HI lines, is 1,
59  * for element He is 1 for He-like (HeI) and 2 for H-like (HeII) */
60  int ion = nelem+1-ipISO;
61  /* do not evaluate in case where trivial parent ion */
62  if( ion <=dense.IonHigh[nelem] && dense.xIonDense[nelem][ion] > dense.density_low_limit )
63  {
64  factor = dense.xIonDense[nelem][ion];
65  for( ipHi=1; ipHi < iso.numLevels_local[ipISO][nelem]; ipHi++ )
66  {
67  if( iso.lgDielRecom[ipISO] )
68  RT_line_one_tauinc(&SatelliteLines[ipISO][nelem][ipHi],
69  ipISO , nelem , -1 , ipHi );
70 
71  for( ipLo=0; ipLo < ipHi; ipLo++ )
72  {
73  /* must temporarily make ipLnPopOpc physical */
74  double save;
75 
76  if( Transitions[ipISO][nelem][ipHi][ipLo].ipCont <= 0 )
77  continue;
78 
79  save = Transitions[ipISO][nelem][ipHi][ipLo].Emis->PopOpc;
80  Transitions[ipISO][nelem][ipHi][ipLo].Emis->PopOpc *= factor;
81  /* actually do the work */
82  RT_line_one_tauinc(&Transitions[ipISO][nelem][ipHi][ipLo] ,
83  ipISO , nelem , ipHi , ipLo );
84  /* go back to original units so that final correction ok */
85  Transitions[ipISO][nelem][ipHi][ipLo].Emis->PopOpc = save;
86  }
87  }
88  ipLo = 0;
89  /* these are the extra Lyman lines */
90  for( ipHi=StatesElem[ipISO][nelem][iso.numLevels_max[ipISO][nelem]-1].n; ipHi < iso.nLyman[ipISO]; ipHi++ )
91  {
92  /* must make ipLnPopOpc physical */
93  ExtraLymanLines[ipISO][nelem][ipHi].Emis->PopOpc =
94  StatesElem[ipISO][nelem][0].Pop * factor;
95 
96  /* actually do the work */
97  RT_line_one_tauinc(&ExtraLymanLines[ipISO][nelem][ipHi] ,
98  -1 ,ipISO , nelem , ipHi );
99 
100  /* reset to population of ground state */
101  ExtraLymanLines[ipISO][nelem][ipHi].Emis->PopOpc =
102  StatesElem[ipISO][nelem][0].Pop;
103  }
104  }
105  }
106  }
107 
108  /* increment optical depths for all heavy element lines
109  * same routine does wind and static,
110  * does not start from 0 since first line is dummy */
111  for( i=1; i <= nLevel1; i++ )
112  {
114  -2 , -2 , -2 , i );
115  }
116 
117  /* all lines in cooling with g-bar */
118  for( i=0; i < nWindLine; i++ )
119  {
120  /* do not include H-like or He-like in the level two lines since
121  * these are already counted in iso sequences */
122  if( TauLine2[i].Hi->IonStg < TauLine2[i].Hi->nelem+1-NISO )
123  {
125  -3 , -3 , -3 , i );
126  }
127  }
128 
129  /* the block of inner shell lines */
130  for( i=0; i < nUTA; i++ )
131  {
132  if( UTALines[i].Emis->Aul > 0. )
133  {
134  /* populations have not been set */
136  UTALines[i].Lo->Pop = dense.xIonDense[UTALines[i].Hi->nelem-1][UTALines[i].Hi->IonStg-1];
137  UTALines[i].Hi->Pop = 0.;
138  RT_line_one_tauinc(&UTALines[i], -4 , -4 , -4 , i );
139  }
140  }
141 
142  /* all hyper fine structure lines */
143  for( i=0; i < nHFLines; i++ )
144  {
145  /* remember current gas-phase abundances */
146  realnum save = dense.xIonDense[HFLines[i].Hi->nelem-1][HFLines[i].Hi->IonStg-1];
147 
148  /* bail if no abundance */
149  if( save<=0. ) continue;
150 
151  /* set gas-phase abundance to total times isotope ratio */
152  dense.xIonDense[HFLines[i].Hi->nelem-1][HFLines[i].Hi->IonStg-1] *= hyperfine.HFLabundance[i];
153 
154  RT_line_one_tauinc(&HFLines[i] , -5 , -5 , -5 , i );
155 
156  /* put the correct gas-phase abundance back in the array */
157  dense.xIonDense[HFLines[i].Hi->nelem-1][HFLines[i].Hi->IonStg-1] = save;
158  }
159 
160  /* carbon monoxide CO lines */
161  for( i=0; i < nCORotate; i++ )
162  {
164  -6 , -6 , -6 , i );
166  -7 , -7 , -7 , i );
167  }
168 
169  /* do large FeII atom if this is enabled */
170  FeII_RT_TauInc();
171 
172  /* increment optical depth for the H2 molecule */
173  H2_RT_tau_inc();
174 
175  /* database Lines*/
176  for(i=0; i < linesAdded2; i++)
177  {
179  -10 , -10 , -10 , i );
180  }
181 
182  /* following is for static atmosphere */
183  if( wind.windv == 0. )
184  {
185  /* iron fe feii fe2 - overlapping feii lines */
187  }
188 
189  if( trace.lgTrace && trace.lgOptcBug )
190  {
191  fprintf( ioQQQ, " RT_tau_inc updated optical depths:\n" );
192  prtmet();
193  }
194 
195  if( trace.lgTrace )
196  fprintf( ioQQQ, " RT_tau_inc returns.\n" );
197 
198  return;
199 }

Generated for cloudy by doxygen 1.8.4