cloudy
trunk
|
00001 /* This file is part of Cloudy and is copyright (C)1978-2008 by Gary J. Ferland and 00002 * others. For conditions of distribution and use see copyright notice in license.txt */ 00003 /*atom_pop3 solve 3-level atom without radiative transfer, returns pops of level 2 and 3 */ 00004 #include "cddefines.h" 00005 #include "phycon.h" 00006 #include "dense.h" 00007 #include "atoms.h" 00008 00009 /*atom_pop3 return value is population for 3-level atom, cm^-3 */ 00010 double atom_pop3( 00011 /* statictical weights of levels 1, 2, and 3 */ 00012 double g1, double g2, double g3, 00013 00014 /* collision strengths between three levels */ 00015 double o12, double o13, double o23, 00016 00017 /* transition probabilities between three levels */ 00018 double a21, double a31, double a32, 00019 00020 /* excitation energy in Kelvin */ 00021 double Tex12, double Tex23, 00022 00023 /* returned population of level 2, cm^-3 */ 00024 realnum *pop2, 00025 00026 /* incoming total abundance of ion */ 00027 double abund, 00028 00029 /* possible photodestruction of level 2, normally 0 */ 00030 double gam2, 00031 00032 /* excitation rates (s-1) due to "other" processes, 00033 * these are not included in the energy exchange */ 00034 double r12, 00035 double r13 ) 00036 { 00037 double alf, 00038 b12, 00039 b13, 00040 b23, 00041 bet, 00042 c21, 00043 c23, 00044 c31, 00045 c32, 00046 ex, 00047 fac, 00048 pop3_v; 00049 00050 DEBUG_ENTRY( "atom_pop3()" ); 00051 00052 /* computes level populations for 3 level atom, all col rad coupling 00053 * results are populations of levels 2 and 3, (cm^-3) no A included */ 00054 ex = Tex12/phycon.te; 00055 if( (abund <= 0.) || (ex > 20. && r12<SMALLFLOAT ) ) 00056 { 00057 pop3_v = 0.; 00058 *pop2 = 0.; 00059 return( pop3_v ); 00060 } 00061 00062 /* confirm that these are sane values */ 00063 ASSERT( g1>0. && g2>0. && g3>0. && o12>=0. && o13>=0. && o23>=0. && a21>=0. && a31>=0. && a32>=0. && 00064 Tex12>=0. && Tex23>=0. ); 00065 00066 b12 = exp(-ex); 00067 b23 = exp(-Tex23/phycon.te); 00068 00069 b13 = b12*b23; 00070 if( b13 == 0. && r12<SMALLFLOAT ) 00071 { 00072 pop3_v = 0.; 00073 *pop2 = 0.; 00074 return( pop3_v ); 00075 } 00076 00077 /* these rates have units s-1 */ 00078 atoms.c12 = dense.cdsqte*o12/g1*b12 + r12; 00079 atoms.c13 = dense.cdsqte*o13/g1*b13 + r13; 00080 c23 = dense.cdsqte*o23/g2*b23; 00081 c32 = dense.cdsqte*o23/g3; 00082 c31 = dense.cdsqte*o13/g3; 00083 c21 = dense.cdsqte*o12/g2; 00084 00085 alf = a21 + c21 + c23 + gam2; 00086 bet = a31 + a32 + c31 + c32; 00087 *pop2 = (realnum)((atoms.c13/bet + atoms.c12/(c32 + a32))/(alf/(c32 + a32) - c23/bet)); 00088 pop3_v = (atoms.c13 + *pop2*c23)/bet; 00089 00090 /* renorm to 1+pop2+atom_pop3=1 */ 00091 fac = abund/(1. + *pop2 + pop3_v); 00092 *pop2 *= (realnum)fac; 00093 pop3_v *= fac; 00094 00095 return( pop3_v ); 00096 }