Nbody6
 All Files Functions Variables
jacobi.f
Go to the documentation of this file.
1  SUBROUTINE jacobi(NESC)
2 *
3 *
4 * Jacobi escape criterion.
5 * ------------------------
6 *
7  include 'common6.h'
8 *
9 *
10 * Specify escape energy (tidal field or isolated system).
11  IF (kz(14).GT.0.AND.kz(14).LE.2) THEN
12  ecrit = -1.5*(tidal(1)*zmass**2)**0.333
13  ELSE
14  ecrit = 0.0
15  END IF
16 * Define current mean square velocity (= 0.5 initially).
17  v2m = 0.5*zmass/rscale
18 *
19 * Count all escapers.
20  nesc = 0
21  DO 60 i = ifirst,ntot
22  ri2 = (x(1,i) - rdens(1))**2 + (x(2,i) - rdens(2))**2 +
23  & (x(3,i) - rdens(3))**2
24  vi2 = xdot(1,i)**2 + xdot(2,i)**2 + xdot(3,i)**2
25  IF (ri2.GT.rscale**2) THEN
26  vc2 = zmass/sqrt(ri2) + ecrit
27  IF (vi2.LT.vc2) go to 60
28  ELSE
29 * Skip velocities below sqrt(2) times equilibrium value.
30  IF (vi2.LT.2.0*v2m + ecrit) go to 60
31  END IF
32  poti = 0.0
33  DO 55 j = ifirst,ntot
34  IF (j.EQ.i) go to 55
35  rij2 = 0.0
36  DO 52 k = 1,3
37  rij2 = rij2 + (x(k,i) - x(k,j))**2
38  52 CONTINUE
39  poti = poti + body(j)/sqrt(rij2)
40  55 CONTINUE
41  ei = 0.5*vi2 - poti
42  IF (ei.GT.ecrit) nesc = nesc + 1
43  60 CONTINUE
44 *
45  RETURN
46 *
47  END