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

53 lines
1.3 KiB
Fortran

subroutine tlocal(id,tauf,t)
c ============================
c
c local temperature as a a function of optical depth
c for a grey model
c
c input; ID - depth index
c TAUF - current estimate of the flux-mean opacity
c output: T - local temperature
c
INCLUDE 'IMPLIC.FOR'
INCLUDE 'BASICS.FOR'
INCLUDE 'MODELQ.FOR'
parameter (c1=0.8112,c2=3.966e14,c3=6.745e-10,c4=0.96,
* c23=c2*c3,c34=c3*c4)
c
COMMON/FLXAUX/T4,PGAS,PRAD,PGM,PRADM,ITGMAX,ITGMX0
COMMON/FACTRS/GAMJ(MDEPTH),GAMH,FAK0
C
if(tdisk.gt.0.) then
t=tdisk
return
end if
c
vis=viscd(id)/(3.*dm(nd))
extra=4.*fak0*wdil*(tstar/teff)**4
gj=gamj(id)
gh=gamh*5.7735e-1
gg=(tauf-tauthe(id))*fractv+gh+extra
c
if(icompt.eq.0.or.icomgr.eq.0) then
t=(0.75*t4*(gj*gg+vis/abplad(id)))**0.25
return
end if
c
epsbar=abplad(id)/abrosd(id)
tfor=c1*teff*epsbar**(-0.125)
tf0=tfor
if(tauf.gt.un.and.tfor.lt.temp(id).or.tauf.ge.100.) then
tfor=0.
b=gg*(c3-c34)
b=0.
else
b=gg*c3
end if
a=epsbar/(0.75*t4)
c=gg*(epsbar*gj+c34*tfor)+vis/abrosd(id)
call quartc(a,b,c,t1)
t=t1
c
return
end