cloudy  trunk
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ion_oxyge.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 /*IonOxyge derive ionization balance for oxygen */
4 #include "cddefines.h"
5 #include "opacity.h"
6 #include "oxy.h"
7 #include "thermal.h"
8 #include "dense.h"
9 #include "iso.h"
10 #include "trace.h"
11 #include "rfield.h"
12 #include "atmdat.h"
13 #include "atoms.h"
14 #include "gammas.h"
15 #include "ionbal.h"
16 
17 void IonOxyge(void)
18 {
19  const int NDIM = ipOXYGEN+1;
20 
21  static const double dicoef[2][NDIM] = {
22  {1.11e-3,5.07e-3,1.48e-2,1.84e-2,4.13e-3,1.06e-1,6.23e-2,0.},
23  {.0925,.181,.305,.1,.162,.34,.304,0.}
24  };
25  static const double dite[2][NDIM] = {
26  {1.75e5,1.98e5,2.41e5,2.12e5,1.25e5,6.25e6,7.01e6,0.},
27  {1.45e5,3.35e5,2.83e5,2.83e5,2.27e5,1.12e6,1.47e6,0.}
28  };
29  static const double ditcrt[NDIM] = {2.7e4,2.2e4,2.4e4,2.5e4,1.6e4,1.0e6,1.5e6,1e20};
30  static const double aa[NDIM] = {0.,-0.0036,0.,0.0061,-2.8425,0.,0.,0.};
31  static const double bb[NDIM] = {0.0238,0.7519,21.8790,0.2269,0.2283,0.,0.,0.};
32  static const double cc[NDIM] = {0.0659,1.5252,16.2730,32.1419,40.4072,0.,0.,0.};
33  static const double dd[NDIM] = {0.0349,-0.0838,-0.7020,1.9939,-3.4956,0.,0.,0.};
34  static const double ff[NDIM] = {0.5334,0.2769,1.1899,-0.0646,1.7558,0.,0.,0.};
35 
36  bool lgDebug = false;
37  long int iup;
38  double aeff, save_rec;
39 
40  DEBUG_ENTRY( "IonOxyge()" );
41 
42  /* oxygen, atomic number 8 */
43  if( !dense.lgElmtOn[ipOXYGEN] )
44  {
45  oxy.poiii2Max = 0.;
46  oxy.poiii3Max = 0.;
47  oxy.r4363Max = 0.;
48  oxy.r5007Max = 0.;
49  oxy.poiii2 = 0.;
50  oxy.p1666 = 0.;
51  oxy.AugerO3 = 0.;
52  oxy.p1401 = 0.;
53  oxy.s3727 = 0.;
54  oxy.s7325 = 0.;
55  thermal.heating[7][9] = 0.;
56  oxy.poimax = 0.;
57  return;
58  }
59 
61 
62  ion_photo(ipOXYGEN,false);
63 
64  /* find collisional ionization rates */
66 
67  /* get recombination coefficients */
68  /*lint -e64 type mismatch */
69  ion_recomb(false,(const double*)dicoef,(const double*)dite,ditcrt,aa,bb,cc,dd,ff,ipOXYGEN);
70  /*lint +e64 type mismatch */
71 
72  /* photoexcitation of O III 1666 and O IV 1401 */
76 
78 
79  /* photoionization from O++ 1D
80  *
81  * estimate gamma function by assuming no frequency dependence
82  * betwen 1D and O++3P edge */
83  /* destroy upper level of OIII 5007*/
85  opac.ipo3exc[2] , 1. ));
86 
87  /* destroy upper level of OIII 4363*/
89  opac.ipo3exc3[2] , 1. ));
90 
91  /* destroy upper level of OI 6300*/
93  opac.ipo1exc[2] , 1. ));
94 
95  /* A21 = 0.0263 */
96  aeff = 0.0263 + oxy.d5007r;
97 
98  /* 1. as last arg makes this the relative population */
99  oxy.poiii2 = (realnum)(atom_pop2(2.5,9.,5.,aeff,2.88e4,1.)/aeff);
100  {
101  /*@-redef@*/
102  enum {DEBUG_LOC=false};
103  /*@+redef@*/
104  if( DEBUG_LOC )
105  {
106  fprintf(ioQQQ,"pop rel %.1e rate %.1e grnd rate %.1e\n",
108  }
109  }
110 
111  /* photoionization from excited states */
112  if( nzone > 0 )
113  {
114  /* neutral oxygen destruction */
116  (1. - oxy.poiexc) + oxy.d6300*oxy.poiexc;
117 
118  /* doubly ionized oxygen destruction */
120  (1. - oxy.poiii2 - oxy.poiii3) + oxy.d5007r*oxy.poiii2 +
122 
123  if( ionbal.PhotoRate_Shell[ipOXYGEN][2][2][0] > 1e-30 && dense.IonLow[ipOXYGEN] <= 2 )
124  {
126  ionbal.PhotoRate_Shell[ipOXYGEN][2][2][0] > (oxy.r4363Max +
127  oxy.r5007Max) )
128  {
131  }
134  }
135 
136  /* ct into excited states */
137  if( dense.IonLow[ipOXYGEN] <= 0 && (ionbal.PhotoRate_Shell[ipOXYGEN][0][2][0] +
139  {
141  (ionbal.PhotoRate_Shell[ipOXYGEN][0][2][0]+
142  atmdat.HCharExcIonOf[ipOXYGEN][0]* dense.xIonDense[ipHYDROGEN][1])));
143  }
144  }
145  else
146  {
147  oxy.poiii2Max = 0.;
148  oxy.poiii3Max = 0.;
149  oxy.r4363Max = 0.;
150  oxy.r5007Max = 0.;
151  oxy.poimax = 0.;
152  }
153 
154  /* save atomic oxygen photodistruction rate for 3727 creation */
155  if( dense.IonLow[ipOXYGEN] == 0 && oxy.i2d < rfield.nflux )
156  {
157  oxy.s3727 = (realnum)(GammaK(oxy.i2d,oxy.i2p,opac.iopo2d , 1. ));
158 
160  oxy.s7325 = (realnum)(GammaK(oxy.i2d,iup,opac.iopo2d , 1. ));
161 
162  oxy.s7325 -= oxy.s3727;
163  oxy.s3727 = oxy.s3727 + oxy.s7325;
164 
165  /* ratio of cross sections */
166  oxy.s7325 *= 0.66f;
167  }
168  else
169  {
170  oxy.s3727 = 0.;
171  oxy.s7325 = 0.;
172  }
173 
175 
176  /* >>chng 03 sep 29, synch up ion and co solvers.
177  * the co solver will have a different O/O+ balance that
178  * is strongly affected by the chemistry if we are in neutral gas
179  * (hence the test that the highest stage of ionization is <=2 on
180  * physics scale)
181  * in this case use co solver's O/O+ balance */
182  save_rec = ionbal.RateRecomTot[ipOXYGEN][0];
183  /*>>chng 04 apr 27, do not test for ionhigh being 1,
184  * no reason for test on upper stage of ionization,
185  * if codrive called but not evaluted then hevmol is all zero */
186  /* >>chng 04 sep 10, rm check on search phase, no reason for it */
187 # if 0
188  if( dense.IonLow[ipOXYGEN]==0 &&
189  co.hevmol[ipOP] > SMALLFLOAT &&
190  ionbal.RateIonizTot[ipOXYGEN][0]*co.hevmol[ipATO]>0. )
191  {
194  co.hevmol[ipATO]/co.hevmol[ipOP];
195  }
196 
197 # endif
198 
199  /* solve for ionization balance */
200  if(0 && nzone > 100 )
201  lgDebug = true;
202  else
203  lgDebug = false;
204  ion_solver(ipOXYGEN,lgDebug);
205  if( lgDebug )
206  fprintf(ioQQQ,"DEBUG O\t%.3e\t%.3e\tH\t%.3e\t%.3e\n",
211 
212  /* reset the var we just hosed */
213  if( save_rec > 0. )
214  ionbal.RateRecomTot[ipOXYGEN][0] = save_rec;
215 
216  /* 1666 ratio corrected for phot crs at 50ev */
217  oxy.p1666 *= dense.xIonDense[ipOXYGEN][1]*0.3;
218  oxy.p1401 *= dense.xIonDense[ipOXYGEN][2]*0.43;
222 
223  if( trace.lgTrace )
224  {
225  fprintf( ioQQQ, " IonOxyge returns; frac=" );
226  for( int i=1; i <= 9; i++ )
227  {
228  fprintf( ioQQQ, " %10.3e", dense.xIonDense[ipOXYGEN][i-1]/
230  }
231  fprintf( ioQQQ, "\n" );
232  }
233  return;
234 }

Generated for cloudy by doxygen 1.8.4