Table of Contents

Name

ptreecode - parallel treecode

Synopsis

mpirun -np NN partree.exe Nbody_file Parameter_file Max_runtime

Description

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

Running

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.

Nbody_file

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:

fwrite(&m,sizeof(float),1,nbody_file_pointer);
fwrite(&x,sizeof(float),1,nbody_file_pointer);
fwrite(&y,sizeof(float),1,nbody_file_pointer);
fwrite(&z,sizeof(float),1,nbody_file_pointer);
fwrite(&vx,sizeof(float),1,nbody_file_pointer);
fwrite(&vy,sizeof(float),1,nbody_file_pointer);
fwrite(&vz,sizeof(float),1,nbody_file_pointer);


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

Parameter_file


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
theta
nsteps stepnum
t dt dtout dtcheck
nbody_file_prefix
Where,
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

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

Timing

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.

Limitations

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

Author

John Dubinski

Files

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

See Also

MPICH=http://www.mcs.anl.gov/mpi/

History


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


Table of Contents