中文

SPH fluid

There is no grid and no height field. Well over a thousand particles each know only their neighbours’ density, velocity and pressure — yet the water spreads, curls and climbs the wall after a dam break.

Density is a kernel-weighted sum over neighbours; pressure comes from p = k(ρ − ρ₀); pressure gradients, viscosity and gravity give the accelerations. The free surface is simply where the density falls to zero.

Weakly compressible means density is allowed to fluctuate by a few percent. That avoids a global pressure solve, at the cost of a finite sound speed and unphysical compression under strong impacts.