Fluid Simulation with Smoothed Particle Hydrodynamics (SPH)
A Lagrangian, particle-based fluid simulator using SPH kernels and pressure/viscosity forces, with real-time collision handling and a live demo.
TL;DR
I implemented a particle-based fluid simulator using Smoothed Particle Hydrodynamics (SPH) to model incompressible fluid behavior. The system computes density, pressure, and viscosity forces from local neighborhoods and integrates them in real time, producing visually convincing fluid motion with collision handling and tunable physical parameters.
Overview
This project implements Smoothed Particle Hydrodynamics (SPH), a mesh-free Lagrangian approach to fluid simulation. Instead of solving fluid quantities on a grid (Eulerian), SPH represents the fluid as particles and computes density/pressure/forces using local neighborhood smoothing kernels.
Why SPH?
Mesh-free and flexible for complex motion
Naturally handles free surfaces and splashes
Intuitive particle viewpoint for interactive demos
Purpose
Realistic fluid motion is difficult because the system involves:
The simulator resolves particle-obstacle interaction using:
contact point
penetration depth
surface normal at contact point
This prevents particles from tunneling through obstacles and produces believable boundary behavior.
Results
What works (demo outcomes)
Particle-based fluid motion with pressure-driven expansion/compression
Visible viscosity effects (thicker vs runnier behavior)
Stable gravity-driven flow under collisions
Parameters you can tune
SPH is very sensitive to physical parameters. The most important ones you can expose in UI:
rest density
stiffness (pressure coefficient)
viscosity coefficient
smoothing radius (kernel radius)
time step
Limitations
The primary limitation is computational cost, especially as particle count increases. SPH requires neighborhood queries and pairwise interactions, which scale poorly without acceleration structures. :contentReference[oaicite:10]{index=10}
Other common practical issues:
stability constraints requiring small time steps
clumping / jitter if parameters are poorly tuned
boundary handling quality depends on collision model
Future work
Concrete extensions that make this feel like a real graphics portfolio project: