1 SUBROUTINE coal(IPAIR,KW1,KW2,MASS)
21 IF (dt.GT.2.4e-11)
THEN
24 time = tprev + int((time2 + dt)/dtn)*dtn
25 time = min(tblock,time)
27 time = min(t0(i) + step(i),tblock)
33 dmin2 = min(dmin2,rcoll)
37 IF ((kstar(i).LE.10.AND.iqcoll.NE.0).OR.iqcoll.EQ.-2)
THEN
40 eb1 = body(2*ipair-1)*body(2*ipair)*h(ipair)/body(i)
45 eb = body(2*ipair-1)*body(2*ipair)*h(ipair)/body(i)
51 IF (h(ipair).GT.0.0)
THEN
55 vinf = sqrt(2.0*h(ipair))*vstar
56 eb1 = body(2*ipair-1)*body(2*ipair)*h(ipair)/body(i)
65 IF (kstar(i).GE.10.AND.nchaos.GT.0)
THEN
91 zm = body(i1) + body(i2)
93 cm(k) = (body(i1)*x(k,i1) + body(i2)*x(k,i2))/zm
94 cm(k+3) = (body(i1)*xdot(k,i1) + body(i2)*xdot(k,i2))/zm
102 ri2 = ri2 + (x(k,i1) - rdens(k))**2
103 rij2 = rij2 + (x(k,i1) - x(k,i2))**2
104 vij2 = vij2 + (xdot(k,i1) - xdot(k,i2))**2
108 semi = 2.d0/rij - vij2/zm
110 tk = days*semi*sqrt(abs(semi)/zm)
111 ecc = max(1.0 - rcoll/semi,0.001d0)
112 IF (iqcoll.EQ.5)
THEN
113 eb1 = -0.5*body(i1)*body(i2)/semi
121 IF (list(1,i1).GT.list(1,icm)) icm = i1
122 IF (list(1,i2).GT.list(1,icm)) icm = i2
124 IF (jlist(4).GT.0)
THEN
126 IF (list(1,i4).GT.list(1,icm)) icm = 4
137 jpert(l) = list(l+1,icm)
138 IF (jpert(l).EQ.i2)
THEN
141 IF (i2.EQ.n) jpert(l) = n - 1
147 ri2 = ri2 + (cm(k) - x(k,jj))**2
149 IF (ri2.LT.rij2)
THEN
161 IF (icm.EQ.i1.OR.icm.EQ.i2) jpert(nnb) = jlist(3)
163 IF (icm.EQ.i1) jlist(1) = jlist(3)
170 CALL
nbpot(2,nnb,pot1)
173 zmnew = (mass(1) + mass(2))/zmbar
175 IF (dm.LT.1.0d-10) dm = 0.d0
183 IF(body0(i1).LT.body0(i2))
THEN
184 body0(i1) = body0(i2)
185 epoch(i1) = epoch(i2)
188 radius(i1) = radius(i2)
195 t0(i2) = tadj + dtadj
196 IF (kz(23).EQ.0.OR.rtide.GT.1000.0*rscale) t0(i2) = 1.0d+10
201 tev0(i1) = max(tev0(i1),tev0(i2))
202 IF(iqcoll.NE.3) tev(i1) = max(time,tev0(i1))
204 vi = sqrt(xdot(1,i2)**2 + xdot(2,i2)**2 + xdot(3,i2)**2)
210 IF (j.NE.i1.AND.j.NE.i2)
THEN
217 IF(zmnew*zmbar.LT.0.001.AND.kw1.NE.15)
THEN
218 WRITE(6,*)
' ERROR COAL: mass1 = 0.0 and kw1 is not equal 15'
219 WRITE(6,*)
' I KW ',i1,kw1
227 x0dot(k,i1) = cm(k+3)
229 x0(k,i2) = min(1.0d+04 + (x(k,i2)-rdens(k)),
230 & 1000.d0*rscale*(x(k,i2)-rdens(k))/ri)
232 x0dot(k,i2) = sqrt(0.004d0*zmass/rscale)*xdot(k,i2)/vi
233 xdot(k,i2) = x0dot(k,i2)
247 CALL
nbpot(1,nnb,pot2)
261 IF (kz(19).GE.3.AND.dm.GT.0.0)
THEN
265 body(i1) = max(body(i1),0.d0)
266 IF (abs(body(i1)).LT.1.0d-10) tev(i1) = 1.0d+10
272 ilist(l+1) = jpert(l)
279 IF (kw1.EQ.13.OR.kw1.EQ.14)
THEN
280 IF(kstar(i1).GE.13.OR.kstar(i2).GE.13) kw = 0
283 IF (kw1.GE.10.AND.kw1.LE.12)
THEN
284 IF(kstar(i1).GE.10.OR.kstar(i2).GE.10) kw = 0
291 IF (body(i1).GT.0.0d0)
THEN
292 CALL
dtchck(time,step(i1),dtk(40))
299 IF (dm*zmbar.GT.0.1)
THEN
310 ELSE IF (t0(j).LT.time)
THEN
312 CALL
dtchck(time,step(j),dtk(40))
315 x0dot(k,j) = xdot(k,j)
318 IF (body(j).EQ.0.0d0)
THEN
320 x0(k,i1) = min(1.0d+04 + (x(k,i1)-rdens(k)),
321 & 1000.d0*rscale*(x(k,i1)-rdens(k))/ri)
323 x0dot(k,i1) = sqrt(0.004d0*zmass/rscale)*
325 xdot(k,i1) = x0dot(k,i1)
332 WRITE (6,28) name(i1), kw1
333 28
FORMAT (
' MASSLESS PRIMARY! NAM KW ',i8,i4)
344 IF (ipair.GT.0.AND.body(i1).GT.0.0d0)
THEN
345 IF (jmin.LE.n.AND.rij2.LT.rmin2)
THEN
347 x0dot(k,jmin) = xdot(k,jmin)
352 WRITE (6,36) name(icomp), name(jcomp), list(1,2*npairs-1),
353 & r(npairs), h(npairs), step(ntot)
354 36
FORMAT (
' COAL KS NM NP R H DTCM ',2i6,i4,1p,3e10.2)
357 t0(i2) = tadj + dtadj
360 CALL
fpoly1(icomp,icomp,0)
361 CALL
fpoly2(icomp,icomp,0)
368 npop(9) = npop(9) + 1
374 OPEN (unit=12,
status=
'NEW',form=
'FORMATTED',file=
'COAL')
379 WRITE (12,40) rbar, bodym*zmbar, body1*zmbar, tscale,
381 40
FORMAT (/,6x,
'MODEL: RBAR =',f5.1,
' <M> =',f6.2,
382 &
' M1 =',f6.1,
' TSCALE =',f6.2,
383 &
' NB =',i5,
' N0 =',i6,//)
385 45
FORMAT (
' TIME NAME NAME K1 K2 IQ M1 M2',
386 &
' DM R1 R2 r/Rc R ECC P',/)
390 WRITE (12,50) ttot, name1, name2, kstar(i1), kstar(i2), iqcoll,
391 & zm1, zm2, dm*zmbar, radius(i1)*su, radius(i2)*su,
392 & ri/rc, rij*su, ecc, tk
393 50
FORMAT (1x,f7.1,2i6,3i4,3f5.1,2f7.2,f6.1,f7.2,f9.5,1p,e9.1)
396 WRITE (6,55) which1, iqcoll, name1, name2, kstar(i1), kstar(i2),
397 & kw1, zmnew*zmbar, rcoll, eb, dp, dm*zmbar, vinf
398 55
FORMAT (/,a8,
'COAL IQ =',i3,
' NAME =',2i6,
' K* =',3i3,
399 &
' M =',f6.2,
' RCOLL =',1p,e8.1,
' EB =',e9.1,
400 &
' DP =',e9.1,
' DM =',0p,f6.2,
' VINF =',f4.1)