cloudy  trunk
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
atom_pop3.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 /*atom_pop3 solve 3-level atom without radiative transfer, returns pops of level 2 and 3 */
4 #include "cddefines.h"
5 #include "phycon.h"
6 #include "dense.h"
7 #include "atoms.h"
8 
9 /*atom_pop3 return value is population for 3-level atom, cm^-3 */
10 double atom_pop3(
11  /* statictical weights of levels 1, 2, and 3 */
12  double g1, double g2, double g3,
13 
14  /* collision strengths between three levels */
15  double o12, double o13, double o23,
16 
17  /* transition probabilities between three levels */
18  double a21, double a31, double a32,
19 
20  /* excitation energy in Kelvin */
21  double Tex12, double Tex23,
22 
23  /* returned population of level 2, cm^-3 */
24  realnum *pop2,
25 
26  /* incoming total abundance of ion */
27  double abund,
28 
29  /* possible photodestruction of level 2, normally 0 */
30  double gam2,
31 
32  /* excitation rates (s-1) due to "other" processes,
33  * these are not included in the energy exchange */
34  double r12,
35  double r13 )
36 {
37  double alf,
38  b12,
39  b13,
40  b23,
41  bet,
42  c21,
43  c23,
44  c31,
45  c32,
46  ex,
47  fac,
48  pop3_v;
49 
50  DEBUG_ENTRY( "atom_pop3()" );
51 
52  /* computes level populations for 3 level atom, all col rad coupling
53  * results are populations of levels 2 and 3, (cm^-3) no A included */
54  ex = Tex12/phycon.te;
55  if( (abund <= 0.) || (ex > 20. && r12<SMALLFLOAT ) )
56  {
57  pop3_v = 0.;
58  *pop2 = 0.;
59  return( pop3_v );
60  }
61 
62  /* confirm that these are sane values */
63  ASSERT( g1>0. && g2>0. && g3>0. && o12>=0. && o13>=0. && o23>=0. && a21>=0. && a31>=0. && a32>=0. &&
64  Tex12>=0. && Tex23>=0. );
65 
66  b12 = exp(-ex);
67  b23 = exp(-Tex23/phycon.te);
68 
69  b13 = b12*b23;
70  if( b13 == 0. && r12<SMALLFLOAT )
71  {
72  pop3_v = 0.;
73  *pop2 = 0.;
74  return( pop3_v );
75  }
76 
77  /* these rates have units s-1 */
78  atoms.c12 = dense.cdsqte*o12/g1*b12 + r12;
79  atoms.c13 = dense.cdsqte*o13/g1*b13 + r13;
80  c23 = dense.cdsqte*o23/g2*b23;
81  c32 = dense.cdsqte*o23/g3;
82  c31 = dense.cdsqte*o13/g3;
83  c21 = dense.cdsqte*o12/g2;
84 
85  alf = a21 + c21 + c23 + gam2;
86  bet = a31 + a32 + c31 + c32;
87  *pop2 = (realnum)((atoms.c13/bet + atoms.c12/(c32 + a32))/(alf/(c32 + a32) - c23/bet));
88  pop3_v = (atoms.c13 + *pop2*c23)/bet;
89 
90  /* renorm to 1+pop2+atom_pop3=1 */
91  fac = abund/(1. + *pop2 + pop3_v);
92  *pop2 *= (realnum)fac;
93  pop3_v *= fac;
94 
95  return( pop3_v );
96 }

Generated for cloudy by doxygen 1.8.4