1 SUBROUTINE mix(J1,J2,DM)
13 REAL*8 tscls(20),lums(10),gb(10),tms1,tms2,tms3,tn
14 REAL*8 m01,m02,m03,m1,m2,m3,age1,age2,age3,mc3,lum,rm,rcc
15 REAL*8 rr,mf,rzams,tprems,left,right,err,xx
18 parameter(mch=1.44d0,mxns=3.0d0,err=1d-5)
27 IF(kstar(j1).GE.kstar(j2))
THEN
30 IF(kstar(j1).LE.1.AND.body(j1).LT.body(j2))
THEN
43 IF (k1.LT.0.OR.k2.LT.0)
THEN
45 IF (max(k1,k2).GT.0)
THEN
47 IF (k1 .EQ. -1) epoch(i1) = time*tstar
48 IF (k2 .EQ. -1) epoch(i2) = time*tstar
54 WRITE(38,*)
' MIX ERROR ICASE>100 ',icase,k1,k2
74 tev1 = max(time,tev0(i1))
78 age1 = tev1*tstar - epoch(i1)
79 CALL
star(k1,m01,m1,tms1,tn,tscls,lums,gb,zpars)
84 age2 = tev1*tstar - epoch(i2)
85 CALL
star(k2,m02,m2,tms2,tn,tscls,lums,gb,zpars)
88 IF(k1.EQ.10.AND.m1.LT.0.05)
THEN
94 ELSEIF(k1.GE.11.AND.m1.LT.0.15.AND.icase.EQ.6)
THEN
97 IF(k2.EQ.10.AND.m2.LT.0.05)
THEN
105 WRITE(38,67)k1,m01,m1
106 67
FORMAT(
' MIX OLD *1:',i4,2f10.6)
107 WRITE(38,68)k2,m02,m2
108 68
FORMAT(
' MIX OLD *2:',i4,2f10.6)
119 zmb = body(i1) + body(i2)
124 rij2 = rij2 + (x(k,i1) - x(k,i2))**2
125 vij2 = vij2 + (xdot(k,i1) - xdot(k,i2))**2
126 rdot = rdot + (x(k,i1) - x(k,i2))*(xdot(k,i1) - xdot(k,i2))
130 eb = -0.5*6.68d-08*4.0d+66*m2**2/(radius(i2)*su*7.0d+10)
131 zmu = smu*body(i1)*body(i2)/(body(i1) + body(i2))
132 zke = 0.5*2.0d+33*zmu*1.0d+10*vij2*vstar**2
133 IF (zke + eb.GT.0.0.AND.rij.LT.0.5*(radius(i1)+radius(i2)).AND.
134 & max(k1,k2).LT.2)
THEN
137 WRITE (6,55) fac, rij*su, sqrt(vij2)*vstar, eb, zke
138 55
FORMAT (
' ENFORCED MASS LOSS FAC RIJ VIJ EB KE ',
139 & f7.3,f8.2,f8.2,1p,2e10.2)
149 IF (icase.EQ.-1)
THEN
152 m3 = (1.0 - mf)*(m1 + m2)
161 rr = m03**2*(1.0-mf)*2.33333
162 rr = rr/(m1*m1/rs1 + m2*m2/rs2)*(3.0 - 4.0*mf)
164 tprems = 10d0**(43.628d0-(35.835d0*m3**1.5029d-2)
165 & *exp(m3*3.9608d-3))
177 IF(m3.LT.1.25) kw = 0
178 IF(m3.GE.1.25) kw = 1
182 IF(
premsf(m3,xx,rr).LE.0d0)
THEN
187 101 xx=0.5*(left + right)
190 IF(abs(
premsf(m3,xx,rr)).LE.err)goto 103
191 IF(abs(
premsf(m3,xx,rr)).GT.err)goto 102
193 102
IF(sign(1.d0,
premsf(m3,xx,rr)).EQ.
194 & sign(1.d0,
premsf(m3,left,rr)))left=xx
195 IF(sign(1.d0,
premsf(m3,xx,rr)).EQ.
196 & sign(1.d0,
premsf(m3,right,rr)))right=xx
199 103 age3 = -tprems*xx
201 IF (m3.GT.2.0)
WRITE (6,720) m3, rzams, xx, tprems, age3
202 720
FORMAT (
' WATCH! M3 RZAMS XX TP AGE3 ',f7.2,1p,4e10.2)
203 CALL
star(kw,m3,m3,tms3,tn,tscls,lums,gb,zpars)
205 ELSE IF(icase.EQ.1)
THEN
208 CALL
star(kw,m03,m3,tms3,tn,tscls,lums,gb,zpars)
209 age3 = 0.1d0*tms3*(age1*m01/tms1 + age2*m02/tms2)/m03
210 ELSEIF(icase.EQ.3.OR.icase.EQ.6.OR.icase.EQ.9)
THEN
212 CALL
gntage(mc3,m3,kw,zpars,m03,age3)
213 ELSEIF(icase.EQ.4)
THEN
217 WRITE(6,*)
' WARNING! MIX AGE WRONG FOR KW=4 ',age1,tms1
218 WRITE(6,*)k1,m01,m1,tev1,epoch(i1)
221 CALL
gntage(mc3,m3,kw,zpars,m03,age3)
222 ELSEIF(icase.EQ.7)
THEN
223 CALL
star(kw,m03,m3,tms3,tn,tscls,lums,gb,zpars)
224 age3 = tms3*(age2*m2/tms2)/m3
225 ELSEIF(icase.LE.12)
THEN
229 ELSEIF(icase.EQ.13.OR.icase.EQ.14)
THEN
237 WRITE (6,2) k1, k2, name(i1), name(i2)
238 2
FORMAT (
' NEW TZ K* NM ',2i4,2i6)
239 ELSEIF(icase.EQ.13)
THEN
241 IF(m3.GT.mxns) kw = 14
244 ELSEIF(icase.EQ.15)
THEN
247 ELSEIF(icase.GT.100)
THEN
256 WRITE(6,*)
' ERROR MIX: ICASE NOT CAUGHT!!!'
257 WRITE(6,*)
' K1 K2 -> K3 ',k2,k2,kw
261 WRITE(38,69)kw,m03,m3
262 69
FORMAT(
' MIX NEW *3:',i4,2f10.6)
267 CALL
star(kw,m03,m3,tms3,tn,tscls,lums,gb,zpars)
268 CALL
hrdiag(m03,age3,m3,tms3,tn,tscls,lums,gb,zpars,
269 & rm,lum,kw,mc3,rcc,menv,renv,k2e)
272 WRITE (6,5) name(i1), name(i2), kw0, kw, dm
273 5
FORMAT (
' MIX TYPE CHANGE: NAM K* DM ',2i6,2i4,f6.2)
280 body0(i1) = m03/zmbar
281 epoch(i1) = tev1*tstar - age3
290 IF(tms3.LT.tphys.AND.kstar(i1).LE.1)
THEN
291 WRITE (6,8) name(i1), m3, tms3, tphys, age3
292 8
FORMAT (
' NEW BS (MIX): NAM M3 TM TP AGE ',
295 semi = 2.0/rij - vij2/zmb
297 pd = days*semi*sqrt(abs(semi)/zmb)
299 ecc2 = (1.0 - rij/semi)**2 + rdot**2/(semi*zmb)
301 spin1 = spin(i1)/(rg2*body(i1)*radius(i1)**2)
302 spin2 = spin(i2)/(rg2*body(i2)*radius(i2)**2)
303 ts = 1.0d+06*365.0*twopi*tstar
305 WRITE (91,9) time+ttot, name(i1), name(i2), m3, ecc, pd,
307 9
FORMAT (
' NEW BS T NAM M3 ECC P ROT ',
308 & f8.1,2i7,f6.2,f8.4,1p,3e9.1)
312 WRITE (6,10) iqcoll, k1, k2, kstar(i1), m1, m2, m3, rs1, rs2,
313 & radius(i1)*su, dm*zmbar
314 10
FORMAT (
' NEW STAR: IQ K1 K2 K* M1 M2 M3 R1 R2 R* DM ',
315 & 4i3,3f6.1,3f7.1,f5.1)
318 IF(first.AND.iqcoll.NE.3)
THEN
319 OPEN (unit=13,
status=
'NEW',form=
'FORMATTED',file=
'COLL')
324 WRITE (13,20) rbar, bodym*zmbar, body1*zmbar, tscale,
326 20
FORMAT (/,6x,
'MODEL: RBAR =',f5.1,
' <M> =',f6.2,
327 &
' M1 =',f6.1,
' TSCALE =',f6.2,
328 &
' NB =',i4,
' N0 =',i6,//)
330 25
FORMAT (
' TIME NAME NAME K1 K2 KC M1 M2 MC',
331 &
' DM R1 R2 r/Rc R ECC P',/)
340 ri2 = ri2 + (x(k,i1) - rdens(k))**2
341 rij2 = rij2 + (x(k,i1) - x(k,i2))**2
342 vij2 = vij2 + (xdot(k,i1) - xdot(k,i2))**2
346 semi = 2.d0/rij - vij2/zmb
348 tk = days*semi*sqrt(abs(semi)/zmb)
352 IF (iqcoll.NE.3)
THEN
353 WRITE (13,35) ttot, (itype(k),k=1,5), m1, m2, m3,
354 & dm*zmbar, rs1, rs2, ri/rc, rij*su, ecc, tk
355 35
FORMAT (1x,f7.1,2i6,3i4,4f5.1,2f7.2,f6.2,f7.2,f9.5,1p,e9.1)
363 IF(kstar(i1).GT.12)
THEN
364 WRITE (15,40) k1, k2, kstar(i1), body(i1)*zmbar,
366 40
FORMAT (
' MIX: K1 K2 K* M1 M2 M3 ',3i4,3f7.2)