cloudy  trunk
hydroeinsta.cpp
Go to the documentation of this file.
1 /* This file is part of Cloudy and is copyright (C)1978-2013 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);
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_sp[ipISO][nelem].numLevels_max-iso_sp[ipISO][nelem].nCollapsed_max )
54  {
55  if( ipLo >= iso_sp[ipISO][nelem].numLevels_max-iso_sp[ipISO][nelem].nCollapsed_max )
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,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_sp[ipISO][nelem].CachedAs[ N_(ipHi)-iso_sp[ipISO][nelem].n_HighestResolved_max-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_sp[ipISO][nelem].CachedAs[ N_(ipHi)-iso_sp[ipISO][nelem].n_HighestResolved_max-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_sp[ipISO][nelem].CachedAs[ N_(ipHi)-iso_sp[ipISO][nelem].n_HighestResolved_max-1 ][ ipLo ][1] = 0.f;
85 
86  iso_put_error(ipISO,nelem,ipHi,ipLo,IPRAD,0.01f,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,0.001f);
98  }
99  else if( ipLo == 0 && ipHi == 1 )
100  {
101  // >> refer H-like As Marrus, E. \& Mohr, P. J. Advances in Atomic and Molecular Physics, Vol. 14, Academic, New York, 1978, p. 181
102  Aul = 2.46e-6*pow((double)(nelem+1.),10.);
103  iso_put_error(ipISO,nelem,ipHi,ipLo,IPRAD,0.001f,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,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,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,0.001f);
122  }
123  }
124 
125  return (realnum)Aul;
126 }
iso_put_error
void iso_put_error(long ipISO, long nelem, long ipHi, long ipLo, long whichData, realnum errorOpt, realnum errorPess)
H_Einstein_A
double H_Einstein_A(long int n, long int l, long int np, long int lp, long int iz)
Definition: hydro_bauman.cpp:2324
HydroOscilStr
double HydroOscilStr(double xLower, double Upper)
Definition: hydrooscilstr.cpp:8
t_iso_sp::n_HighestResolved_max
long int n_HighestResolved_max
Definition: iso.h:505
ioQQQ
FILE * ioQQQ
Definition: cddefines.cpp:7
realnum
float realnum
Definition: cddefines.h:103
hydro_bauman.h
L_
#define L_(A_)
Definition: iso.h:21
ASSERT
#define ASSERT(exp)
Definition: cddefines.h:578
iso.h
POW2
#define POW2
Definition: cddefines.h:929
MIN2
#define MIN2
Definition: cddefines.h:761
EXIT_FAILURE
#define EXIT_FAILURE
Definition: cddefines.h:140
cddefines.h
IPRAD
#define IPRAD
Definition: iso.h:86
MAX2
#define MAX2
Definition: cddefines.h:782
RYD_INF
const UNUSED double RYD_INF
Definition: physconst.h:115
cdEXIT
#define cdEXIT(FAIL)
Definition: cddefines.h:434
hydrooscilstr.h
HydroEinstA
double HydroEinstA(long int n1, long int n2)
Definition: hydroeinsta.cpp:12
t_iso_sp::CachedAs
multi_arr< realnum, 3 > CachedAs
Definition: iso.h:567
physconst.h
TRANS_PROB_CONST
const UNUSED double TRANS_PROB_CONST
Definition: physconst.h:237
taulines.h
iso_sp
t_iso_sp iso_sp[NISO][LIMELM]
Definition: iso.cpp:8
hydro_transprob
realnum hydro_transprob(long nelem, long ipHi, long ipLo)
Definition: hydroeinsta.cpp:45
hydroeinsta.h
DEBUG_ENTRY
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:684
ipH_LIKE
const int ipH_LIKE
Definition: iso.h:62
POW4
#define POW4
Definition: cddefines.h:943
SMALLFLOAT
const realnum SMALLFLOAT
Definition: cpu.h:191
N_
#define N_(A_)
Definition: iso.h:20