SPH. By assigning each particle its own smoothing length and allowing it to vary with time, the resolution of a simulation can be made to automatically adapt itself depending on local conditions. For example, in a very dense region where many particles are close together, the smoothing length can be made relatively short, yielding high spatial resolution. Conversely, in low-density regions where individual particles are far apart and the resolution is low, the smoothing length can be increased, optimising the computation for the regions of interest. Discretization of governing equations For particles of constant mass, differentiating the interpolated density with respect to time yields where is the gradient of with respect to . Comparing this equation with the continuity equation in the Lagrangian description (using material derivatives), it is apparent that its right-hand side is an approximation of ; hence one defines a discrete divergence operator as follows: This operator gives an SPH approximation of at the particle for a given set of particles with given masses , positions and velocities . The other important equation for a compressible inviscid fluid is the Euler equation for momentum balance: Similarly to continuity, the task is to define a discrete gradient operator in order to write One choice is which has the property of being skew-adjoint with the divergence operator above, in the sense that this being a discrete version of the continuum identity This property leads to nice conservation properties. Notice also that this choice leads to a symmetric divergence operator and antisymmetric gradient. Although there are several ways of discretizing the pressure gradient in the Euler equations, the above antisymmetric form is the most acknowledged one. It supports strict conservation of linear and angular momentum. This means that a force that is exerted on particle by particle equals the one that is exerted on particle by particle including the sign change of the effective direction, thanks to the antisymmetry property . Nevertheless, other operators have been proposed, which may perform better numerically or physically. For instance, one drawback of these operators is that while the divergence is zero-order consistent (i.e. yields zero when applied to a constant vector field), it can be seen that the gradient is not. Several techniques have been proposed to circumvent this issue, leading to renormalized operators (see e.g.). Variational principle The above SPH governing equations can be derived from a least action principle, starting from