Table of Contents

Name

nbody1 - direct summation N-body integrator with variable timestep

Synopsis

nbody1 < parameter_file > log_file

Description

nbody1 is a direct N-body integrator, i.e. for each particle the force due to all other N-1 particles is calculated, hence the computational time grows approximately as N*N.

Each particle is followed with its own integration step - an essential feature when the dynamical times of different particles vary a lot. A complete description is given in Aarseth (1985).

This version is the formal release of the toy code, as published in Binney & Tremaine (1987)(see also nbody0(1NEMO) ), and was written by Sverre Aarseth.

Parameters

The input parameters are given in a small ASCII parameter_file (which can also be read from standard input) in the order as detailed below

Example input parameter_file for the standard internal benchmark (a 25-body problem integrated for 5 crossing times):

1 1.0                                 KSTART TCOMP
25 1 10 1                               N NFIX NRAND NRUN
0.02 1.0 5.0 2.0E-05 0.03                ETA DELTAT TCRIT QE EPS
1 0 0 0 1 1 0 0 0 0 0 0 0 0 0          KZ(J), J=1,15
2.5 5.0 1.0                            ALPHAS BODY1 BODYN
0.5 0.0 0.0 1.0 1.0                     Q VXROT VZROT RBAR ZMBAR
Note: the order of input lines may change depending on previous ones (KSTART and KZ’s in particular)

Definition of input parameters: (parameters with a * start on a new line; their type is the implicit FORTRAN specification: [I-N] for integers, [A-H,O-Z] for floating point parameters)

* KSTART
Control index (1: new run; >1: restart; >2: new params).
TCOMP
Maximum computing time in minutes, if the software knows how to compute it.
* N
Total particle number (the program is compiled with a maximum, NMAX)
NFIX
Output frequency, in terms of DELTAT, of data save or binaries (option 3 & 6).
NRAND
Random number sequence skip.
NRUN
Run identification index.
* ETA
Time-step accuracy parameter for total force polynomial.
DELTAT
Output time interval in units of the crossing time.
TCRIT
Termination time in units of the crossing time.
QE
Energy tolerance (stop if DE/E > 5*QE & KZ(2) <= 1; restart if KZ(2) > 1)
EPS
Softening parameter.
* KZ(J)
Non-zero options for alternative paths (see table below).
* ALPHAS
Power-law index for initial mass function. (option 4 not 2)
BODY1
Maximum particle mass (before scaling, if scaling option KJ(10) choosen).
BODYN
Minimum particle mass before scaling.
* Q
Virial ratio (Q = 0.5 for equilibrium).
VXROT
XY-velocity scaling factor (> 0 for solid-body rotation).
VZROT
Z-velocity scaling factor (not used if VXROT = 0).
RBAR
Virial radius in pc (for scaling to physical units).
ZMBAR
Mean mass in solar units.
* NFRAME
Maximum number of movie frames (option 7).
DELTAF
Time interval for movie output (in units of crossing time).
* XCM
Displacement for subsystem (option 8).
ECC
Eccentricity of relative motion for subsystem (ECC =< 1).
* SEMI
Semi-major axis of binary orbit (options 10 & 12).
ECC
Eccentricity of binary.

Definition of options KZ:

KZ(J)

  1  COMMON save on unit 1 if TCOMP > CPU or if TIME > TCRIT.
  2  COMMON save on unit 2 at output (=1); restart if DE/E > 5*QE <=2).
  3  Basic data written to unit 3 at output time (frequency NFIX). File:
OUT3
  4  Initial conditions on unit 4 (=1: output; =2: input; 3=input+output).
  5  Initial conditions (=0: uniform & isotropic; =1: Plummer law).
  6  Output of significant binaries on printout.
  7  Output of movie frames on unit 7 (read NFRAME, DELTAF).
  8  Generation of two subsystems (merger experiment) (read XCM, ECC).
  9  Individual bodies printed at output time (MIN(5**KZ9,N)).
 10  No scaling of initial conditions to physical units.
 11  Modification of ETA by tolerance QE.
 12  Initial parameters for binary orbit (read SEMI, ECC).
 13  Escaper removal (R > 2*RTIDE; RTIDE = 10*RSCALE).
 14  Adjustment of coordinates & velocities to c.m. condition.
 15  --read but not used--

Input Order

The order of the input lines is very important, and can depend on previous lines. Here’s a sketch that hopefully helps you in creating input parameter files. Basically there are two types of input files: 1) a new run, and 2) restart of an unfinished run.
read: KSTART, TCOMP
if KSTART=1 then          new run
    read: N, NFIX, NRAND, NRUN                            input.f
    read: ETA, DELTAT, TCRIT, QE, EPS                     input.f
    read: KZ(J),J=1,15                                    input.f
    if KZ(4)=2 then
        read(unit 4)                                      data.f
    else
        read: ALPHAS, BODY1, BODYN                        data.f
    endif
    if KZ(12)>0 then
        read: SEMI, ECC                                   data.f
    endif
    read: Q, VXROT, VZROT, RBAR, ZMBAR                    scale.f
    if KZ(7)>0 then
        read: NFRAME, DELTAF                              scale.f
    endif
    
    if KZ(8)>0 then
        read: XCM, ECC                                    subsys.f
    endif
else 
    read (unit=1)       restart                 nbody1.f
    if (KSTART>2)       restart with new parameters
        if KSTART=4 then
            ...
        else
            read: DELTAT, TNEXT, TCRIT, QE, J, KZ(J)       modify.f
        endif
        if KSTART>=4 then
            read: ETA                                     modify.f
        endif
    endif
endif

Benchmark

The following machines have been used to time this routine on the standard benchmark as described in the PARAMETERS section before:
machine                 cpu(sec)    compiler/options
DEC DS3000/400-alpha           1.6
CONVEX C3                    1.94    -O0
CONVEX C3                   1.72    -O1
CONVEX C3                     1.21    -O2 (+vect)
CONVEX C3                    2.98    -O3 (+paral)
Indigo 1                         2.3
DEC 5000/240                   3.8
SS10/30                          4.1             
SS2 4/...                        9.3
SS1 4/60                       20.6
SUN 3/60                        71.7              

Author

Sverre Aarseth

Files


fort.1    common block restart dump file (option 1)
fort.2    common block restart dump file (option 2)
OUT3    output file (option 3)
fort.4    initial conditions input or output file  (option 4)
fort.7    formatted frame files (option 7)

See Also

u3tos(1NEMO) , u4tos(1NEMO) , stou4(1NEMO)

Aarseth, S.J. IAU colloquium 16, The Gravitational N-Body Problem, ed. M. Lecar, p.373.

Direct Methods for N-Body Simulations by S.J. Aarseth in: Multiple Time Scales, eds. J.U. Brackbill & B.L. Cohen, Academic Press, p. 377 (1984).

NBODY0 source code in Binney & Tremaine’s Galactic Dynamics (Princeton University Press, 1987). pp.678.

Small-N Systems by S.J. Aarseth in: XXX eds. Benz, Barnes and XXX (to be published, 1994)

History


6-apr-93    manual page written    PJT
9-apr-93    unit.4 I/O now full REAL*4    PJT/SJA
25-may-93    man    PJT
26-mar-94    man    PJT
18-dec-99    1/2 bug fix in ALPHAS line in define.f    PJT/SJA/xxx


Table of Contents