  We describe PTreeSPH, a gravity treecode combined with an SPH hydrodynamics
code designed for massively parallel supercomputers having distributed memory.
Our computational algorithm is based on the popular TreeSPH code of Hernquist &
Katz (1989). PTreeSPH utilizes a domain decomposition procedure and a
synchronous hypercube communication paradigm to build self-contained subvolumes
of the simulation on each processor at every timestep. Computations then
proceed in a manner analogous to a serial code. We use the Message Passing
Interface (MPI) communications package, making our code easily portable to a
variety of parallel systems. PTreeSPH uses individual smoothing lengths and
timesteps, with a communication algorithm designed to minimize exchange of
information while still providing all information required to accurately
perform SPH computations. We have additionally incorporated cosmology, periodic
boundary conditions with forces calculated using a quadrupole Ewald summation
method, and radiative cooling and heating from a parameterized ionizing
background following Katz, Weinberg & Hernquist (1996). The addition of other
physical processes, such as star formation, is straightforward. A cosmological
simulation from z=49 to z=2 with 64^3 gas particles and 64^3 dark matter
particles requires ~6000 node-hours on a Cray T3D, with a communications
overhead of ~10% and is load balanced to a ~90% level. When used on the new
Cray T3E, this code will be capable of performing cosmological hydrodynamical
simulations down to z=0 with ~2x10^6 particles, or to z=2 with ~10^7 particles,
in a reasonable amount of time. Even larger simulations will be practical in
situations where the matter is not highly clustered or when periodic boundaries
are not required.
