cloudy  trunk
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ion_nitro.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 /*IonNitro ionization balance for nitrogen */
4 #include "cddefines.h"
5 #include "dense.h"
6 #include "thermal.h"
7 #include "atoms.h"
8 #include "opacity.h"
9 #include "trace.h"
10 #include "conv.h"
11 #include "gammas.h"
12 #include "ionbal.h"
13 
14 void IonNitro(void)
15 {
16  const int NDIM = ipNITROGEN+1;
17 
18  static const double dicoef[2][NDIM] = {
19  {2.98e-3,7.41e-3,1.13e-2,2.62e-3,7.5e-2,4.61e-2,0.},
20  {0.,.0764,.164,.243,.35,.309,0.}
21  };
22  static const double dite[2][NDIM] = {
23  {2.2e5,2.01e5,1.72e5,1.02e5,4.75e6,5.44e6,0.},
24  {0.,7.37e4,2.25e5,1.25e5,8.35e5,1.14e6,0.}
25  };
26  static const double ditcrt[NDIM] = {1.8e4,1.8e4,2.4e4,1.5e4,6.8e5,1.0e6,1e20};
27  static const double aa[NDIM] = {0.0,0.0320,-0.8806,0.4134,0.,0.,0.};
28  static const double bb[NDIM] = {0.6310,-0.6624,11.2406,-4.6319,0.,0.,0.};
29  static const double cc[NDIM] = {0.1990,4.3191,30.7066,25.9172,0.,0.,0.};
30  static const double dd[NDIM] = {-0.0197,0.0003,-1.1721,-2.2290,0.,0.,0.};
31  static const double ff[NDIM] = {0.4398,0.5946,0.6127,0.2360,0.1,0.,0.};
32 
33  bool lgDebug;
34  double save_rec;
35 
36  DEBUG_ENTRY( "IonNitro()" );
37 
38  /* nitrogen, atomic number 7 */
39  if( !dense.lgElmtOn[ipNITROGEN] )
40  {
41  return;
42  }
43 
45 
46  ion_photo(ipNITROGEN,false);
47 
48  /* find collisional ionization rates */
50 
51  /* get recombination coefficients */
52  /*lint -e64 type mismatch */
53  ion_recomb(false,(const double*)dicoef,(const double*)dite,ditcrt,aa,bb,cc,dd,ff,ipNITROGEN);
54  /*lint +e64 type mismatch */
55 
56  /* >>chng 04 jul 09, synch up ion and co solvers.
57  * the co solver will have a different N/N+ balance that
58  * is strongly affected by the chemistry if we are in neutral gas
59  * in this case use co solver's N/N+ balance */
60  save_rec = ionbal.RateRecomTot[ipNITROGEN][0];
61  /*>>chng 04 apr 24, do not test for ionhigh being 1,
62  * no reason for test on upper stage of ionization,
63  * if codrive called but not evaluated then hevmol is all zero */
64  /* >>chng 04 sep 10, rm check on search phase, no reason for it */
65 # if 0
66  if( dense.IonLow[ipNITROGEN]==0 &&
67  co.hevmol[ipNP] > SMALLFLOAT &&
68  ionbal.RateIonizTot[ipNITROGEN][0]*co.hevmol[ipATN]> 0. )
69  {
72  co.hevmol[ipATN]/co.hevmol[ipNP];
73  }
74 # endif
75 
76  /* photoionization from 2D of NI, is atomic nitrogen present? */
77  if( dense.xIonDense[ipNITROGEN][0] > 0. )
78  {
79  atoms.d5200r = (realnum)GammaK(opac.in1[0],opac.in1[1],opac.in1[2],1.);
80  /*aeff = atoms.d5200r + 1.28e-5;*/
81  /* >>chng 01 sep 02, use values from coolnitr */
82  /*cs5200 = 1.32e-4*phycon.te/(phycon.te10*phycon.te01);*/
83  /* uses 1 for total pop of atom - so is normalized to unity */
84  /*atoms.p2nit = (realnum)(atom_pop2(cs5200,4.,10.,aeff,2.769e4,1.)/aeff);*/
85  /* if very first call then set to zero */
86  if( !conv.nTotalIoniz )
87  atoms.p2nit = 0.;
88  /* valence shell photoionization, [0][6] => atomic nitrogen */
90  (1. - atoms.p2nit) + atoms.p2nit*atoms.d5200r;
93  }
94  else
95  {
96  atoms.p2nit = 0.;
97  atoms.d5200r = 0.;
98  }
99 
100  /* solve for ionization balance */
101 # if 0
102  broken();/* rm following true */
103  if(nzone == 1 )
104  lgDebug = true;
105  else
106  lgDebug = false;
107 # endif
108  lgDebug = false;
109  ion_solver(ipNITROGEN,lgDebug);
110 
111  /* reset the var we just hosed */
112  if( save_rec > 0.)
113  ionbal.RateRecomTot[ipNITROGEN][0] = save_rec;
114 
115  if( trace.lgTrace && trace.lgHeavyBug )
116  {
117  fprintf( ioQQQ, " IonNitro retun; frac=" );
118  for( int i=0; i < 8; i++ )
119  {
120  fprintf( ioQQQ, "%10.3e", dense.xIonDense[ipNITROGEN][i]/
122  }
123  fprintf( ioQQQ, "\n" );
124  }
125  return;
126 }

Generated for cloudy by doxygen 1.8.1.1