Nbody6
 All Files Functions Variables
mrenv.f
Go to the documentation of this file.
1 ***
2  SUBROUTINE mrenv(kw,mass,mt,mc,lum,rad,rc,aj,tm,ltms,lbgb,lhei,
3  & rzams,rtms,rg,menv,renv,k2e)
4  implicit none
5  integer kw
6  real*8 mass,mt,mc,lum,rad,rc,aj,tm
7  real*8 k2e,menv,menvg,menvt,menvz,renv,renvg,renvt,renvz,rzr
8  real*8 a,b,c,d,e,f,x,y
9  real*8 k2bgb,k2g,k2z,logm,logmt,lbgb,ltms,lhei,rg,rtms,rzams
10  real*8 teff,tebgb,tetms,tau,tauenv,tautms
11 *
12 * A function to estimate the mass and radius of the convective envelope,
13 * as well as the gyration radius of the envelope.
14 * N.B. Valid only for Z=0.02!
15 *
16 * The following input is needed from HRDIAG:
17 * kw = stellar type
18 * mass = zero-age stellar mass
19 * mt = actual mass
20 * mc = core mass (not really needed, can also be done outside subroutine)
21 * lum = luminosity
22 * rad = radius
23 * rc = core radius (not really needed...)
24 * aj = age
25 * tm = main-sequence lifetime
26 * ltms = luminosity at TMS, lums(2)
27 * lbgb = luminosity at BGB, lums(3)
28 * lhei = luminosity at He ignition, lums(4)
29 * rzams = radius at ZAMS
30 * rtms = radius at TMS
31 * rg = giant branch or Hayashi track radius, approporaite for the type.
32 * For kw=1 or 2 this is radius at BGB, and for kw=4 either GB or
33 * AGB radius at present luminosity.
34 *
35  logm = log10(mass)
36  a = min(0.81d0,max(0.68d0,0.68d0+0.4d0*logm))
37  c = max(-2.5d0,min(-1.5d0,-2.5d0+5.d0*logm))
38  d = -0.1d0
39  e = 0.025d0
40 *
41 * Zero-age and BGB values of k^2.
42 *
43  k2z = min(0.21d0,max(0.09d0-0.27d0*logm,0.037d0+0.033d0*logm))
44  if(logm.gt.1.3d0) k2z = k2z - 0.055d0*(logm-1.3d0)**2
45  k2bgb = min(0.15d0,min(0.147d0+0.03d0*logm,0.162d0-0.04d0*logm))
46 *
47  if(kw.ge.3.and.kw.le.6)then
48 *
49 * Envelope k^2 for giant-like stars; this will be modified for non-giant
50 * CHeB stars or small envelope mass below.
51 * Formula is fairly accurate for both FGB and AGB stars if M <= 10, and
52 * gives reasonable values for higher masses. Mass dependence is on actual
53 * rather than ZA mass, expected to work for mass-losing stars (but not
54 * tested!). The slightly complex appearance is to insure continuity at
55 * the BGB, which depends on the ZA mass.
56 *
57  logmt = log10(mt)
58  f = 0.208d0 + 0.125d0*logmt - 0.035d0*logmt**2
59  b = 1.0d+04*mt**(3.d0/2.d0)/(1.d0+0.1d0*mt**(3.d0/2.d0))
60  x = ((lum-lbgb)/b)**2
61  y = (f - 0.033d0*log10(lbgb))/k2bgb - 1.d0
62  k2g = (f - 0.033d0*log10(lum) + 0.4d0*x)/(1.d0+y*(lbgb/lum)+x)
63  elseif(kw.eq.9)then
64 *
65 * Rough fit for for HeGB stars...
66 *
67  b = 3.0d+04*mt**(3.d0/2.d0)
68  x = (max(0.d0,lum/b-0.5d0))**2
69  k2g = (k2bgb + 0.4d0*x)/(1.d0 + 0.4d0*x)
70  else
71  k2g = k2bgb
72  endif
73 *
74  if(kw.le.2)then
75  menvg = 0.5d0
76  renvg = 0.65d0
77  elseif(kw.eq.3.and.lum.lt.3.d0*lbgb)then
78 *
79 * FGB stars still close to the BGB do not yet have a fully developed CE.
80 *
81  x = min(3.d0,lhei/lbgb)
82  tau = max(0.d0,min(1.d0,(x-lum/lbgb)/(x-1.d0)))
83  menvg = 1.d0 - 0.5d0*tau**2
84  renvg = 1.d0 - 0.35d0*tau**2
85  else
86  menvg = 1.d0
87  renvg = 1.d0
88  endif
89 *
90  if(rad.lt.rg)then
91 *
92 * Stars not on the Hayashi track: MS and HG stars, non-giant CHeB stars,
93 * HeMS and HeHG stars, as well as giants with very small envelope mass.
94 *
95 
96  if(kw.le.6)then
97 *
98 * Envelope k^2 fitted for MS and HG stars.
99 * Again, pretty accurate for M <= 10 but less so for larger masses.
100 * [Note that this represents the whole star on the MS, so there is a
101 * discontinuity in stellar k^2 between MS and HG - okay for stars with a
102 * MS hook but low-mass stars should preferably be continous...]
103 *
104 * For other types of star not on the Hayashi track we use the same fit as
105 * for HG stars, this is not very accurate but has the correct qualitative
106 * behaviour. For CheB stars this is an overestimate because they appear
107 * to have a more centrally concentrated envelope than HG stars.
108 * NOTE: Max on radius ratio added to stop large k2e (5/5/2009, JH)
109 *
110  rzr = max(1.d0,rad/rzams)
111  k2e = (k2z-e)*rzr**c + e*rzr**d
112  elseif(kw.eq.7)then
113 * Rough fit for naked He MS stars.
114  tau = aj/tm
115  k2e = 0.08d0 - 0.03d0*tau
116  elseif(kw.le.9)then
117 * Rough fit for HeHG stars.
118  k2e = 0.08d0*rzams/rad
119  endif
120 *
121 * tauenv measures proximity to the Hayashi track in terms of Teff.
122 * If tauenv>0 then an appreciable convective envelope is present, and
123 * k^2 needs to be modified.
124 *
125  if(kw.le.2)then
126  teff = sqrt(sqrt(lum)/rad)
127  tebgb = sqrt(sqrt(lbgb)/rg)
128  tauenv = max(0.d0,min(1.d0,(tebgb/teff-a)/(1.d0-a)))
129  else
130  tauenv = max(0.d0,min(1.d0,(sqrt(rad/rg)-a)/(1.d0-a)))
131  endif
132 *
133  if(tauenv.gt.0.d0)then
134  menv = menvg*tauenv**5
135  renv = renvg*tauenv**(5.d0/4.d0)
136  if(kw.le.1)then
137 * Zero-age values for CE mass and radius.
138  x = max(0.d0,min(1.d0,(0.1d0-logm)/0.55d0))
139  menvz = 0.18d0*x + 0.82d0*x**5
140  renvz = 0.4d0*x**(1.d0/4.d0) + 0.6d0*x**10
141  y = 2.d0 + 8.d0*x
142 * Values for CE mass and radius at start of the HG.
143  tetms = sqrt(sqrt(ltms)/rtms)
144  tautms = max(0.d0,min(1.d0,(tebgb/tetms-a)/(1.d0-a)))
145  menvt = menvg*tautms**5
146  renvt = renvg*tautms**(5.d0/4.d0)
147 * Modified expressions during MS evolution.
148  tau = aj/tm
149  if(tautms.gt.0.d0)then
150  menv = menvz + tau**y*menv*(menvt - menvz)/menvt
151  renv = renvz + tau**y*renv*(renvt - renvz)/renvt
152  else
153  menv = 0.d0
154  renv = 0.d0
155  endif
156  k2e = k2e + tau**y*tauenv**3*(k2g - k2e)
157  else
158  k2e = k2e + tauenv**3*(k2g - k2e)
159  endif
160  else
161  menv = 0.d0
162  renv = 0.d0
163  endif
164  else
165 *
166 * All other stars should be true giants.
167 *
168  menv = menvg
169  renv = renvg
170  k2e = k2g
171  endif
172 *
173  menv = menv*(mt - mc)
174  renv = renv*(rad - rc)
175  menv = max(menv,1.0d-10)
176  renv = max(renv,1.0d-10)
177 *
178  return
179  end
180 ***