cloudy  trunk
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
hydroeinsta.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 /*HydroEinstA calculates Einstein A's from osillator strengths*/
4 #include "cddefines.h"
5 #include "hydro_bauman.h"
6 #include "hydrooscilstr.h"
7 #include "hydroeinsta.h"
8 #include "iso.h"
9 #include "physconst.h"
10 #include "taulines.h"
11 
12 double HydroEinstA(long int n1,
13  long int n2)
14 {
15  long int lower, iupper;
16  double EinstA_v,
17  ryd,
18  xl,
19  xmicron,
20  xu;
21 
22  DEBUG_ENTRY( "HydroEinstA()" );
23  /* (lower,upper) of Johnson 1972. */
24 
25  /* strictly n -> n' transition probabilities
26  * no attempt to distribute according to l,l' */
27 
28  /* sort out the order of upper and lower, so can be called either way */
29  lower = MIN2( n1 , n2 );
30  iupper = MAX2( n1, n2 );
31  if( lower < 1 || lower == iupper )
32  {
33  fprintf(ioQQQ," HydroEinstA called with impossible ns, =%li %li\n", lower, iupper);
34  cdEXIT(EXIT_FAILURE);
35  }
36 
37  xl = (double)lower;
38  xu = (double)iupper;
39  ryd = 1./POW2(xl) - 1./POW2(xu);
40  xmicron = 1.E4/(ryd*RYD_INF);
41  EinstA_v = HydroOscilStr(xl,xu)*TRANS_PROB_CONST*1e8f/(POW2(xmicron))*xl*xl/xu/xu;
42  return( EinstA_v );
43 }
44 
45 realnum hydro_transprob( long nelem, long ipHi, long ipLo )
46 {
47  double Aul, Aul1;
48  long ipISO = ipH_LIKE;
49  /* charge to 4th power, needed for scaling laws for As*/
50  double z4 = POW4((double)nelem+1.);
51  DEBUG_ENTRY( "hydro_transprob()" );
52 
53  if( ipHi >= iso.numLevels_max[ipISO][nelem]-iso.nCollapsed_max[ipISO][nelem] )
54  {
55  if( ipLo >= iso.numLevels_max[ipISO][nelem]-iso.nCollapsed_max[ipISO][nelem] )
56  {
57  /* Neither upper nor lower is resolved...Aul's are easy. */
58  Aul = HydroEinstA( N_(ipLo), N_(ipHi) )*z4;
59  iso_put_error(ipISO,nelem,ipHi,ipLo,IPRAD,0.001f);
60 
61  ASSERT( Aul > 0.);
62  }
63  else
64  {
65  /* Lower level resolved, upper not. First calculate Aul
66  * from upper level with ang mom one higher. */
67  Aul = H_Einstein_A( N_(ipHi), L_(ipLo)+1, N_(ipLo), L_(ipLo), nelem+1 );
68 
69  iso.CachedAs[ipISO][nelem][ N_(ipHi)-iso.n_HighestResolved_max[ipISO][nelem]-1 ][ ipLo ][0] = (realnum)Aul;
70 
71  Aul *= (2.*L_(ipLo)+3.) * 2. / (2.*(double)N_(ipHi)*(double)N_(ipHi));
72 
73  if( L_(ipLo) != 0 )
74  {
75  /* For all l>0, add in transitions from upper level with ang mom one lower. */
76  Aul1 = H_Einstein_A( N_(ipHi), L_(ipLo)-1, N_(ipLo), L_(ipLo), nelem+1 );
77 
78  iso.CachedAs[ipISO][nelem][ N_(ipHi)-iso.n_HighestResolved_max[ipISO][nelem]-1 ][ ipLo ][1] = (realnum)Aul1;
79 
80  /* now add in this part after multiplying by stat weight for lHi = lLo-1. */
81  Aul += Aul1*(2.*L_(ipLo)-1.) * 2. / (2.*(double)N_(ipHi)*(double)N_(ipHi));
82  }
83  else
84  iso.CachedAs[ipISO][nelem][ N_(ipHi)-iso.n_HighestResolved_max[ipISO][nelem]-1 ][ ipLo ][1] = 0.f;
85 
86  iso_put_error(ipISO,nelem,ipHi,ipLo,IPRAD,0.01f);
87  ASSERT( Aul > 0.);
88  }
89  }
90  else
91  {
92  if( N_(ipHi) == N_(ipLo) )
93  {
96  Aul = SMALLFLOAT;
97  iso_put_error(ipISO,nelem,ipHi,ipLo,IPRAD,0.001f);
98  }
99  else if( ipLo == 0 && ipHi == 1 )
100  {
101  /* 2s two photon */
102  Aul = 8.226*pow((double)(nelem+1.),6.);
103  iso_put_error(ipISO,nelem,ipHi,ipLo,IPRAD,0.001f);
104  }
105  else if( ipLo == 0 && ipHi == 2 )
106  {
107  Aul = 6.265e8*z4;
108  iso_put_error(ipISO,nelem,ipHi,ipLo,IPRAD,0.001f);
109  }
110  else if( abs( L_(ipLo) - L_(ipHi) )== 1 )
111  {
112  Aul = H_Einstein_A( N_(ipHi), L_(ipHi), N_(ipLo), L_(ipLo), nelem+1 );
113  iso_put_error(ipISO,nelem,ipHi,ipLo,IPRAD,0.001f);
114  }
115  else
116  {
117  ASSERT( N_(ipHi) > N_(ipLo) );
118  ASSERT( (L_(ipHi) == L_(ipLo)) ||
119  ( abs(L_(ipHi)-L_(ipLo)) > 1) );
120  Aul = SMALLFLOAT;
121  iso_put_error(ipISO,nelem,ipHi,ipLo,IPRAD,0.001f);
122  }
123  }
124 
125  return (realnum)Aul;
126 }

Generated for cloudy by doxygen 1.8.1.1