Fluid Dynamics

By Daniel V. Schroeder, Physics Department, Weber State University

This application runs only in modern browsers. For best results, use Google Chrome.
Flow speed = 0.100   Viscosity = 0.020
Animation speed:   Steps per second: 0
Show: Tracers Force on barriers Sensor Data

This is a simulation of a two-dimensional fluid. Initially the fluid is flowing from left to right, and a linear barrier (shown in black) diverts the fluid and creates vortices. The colors indicate the curl, or local rotational motion, of the fluid. Use the controls to adjust the flow speed and viscosity, draw different barriers, drag the fluid around, plot other quantities besides the curl, show the force exerted by the fluid on the barriers, and measure the fluid's density and velocity at any point.

The simulation uses a fairly simple lattice-Boltzmann algorithm, which you can see by viewing the JavaScript source code. As of early 2013, the simulation runs fastest under Chrome on either MacOS or Windows. Firefox and Safari are noticeably slower, while Opera and Internet Explorer are much slower. You can adjust the resolution to increase or decrease the simulation speed.

This HTML5-canvas-JavaScript web app is a work in progress. It still has a few bugs and awkward features, which I hope to address over the coming months.