Physical Simulation: Smoothed Particle Hydrodynamics

Lagrange fluid simulation: Smoothed particle hydrodynamics

High-level idea: use particle carrying samples of physical quantities, and a kernel function $W$, to approximate continuous fields:

SPH particles and their kernel

  • Originally proposed for astrophysical problems
  • No meshes. Very suitable for free-surface flows!
  • Easy to understand intuitively: just imagine each particle is a small parcel of water (although strictly not the case)

Implementing SPH using the Equation of States (EOS)

Also know as Weakly Compressible SPH (WCSPH).

Momentum equation: ($\rho$: density; $B$: bulk modulus; $\gamma$: constant, usually $\sim 7$ )

Gradients in SPH

  • Not really accurate
  • But at least symmetric and momentum conversing

Now we can compute $\nabla p_i$

SPH Simulation Cycle

  1. For each particle $i$, compute $\rho_i= \sum_j{ m_j W \left( ||\textbf{x} - \textbf{x}_j||_2, h \right)}$

  2. For each particle $i$, compute $\nabla p_i$ using the gradient operator

  3. Symplectic Euler step:

Variants of SPH

  • PCI-SPH: Predictive-Corrective Incompressible SPH
  • PBF: Position-based fluids
  • DFSPH: Divergence-free SPH

Courant-Friedrichs-Lewy (CFL) condition

One upper bound of time step size:

  • $C$: CFL number (Courant number, or simple the CFL)
  • $\Delta t$: time step
  • $\Delta x$: length interval (e.g. particle radius and grid size)
  • $u$: maximum (velocity)

Application: estimating allowed time step in (explicit) time integrations. Typical $C_{max}$ in graphics:

  • SPH: ~ 0.4
  • MPM: 0.3 ~ 1
  • FLIP fluid (smoke): 1 ~ 5+

So far, per sub-step complexity of SPH is $O(n^2)$. This is too costly to be practical. In practice, people build spatial data structure such as voxel grid to accelerate neighborhood search. This reduces time complexity to $O(n)$.

Reference: Compact Hashing

Extend reading

SPH Fluids in Computer Graphics: https://cg.informatik.uni-freiburg.de/publications/2014_EG_SPH_STAR.pdf

A tutorial for SPH: Smoothed Particle Hydrodynamics Techniques for the Physics Based Simulation of Fluids and Solids