Nbody6
 All Files Functions Variables
fcloud.f
Go to the documentation of this file.
1  SUBROUTINE fcloud(I,FREG,FDR,KCASE)
2 *
3 *
4 * Force due to interstellar clouds.
5 * ---------------------------------
6 *
7  include 'common6.h'
8  common/clouds/ xcl(3,mcl),xdotcl(3,mcl),bodycl(mcl),rcl2(mcl),
9  & clm(mcl),clmdot(mcl),cldot,vcl,sigma,rb2,pcl2,
10  & tcl,stepcl,ncl,newcl
11  REAL*8 freg(3),fdr(3),a(6)
12 *
13 *
14 * Distinguish between standard case and initialization.
15  IF (kcase.EQ.1) THEN
16  rb3 = rb2*sqrt(rb2)
17 *
18 * Sum over all clouds.
19  DO 10 icl = 1,ncl
20  DO 5 k = 1,3
21  a(k) = xcl(k,icl) - x(k,i)
22  a(k+3) = xdotcl(k,icl) - xdot(k,i)
23  5 CONTINUE
24 *
25  rij2 = a(1)**2 + a(2)**2 + a(3)**2 + rcl2(icl)
26  a7 = bodycl(icl)/rb3
27  a8 = bodycl(icl)/(rij2*sqrt(rij2))
28  a9 = 3.0*(a(1)*a(4) + a(2)*a(5) + a(3)*a(6))/rij2
29 *
30 * Add cloud force & derivative but subtract the average field effect.
31  DO 8 k = 1,3
32  freg(k) = freg(k) + a(k)*a8 + (x(k,i) - rdens(k))*a7
33  fdr(k) = fdr(k) + (a(k+3) - a(k)*a9)*a8 + xdot(k,i)*a7
34  8 CONTINUE
35  10 CONTINUE
36  ELSE
37 *
38 * Obtain total cloud force & first derivative (for routine FPOLY1).
39  DO 20 icl = 1,ncl
40  DO 15 k = 1,3
41  a(k) = xcl(k,icl) - x(k,i)
42  a(k+3) = xdotcl(k,icl) - xdot(k,i)
43  15 CONTINUE
44 *
45  rij2 = a(1)**2 + a(2)**2 + a(3)**2 + rcl2(icl)
46  a8 = bodycl(icl)/(rij2*sqrt(rij2))
47  a9 = 3.0*(a(1)*a(4) + a(2)*a(5) + a(3)*a(6))/rij2
48 *
49 * Include direct cloud contributions but ignore the average field.
50  DO 18 k = 1,3
51  fr(k,i) = fr(k,i) + a(k)*a8
52  d1r(k,i) = d1r(k,i) + (a(k+3) - a(k)*a9)*a8
53  18 CONTINUE
54  20 CONTINUE
55  END IF
56 *
57  RETURN
58 *
59  END