1 SUBROUTINE chaos(IPAIR,I1,I2,QPERI,ECC,IS,ZMU,RKS,SEMI1,ECC1,IDIS)
11 common/modes/ eb0(ntmax),zj0(ntmax),ecrit(ntmax),ar(ntmax),
12 & br(ntmax),eosc(4,ntmax),edec(ntmax),tosc(ntmax),
13 & rp(ntmax),es(ntmax),cm(2,ntmax),iosc(ntmax),
15 REAL*8 de2(2),de3(2),ww(6),w(4),alf(4),tl(2),at(2),tdyn(2),
16 & wg(2),qg(2),wscale(2),qscale(2),a0(3),a2(3),eosc0(2),
21 SAVE kicks,ndec,eosc0,zjosc
22 DATA ww /2.119,3.113,8.175,3.742,4.953,9.413/
23 DATA eccm2 /0.00000399/
31 IF (namec(k).EQ.name(i)) ic = k
37 IF (time - tosc(ic).GT.1.0.OR.kstar(i).EQ.0)
THEN
60 IF (kz(8).GT.3.AND.h(ipair).LT.0.0)
THEN
63 IF (nchaos.GT.ntmax)
THEN
64 WRITE (6,6) name(i1), nchaos, ecc, qperi
65 6
FORMAT (
' FATAL ERROR! CHAOS NM NCH E QP ',
67 WRITE (6,7) (namec(k),k=1,nchaos)
68 7
FORMAT (
' NAMEC ',12i6,(/,12i6))
74 qp = qperi/max(radius(i1),radius(i2))
75 IF (qp.GT.7.0.AND.ndec.GT.1000)
THEN
83 semi = -0.5*body(i)/h(ipair)
84 WRITE (6,8) name(i1), name(i2), ndec, list(1,i1), qp, ecc,
86 8
FORMAT (
' WIDE CHAOS NAM NDEC NP QP/S E A ',
87 & 3i6,i4,f5.1,f8.4,1p,e10.2)
99 tdyn(k) = radius(ik)*sqrt(radius(ik)/body(ik))
101 IF (kstar(ik).EQ.3.OR.kstar(ik).EQ.5.OR.
102 & kstar(ik).EQ.6.OR.kstar(ik).EQ.9)
THEN
103 CALL
giant(ipair,ik,wg,qg,wscale,qscale,xn,qd)
112 IF (kstar(ik).GE.3) ip = 2
113 IF (kstar(ik).EQ.4.OR.kstar(ik).EQ.7) ip = 3
114 IF (kstar(ik).EQ.8) ip = 3
115 IF (kstar(ik).EQ.0) ip = 1
119 alf(k) = 2.0*tdyn(k)/sqrt(w(k))
120 alf(j) = 3.0*tdyn(k)/sqrt(w(j))
121 tl(k) = twopi*tdyn(k)/sqrt(w(k))
125 cj = zmu*sqrt(body(i))
126 IF (iosc(ic).EQ.0.OR.list(1,i1).GT.0)
THEN
127 semi = -0.5*body(i)/h(ipair)
129 eb0(ic) = zmu*h(ipair)
130 zj0(ic) = cj*sqrt(qperi*(1.0 + ecc0))
134 IF (ndec.GT.0) idis = kstar(i)
137 CALL
chaos0(qperi,ecc,eb0(ic),zj0(ic),body(i1),body(i2),
138 & radius(i1),radius(i2),w,ecrit(ic),ar(ic),br(ic),idis)
150 CALL
tcirc(qperi,ecc,i1,i2,icirc,tc)
151 IF (tc.GT.100.0)
THEN
157 IF (list(1,i1).EQ.1)
THEN
160 CALL
induce(ipair,emax,emin,icirc,tc,angle,tg,edav)
161 IF (emax.LT.0.9)
THEN
168 WRITE (6,12) ttot, name(i1), name(i2), kstar(i1),
169 & kstar(i2), list(1,i1), body(i1)*zmbar,
170 & body(i2)*zmbar, radius(i1)*su,
171 & radius(i2)*su, qperi, semi, ecc, xn, qd
172 12
FORMAT (
' NEW SPIRAL T NM K* NP M1 M2 R* QP A E n Q ',
173 & f9.2,2i6,3i3,2f5.1,2f6.1,
174 & 1p,2e10.2,0p,f7.3,f5.1,f7.1)
184 IF (list(1,i1).GT.0)
THEN
193 IF (idis.GT.0.AND.ic.EQ.nchaos)
THEN
202 IF (semi.LT.0.0) which1 =
' CAPTURE'
203 ga = gamma(ipair)*(rmin/rks)**3
204 WRITE (6,15) which1, ttot, name(i1), name(i2), kstar(i1),
205 & kstar(i2), list(1,i1), body(i1)*zmbar,
206 & body(i2)*zmbar, radius(i1)*su,
207 & radius(i2)*su, qperi, semi, ecc, ga, xn, qd
208 15
FORMAT (
' NEW',a8,
' T NM K* NP M1 M2 R* QP A E G n Q ',
209 & f9.2,2i6,3i3,2f5.1,2f6.1,1p,2e10.2,
210 & 0p,f9.5,f7.3,f5.1,f7.1)
215 CALL
tides2(qperi,body(i1),body(i2),radius(i1),radius(i2),is,ecc,
216 & kg,wscale,qscale,de2,de3)
219 IF (de2(1).EQ.0.0d0.OR.de2(2).EQ.0.0d0)
THEN
221 de2(1) = -0.001*eb*
ran2(idum)
222 de2(2) = -0.001*eb*
ran2(idum)
226 eosc0(1) = eosc(1,ic)**2 + eosc(2,ic)**2
227 eosc0(2) = eosc(3,ic)**2 + eosc(4,ic)**2
228 eosc0(1) = sqrt(eosc0(1))
229 eosc0(2) = sqrt(eosc0(2))
231 qnl1 = ql(1)/max(sqrt(eosc0(1)),0.00001d0)
232 qnl2 = ql(2)/max(sqrt(eosc0(2)),0.00001d0)
233 semi = -0.5*body(i)/h(ipair)
235 tk = twopi*semi*sqrt(semi/body(i))
236 td(1) = (1.0/ql(1) + 1.0/qnl1)*tk
237 td(2) = (1.0/ql(2) + 1.0/qnl2)*tk
239 rm = max(radius(i1),radius(i2))
240 IF (ndec.GT.10000.AND.qperi.GT.4.0*rm)
THEN
242 de2(k) = 1000.0*de2(k)
243 de3(k) = 1000.0*de3(k)
255 e20 = e20 + eosc(k,ic)
256 e30 = e30 + eosc(j,ic)
257 eosc(k,ic) = eosc(k,ic)*exp(at(k))
258 eosc(j,ic) = eosc(j,ic)*exp(at(k))
259 edec(ic) = edec(ic) - (eosc(k,ic) + eosc(j,ic))
260 IF (iosc(ic).EQ.-1)
THEN
263 delta = twopi*
ran2(idum1)
265 eosc(k,ic) = eosc(k,ic) +
266 & 2.0*sqrt(eosc(k,ic)*de2(k))*cos(delta) + de2(k)
267 IF (iosc(ic).EQ.-1)
THEN
268 IF (k.EQ.2) iosc(ic) = 1
270 delta = twopi*
ran2(idum1)
272 eosc(j,ic) = eosc(j,ic) +
273 & 2.0*sqrt(eosc(j,ic)*de3(k))*cos(delta) + de3(k)
275 eosc(k,ic) = max(eosc(k,ic),0.0d0)
276 eosc(j,ic) = max(eosc(j,ic),0.0d0)
277 e2t = e2t + eosc(k,ic)
278 e3t = e3t + eosc(j,ic)
279 zjosc = zjosc + alf(k)*eosc(k,ic) + alf(j)*eosc(j,ic)
284 edec(ic) = edec(ic) + e20 + e30
289 hnew = (eb0(ic) - edec(ic) - (e2t + e3t))/zmu
290 semi1 = -0.5*body(i)/hnew
293 efac = (zj0(ic) - zjosc)/cj
294 ecc2 = 1.0 - efac**2/semi1
295 ecc2 = max(ecc2,eccm2)
297 peri1 = semi1*(1.0d0 - ecc1)
300 IF (hnew.GT.0.0)
THEN
303 IF (ic.EQ.nchaos)
THEN
306 WRITE (6,25) ipair, ndec, kicks, ecc, ecc1, semi1, qperi,
308 25
FORMAT (
' TERMINATED CHAOS IPAIR NDEC KICK E E1 A1 QP DH ',
309 & 3i4,2f9.5,1p,3e10.2)
316 deb = zmu*(hi - h(ipair))
322 IF (kz(27).EQ.2.AND.(iosc(ic).EQ.1.OR.iosc(ic).EQ.-1))
THEN
323 IF (edec(ic).GT.-(ecrit(ic) - eb0(ic)))
THEN
325 WRITE (6,30) ttot, name(i1), name(i2), ndec, kicks,
326 & ecc1, semi1, ecrit(ic), edec(ic)
327 30
FORMAT (
' END CHAOS T NM NDEC KICKS E A ECRIT EDEC ',
328 & f9.2,4i6,f8.4,1p,3e10.2)
338 eps = (2.0*ecrit(ic) - eb0(ic) + edec(ic))/(zmu*body(i))
339 eccm = (1.0 + eps*br(ic))/(1.0 - eps*ar(ic))
340 IF (ecc1.LT.eccm)
THEN
344 WRITE (6,32) ndec, eps, eccm, ecc1
345 32
FORMAT (
' NEW CHAOS KICK NDEC EPS ECCM E ',
346 & i5,1p,e10.2,0p,2f8.4)
353 34
IF (ndec.LE.1.AND.semi.GT.0.0.AND.semi.LT.2.0*rmin)
THEN
364 rij2 = rij2 + (x(k,i) - x(k,j))**2
365 vij2 = vij2 + (xdot(k,i) - xdot(k,j))**2
366 rdot = rdot + (x(k,i) - x(k,j))*(xdot(k,i) -xdot(k,j))
371 a0(k) = (x(k1,i1)-x(k1,i2))*(xdot(k2,i1)-xdot(k2,i2))
372 & - (x(k2,i1)-x(k2,i2))*(xdot(k1,i1)-xdot(k1,i2))
373 a2(k) = (x(k1,j) - x(k1,i))*(xdot(k2,j) - xdot(k2,i))
374 & - (x(k2,j) - x(k2,i))*(xdot(k1,j) - xdot(k1,i))
377 a1a2 = a1a2 + a0(k)*a2(k)
380 a1 = 2.0/rip - vij2/(body(i) + body(j))
383 a4 = rdot**2/(a1*(body(i) + body(j)))
384 eccp = sqrt((1.0d0 - rip/a1)**2 + a4)
385 pmin = a1*(1.0d0 - eccp)
386 IF (pmin.LT.3.0*semi)
THEN
387 tm = min(tev(i1),tev(i2)) - time
388 WRITE (6,36) ipair, name(j), eccp, pmin/semi,
389 & rdot/rip, semi, a1, rip, tm
390 36
FORMAT (
' RECOIL: KS NMJ E1 PM/A RD A0 A1 RP TM ',
391 & i4,i6,f7.3,f5.1,f6.1,1p,4e10.2)
394 IF (1.0/a1.GT.0.04/semi.AND.idis.LE.0)
THEN
395 ra = semi*(1.0 + ecc)
397 ga = 2.0*body(j)*(ra/pmin)**3/body(i)
399 fac = a1a2/sqrt(a12*a22)
401 in = 1 + fac*360.0/(twopi*22.5)
402 WRITE (6,38) ipair, name(j), h(ipair), semi, a1,
403 & pmin, ga, eccp, sr, in
404 38
FORMAT (
' HIERARCHY: KS NMJ H A0 A1 RP GA E1 SR ',
405 &
'IN',i5,i6,f7.0,1p,3e9.1,0p,2f6.2,f6.1,i3)
411 IF (ndec.EQ.1.AND.nchaos.GT.1)
THEN
414 40
DO 45 jpair = 1,npairs
415 IF (namec(j).EQ.name(n+jpair))
THEN
417 IF (kstar(n+jpair).GT.0)
THEN
426 IF (nmerge.GT.0.OR.nsub.GT.0) go to 70
429 50 nchaos = nchaos - 1
433 eosc(k,l) = eosc(k,l1)
452 IF (j.LE.nchaos) go to 40
456 80
IF (kz(8).GT.3.AND.kstar(i).NE.-1)
THEN
458 IF (list(1,i1).GT.0.AND.h(ipair).LT.0.0)
THEN