Real-Time Fluid Simulation (2D) — CPU Navier–Stokes Solver
A plain-arrays companion to the GPU fluid solver: the same Jos Stam "Stable Fluids" equations (diffuse → project → advect) run on the CPU with a visible Gauss-Seidel relaxation loop instead of GLSL fragment shaders, so you can trade grid resolution for solver speed and see exactly what each stage does.
This 2D companion strips away the GPU/GLSL layer of the WebGL original and runs Jos Stam's "Stable Fluids" scheme directly on JavaScript typed arrays: an explicit Gauss-Seidel relaxation loop you can watch converge, rather than a fragment-shader Jacobi sweep. Drag anywhere on the grid to inject velocity and dye, then use the Viscosity, Dye diffusion and Fade sliders to reshape how momentum and colour spread and decay. A Grid resolution slider lets you trade detail for solver speed (48×48 up to 88×88), and the on-screen Solver time readout shows the real per-frame cost of the CPU Gauss-Seidel iterations — something the GPU version, running the same maths in parallel, never has to expose.
CPU port of Jos Stam's unconditionally-stable Navier–Stokes solver: diffuse → project (pressure Poisson solve via Gauss-Seidel) → advect (semi-Lagrangian backtrace) for velocity, then diffuse → advect → fade for the dye field, each frame, on a resizable interior grid.
2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install