  We present an implementation of Smoothed Particle Hydrodynamics (SPH) in an
adaptive-mesh PPPM algorithm. The code evolves a mixture of purely
gravitational particles and gas particles. The code retains the desirable
properties of previous PPPM--SPH implementations; speed under light clustering,
naturally periodic boundary conditions and accurate pairwise forces. Under
heavy clustering the cycle time of the new code is only 2--3 times slower than
for a uniform particle distribution, overcoming the principal disadvantage of
previous implementations\dash a dramatic loss of efficiency as clustering
develops. A 1000 step simulation with 65,536 particles (half dark, half gas)
runs in one day on a Sun Sparc10 workstation. The choice of time integration
scheme is investigated in detail. A simple single-step Predictor--Corrector
type integrator is most efficient. A method for generating an initial
distribution of particles by allowing a a uniform temperature gas of SPH
particles to relax within a periodic box is presented. The average SPH density
that results varies by $\sim\pm1.3$\%. We present a modified form of the
Layzer--Irvine equation which includes the thermal contribution of the gas
together with radiative cooling. Tests of sound waves, shocks, spherical infall
and collapse are presented. Appropriate timestep constraints sufficient to
ensure both energy and entropy conservation are discussed. A cluster
simulation, repeating Thomas and
