2 SUBROUTINE hrdiag(mass,aj,mt,tm,tn,tscls,lums,GB,zpars,
3 & r,lum,kw,mc,rc,menv,renv,k2)
31 parameter(wdflag=1,nsflag=1)
33 real*8 mass,aj,mt,tm,tn,tscls(20),lums(10),gb(10),zpars(20)
34 real*8 r,lum,mc,rc,menv,renv,k2
36 parameter(mch=1.44d0,mlp=12.d0,tiny=1.0d-14)
37 real*8 mxns,mxns0,mxns1
38 parameter(mxns0=1.8d0,mxns1=3.d0)
41 real*8 thook,thg,tbagb,tau,tloop,taul,tauh,tau1,tau2,dtau,texp
42 real*8 lx,ly,dell,alpha,beta,neta
43 real*8 rx,ry,delr,rzams,rtms,gamma,rmin,taumin,rg
44 parameter(taumin=5.0d-08)
45 real*8 mcmax,mcx,mcy,mcbagb,lambda
46 real*8 am,xx,fac,rdgen,mew,lum0,kap,zeta,ahe,aco
47 parameter(lum0=7.0d+04,kap=-0.5d0,ahe=4.d0,aco=16.d0)
49 real*8 tprems,pre1,pre2,pre3,pre4
81 if(nsflag.eq.1) mxns = mxns1
84 if(mass0.gt.100.d0) mass = 100.d0
86 if(mt0.gt.100.d0) mt = 100.d0
92 tbagb = tscls(2) + tscls(3)
98 if(aj.ge.0.d0.and.kw.eq.-1)
then
111 tprems = -1.d0*aj/tscls(15)
113 if(tprems.gt.1.d0)
then
120 pre3 = 7.432d-02 - 9.43d-02*mass + 7.439d-02*mass**2
122 if(mass.gt.1.d0.and.mass.lt.2.d0)
then
123 pre1 = -4.00772d0 + 4.00772d0*mass
124 pre2 = 8.5656d0 - 8.5656d0*mass
125 pre3 = -4.50678d0 + 4.56118d0*mass
128 pre1 = 1.60324d0 + 2.20401d0*mass - 0.60433d0*mass**2 +
130 pre2 = -4.56878d0 - 4.05305d0*mass + 1.24575*mass**2 -
132 pre3 = 3.01153 + 1.85745*mass -0.64290d0*mass**2 +
137 r = rzams*10.d0**((pre1*tprems**3 + pre2*tprems**4 +
138 & pre3*tprems**5)/(1.05d0-tprems))
140 pre1 = -2.63181d0 + 3.16607d0*mass - 3.30223d0*mass**2 +
141 & 0.83556d0*mass**3 - 0.06356d0*mass**4
142 pre2 = -11.70230d0 + 16.60510d0*mass - 9.69755d0*mass**2 +
143 & 2.42426d0*mass**3 - 0.27213d0*mass**4 + 0.01134d0*mass**5
144 pre3 = 26.19360d0 - 35.09590d0*mass + 20.64280d0*mass**2 -
145 & 5.18601d0*mass**3 + 0.58360d0*mass**4 - 0.02434d0*mass**5
146 pre4 = -14.64590d0 + 18.55660d0*mass - 10.95070d0*mass**2 +
147 & 2.75979d0*mass**3 - 0.31103d0*mass**4 + 0.01298d0*mass**5
149 lum = lums(1)*10.d0**((exp(pre1*tprems**2) - 1.d0)*
150 & (pre2*tprems + pre3*tprems**2 + pre4*tprems**3)/
153 elseif(aj.lt.tscls(1))
then
157 rg =
rgbf(mt,lums(3))
165 thook =
thookf(mass)*tscls(1)
167 tau1 = min(1.d0,aj/thook)
169 & min(1.d0,(aj-(1.d0-zeta)*thook)/(zeta*thook)))
171 dell =
lhookf(mass,zpars(1))
172 dtau = tau1**2 - tau2**2
176 lx = log10(lums(2)/lums(1))
177 if(tau.gt.taumin)
then
178 xx = alpha*tau + beta*tau**neta +
179 & (lx - alpha - beta)*tau**2 - dell*dtau
181 xx = alpha*tau + (lx - alpha)*tau**2 - dell*dtau
183 lum = lums(1)*10.d0**xx
185 delr =
rhookf(mass,zpars(1))
186 dtau = tau1**3 - tau2**3
190 rx = log10(rtms/rzams)
193 if(tau.gt.taumin)
then
194 xx = alpha*tau + beta*tau**10 + gamma*tau**40 +
195 & (rx - alpha - beta - gamma)*tau**3 - delr*dtau
197 xx = alpha*tau + (rx - alpha)*tau**3 - delr*dtau
201 if(mass.lt.(zpars(1)-0.3d0))
then
207 rdgen = 0.0258d0*((1.d0+zpars(11))**(5.d0/3.d0))*
208 & (mass**(-1.d0/3.d0))
219 if(mass.le.zpars(2))
then
220 mc =
mcgbf(lums(3),gb,lums(6))
221 elseif(mass.le.zpars(3))
then
222 mc =
mcheif(mass,zpars(2),zpars(9))
224 mc =
mcheif(mass,zpars(2),zpars(10))
228 mc = ((1.d0 - tau)*neta + tau)*mc
235 if(mass.gt.zpars(2))
then
242 CALL
star(kw,mass,mt,tm,tn,tscls,lums,gb,zpars)
252 lum = lums(2)*(lums(3)/lums(2))**tau
253 if(mass.le.zpars(3))
then
258 ry =
ragbf(mt,lums(4),zpars(2))
261 texp = log(mass/mlp)/log(zpars(3)/mlp)
263 rx = rmin*(rx/rmin)**texp
265 tau2 =
tblf(mass,zpars(2),zpars(3))
266 if(tau2.lt.tiny) rx = ry
268 r = rtms*(rx/rtms)**tau
276 elseif(aj.lt.tscls(2))
then
281 lum =
lgbtf(aj,gb(1),gb,tscls(4),tscls(5),tscls(6))
282 if(mass.le.zpars(2))
then
284 mc =
mcgbf(lum,gb,lums(6))
288 tau = (aj - tscls(1))/(tscls(2) - tscls(1))
289 mcx =
mcheif(mass,zpars(2),zpars(9))
290 mcy =
mcheif(mass,zpars(2),zpars(10))
291 mc = mcx + (mcy - mcx)*tau
297 if(mass.gt.zpars(2))
then
304 CALL
star(kw,mass,mt,tm,tn,tscls,lums,gb,zpars)
315 elseif(aj.lt.tbagb)
then
319 if(kw.eq.3.and.mass.le.zpars(2))
then
321 CALL
star(kw,mass,mt,tm,tn,tscls,lums,gb,zpars)
324 if(mass.le.zpars(2))
then
325 mcx =
mcgbf(lums(4),gb,lums(6))
327 mcx =
mcheif(mass,zpars(2),zpars(10))
329 tau = (aj - tscls(2))/tscls(3)
330 mc = mcx + (
mcagbf(mass) - mcx)*tau
332 if(mass.le.zpars(2))
then
335 rx =
rzahbf(mt,mc,zpars(2))
337 rmin = rg*zpars(13)**(mass/zpars(2))
338 texp = min(max(0.4d0,rmin/rx),2.5d0)
339 ry =
ragbf(mt,ly,zpars(2))
341 taul = (log(rx/rmin))**(1.d0/3.d0)
346 tauh = (log(ry/rmin))**(1.d0/3.d0)
347 tau2 = taul*(tau - 1.d0) + tauh*tau
348 r = rmin*exp(abs(tau2)**3)
349 rg = rg + tau*(ry - rg)
350 lum = lx*(ly/lx)**(tau**texp)
351 elseif(mass.gt.zpars(3))
then
356 tau2 =
tblf(mass,zpars(2),zpars(3))
357 tloop = tscls(2) + tau2*tscls(3)
359 rg =
rgbf(mt,lums(4))
360 rx =
ragbf(mt,lums(4),zpars(2))
363 texp = log(mass/mlp)/log(zpars(3)/mlp)
365 rx = rmin*(rx/rmin)**texp
369 texp = min(max(0.4d0,rmin/rx),2.5d0)
370 lum = lums(4)*(lums(7)/lums(4))**(tau**texp)
372 ly = lums(4)*(lums(7)/lums(4))**(tau2**texp)
373 ry =
ragbf(mt,ly,zpars(2))
375 if(abs(rmin-rx).gt.tiny)
then
376 taul = (log(rx/rmin))**(1.d0/3.d0)
379 if(ry.gt.rmin) tauh = (log(ry/rmin))**(1.d0/3.d0)
380 tau = (aj - tscls(2))/(tau2*tscls(3))
381 tau2 = taul*(tau - 1.d0) + tauh*tau
382 r = rmin*exp(abs(tau2)**3)
383 rg = rg + tau*(ry - rg)
385 r =
ragbf(mt,lum,zpars(2))
393 tau2 = 1.d0 -
tblf(mass,zpars(2),zpars(3))
394 tloop = tscls(2) + tau2*tscls(3)
396 tau = (tloop - aj)/(tau2*tscls(3))
397 lum = lums(5)*(lums(4)/lums(5))**(tau**3)
405 texp = min(max(0.4d0,rmin/rx),2.5d0)
406 ry =
ragbf(mt,ly,zpars(2))
408 taul = (log(rx/rmin))**(1.d0/3.d0)
413 tauh = (log(ry/rmin))**(1.d0/3.d0)
414 tau = (aj - tloop)/(tscls(3) - (tloop - tscls(2)))
415 tau2 = taul*(tau - 1.d0) + tauh*tau
416 r = rmin*exp(abs(tau2)**3)
417 rg = rx + tau*(ry - rx)
418 lum = lx*(ly/lx)**(tau**texp)
429 xx = (aj - tscls(2))/tscls(3)
431 CALL
star(kw,mass,mt,tm,tn,tscls,lums,gb,zpars)
445 mcx =
mcgbtf(tbagb,gb(8),gb,tscls(7),tscls(8),tscls(9))
446 mcmax = max(max(mch,0.773d0*mcbagb-0.35d0),1.05d0*mcx)
448 if(aj.lt.tscls(13))
then
449 mcx =
mcgbtf(aj,gb(8),gb,tscls(7),tscls(8),tscls(9))
462 CALL
star(kw,mass,mt,tm,tn,tscls,lums,gb,zpars)
464 aj = tscls(4) - (1.d0/((gb(5)-1.d0)*gb(8)*gb(4)))*
467 aj = tscls(5) - (1.d0/((gb(6)-1.d0)*gb(8)*gb(3)))*
477 mc =
mcgbtf(aj,gb(2),gb,tscls(10),tscls(11),tscls(12))
482 lambda = min(0.9d0,0.3d0+0.001d0*mass**5)
484 mcx =
mcgbtf(tau,gb(2),gb,tscls(10),tscls(11),tscls(12))
486 mc = mc - lambda*(mcy-mcx)
488 mcmax = min(mt,mcmax)
490 r =
ragbf(mt,lum,zpars(2))
496 if(mcmax-mcx.lt.tiny)
then
501 if(mcbagb.lt.1.6d0)
then
514 if(mcbagb.lt.1.6d0)
then
526 mt = 1.17d0 + 0.09d0*mc
527 elseif(nsflag.ge.1)
then
545 mcx=1.4512017*mc -6.5913737d-3*mc*mc -6.1073371
570 if(kw.ge.7.and.kw.le.9)
then
582 am = max(0.d0,0.85d0-0.08d0*mass)
583 lum = lums(1)*(1.d0+0.45d0*tau+am*tau**2)
584 am = max(0.d0,0.4d0-0.22d0*log10(mt))
585 r = rx*(1.d0+am*(tau-tau**6))
591 if(mt.lt.zpars(10)) kw = 10
597 lum =
lgbtf(aj,gb(8),gb,tscls(4),tscls(5),tscls(6))
598 r =
rhehgf(mt,lum,rx,lums(2))
604 mc =
mcgbf(lum,gb,lums(6))
605 mtc = min(mt,1.45d0*mt-0.31d0)
606 mcmax = min(mtc,max(mch,0.773d0*mass-0.35d0))
607 if(mcmax-mc.lt.tiny)
then
611 if(mass.lt.1.6d0)
then
615 mt = max(mc,(mc+0.31d0)/1.45d0)
626 if(mass.lt.1.6d0)
then
638 mt = 1.17d0 + 0.09d0*mc
639 elseif(nsflag.ge.1)
then
641 mcx = 0.161767d0*mc + 1.067055d0
643 mcx = 0.314154d0*mc + 0.686088d0
647 elseif(mc.lt.7.6d0)
then
648 mt = mcx + (mc - 5.d0)*(mt - mcx)/2.6d0
669 if(kw.ge.10.and.kw.le.12)
then
674 if(mc.ge.mch.and.kw.eq.12)
then
682 elseif(mc.ge.(mch-0.06d0).and.kw.le.11)
then
700 lum = 635.d0*mt*zpars(14)/(xx*(aj+0.1d0))**1.4d0
702 elseif(wdflag.ge.1)
then
707 lum = 300.d0*mt*zpars(14)/(xx*(aj+0.1d0))**1.18d0
709 fac = (9000.1d0*xx)**5.3d0
710 lum = 300.d0*fac*mt*zpars(14)/(xx*(aj+0.1d0))**6.48d0
715 if(mt.lt.0.000005d0)
then
717 elseif(mt.lt.0.0005d0)
then
720 r = 0.0115d0*sqrt(max(1.48204d-06,(mch/mt)**(2.d0/3.d0)
721 & - (mt/mch)**(2.d0/3.d0)))
740 lum = 0.02d0*(mt**0.67d0)/(max(aj,0.1d0))**2
758 if(kw.le.1.or.kw.eq.7)
then
761 if(mass.gt.zpars(2))
then
767 lx = 635.d0*mc*zpars(14)/((ahe*0.1d0)**1.4d0)
768 elseif(wdflag.ge.1)
then
769 lx = 300.d0*mc*zpars(14)/((ahe*0.1d0)**1.18d0)
771 rx = 0.0115d0*sqrt(max(1.48204d-06,
772 & (mch/mc)**(2.d0/3.d0)-(mc/mch)**(2.d0/3.d0)))
776 tau = (aj - tscls(2))/tscls(3)
778 CALL
star(kwp,mc,mc,tm,tn,tscls,lums,gb,zpars)
779 am = max(0.d0,0.85d0-0.08d0*mc)
780 lx = lums(1)*(1.d0+0.45d0*tau+am*tau**2)
782 am = max(0.d0,0.4d0-0.22d0*log10(mc))
783 rx = rx*(1.d0+am*(tau-tau**6))
784 CALL
star(kw,mass,mt,tm,tn,tscls,lums,gb,zpars)
788 if(tn.gt.tbagb) tau = 3.d0*(aj-tbagb)/(tn-tbagb)
789 CALL
star(kwp,mc,mc,tm,tn,tscls,lums,gb,zpars)
791 if(tau.lt.1.d0) lx = lums(2)*(lx/lums(2))**tau
794 CALL
star(kw,mass,mt,tm,tn,tscls,lums,gb,zpars)
798 lx = 635.d0*mc*zpars(14)/((aco*0.1d0)**1.4d0)
799 elseif(wdflag.ge.1)
then
800 lx = 300.d0*mc*zpars(14)/((aco*0.1d0)**1.18d0)
802 rx = 0.0115d0*sqrt(max(1.48204d-06,
803 & (mch/mc)**(2.d0/3.d0) - (mc/mch)**(2.d0/3.d0)))
814 if(kw.ge.2.and.kw.le.9.and.kw.ne.7)
then
815 mew = ((mt-mc)/mt)*min(5.d0,max(1.2d0,(lum/lum0)**kap))
816 if(kw.ge.8) mew = ((mtc-mc)/mtc)*5.d0
819 lum = lx*(lum/lx)**xx
833 if(kw.ge.0.and.kw.lt.10)
then
834 CALL
mrenv(kw,mass,mt,mc,lum,r,rc,aj,tm,lums(2),lums(3),
835 & lums(4),rzams,rtms,rg,menv,renv,k2)
838 if(mass.gt.99.99d0)
then
841 if(mt.gt.99.99d0)
then