Continuing my little foray into fluid simulation, here is a better fluid simulation using the multi-grid algorithm with a Jacobi kernel. It also uses a vertex grid, meaning the pressure and velocities are diagonally offset by half a grid cell, instead of a colocated grid.
This is faster and produces more curls than my previous attempt with a plain Jacobi method on a colocated grid. I also hacked in open boundary conditions, where the fluid flows outside of the simulation area without bouncing back.
You can click and drag the mouse inside the canvas below to create splats of color. Double-clicking resets the simulation. Your browser needs to support WebAssembly and WebGL 2.0.