cloudy trunk
Loading...
Searching...
No Matches
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
12double 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
45realnum 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}
FILE * ioQQQ
Definition cddefines.cpp:7
#define ASSERT(exp)
Definition cddefines.h:578
#define MIN2
Definition cddefines.h:761
#define POW2
Definition cddefines.h:929
#define EXIT_FAILURE
Definition cddefines.h:140
#define cdEXIT(FAIL)
Definition cddefines.h:434
float realnum
Definition cddefines.h:103
#define MAX2
Definition cddefines.h:782
#define POW4
Definition cddefines.h:943
#define DEBUG_ENTRY(funcname)
Definition cddefines.h:684
const realnum SMALLFLOAT
Definition cpu.h:191
double H_Einstein_A(long int n, long int l, long int np, long int lp, long int iz)
double HydroEinstA(long int n1, long int n2)
realnum hydro_transprob(long nelem, long ipHi, long ipLo)
double HydroOscilStr(double xLower, double Upper)
t_iso_sp iso_sp[NISO][LIMELM]
Definition iso.cpp:8
#define IPRAD
Definition iso.h:86
#define N_(A_)
Definition iso.h:20
const int ipH_LIKE
Definition iso.h:62
#define L_(A_)
Definition iso.h:21
void iso_put_error(long ipISO, long nelem, long ipHi, long ipLo, long whichData, realnum errorOpt, realnum errorPess)
UNUSED const double TRANS_PROB_CONST
Definition physconst.h:237
UNUSED const double RYD_INF
Definition physconst.h:115