# Fluid Dynamics in the Browser

11 Jun 2009 in The Navier-Stokes equations:

\frac{\partial \mathbf{v}}{\partial t} + ( \mathbf{v}\cdot\nabla ) \mathbf{v} = -\nabla p + \nu\Delta \mathbf{v} +\mathbf{f}(\boldsymbol{x},t)

\frac{\partial \mathbf{v}}{\partial t} + ( \mathbf{v}\cdot\nabla ) \mathbf{v} = -\nabla p + \nu\Delta \mathbf{v} +\mathbf{f}(\boldsymbol{x},t)

Describe the flow of an incompressible fluid. The equations are non-linear and are notoriously difficult to solve. I've always found them to be very beautiful and the fact that Sr George Stokes was an Irishman probably had some effect on my taking to the subject when I was an undergrad.

There are many subtleties hidden in the equations, notably the issue of conservation of momentum and the appearance of turbulence. The subject inspired the following rather fun ditty:

Big whorls have little whorls

That feed on their velocity,

And little whorls have lesser whorls

And so on to viscosity.

-- Lewis F. Richardson

When I was an undergrad I spent some time playing with a Cray supercomputer running simulations of fluid flow on a sphere. A supercomputer. A big one. In my grazing of the online new sources today I saw a link to Oliver's fluid dynamics simulation which provides a Navier - Stokes solver in the browser in javascript. It's pretty, and it's damn impressive.

It doesn't solve the actual equations, but a diffusive model optimized for stability, speed and aesthetics based on this paper.

It really shows the potential of the browser as a tool for the teaching of science. Being able to make changes to your code and test the results right there, nice!