An ode to all math.
Eulerian velocity field with Lagrangian particle advection. Click and drag to create pressure gradients. Simulation core based on Jos Stam's "Stable Fluids".
Why it works: The standard Forward-Euler numerical method (like the one shown in Heavy Algebra mode) is unconditionally unstable for fluids—if the velocity pushes fluid further than one grid cell per timestep, the math blows up to infinity. Stam solved this using semi-Lagrangian backward-tracing. Instead of pushing fluid forward into the future, the solver traces backwards from each grid cell's center to find where the fluid came from, and bilinearly interpolates the old velocities. Because it's just averaging past states, the new velocity can never exceed the maximum of the old velocity field. This simple mathematical trick makes the simulation unconditionally stable, allowing for real-time interaction without crashing.