HTML automatically generated with rman
Table of Contents

Name

nbody0, nbody00, nbody0h4 - direct summation Aarseth N-body integrator

Synopsis

nbody0 in=snap_in out=snap_out [keyword=value ...]

Description

nbody0 is the NEMO adaptation of version 0 (the Micky Mouse version) of Aarseth’s N-body integrator, as published in Appendix 4B of Binney & Tremaine (1987). It is a direct N-body integrator, i.e. for each particle it computes the force due to all other N-1 particles, hence the computational time grows approximately as N*N. Although also being referred to as a ’toy version’, it is a fully functional N-body integrator.

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: S.J. Aarseth, "Multiple Time Scales", ed. U.J. Brackhill & B.I. Cohen, pp377. Orlando: Academic Press. (1985).

An important input parameter to the program is the accuracy parameter eta (see also eta= below). The timestep, dt, chosen for a given particle is related to the force, F, and its time derivatives by dt = sqrt(eta * F / (d2Fdt2)), which is a slight modification of the criterion given by Aarseth in the above mentioned reference (but see also BUGS below on academic cases like the figure8 orbit).

A typical value of eta = 0.02 usually conserves the energy better than one part in 10000 over one crossing time, in the absence of close encounters.

nbody00 is the C version of nbody0, based on the f2c translated code (and hence will look odd and ugly in places). It has more debug output (debug=1 and higher) and also fixes problems with orbits like the Figure8 orbit (see BUGS below).

Parameters

The following parameters are recognized in any order when the keyword is also given
in=in_name
Input file in snapshot(5NEMO) format. Depending on how nbody0 was compiled, other input formats are supported. [no default].
out=out_name
Output file in snapshot format [no default].
eta=value
Accurracy parameter, which automatically determines the integration step. For small enough values of deltat the Heisenberg principle applies and the accuracy is determined by the integration step itself! [0.02].
deltat=value
Time interval of a major output. Although the timestep is determined from eta, the accurracy parameter, for small enough values of deltat= this parameter will determine the integration step, and hence accuracy. [Default: 0.25].
tcrit=value
Final integration time [2.0].
eps=value
Gravitational softening length [0.05].
reset=t|f
Selects if the integration time of the next particle to be advanced be reset to the requested output time if that preceded the integration time (see deltat=). This is highly recommended, as for high output frequencies (small deltat= cf. the eta-derived timestep dt) [t].
f3dot=t|f
Use higher order terms to determine the timestep from eta. In the determination of the timestep a simplified formulae using just F and F2DOT is used, which is what the original BT87 code uses. By setting this keyword higher order terms F3DOT (and also FDOT) are used, which mimic the behavior of nbody1(1NEMO) . This keyword was introduced to integrate nice orbits like the Figure8 orbit, in which both F and FDOT were 0 for the central particle. [f].
options=step
Miscellaneous control options, specified as a comma separated list of keywords. Currently implemented are: step, outputs the current timestep per particle in the Aux array of a snapshot(5NEMO) . Default: none.

Limitations

The code has a hardcoded maximum number of particles in the fortran and C code (File: nmax.h), change the relevant PARAMETER statement to whatever is required. Using NEMO install the Makefile macro NMAX can also be used to do this automatically and hence easily generate a new version with a different value for NMAX, e.g. make nmax NMAX=256 nbody0. The NDIM parameter should not be changed, and remains at 3.

Close encounters are not treated in any special way. See any of the modified versions of the Aarseth code (nbody2(1NEMO) ) or in case regularization is needed (see also newton0_reg in: newton0(1NEMO) ).

Timesteps are not recomputed until the current timestep has expired.

A side-effect of the variable and particle-unique timesteps is that the final snapshot will not be exactly identical for two runs with different choices of deltat.

In order to save time, all calculations in the fortran code (nbody0.f) can be done in single precision. A different version of nbody0.f is needed in this case. See code comments labeled ‘‘SED’’.

A C version is also available, as nbody0.c, though the Makefile needs the target nbody00 to install it. The user interface is as that of nbody0, except the keyword f3dot= was added.

Bugs

Starting time of initial conditions is (re)set to 0, even if the snapshot had another time.

nbody0 has a simple version of the time step criterion, which can fail in "academic" situations. For example, for the nice symmetric "figure8 orbit" (see $NEMODAT/figure8.dat), the integration will fail since the timestep for the 3rd particle blows up. Interestingly enough, some compilers (e.g. gnu) will happily work around this if optimization is turned on, but fail with pure debugging (OPT=-g) since only in this case the expression will compute as exactly 0.

Storage

A total of order 600.NMAX bytes is needed, for a given maximum of NMAX particles. This breaks down as follows:

The FORTRAN I/O code uses 10.NMAX double precision and 20.NMAX real storage units for a maximum compiled number of NMAX particles. On most machines this adds up to 160.NMAX bytes.

The C I/O code allocates space dynamically; and through limitations of the fortran code, a maximum of 100.NMAX double’s are needed, which means 400.NMAX bytes.

Author

Sverre Aarseth (F77), Peter Teuben (C)

Genealogy

The nbody* series of NBODY integrators were all originally written by Sverre Aarseth, and exist in many forms throughout the scientific community. The list below is a mere zeroth order approximation to the current state of affairs:
nbody0        Binney & Tremaine’s toy version, with NEMO interface 
nbody1           variable timestep; runbody1
nbody2         with Ahmad-Cohen scheme - (see also Benz et al, 1997); runbody2
nbody3          XXX
nbody4        ... for HARP
nbody5        with regularization handling triples & binaries  
nbody6         ... for new parallel machine
nbody7        ... secret

Nbody0h4

On Sverre’s CODES site, he also presents nbody0, a simple Compact fourth-order Hermite block-step code. We include it here as nbody0h4. This code has an unusual interface, in that it reads the input from standard input, the first line contains the usual
      N, ETA, DELTAT, TCRIT, EPS2
(though note the softening EPS is entered in the square value). This is followed by N lines of m,x,y,z,vx,vy,vz for each of the particles each. At some point in the future we may provide a wrapper for this.

Files


NEMO/src/nbody/evolve/aarseth/nbody0    official source code within NEMO
NEMO/usr/aarseth/                          SJA’s other nbodyX versions (not
all exported)

See Also

hackcode1(1NEMO) , runbody1(1NEMO) , runbody2(1NEMO) , gravidy(1NEMO) , snapshot(5NEMO) , atos(1NEMO) , stoa(1NEMO)

Binney, J. & Tremaine, S. Galactic Dynamics. Princeton Unversity Press (1987), pp678.

S.J.Aarseth, 1972, p.373 in: "Gravitational N-Body Problem", IAU Colloquium #10, M.Lecar (Ed.), Reidel, Dordrecht.

S.J.Aarseth, 1985, p.377 in: "Multiple Time Scales", U.J. Brackbill & B.I. Cohen (Eds.), Academic Press, Orlando.

S.J. Aarseth, 1999. "From NBODY1 to NBODY6: The Growth of an Industry" http://adsabs.harvard.edu/abs/1999PASP..111.1333A

S.J. Aarseth, 2003, "Gravitational N-Body Simulations : Tools and Algorithms" (Cambridge Univ. Press).

History


30-jun-89    V1.0 created + NEMO interfaces to fortran source    PJT
3-jul-89    V1.1 mods to f2c interface, name of keywords           PJT
24-jan-90    V1.2 all in double precision                         PJT
15-nov-91    fixed up pure nbody0_ff version                     PJT
20-may-92    -- also made the C (f2c) version available                PJT
2-apr-97    documentation updated for NEMO 2.4                     PJT
6-aug-97    V1.3 added options=                                      PJT
11-feb-98    V1.3a fixed array index bug for higher order term    PJT
21-jan-00    V1.4 added reset= to fix small deltat problem/bug    PJT
24-feb-04    V1.5 documented the academic figure8 orbit problem, fixed in nbody00    PJT
9-feb-19    added some docs on nbody0h4    PJT


Table of Contents