Nbody6
xtrnld.f
Go to the documentation of this file.
1  SUBROUTINE xtrnld(I1,I2,KCASE)
2 *
3 *
4 * External force & derivatives.
5 * -----------------------------
6 *
7  include 'common6.h'
8  REAL*8 xi(3),xidot(3),firr(3),freg(3),fd(3),fdr(3)
9 *
10 *
11 * See whether to include the standard or point-mass tidal force.
12  IF (kz(14).LE.2.AND.kcase.EQ.1) THEN
13 * Include tidal force & first derivative (I1 = I2 for single body).
14  DO 10 i = i1,i2
15  fi(1,i) = fi(1,i) + tidal(4)*xdot(2,i)
16  fi(2,i) = fi(2,i) - tidal(4)*xdot(1,i)
17  fr(1,i) = fr(1,i) + tidal(1)*x(1,i)
18  fr(3,i) = fr(3,i) + tidal(3)*x(3,i)
19  d1(1,i) = d1(1,i) + tidal(4)*(fi(2,i) + fr(2,i))
20  d1(2,i) = d1(2,i) - tidal(4)*(fi(1,i) + fr(1,i))
21  d1r(1,i) = d1r(1,i) + tidal(1)*xdot(1,i)
22  d1r(3,i) = d1r(3,i) + tidal(3)*xdot(3,i)
23  10 CONTINUE
24  END IF
25 *
26  IF (kz(14).LE.2.AND.kcase.EQ.2) THEN
27 * Add the second and third derivatives due to the tidal field.
28  DO 20 i = i1,i2
29  d2(1,i) = d2(1,i) + tidal(4)*fdot(2,i)
30  d2(2,i) = d2(2,i) - tidal(4)*fdot(1,i)
31  d2r(1,i) = d2r(1,i) + tidal(1)*f(1,i)
32  d2r(3,i) = d2r(3,i) + tidal(3)*f(3,i)
33  d3(1,i) = d3(1,i) + tidal(4)*(d2(2,i) + d2r(2,i))
34  d3(2,i) = d3(2,i) - tidal(4)*(d2(1,i) + d2r(1,i))
35  d3r(1,i) = d3r(1,i) + tidal(1)*fdot(1,i)
36  d3r(3,i) = d3r(3,i) + tidal(3)*fdot(3,i)
37  20 CONTINUE
38  END IF
39 *
40 * Check options for galactic potential (called from FPOLY1).
41  IF (kz(14).GE.3.AND.kcase.EQ.1) THEN
42 * Obtain regular force components for 3D galaxy or Plummer model.
43  DO 30 i = i1,i2
44  DO 25 k = 1,3
45  xi(k) = x(k,i)
46  xidot(k) = xdot(k,i)
47  firr(k) = 0.0
48  fd(k) = 0.0
49  freg(k) = 0.0
50  fdr(k) = 0.0
51  25 CONTINUE
52  CALL xtrnlf(xi,xidot,firr,freg,fd,fdr,1)
53  DO 28 k = 1,3
54  fr(k,i) = fr(k,i) + freg(k)
55  d1r(k,i) = d1r(k,i) + fdr(k)
56  28 CONTINUE
57  30 CONTINUE
58 *
59  END IF
60 *
61  RETURN
62 *
63  END