cloudy  trunk
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ion_magne.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 /*IonMagne ionization balance for magnesium */
4 #include "cddefines.h"
5 #include "atoms.h"
6 #include "trace.h"
7 #include "iso.h"
8 #include "dense.h"
9 #include "mole.h"
10 #include "opacity.h"
11 #include "gammas.h"
12 #include "ionbal.h"
13 
14 void IonMagne(void)
15 {
16  const int NDIM = ipMAGNESIUM+1;
17 
18  static const double dicoef[2][NDIM] = {
19  {4.49e-4,1.95e-3,5.12e-3,7.74e-3,1.17e-2,3.69e-2,3.63e-2,4.15e-2,8.86e-3,.252,.144,0.},
20  {.021,.074,.323,.636,.807,.351,.548,.233,.318,.315,.291,0.}
21  };
22  static const double dite[2][NDIM] = {
23  {5.01e4,6.06e5,4.69e5,3.74e5,3.28e5,4.80e5,3.88e5,3.39e5,2.11e5,1.40e7,1.50e7,0.},
24  {2.81e4,1.44e6,7.55e5,7.88e5,1.02e6,9.73e5,7.38e5,3.82e5,1.54e6,2.64e6,3.09e6,0.}
25  };
26  static const double ditcrt[NDIM] = {4.0e3,7.4e4,6.6e4,5.5e4,4.4e4,4.5e4,
27  4.5e4,5.0e5,3.4e4,2.4e6,4.0e6,1e20};
28  static const double aa[NDIM] = {1.2044,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
29  static const double bb[NDIM] = {-4.6836,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
30  static const double cc[NDIM] = {7.6620,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
31  static const double dd[NDIM] = {-0.5930,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
32  static const double ff[NDIM] = {1.6260,0.1,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
33 
34  realnum rmg2l;
35 
36  DEBUG_ENTRY( "IonMagne()" );
37 
38  /* magnesium nelem=12
39  *
40  * rates from Shull and van Steenberg, Ap.J. Sup 48, 95. */
41 
42  /* rec from +9, +10, +11 from Arnauld et al '85 */
43  /* Pequignot and Aldrovandi Ast Ap 161, 169. */
44 
45  /* mg i from nuss+storey, who say that =>Mgii is very small */
46 
47  if( !dense.lgElmtOn[ipMAGNESIUM] )
48  {
49  atoms.xMg2Max = 0.;
50  return;
51  }
52 
54 
55  ion_photo(ipMAGNESIUM,false);
56  /* debugging printout for shell photo rates - 0 for atom, last true, also print details */
57  /*GammaPrtRate( ioQQQ , 0 , ipMAGNESIUM , true );*/
58 
59  /* find collisional ionization rates */
61 
62  /* get recombination coefficients */
63  ion_recomb(false,(const double*)dicoef,(const double*)dite,ditcrt,aa,bb,cc,dd,ff,ipMAGNESIUM);
64 
65  /* is the atom present*/
66  if( dense.IonLow[ipMAGNESIUM] <= 0 )
67  {
68  /* can only do this one time
69  * photoionization from excited upper state of 2798 */
71  ionbal.PhotoRate_Shell[ipMAGNESIUM][1][3][0] += rmg2l*atoms.popmg2;
72 
73  /* >>chng 06 Feb 28 -- NPA. Add in charge transfer ionization of Fe with S+, Si+, and C+ */
74  /* only include this if molecular network is enabled - otherwise no feedback onto
75  * Si+, S+, and C+ soln */
76  if( !co.lgNoCOMole )
77  {
78  /* Use sink rate from last completed state of network, including _all_ present & future Mg sinks */
79  ionbal.PhotoRate_Shell[ipMAGNESIUM][0][3][0] +=
80  CO_findrk("S+,Mg=>S,Mg+")*dense.xIonDense[ipSULPHUR][1] +
81  CO_findrk("Si+,Mg=>Si,Mg+")*dense.xIonDense[ipSILICON][1] +
82  CO_findrk("C+,Mg=>C,Mg+")*dense.xIonDense[ipCARBON][1];
83  /* CO_sink_rate("Mg"); */
84  }
85 
86  if( nzone <= 1 )
87  {
88  atoms.xMg2Max = 0.;
89  }
90  else if( ionbal.PhotoRate_Shell[ipMAGNESIUM][1][3][0] > 1e-30 )
91  {
92  /* remember max rel photo rate */
95  }
96  }
97  else
98  {
99  atoms.xMg2Max = 0.;
100  }
101 
102  /* solve for ionization balance */
103  ion_solver(ipMAGNESIUM,false);
104 
105  if( trace.lgTrace && trace.lgHeavyBug )
106  {
107  fprintf( ioQQQ, " IonMagne returns; frac=" );
108  for( int i=0; i < 10; i++ )
109  {
110  fprintf( ioQQQ, "%10.3e", dense.xIonDense[ipMAGNESIUM][i]/
112  }
113  fprintf( ioQQQ, "\n" );
114  }
115  return;
116 }

Generated for cloudy by doxygen 1.8.1.1