cloudy  trunk
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ion_sulph.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 /*IonSulph compute ionization balance for sulphur */
4 #include "cddefines.h"
5 #include "dense.h"
6 #include "ionbal.h"
7 
8 void IonSulph(void)
9 {
10  const int NDIM = ipSULPHUR+1;
11 
12  static const double dicoef[2][NDIM] = {
13  {1.62e-3,1.09e-2,3.35e-2,3.14e-2,1.27e-2,1.47e-2,1.34e-2,
14  2.38e-2,3.19e-2,7.13e-2,.08,.0796,.0134,.402,.241,0.},
15  {0.,1.20e-2,6.59e-2,6.89e-2,.187,.129,1.04,1.12,1.40,1.00,
16  .555,1.63,.304,.298,.281,0.}
17  };
18  static const double dite[2][NDIM] = {
19  {1.25e5,1.92e5,1.89e5,1.68e5,1.38e5,1.80e6,6.90e5,5.84e5,
20  5.17e5,6.66e5,6.00e5,5.09e5,2.91e5,2.41e7,2.54e7,0.},
21  {0.,1.80e4,1.59e5,8.04e4,1.71e5,1.75e6,2.15e6,2.59e6,2.91e6,
22  2.32e6,2.41e6,6.37e6,1.04e6,4.67e6,5.30e6,0.}
23  };
24  static const double aa[NDIM] = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,
25  0.,0.,0.,0.};
26  static const double bb[NDIM] = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,
27  0.,0.,0.,0.};
28  static const double cc[NDIM] = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,
29  0.,0.,0.,0.};
30  static const double dd[NDIM] = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,
31  0.,0.,0.,0.};
32  static const double ff[NDIM] = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,
33  0.,0.,0.,0.};
34  static const double ditcrt[NDIM] = {2.2e4,1.2e4,1.4e4,1.5e4,1.4e4,2.9e5,
35  1.3e5,1.1e5,9.0e4,9.0e4,9.0e4,8.3e4,6.0e4,5.0e6,9.0e6,1e20};
36 
37  bool lgPrtDebug=false;
38  double save_rec;
39 
40  DEBUG_ENTRY( "IonSulph()" );
41 
42  /* sulphur, atomic number 16 */
43  if( !dense.lgElmtOn[ipSULPHUR] )
44  {
45  return;
46  }
47 
49 
50  ion_photo(ipSULPHUR,lgPrtDebug);
51 
52  /* find collisional ionization rates */
54 
55  /* get recombination coefficients */
56  /*lint -e64 type mismatch */
57  ion_recomb(false,(const double*)dicoef,(const double*)dite,ditcrt,aa,bb,cc,dd,ff,ipSULPHUR);
58  /*lint +e64 type mismatch */
59 
60  /* >>chng 03 sep 29, synch up ion and co solvers.
61  * the co solver will have a different S/S+ balance that
62  * is strongly affected by the chemistry if we are in neutral gas
63  * (hence the test that the highest stage of ionization is <=2 on
64  * physics scale)
65  * in this case use co solver's S/S+ balance */
66  save_rec = ionbal.RateRecomTot[ipSULPHUR][0];
67  /*>>chng 04 apr 27, do not test for ionhigh being 1,
68  * no reason for test on upper stage of ionization,
69  * if codrive called but not evaluted then hevmol is all zero */
70  /* >>chng 04 sep 10, rm check on search phase, no reason for it */
71 # if 0
72  if( dense.IonLow[ipSULPHUR]==0 &&
73  co.hevmol[ipSP] > SMALLFLOAT &&
74  ionbal.RateIonizTot[ipSULPHUR][0]*co.hevmol[ipATS]> 0. )
75  {
78  co.hevmol[ipATS]/co.hevmol[ipSP];
79  }
80 # endif
81 
82  /* solve for ionization balance */
83  /*if( nzone>700 ) lgPrtDebug = true;*/
84  ion_solver(ipSULPHUR,lgPrtDebug);
85 
86  /* reset the var we just hosed */
87  /* if ion just trimed down, old rec may be zero, must not use it*/
88  if( save_rec > 0. )
89  ionbal.RateRecomTot[ipSULPHUR][0] = save_rec;
90  return;
91 }

Generated for cloudy by doxygen 1.8.1.1