SpectraRust/tlusty/extracted/gami.f
2026-03-19 14:05:33 +08:00

46 lines
1.2 KiB
Fortran

function gami(j,aper,omeg,t,ane)
c ================================
c
c function i(j) defined by eqs. (4.5)-(4.9) of
c cooper, ballagh, and hubeny (1989), ap.j. 344, 949.
c j = principal quantum number
c aper = either 'iont', or 'elec', whether one calculates the
c ion or electron contribution
c omeg = delta omega (circular frequency)
c t = temperature
c ane = electron density (assumed equal to proton density)
c
INCLUDE 'IMPLIC.FOR'
character*4 aper
dimension xx(3)
data xx/0., 50.6205, 68.6112/
c
if(omeg.gt.0.) then
gami=xx(j)*ane/sqrt(omeg)
return
end if
c
x=j*j
omegp=5.64e4*sqrt(ane)
amu=1.
if(aper.eq.'iont') then
amu=30.2
omegp=omegp/42.85
end if
omegc=1.7455e11*t/amu/amu/j
corr=0.27-log(8.356e-13*x*amu*amu*ane/t/t)
gami=3.885e-5*amu*x*ane/sqrt(t)*corr
if(omeg.lt.omegp) return
gamp=gami
gam0=22.58*x**0.75*ane
gamc=gam0/sqrt(omegc)
if(omeg.lt.omegc) then
gami=log(omeg/omegp)/log(omegc/omegp)*log(gamc/gamp)+
* log(gamp)
gami=exp(gami)
else
gami=gam0/sqrt(omeg)
end if
return
end