Skip to main content
Sandbox Physics

Fluid dynamics · simulating a splash with particles

SPH Free-Surface Splash

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.

Interactive modelSPH Free-Surface Splash
Simulation time tg/Ht\sqrt{g/H}00
Fluid particles NN260260
Bulk density RMS ερ\varepsilon_\rho0%0\%
Normalized mass M/M0M/M_01.0001.000
Acoustic time step ΔtCFL\Delta t_{\mathrm{CFL}}00
Scenario validationxf/H=0x_f/H=0

Physics tutorial

SPH free surfaces: reconstructing a pool from neighbors

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

Focus question
If each particle knows only its nearby neighbors, how do they together produce pressure, nearly incompressible water and the motion of a free surface?
One-sentence intuition
A kernel that is nonzero only over a short range turns a handful of discrete neighbors into a smooth estimate. Raising the numerical sound speed c0c_0 reduces density variation but shortens the stable time step. In weakly compressible SPH (WCSPH), water that compresses less costs more computing time.

Core mathematical model

SPH density summation

ρi=∑jmjW ⁣(∥ri−rj∥,h)\rho_i=\sum_j m_j W\!\left(\lVert\boldsymbol r_i-\boldsymbol r_j\rVert,h\right)

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.

Symmetric pressure force and viscosity

dvidt=−∑jmj(piρi2+pjρj2)∇iWij+ν∇2vi+g\frac{\mathrm d\boldsymbol v_i}{\mathrm dt}=-\sum_j m_j\left(\frac{p_i}{\rho_i^2}+\frac{p_j}{\rho_j^2}\right)\nabla_i W_{ij}+\nu\nabla^2\boldsymbol v_i+\boldsymbol g

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.

Tait equation of state and acoustic CFL

pi=ρ0c02γ[(ρiρ0)γ−1],Δt≤Chc0+max⁡i∥vi∥,γ=7p_i=\frac{\rho_0c_0^2}{\gamma}\left[\left(\frac{\rho_i}{\rho_0}\right)^\gamma-1\right],\qquad \Delta t\leq C\frac{h}{c_0+\max_i\lVert\boldsymbol v_i\rVert},\qquad \gamma=7

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.

Common difficulties

Particles are not water molecules

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.

A pretty splash is not convergence

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 p=ρgdp=\rho g d, 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.

Run the experiment

  1. 01

    See how a kernel neighborhood estimates density

    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.
  2. 02

    Test hydrostatic pressure

    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.
  3. 03

    Compare sound speed and time step

    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.
  4. 04

    Check the resolution

    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.

FeedbackSomething broken, confusing, or missing on this page?Tell us
What kind of feedback?

Sent with this page’s address, its Lab ID, the site language and your device type. Please leave out personal details. Feedback is kept for up to 12 months.Privacy policy