1 SUBROUTINE chaos2(I1,I2,ECC,HI,IS,BODYI,ZMU,RSTAR,SEMI1,ECC1,DH,
12 parameter(nmx=10,nmx2=2*nmx,nmx3=3*nmx,nmx4=4*nmx,
13 & nmx8=8*nmx,nmxm=nmx*(nmx-1)/2)
14 REAL*8 m,mass,mc,mij,mkk,rstar(2)
15 common/chain1/ xch(nmx3),vch(nmx3),m(nmx),
16 & zz(nmx3),wc(nmx3),mc(nmx),
17 & xi(nmx3),pi(nmx3),mass,rinv(nmxm),rsum,mkk(nmx),
18 & mij(nmx,nmx),tkk(nmx),tk1(nmx),iname(nmx),nn
20 common/chreg/ timec,tmax,rmaxc,cm(10),namex(6),nstep1,kz27,kz30
21 common/ccoll2/ qk(nmx4),pk(nmx4),rij(nmx,nmx),
SIZE(nmx),vstar1,
22 & ecoll1,rcoll,qperi,istar(nmx),icoll,isync,ndiss1
23 common/modes/ eb0(ntmax),zj0(ntmax),ecrit(ntmax),ar(ntmax),
24 & br(ntmax),eosc(4,ntmax),edec(ntmax),tosc(ntmax),
25 & rp(ntmax),es(ntmax),cx(2,ntmax),iosc(ntmax),
27 REAL*8 de2(2),de3(2),ww(6),w(4),alf(4),tl(2),at(2),tdyn(2),wg(2),
28 & qg(2),wscale(2),qscale(2),eosc0(2),ql(2),td(2)
33 DATA ww /2.119,3.113,8.175,3.742,4.953,9.413/
34 DATA eccm2 /0.00000399/
38 IF (isync.NE.0) go to 100
40 IF (ecc.LT.0.0021)
THEN
48 nam1 = nzero + namex(i1)
49 nam2 = nzero + namex(i2)
51 IF (namec(k).EQ.nam1.OR.namec(k).EQ.nam2) ic = k
57 IF (namex(i1) + namex(i2).EQ.ksave(2)) k = 1
58 IF (namex(i1) + namex(i2).EQ.ksave(4)) k = 3
61 IF (kstari.EQ.-2)
THEN
76 tosc(ic) = time + timec
80 IF (nchaos.GT.ntmax)
THEN
81 WRITE (6,6) name(i1), nchaos, ecc
82 6
FORMAT (
' FATAL ERROR! CHAOS2 NM NCH E ',
93 tdyn(k) = sqrt(rstar(k)**3/m(ik))
95 IF (is(k).EQ.3.OR.is(k).EQ.5)
THEN
97 CALL
giant2(k,ik,wg,qg,wscale,qscale,xn,qd)
106 IF (is(k).GE.3) ip = 2
107 IF (is(k).EQ.4.OR.is(k).EQ.6) ip = 3
108 IF (is(k).EQ.0) ip = 1
112 alf(k) = 2.0*tdyn(k)/sqrt(w(k))
113 alf(j) = 3.0*tdyn(k)/sqrt(w(j))
114 tl(k) = twopi*tdyn(k)/sqrt(w(k))
120 IF (iosc(ic).EQ.0)
THEN
123 zj0(ic) = cj*sqrt(qperi*(1.0 + ecc0))
126 tosc(ic) = time + timec
131 CALL
chaos0(qperi,ecc,eb0(ic),zj0(ic),m(i1),m(i2),
132 & rstar(1),rstar(2),w,ecrit(ic),ar(ic),br(ic),idis)
137 WRITE (6,12) is(1), is(2), m(i1), m(i2), rstar(1),
138 & rstar(2), qperi, semi, ecc
139 12
FORMAT (
' CHAIN SPIRAL K* M1 M2 R* QP A E ',
140 & 2i4,1p,6e10.2,0p,f8.4)
144 tosc(ic) = time + timec
149 IF (namec(j).EQ.nam1.OR.namec(j).EQ.nam2)
THEN
161 WRITE (6,15) which1, namex(i1), namex(i2), is(1), is(2),
162 & m(i1)*zmbar, m(i2)*zmbar, rstar(1), rstar(2),
164 15
FORMAT (
' CHAIN',a8,
' NAM K* M1 M2 R* QP A E ',
165 & 2i6,2i4,2f5.1,1p,4e10.2,0p,f8.4)
170 IF (idis.GT.1) go to 90
174 CALL
tides2(qperi,m(i1),m(i2),rstar(1),rstar(2),is,ecc,kg,
175 & wscale,qscale,de2,de3)
178 eosc0(1) = eosc(1,ic)**2 + eosc(2,ic)**2
179 eosc0(2) = eosc(3,ic)**2 + eosc(4,ic)**2
180 eosc0(1) = sqrt(eosc0(1))
181 eosc0(2) = sqrt(eosc0(2))
183 qnl1 = ql(1)/max(sqrt(eosc0(1)),0.00001d0)
184 qnl2 = ql(2)/max(sqrt(eosc0(2)),0.00001d0)
186 tk = twopi*semi*sqrt(semi/bodyi)
187 td(1) = (1.0/ql(1) + 1.0/qnl1)*tk
188 td(2) = (1.0/ql(2) + 1.0/qnl2)*tk
191 rm = max(rstar(1),rstar(2))
192 IF (ndec.GT.10000.AND.qperi.GT.4.0*rm)
THEN
194 de2(k) = 1000.0*de2(k)
195 de3(k) = 1000.0*de3(k)
208 e20 = e20 + eosc(k,ic)
209 e30 = e30 + eosc(j,ic)
210 eosc(k,ic) = eosc(k,ic)*exp(at(k))
211 eosc(j,ic) = eosc(j,ic)*exp(at(k))
212 edec(ic) = edec(ic) - (eosc(k,ic) + eosc(j,ic))
213 IF (iosc(ic).EQ.-1)
THEN
216 delta = twopi*
ran2(idum1)
218 eosc(k,ic) = eosc(k,ic) +
219 & 2.0*sqrt(eosc(k,ic)*de2(k))*cos(delta) + de2(k)
220 IF (iosc(ic).EQ.-1)
THEN
221 IF (k.EQ.2) iosc(ic) = 1
223 delta = twopi*
ran2(idum1)
225 eosc(j,ic) = eosc(j,ic) +
226 & 2.0*sqrt(eosc(j,ic)*de3(k))*cos(delta) + de3(k)
228 eosc(k,ic) = max(eosc(k,ic),0.0d0)
229 eosc(j,ic) = max(eosc(j,ic),0.0d0)
230 e2t = e2t + eosc(k,ic)
231 e3t = e3t + eosc(j,ic)
232 zjosc = zjosc + alf(k)*eosc(k,ic) + alf(j)*eosc(j,ic)
237 edec(ic) = edec(ic) + e20 + e30
240 hnew = (eb0(ic) - edec(ic) - (e2t + e3t))/zmu
243 semi1 = -0.5*bodyi/hnew
246 efac = (zj0(ic) - zjosc)/cj
247 ecc2 = 1.0 - efac**2/semi1
248 ecc2 = max(ecc2,eccm2)
250 peri1 = semi1*(1.0d0 - ecc1)
253 IF (hnew.GT.0.0)
THEN
257 IF (ic.EQ.nchaos)
THEN
261 WRITE (6,25) namex(i1), namex(i2), ndec, kicks, ecc, ecc1,
263 25
FORMAT (
' TERMINATED CHAOS NAM NDEC KICK E E1 A1 QP ',
264 & 2i6,2i4,2f8.4,1p,2e10.2)
265 ELSE IF (ecc.GT.1.0)
THEN
266 vinf = sqrt(2.0*hi)*vstar1
267 p = days*semi1*sqrt(semi1/bodyi)
268 WRITE (6,26) time+toff, namex(i1), namex(i2), ecc, ecc1,
270 26
FORMAT (
' CHAIN CAPTURE T NAM E E1 VINF A1 P ',
271 & f10.3,2i6,f9.5,f8.4,f5.1,1p,2e9.1)
275 IF (iosc(ic).EQ.1.OR.iosc(ic).EQ.-1)
THEN
276 IF (edec(ic).GT.-(ecrit(ic) - eb0(ic)))
THEN
278 WRITE (6,30) namex(i1), namex(i2), ndec, kicks, ecc1,
279 & semi1, ecrit(ic), edec(ic)
280 30
FORMAT (
' END CHAOS NAM NDEC KICKS E A ECRIT EDEC ',
281 & 2i6,2i5,f8.4,1p,3e10.2)
285 tosc(ic) = time + timec
290 eps = (2.0*ecrit(ic) - eb0(ic) + edec(ic))/(zmu*bodyi)
291 eccm = (1.0 + eps*br(ic))/(1.0 - eps*ar(ic))
292 IF (ecc1.LT.eccm)
THEN
296 WRITE (6,32) ndec, eps, eccm, ecc1
297 32
FORMAT (
' NEW KICK NDEC EPS ECCM E ',
298 & i5,1p,e10.2,0p,2f8.4)
311 IF (ecc1.LT.0.0021)
THEN
313 IF (ic.EQ.0) nchaos = nchaos - 1
319 IF (namex(i1) + namex(i2).EQ.ksave(2)) k = 1
320 IF (namex(i1) + namex(i2).EQ.ksave(4)) k = 3
323 ELSE IF (kstari.LT.0)
THEN
328 ksave(l+1) = namex(i1) + namex(i2)