1 SUBROUTINE higrow(I,IG,IM,ECC,SEMI,EMAX,EMIN,TG,EDAV,ZI,IQ)
8 common/binary/ cm(4,mmax),yrel(3,mmax),zrel(3,mmax),
9 & hm(mmax),um(4,mmax),umdot(4,mmax),tmdis(mmax),
10 & namem(mmax),nameg(mmax),kstarm(mmax),iflagm(mmax)
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),zm(2,ntmax),iosc(ntmax),
15 common/slow0/ range,islow(10)
16 common/tidal/ cq(2),ct(2),cgr,dedt
17 common/rksave/ coeff,hohat(3),e0,a0,hh,xmb
18 REAL*8 a1(3),a2(3),xrel(3),vrel(3),ei(3),hi(3),ho(3),bhat(3),
19 & ui(4),v(4),evec(3),xr0(3),vr0(3),ei0(3),ww(6),w(4)
20 REAL*8 bodyi(2),qg(2),wg(2)
22 DATA ww /2.119,3.113,8.175,3.742,4.953,9.413/
23 SAVE icall,itime,itry,namei,dtprev,tcheck,zfac,pmin1
24 DATA icall,itry,namei,tcheck /0,0,0,0.0d0/
34 CALL
ksphys(ui,v,xrel,vrel)
65 a1(k) = xrel(k1)*vrel(k2) - xrel(k2)*vrel(k1)
66 a2(k) = (x(k1,jcomp) - x(k1,i))*(xdot(k2,jcomp) - xdot(k2,i))
67 & - (x(k2,jcomp) - x(k2,i))*(xdot(k1,jcomp) - xdot(k1,i))
70 a1a2 = a1a2 + a1(k)*a2(k)
71 ri2 = ri2 + xrel(k)**2
72 vi2 = vi2 + vrel(k)**2
73 rvi = rvi + xrel(k)*vrel(k)
77 zmb = body(i) + body(jcomp)
78 semi1 = -0.5*zmb/h(ipair)
79 ecc2 = (1.0 - r(ipair)/semi1)**2 + tdot2(ipair)**2/(semi1*zmb)
82 fac = a1a2/sqrt(a12*a22)
83 IF(fac.LT.-1.d0.OR.fac.GT.1.d0)
THEN
84 IF(fac.LT.-1.05d0.OR.fac.GT.1.05d0)
THEN
85 WRITE (6,9) ipair, i, jcomp, ecc1, semi1*su, fac
86 9
FORMAT (
' WARNING! HIGROW FAC: IP I J E A FAC ',
93 cc = (1.0 - ecc**2)*cos(zi)**2
98 ei(k) = (vi2*xrel(k) - rvi*vrel(k))/body(i) -
103 ei2 = min(ei2,0.9999d0)
109 ei(k) = ei(k)/sqrt(ei2)
110 hi(k) = a1(k)/sqrt(a12)
111 ho(k) = a2(k)/sqrt(a22)
112 cosj = cosj + hi(k)*ho(k)
113 sjsg = sjsg + ei(k)*ho(k)
124 bhat(k) = hi(k1)*ei(k2) - hi(k2)*ei(k1)
125 ah = ah + ei(k)*ho(k)
126 bh = bh + bhat(k)*ho(k)
130 a = cosj*sqrt(1.0 - ei2)
131 z = (1.0 - ei2)*(2.0 - cosj**2) + 5.0*ei2*sjsg**2
134 z2 = z**2 + 25.0 + 16.0*a**4 - 10.0*z - 20.0*a**2 - 8.0*a**2*z
135 emax = one6*(z + 1.0 - 4.0*a**2 + sqrt(z2))
136 emax = max(emax,0.0001d0)
142 az1 = 1.0 + z - 4.0*a**2
143 emin2 = one6*(az1 - sqrt(az1**2 - 12.0*az))
145 emin2 = 1.0 - 0.5*(a**2 + z)
147 emin2 = max(emin2,0.0001d0)
151 tk = twopi*semi*sqrt(semi/body(i))
152 tk1 = twopi*abs(semi1)*sqrt(abs(semi1)/zmb)
153 tg = tk1**2*zmb*(1.0 - ecc1**2)**1.5/(body(jcomp)*tk)
163 yfac = 15.0*body(jcomp)/(4.0*zmb)*twopi*tk/tk1**2
164 yfac = yfac*ecc*sqrt(1.0 - ecc**2)/(1.0 - ecc1**2)**(1.5)
168 qperi = semi*(1.0 - ecc)
169 pmin = semi*(1.0 - emax)
170 rm = max(radius(i),radius(ig),1.0d-20)
171 IF (kstarm(im).GE.0.AND.emax.LT.0.9)
THEN
177 IF (emax.GE.0.9)
THEN
178 CALL
hicirc(pmin,emax,i,ig,bodyi,tg,tc,ec,edt,w)
179 IF (tc.GT.2000.OR.(ecc.LT.0.1.AND.emax.LT.0.95))
THEN
186 IF (name(i).EQ.namei.AND.(time+toff).GT.tcheck)
THEN
187 WRITE (6,17) name(i), ecc, emax, alph, zfac, ecc1, pmin1,
189 17
FORMAT (
' ECCMOD UNSTAB NM E EX IN YF E1 PM PC ',
190 & i6,2f8.4,f7.1,f6.2,f7.3,1p,2e10.2)
196 IF (ecc.GT.0.9.AND.edav.GT.0.0)
THEN
197 CALL
hicirc(qperi,ecc,i,ig,bodyi,tg,tc,ec,edt,w)
198 IF (tc.LT.2000.0)
THEN
210 IF (qperi.LT.2.0*rm) icoll = .true.
213 IF ((kstarm(im).GE.0.AND.edav.GT.0.0.AND.
214 & (dedt.LT.0.0.OR.ecc.GT.abs(emax-0.00005))).OR.icoll)
THEN
216 CALL
hicirc(qperi,ecc,i,ig,bodyi,tg,tc,ec,edt,w)
218 IF (tc.LT.7.0d+04.AND.qperi.LT.6.0*rm.AND.itry.LT.4.OR.
219 & tc.LT.1.0d+04.AND.qperi.LT.5.0*rm.AND.itry.LT.8)
THEN
220 WRITE (6,18) ecc, emax, emin, semi*su, tg, tc, edav,
222 18
FORMAT (
' HICIRC TRY: E EX EM A TG TC EDA EDT QP/R ',
223 & 2f9.5,f7.3,f7.1,1p,5e9.1)
226 IF (itry.GT.8) itry = 0
229 IF (tc.GT.2000.0) go to 25
232 eb = -0.5*cm(1,im)*cm(2,im)/a0
233 cj = cm(1,im)*cm(2,im)/body(i)*sqrt(body(i))
234 zj = cj*sqrt(qperi*(1.0 + ecc))
247 IF (kstar(ik).EQ.3.OR.kstar(ik).EQ.5)
THEN
249 CALL
giant3(ik,bodi,wg,qg,xn,ql)
253 IF (kstar(ik).GE.3) ip = 2
254 IF (kstar(ik).EQ.4.OR.kstar(ik).EQ.6) ip = 3
255 IF (kstar(ik).EQ.0) ip = 1
260 CALL
chaos0(qperi,ecc,eb,zj,cm(1,im),cm(2,im),radius(i),
261 & radius(ig),w,ecrit(ic),ar(ic),br(ic),idis)
265 WRITE (6,22) ttot, name(i), ic, ecc, emax, semi, qperi,
267 22
FORMAT (
' ECCMOD CHAOS T NAM IC E EX A QP EDAV QP/R ',
268 & f9.2,i6,i4,2f9.5,1p,4e10.2)
274 ELSE IF (idis.EQ.-1)
THEN
275 WRITE (6,23) ttot, name(i), ic, ecc, emax, semi, qperi,
277 23
FORMAT (
' ECCMOD SPIRAL T NAM IC E EX A QP EDAV QP/R ',
278 & f9.2,i6,i4,2f9.5,1p,4e10.2)
284 ELSE IF (idis.EQ.1)
THEN
286 IF (qperi.LT.radius(i) + radius(ig))
THEN
287 WRITE (6,24) ttot, name(i), ic, ecc, semi, qperi, edav,
289 24
FORMAT (
' ECCMOD DISRUPT T NAM IC E A QP EDAV QP/R ',
290 & f9.2,i6,i4,f8.4,1p,4e10.2)
302 xr0(k) = x(k,jcomp) - x(k,i)
303 vr0(k) = xdot(k,jcomp) - xdot(k,i)
304 rv0 = rv0 + xr0(k)*vr0(k)
305 v20 = v20 + vr0(k)**2
311 ei0(k) = (v20*xr0(k) - rv0*vr0(k))/zmb - xr0(k)/sqrt(rr)
315 IF (list(1,i).EQ.0)
THEN
321 dt0 = 0.98*float(islow(imod))*tk1
326 dt1 = min(dt0,0.1*tg*sqrt(1.0 - ecc**2)/tstar)
327 IF (dtsum + dt1.GT.dt0) dt1 = dt0 - dtsum + 1.0d-12
330 dtm = time - max(tev0(i),tev0(ig))
331 IF (name(i).NE.namei.OR.dtm.LE.dt0)
THEN
332 CALL
qtides(i,ig,im,semi,ecc)
336 nst = nstab(semi,semi1,ecc,ecc1,zi,bodyi(1),bodyi(2),zm3)
338 pcrit = 0.98*qperi*(1.0 - pert)
339 pcr =
stability(bodyi(1),bodyi(2),zm3,ecc,ecc1,zi)
342 IF (pcr.LT.0.5*pcrit)
THEN
345 IF (pcrit.LT.pcr.AND.pert.LT.0.01.AND.
347 alph = 360.0*zi/twopi
348 fail = qperi*(1-pert) - pcr
349 WRITE (6,42) ttot, alph, ecc, ecc1, qperi, fail, pert
350 42
FORMAT (
' NEWSTAB T INC EI EO QP FAIL PERT ',
351 & f7.1,f7.2,2f8.4,1p,3e10.2)
356 pmin1 = semi1*(1.0 - ecc1)
357 IF (pmin1.LT.pcrit)
THEN
358 nk = 1 + 10.0*ecc1/(1.0 - ecc1)
359 tcheck = time + toff + nk*tk1
366 ge=30*ecc+45*ecc**3+3.75*ecc**5
369 slr=semi*(1.0 - ecc**2)
370 zq=ge/(slr**5*semi*sqrt(semi))
372 zq = zq*(1.0 - ecc**2)
373 edq = zq*(cq(1) + cq(2))
375 zgr = cgr/(slr*semi*sqrt(semi))
380 IF (ecc.LT.0.90.AND.itime.EQ.0)
THEN
381 IF (min(tq,tgr)*tstar.LT.tg)
THEN
388 IF (kstarm(im).GE.0.AND.ecc.GT.0.9)
THEN
395 dt = 0.5*sqrt(tk*min(tg/tstar,tq))
396 IF (ecc.GT.0.98) dt = 0.1*dt
397 dt = min(dt,0.001/(abs(edav) + 1.0d-20))
400 dt = min(dt,1.0d-03*tg/tstar)
402 dt = min(dt,2.0d0*dtprev)
406 etry = ecc + edav*dt1
407 IF (ecc.GT.0.96.AND.etry.GT.0.98)
THEN
408 etry = min(etry,emax)
409 qptry = semi*(1.0 - etry)
410 CALL
hicirc(qptry,etry,i,ig,bodyi,tg,tc,ec,edt,w)
418 IF (qperi.LT.5.0*rm.AND.edav.GT.0.0.AND.kstarm(im).GE.0)
THEN
420 dtt = (qperi - 4.0*rm)/(semi*edav)
427 CALL
himod(evec,a1,zm3,zmb,ei0,a2,icall,dt1,dt,ecc,xrel,vrel)
437 IF (dtsum.LT.dt0) go to 4
440 neint = neint + itime
441 tmdis(im) = time + dtsum
444 40
IF (itime.GT.0)
THEN
445 CALL
physks(xrel,vrel,ui,v)
448 umdot(k,im) = 0.25*v(k)
454 hm(im) = -0.5d0*body(i)/a0
456 zmu = cm(1,im)*cm(2,im)/body(i)
457 decorr = zmu*(hm0 - hm(im))
458 emerge = emerge - decorr
459 ecoll = ecoll + decorr
460 egrav = egrav + decorr
462 IF (e0.LT.0.002)
THEN
465 IF (km.LT.0) ncirc = ncirc + 1
467 tev(n+ipair) = min(tev(i),tev(ig)) - 2.0*stepx
468 tb = days*semi*sqrt(semi/body(i))
469 alph = zi*360.0/twopi
470 WRITE (6,48) name(i), name(ig), km, e0, a0*su, tb, alph
471 48
FORMAT (
' END KOZAI NM K* E A P INC ',
472 & 2i6,i4,f7.3,f6.1,2f7.1)
477 IF (namec(k).EQ.nzero - namem(im)) ic = k
481 rp(ic) = a0*(1.0 - ecc)
485 WRITE (6,60) ttot, tmdis(im), ecc, rp(ic), dh
486 60
FORMAT (
' UPDATE: T TMD E RP DH ',
487 & 2f10.2,f8.4,1p,2e10.2)