Home▸Physics & Mechanics▸2D SPH Fluid

2D SPH Fluid — Smoothed Particle Hydrodynamics, Side View

A 2D side-view companion to the 3D SPH fluid tank: the same Muller-2003 smoothed-particle-hydrodynamics kernels (poly6 density, spiky pressure gradient, viscosity Laplacian) computed on a flat plane instead of a volume, so the liquid pools, sloshes and splashes against a floor and two walls instead of a box. Drag the mouse through the liquid to push it.

Physics & Mechanics2DModerate60 FPS📱 Mobile-adapted💧 Water⇄ 3D version
2d-fluid ↗ Open standalone

A real-time 2D fluid simulation built on Smoothed Particle Hydrodynamics: each particle carries a density and pressure computed from its neighbours with the planar Muller-2003 kernels (poly6 for density, spiky for pressure gradient, a viscosity Laplacian for internal friction), then falls under gravity and bounces off the floor and side walls. Drag through the liquid to push it and watch it pool, slosh and splash — the same numerical method as the 3D tank, recomputed for a flat plane instead of a volume.

⚙ Under the hood

A 2D side-view companion to the 3D SPH Fluid tank: the same Muller-2003 smoothed-particle-hydrodynamics kernels (poly6 density, spiky pressure gradient, viscosity Laplacian) computed on a flat plane instead of a volume, so the liquid pools, sloshes and splashes against a floor and two walls. Drag with the mouse or a finger to push the fluid; a spatial-hash neighbour grid keeps hundreds of particles interacting in real time.

physicsfluidSPHsmoothed-particle-hydrodynamicspressureviscosity2d

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)