Nbody6
 All Files Functions Variables
setup2.f
Go to the documentation of this file.
1  SUBROUTINE setup2
2 *
3 *
4 * Initial conditions in astrophysical units (#22 = -1).
5 * -----------------------------------------------------
6 *
7  include 'common6.h'
8 *
9 *
10 * Define GM & PC in cgs units and AU in pc (if preferred).
11  gm = 6.67d-08*1.989d+33
12  pc = 3.0857d+18
13  au = 2.0627e+05
14 * Define RBAR (use appropriate value if N-body units skipped in SCALE).
15  rbar = 1.0
16 *
17 * Read initial conditions from unit #10.
18  zmass = 0.0
19  DO 10 i = 1,n
20  READ (10,*) body(i), (x(k,i),k=1,3), (xdot(k,i),k=1,3)
21  zmass = zmass + body(i)
22  10 CONTINUE
23 *
24 * Form velocity scale in km/sec from mass in Msun & X,Y,Z in pc.
25  vstar = 1.0d-05*sqrt(gm/pc)
26  vstar = vstar*sqrt(zmass/rbar)
27 *
28 * Convert to N-body units before optional virial theorem scaling.
29  DO 20 i = 1,n
30  body(i) = body(i)/zmass
31  DO 15 k = 1,3
32  x(k,i) = x(k,i)/rbar
33  xdot(k,i) = xdot(k,i)/vstar
34  15 CONTINUE
35  20 CONTINUE
36 * Note: setting KZ(5) = 3 skips scaling to N-body units (ensure RBAR).
37 *
38  RETURN
39 *
40  END