SPH density summation
The cubic-spline kernel is nonzero only within a finite support radius. A particle inside the bulk has neighbors almost all around it; a particle on the free surface has none on the air side, so its neighborhood is cut short.
Fluid dynamics · simulating a splash with particles
How can particles that only sense their neighbors work out the density and pressure of splashing water? Each particle estimates the local density by adding up its nearby neighbors with a smooth weighting function. An equation of state then turns that density into pressure. The water is treated as slightly compressible: giving it a higher artificial sound speed keeps the density closer to constant, but forces smaller time steps.
A two-dimensional, weakly compressible SPH simulation builds a free surface out of moving particles. In six scenarios, the particle field, the compact kernel, the pressure–depth profile and the histories of energy and density error update together on one canvas.
Physics tutorial
BackgroundSmoothed particle hydrodynamics (SPH) splits a fluid into moving particles, each carrying mass, position and velocity. A particle looks only at neighbors within a finite radius, estimates the density from a weighted sum, and then moves under pressure gradients, viscosity and gravity. Where the particles end, a free surface appears on its own.
Why it mattersDam breaks, sloshing and droplet impacts all have interfaces that move violently. A fixed grid needs a separate method to track the interface, but Lagrangian particles simply move with the fluid. The price is noisy density, errors at the boundaries and a strict limit on the explicit time step.
Start with the essentials
The cubic-spline kernel is nonzero only within a finite support radius. A particle inside the bulk has neighbors almost all around it; a particle on the free surface has none on the air side, so its neighborhood is cut short.
The pressure term is symmetric in each pair of particles, so the forces come in pairs. The viscous Laplacian, wall reflection and cohesion used here are deliberately low-order teaching approximations.
The equation of state lets the water compress by a finite amount, and in return the simulation can step forward explicitly. A higher numerical sound speed holds down the density error, but it also shrinks the allowed time step.
Typical misconceptionEach blue point in the rendering is one real water molecule.
Better mental modelAn SPH particle stands for a small but finite parcel of fluid. It carries a smoothed mass, velocity and thermodynamic state; it is not an individual molecule.
Typical misconceptionIf the crown-shaped splash looks right, the solver must be correct.
Better mental modelFirst check the total mass, the density error in the bulk, the hydrostatic relation , the free-fall motion of the centroid and how much the result changes with particle spacing. Looking right is only the last layer of evidence.
Pause the dam break and tap a bulk particle, then a free-surface particle. Compare the support circle in panel A and the neighbor count in panel B.
What to observe: A bulk particle has neighbors on all sides, spread almost evenly in every direction. A surface particle has none on the air side, so its density sum comes out short at the boundary.Choose Hydrostatic check, reduce the viscosity, step forward, and compare the particle pressures with the hydrostatic line in panel C.
What to observe: Pressure rises with depth overall, but particle noise, the wall treatment and the low density at the free surface pull the points away from the analytic line.Reset the same scenario at lower and higher numerical sound speeds, then compare bulk-density RMS with the acoustic time-step readout.
What to observe: A higher sound speed usually reduces the density fluctuations but needs a shorter time step. This is the central computational tradeoff of weakly compressible SPH.Change particle spacing, reset the dam break, and compare front position, density error, and histories at similar simulation times.
What to observe: The particle count, the neighborhood sampling and the stable time step all change together. If the result shifts a lot with resolution, a single splash run is not a reliable prediction.Conceptual inspiration: FluidMotion. Original simulations and graphics; the model limits are described above.