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

71 lines
2.3 KiB
Fortran

SUBROUTINE SETWIN
C =================
C
C Initialisation of an extended radial structure
C (spherical symmetry is assumed)
C with a continuous connection between the lower quasi-hydrostatic
C layers and the upper, supersonic layers. The velocity structure
C in the upper layers is a beta-type law (v=vinf*(1-r0/r)^beta).
C
C Additional input are read at the end of Unit 8:
C RCORE : Core radius (deepest layer, in solar radii or in cm)
C NDRAD : Number of layers
C NRCORE: Number of core rays
C INRV : Switch indicating the data to be read:
C = 0 : Read an hydrostatic, plane-parallel model only; the
C routine builds the radial points, density and
C velocity structure;
C < 0 : Read also an hydrostatic, plane-parallel model, but
C an empirical velocity law V(r) is read at each
C radial point (r(id) is read);
C > 0 : Input from an extended model atmosphere; the velocity
C law is read; the density structure is recomputed for
C a possibly different mass-loss rate.
C XMDOT : Mass loss rate (in solar mass/yr)
C BETAV, VINF : Parameters of the velocity law (VINF in km/s)
C RD, VEL: Radial points, expansion velocity
C
C Synspec version
C
INCLUDE 'PARAMS.FOR'
INCLUDE 'MODELP.FOR'
INCLUDE 'WINCOM.FOR'
PARAMETER (RSUN=6.96D10)
common/velaux/velmax,iemoff,nltoff,itrad
C
C Read data for spherical atmosphere and velocity law
C
READ(8,*,END=9,ERR=9) RCORE,NDRAD,NRCORE,INRV,NFIRY,NDF
IF(RCORE.LT.1.E5) RCORE=RCORE*RSUN
IF(NDRAD.GT.MDEPTH) CALL quit('NDRAD too large')
READ(8,*) XMDOT,BETAV,VINF
XMDOT=6.30289D25*XMDOT
VINF=1.D5*VINF
ND=NDRAD
DO ID=1,ND
READ(8,*) RD(ID),VEL(ID),VTURB(ID),DENSCON(ID)
if(denscon(id).eq.0.) denscon(id)=1.
vturb(id)=vturb(id)*vturb(id)
END DO
C
C Apply density contrast for clumping
C
DO ID=1,ND
ELEC(ID) = ELEC(ID) * DENSCON(ID)
DENS(ID) = DENS(ID) * DENSCON(ID)
DO I=1,NLEVEL
POPUL(I,ID) = POPUL(I,ID) * DENSCON(ID)
END DO
END DO
C
C Set up rays and weights
C
itrad=1
call radtem
CALL SETRAY
CALL WGTJH1
C
9 continue
RETURN
END