This HTML automatically generated with rman for NEMO
Table of Contents

Name

treecode1 - Hierarchical N-body code (theta scan)

Synopsis

treecode1 [parameter=value]

Description

treecode1 is NEMO’s adaptation of treecode, a a program for self-consistent N-body simulation. It is faster than previous codes, and generally provides better error control. Preliminary timing tests show that treecode is indeed about a factor of two faster than the BH86 code (see hackcode1(1NEMO) ) at a fixed level of accuracy; it also outperforms other versions of that algorithm (Barnes 1998). Moreover, it is significantly more robust when presented with ‘perverse’ mass distributions (Salmon & Warren 1994).

Parameters

The following parameters are recognized in any order if the keyword is also given:
in=
if given, names an input file containing initial conditions for the calculation. The format of this file is described below.
out=
If given, is a pattern naming output files for N-body snapshots taken at regular intervals. This pattern is used as an argument to sprintf, along with the integration step number, to generate an actual file name. If the resulting file already exists, the new data is appended. The format used is similar to the format used for input files. See below.
dtime=
is the integration time-step. It’s convenient to use a timestep which has an exact representation as a floating-point number; for example, a value n/d, where n is an integer and d is a power of two. To simplify specification of such timesteps, the code accepts fractions as well as ordinary floating-point values. If dtime=0, treecode does a single force calculation, outputs the result, and exits. [1/32]
eps=
is the smoothing length used in the gravitational force calculation. In effect, the mass distribution is smoothed by replacing each body by a Plummer sphere with scale length eps, and the gravitational field of this smoothed distribution is calculated. [0.025]
theta=
is the opening angle used to adjust the accuracy of the force calculation. Values less than unity produce more accurate forces, albeit at greater computational expense. The QUICKSCAN version does not use or accept this parameter. [1.0]
usequad=
determines if quadrupole corrections are used when calculating gravitational fields. These corrections can significantly improve the accuracy of force calculation at a fairly modest computational cost. [false]
options=
is a list of comma-separated key words used to obtain various run-time options. The options available are : reset-time: set the time to zero, regardless of the value in the input file; new-tout: reschedule the first snapshot output; out-phi: include potential values in the output files; out-acc: include acceleration vectors in the output files; bh86: use the BH86 criterion to set critical cell radii; sw94: use Salmon & Warren’s (1994) bmax criterion to set critical cell radii.
tstop=
is the time at which the N-Body integration terminates. [2.0]
dtout=
is the time interval between output files. To insure that outputs are performed when expected, dtout should be a multiple of dtime. Like dtime, this parameter may be specified as a fraction. [1/4]
nbody=
is the number of bodies used to self-generate initial conditions. This parameter is only used if no input or restore file is given. [4096]
seed=
is the random number seed used to self-generate initial conditions. This parameter is only used if no input or restore file is given. [123]
save=
Write state file as code runs. Not used in NEMO yet.
restore=
Continue run from state file. Not used in NEMO yet.

Examples

For example, to run a test calculation using a Plummer model with 32768 bodies and an opening angle of 0.75, type
    % treecode nbody=32768 theta=0.75
To compute forces and potentials for a N-body configuration in the input file input.data, writing the result to output file forces.data, type % treecode input.data forces.data dtime=0 options=out-phi,out-acc
To run the initial conditions in input.data with a timestep of 1/64, writing results at intervals of 1/16 to separate files run_000.data, run_004.data, ..., type
    % treecode input.data run_%03d.data dtime=1/64 dtout=1/16

To perform the same calculation using the QUICKSCAN version, while saving the program’s state after each step, type

    % treecode_q input.data run_%03d.data dtime=1/64 dtout=1/16 save=state.data
To continue this calculation until time 4, type
    % treecode_q restore=state.data out=run_%03d.data tstop=4

Performance

The standard benchmark uses nbody=4096 bodies, a timestep of dtime=1/32, a smoothing length of eps=0.025, an accuracy parameter theta=1.0, and no quadrupole moments. A log of the calculation is sent to standard output; no other output is generated. On a 500 MHz Pentium, this test calculation takes about 1.2 minutes.
    mkplummer std4k 4096 seed=123
    stoa std4k std4k.tab
    time treecode1 std4k.tab > std4k.log

Data Format

The data format used for in= and out= depends on the compilation option. If compiled with the USE_NEMO_IO flag, the dataformat is in snapshot(5NEMO) format, with a separate Position and Velocity, instead of the original PhaseSpace

Compilation

The code can be compiled with various flags that will change the behavior of the code:
USE_NEMO_IO    use NEMO I/O, thus snapshots (default in NEMO), instead of the
"205" format (atos) 
BINARYIO    use binary output, complementary to the non-NEMO ascii I/O (default:
none)
USEFREQ        use freq,freqout instead of dtime,dtout (the default)
QUICKSCAN    use the theta= accuracy parameter (the default) instead of a theta-scan

See Also


hackcode1(1NEMO), treecode(1NEMO), atos(1NEMO), snapshot(5NEMO)
http://www.ifa.hawaii.edu/faculty/barnes/treecode/treeguide.html

Files

src/nbody/evolve/hackcode/treecode1

Author

Joshua Barnes, Peter Teuben (NEMO adaptation)

Update History


1999           written, Tokyo, Japan    JEB
22-jun-01    V1.4 NEMO adaptation    PJT
25-apr-04    V1.4.2 added USE_NEMO_IO to do snapshot I/O    PJT


Table of Contents