Table of Contents


ptreecode - parallel treecode


mpirun -np NN partree.exe Nbody_file Parameter_file Max_runtime


ptreecode is a parallel version of the treecode, using MPI.


partree.exe does not use NEMO’s user interface. It simply takes 3 command line arguments. On most MPI systems, you run the code with:
    mpirun -np NN partree.exe Nbody_file Parameter_file Max_runtime
where NN is the number of processors (must be 2^n i.e 1, 2, 4, 8, 16, 32 etc.)

On different systems, the number of processors may be specified in different ways e.g. on the T3D, you would use

    partree.exe -npes NN Nbody_file Parameter_file Max_runtime
but, on the T3E you would instead use
    mpprun -nNN partree.exe etc.

The 3 command line arguments are:

Nbody_file     - the nbody data for the run (see below)
Parameter_file - input parameters for the run (see below)
Max_runtime    - maximum run time in seconds
                 After this time has elapsed the code will 
                 finish the step its working on, output the data 
                 and exit.  This is useful on parallel batch 
                 queues which have fixed time limits.  
                 Max_runtime can be set to the time
                 limit minus 10 minutes or some other value so 
                 the program will exit cleanly and dump the last 
                 completed step before the time limit is reached.


The N-body file format is binary, and very basic. Each particle has a mass, a position and a velocity given by the 7 values m, x, y, z, vx, vy, vz. The gravitational constant, G=1, so your input masses should be calculated with this mind. The format is simply a list of N of these 7 4-byte IEEE floating point vectors in C written as follows:


WARNING: On Dec Alpha’s and IBM’S the byte order for 4-byte IEEE floats 
is reversed (big_endian vs. little_endian or vice versa) so if 
you generate data on a DEC Alpha you will need to reverse the byte 
order from 1234 to 4321 for the data to be recognized on machines 
that use standard byte ordering for IEEE.
The program swapbytes (src is swapbytes.c) will reorder the bytes for you,
the NEMO program bswap does the same thing:

    bswap in=in_file out=out_file len=4


This file format is also rather simple.  You are
allowed to assign different softening lengths to the particles if you wish.
The first nsoft1 particles get the length rsoft1, the second nsoft2
particles get rsoft2 etc.  Here it is:
nparticles  nsoftenings
nsoft1 rsoft1
nsoft2 rsoft2
nsoftn rsoftn
nsteps stepnum
t dt dtout dtcheck
nparticles  - number of particles
nsoftenings - number of particle softening lengths
nsofti      - number of particles with the i’th softening length, rsofti
rsofti      - the i’th softening length
theta       - opening angle for the treecode 
              recommended values are 0.9 < theta < 1.2
              smaller values give more accurate forces and longer runs
              1.2 gives error in forces around 1%.
nsteps      - number of steps
stepnum     - current step number
t           - current simulation time
dt          - leapfrog timestep
dtout       - output time interval
dtcheck     - checkpoint output time interval (not used currently)
nbody_file_prefix - what it says


Output is more nbody and parameter files with an index showing the appropriate step number. These files can be used to restart the code.

The file ‘‘Report’’ is also output and gives diagnostics of momentum and energy conservation of the code at each time step. Some sample output is

t 0 P -0.508763 0.808938 0.0532085 J 20.4152 -41.709 -113.745 be, ke, pe 2*ke/pe -19.8647

24.8928 -44.7575 -1.11234

t - current time
P - total system momentum (Px,Py,Pz)
J - total system angular momentum (Jx,Jy,Jz)
ke - total kinetic energy
pe - total potential energy
be - ke+pe - total binding energy - should be conserved
2*ke/pe - virial ratio - for virialized systems = -1.0


Integrating a Plummer sphere of 128 (?check?) particles with accuracy eta=0.02 for about a crossing time (T=0 to T=2) takes about XX minutes on a SUN 3/60 with a simple f68881 floating point chip.


This release does not include the cosmological, periodic boundary version of the code.


John Dubinski


~/src/nbody/evolve/ptreecode    source code, and an example testrun

See Also



xx-mar-01    First Public Release within NEMO    John Dubinski   
26-apr-01    man page written for NEMO    PJT

Table of Contents