Real-Time Fluid Dynamics In Javascript

About

Click and drag (inside the white border; touch and drag on mobile) to add density. Move the mouse over the canvas to move the fluid around.

You can change the simulation parameters in real-time using the GUI on the left.

 

Based on Jos Stam's paper Real-Time Fluid Dynamics for Games.

Simulates the Navier-Stokes equations for incompressible fluids.

Source Code

Can be found on my Github.

Credits

The demo uses lil-gui for the GUI

I've looked at other implementations while making this, but the links are very old and are now dead and/or insecure.

The best reference is the original paper which is still online and contains a very clear explanation of the solver and methods it uses. It also contains a complete C implementation of the solver.