Nbody6
 All Files Functions Variables
deform.f
Go to the documentation of this file.
1  SUBROUTINE deform(IPAIR,ECC0,ECC)
2 *
3 *
4 * Deformation of elliptic orbit.
5 * ------------------------------
6 *
7  include 'common6.h'
8 *
9 *
10 * Evaluate square regularized velocity.
11  v20 = 0.0
12  DO 10 k = 1,4
13  v20 = v20 + udot(k,ipair)**2
14  10 CONTINUE
15 *
16 * Form KS coordinate & velocity scaling factors at peri or apocentre.
17  i = n + ipair
18  semi = -0.5*body(i)/h(ipair)
19  IF (r(ipair).LT.semi) THEN
20  efac = (1.0 - ecc)/(1.0 - ecc0)
21  rnew = semi*(1.0 - ecc)
22  ELSE
23  efac = (1.0 + ecc)/(1.0 + ecc0)
24  rnew = semi*(1.0 + ecc)
25  rnew = efac*r(ipair)
26  END IF
27  c1 = sqrt(efac)
28  v2 = 0.5*(body(i) + h(ipair)*rnew)
29  IF(v2.LE.0.d0)THEN
30  c2 = 1.0d-06
31  ELSE
32  c2 = sqrt(v2/v20)
33  ENDIF
34 *
35 * Re-scale KS variables at constant energy to new eccentricity (ECC).
36  r(ipair) = 0.0d0
37 * Retain sign of radial velocity for unperturbed KS (apo or peri).
38  tdot2(ipair) = 0.0d0
39  DO 20 k = 1,4
40  u(k,ipair) = c1*u(k,ipair)
41  udot(k,ipair) = c2*udot(k,ipair)
42  u0(k,ipair) = u(k,ipair)
43  r(ipair) = r(ipair) + u(k,ipair)**2
44  tdot2(ipair) = tdot2(ipair) + 2.0*u(k,ipair)*udot(k,ipair)
45  20 CONTINUE
46 *
47 * Re-initialize KS polynomials for perturbed motion.
48  t0(2*ipair-1) = time
49  IF (list(1,2*ipair-1).GT.0) THEN
50  CALL resolv(ipair,1)
51  CALL kspoly(ipair,1)
52  ELSE
53 * Determine new interval for unperturbed motion (>= TK).
54  tk = twopi*semi*sqrt(semi/body(i))
55  CALL tpert(ipair,gmin,dt)
56 * Adopt c.m. step instead if integer argument exceeds 10**9.
57  IF (dt.LT.2.0e+09*tk) THEN
58  k = 1 + int(0.5d0*dt/tk)
59 * Restrict Kepler period to c.m. step (case of very wide orbit).
60  step(2*ipair-1) = float(k)*min(tk,step(i))
61  ELSE
62  step(2*ipair-1) = step(i)
63  END IF
64  END IF
65 *
66  RETURN
67 *
68  END