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

54 lines
1.5 KiB
Fortran

subroutine rte_sc(dtau,st0,rup,rdown,amu0,ri,ali)
C ================================================
C
C formal solver of the radiative transfer equation
C for one frequency, angle, and for completely known source function;
c using short characteristics
C
c
c input: dtau - optical depth increments Delta tau
c st0 - total source function
c rup - intensity at the upper boundary (id=1)
c rdown- intensity at the lower boundary (id=nd)
c amu0 - cosine of angle of propagation (wrt. the normal)
c output: ri - radiation intensity
c
INCLUDE 'IMPLIC.FOR'
INCLUDE 'BASICS.FOR'
dimension dtau(mdepth),st0(mdepth),ri(mdepth),ali(mdepth),
* dtx1(mdepth),dtx2(mdepth),dtx0(mdepth)
C
do id=1,nd-1
dtx1(id)=exp(-dtau(id))
dtx2(id)=(un-dtx1(id))/dtau(id)
dtx0(id)=un-dtx2(id)
end do
c
c incoming intensity
c
if(amu0.lt.0) then
c
ID=1
ri(id)=rup
do id=1,nd-1
ri(id+1)=ri(id)*dtx1(id)+st0(id)*(dtx2(id)-dtx1(id))+
* st0(id+1)*dtx0(id)
ali(id+1)=dtx0(id)
end do
ali(1)=0.
C
c outgoing intensity
c
else
c
ri(nd)=rdown
do id=nd-1,1,-1
ri(id)=ri(id+1)*dtx1(id)+st0(id)*dtx0(id)+
* st0(id+1)*(dtx2(id)-dtx1(id))
ali(id)=dtx0(id)
end do
ali(nd)=0.
end if
return
end