← Back to Interactive Hub

Lattice-Boltzmann Fluid Simulation

A browser-based version of Daniel V. Schroeder's lattice-Boltzmann wind tunnel demo. Draw barriers into the flow, change viscosity and flow speed, and visualise speed, velocity, density, or curl.

Move the mouse over the canvas to inspect local values.

How to use it

Run starts and pauses the simulation. Step advances it once. Click or drag on the canvas to draw a barrier; drag over an existing barrier to erase it. Use the preset buttons to compare wakes from a line, circle, square, wedge, or aerofoil. Use Simulation size to switch between the smoother 200 × 80 lattice and the larger 320 × 120 lattice, which gives wakes more downstream room but can be laggy.

Teaching focus

This is useful for discussing flow separation, vortex shedding, viscosity, wake formation, drag, lift-style aerofoil behaviour, and how microscopic update rules can create macroscopic fluid behaviour. Trace lines make particle paths easier to follow over time.

Notes

Large mode gives better downstream wake visibility but uses more processing power. Very high speed with very low viscosity can become numerically unstable. If the view becomes noisy, reduce the flow speed, increase viscosity, or reset the fluid.

Credit and licence

This browser version is adapted from the Java source by Daniel V. Schroeder, Weber State University. The original notice is preserved below.

Copyright 2011-2013, Daniel V. Schroeder (Weber State University)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated data and documentation (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of the author shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization.

Credits from the original source:
The "wind tunnel" entry/exit conditions are inspired by Graham Pullan's code. Additional inspiration from Thomas Pohl's applet. Other portions of code are based on Wagner and Gonsalves; code adapted from Succi.