-
Notifications
You must be signed in to change notification settings - Fork 5
/
jhalpha_coef.pro
49 lines (49 loc) · 1.83 KB
/
jhalpha_coef.pro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
;+
; JHAlpha_Coef.pro
;
; Evaluates the recombination rate coefficient, S (m^-6 s^-1), from Johnson-Hinnov table 1 (MKS units).
;
Function JHAlpha_Coef,Density,Te,create=create,no_null=no_null
;
;________________________________________________________________________________
; Input:
; Density - fltarr, electron density (=hydrogen ion density) (m^-3)
; Te - fltarr, electron temperature (eV
;
; Keywords:
; create - if set, then create bi-cubic spline coefficients for
; interpolation of S and save them in the default save set.
; No_Null - if set, then rather than generate a NULL value when Density and Te
; are outside the data range, compute the rate based on the min or max
; data range values.
;________________________________________________________________________________
; History:
; Coding by B. LaBombard 6/29/99
; Coefficients from J. Terry's idl code JH_RATES.PRO
;
;-
common JH_Coef,DKnot,TKnot,order,LogR_BSCoef,LogS_BSCoef,LogAlpha_BSCoef,A_Lyman,A_Balmer
if keyword_set(create) then create_JH_BSCoef
if type_of(LogR_BSCoef) eq 0 then begin
restore,'jh_bscoef.dat'
endif
;
; Evaluate Alpha coefficients
;
if n_elements(Density) ne n_elements(Te) then message,'Number of elements of Density and Te are different!'
Result=Density & Result(*)=1.0e32
LDensity=Alog(Density)
LTe=Alog(Te)
if keyword_set(No_Null) then begin
LDensity=LDensity > min(Dknot)
LDensity=LDensity < max(Dknot)
LTe=LTe > min(Tknot)
LTe=LTe < max(Tknot)
count=n_elements(LDensity)
ok=lindgen(count)
endif else begin
ok=where(LDensity le max(Dknot) and LDensity ge min(Dknot) and LTe le max(Tknot) and LTe ge min(Tknot),count)
endelse
if count gt 0 then Result(ok)=exp(BS2DR(0,0,LDensity(ok),LTe(ok),order,order,Dknot,Tknot,LogAlpha_BSCoef))
return,result
end