Variable Smoothing Lengths and Energy Conservation in Smoothed Particle   Hydrodynamics
  We present a new formulation of the equations of motion used in smoothed particle hydrodynamics (SPH). The spatial resolution in SPH is determined by the smoothing length, $h$, and it has become common practice for each particle to be given its own adaptive smoothing length, $h_i$. Consequently, the dynamic range that may be spatially resolved is greatly increased, but additional ($\nabla h$) terms, which account for the variability of the smoothing lengths, should appear in the equations of motion in order to satisy conservation requirements. Previous implementations of SPH have neglected these additional terms, whereas we have included them. This is achieved by defining a functional form for the $h_i$s, that depends on inter-particle distances only, and then deriving the equations of motion using a Hamiltonian formalism. A number of test calculations are presented. We find that including the $\nabla h$ terms has no detrimental effect on the ability of SPH to model known problems with reasonable accuracy. For problems where the energy conservation was rather poor, including the $\nabla h$ terms results in a dramatic improvement. In particluar non-conservation of energy during a collision between two polytropes can occur at the level of 10% when the $\nabla h$ terms are neglected. When the $\nabla h$ terms are included, then this error reduces to 0.8%. 
Richard P. Nelson and John C.B. Papaloizou