Smoothed Particle Hydrodynamics (SPH)

Smoothed Particle Hydrodynamics (SPH) is a numerical simulation method used to solve the equations governing fluid motion, the Navier-Stokes equations. In SPH, the fluid is represented as a large collection of moving particles, each carrying physical properties like mass, density, pressure, and velocity. Originally developed in 1977 by Gingold, Monaghan, and Lucy to simulate astrophysical phenomena, SPH has since found applications in everything from ocean wave simulation to video game physics engines.

The core idea behind SPH is kernel interpolation. Instead of computing a property (e.g. density) at a fixed point in space, SPH estimates it by averaging the contributions of all nearby particles, weighted by a smooth function called the kernel, . The parameter , called the smoothing length, controls how far that influence reaches. Think of it as each particle casting a fuzzy "vote" on its neighborhood. The larger is, the smoother (and less sharp) the resulting field. This weighted summation is the backbone of every quantity computed in SPH.

To move the fluid forward in time, SPH discretizes the equations into small time steps. At each step, every particle is updated in three phases. First, the density of each particle is estimated by the relative positions of its neighbors. A crowded neighbors mean higher density. Second, forces are calculated from those densities: high-density regions build up pressure, which pushes particles apart. Finally, each particle's position is updated using those forces and its mass using Newton's second law.

SPH is widely loved because it naturally handles free surfaces, splashing, and large deformations. While SPH was born in astrophysics and matured in fluid simulation, its underlying mathematics turns out to be surprisingly general. Wherever a system can be described as many agents influencing their neighbors, with that influence fading smoothly with distance, SPH-like thinking can follow.

You can interact with the simulation. Use the A and D keys to rotate the direction of gravity. The particles are color-coded by pressure: blue for low, red for high.