lbm
lbm,
a MATLAB code which
demonstrates the Lattice Boltzmann Method, which
uses a statistical particle model to simulate fluid flow.
The resulting png images are animated using ImageMagick convert().
The original code is by Ferran Alia.
Licensing:
The information on this web page is distributed under the MIT license.
Languages:
lbm is available in
a C++ version and
a MATLAB version and
an Octave version and
a Python version.
Related Data and Programs:
lbm_test
imagemagick,
examples which
use imagemagick(), which
creates, edits, composes or converts
graphical information as stored in many different file formats.
imagemagick() can resize, flip, mirror, rotate, distort, shear and
transform images, adjust image colors, apply various special effects,
or draw text, lines, polygons, ellipses and Bézier curves.
Reference:
-
Ferran Alia,
The fluid simulator that doesn't solve the fluid equations,
Towards Data Science,
https://towardsdatascience.com/the-fluid-simulator-that-doesnt-solve-the-fluid-equations/
25 July 2026.
Source Code:
-
apply_boundaries.m,
applies inflow and outflow boundary conditions.
-
bounce.m,
handles no-slip boundary walls.
-
collide.m,
relaxes the particle density function f() toward equilibrium.
-
equilibrium.m,
computes the equilibrium particle density function f().
-
initialize.m,
initializes the particle density function f().
-
macros.m,
recovers density and velocity from particle density function f().
-
make_solid_cylinder.m,
defines a circular obstacle.
-
plot_state.m,
displays the velocity magnitude and vorticity.
-
stream.m,
propagates the particle density function f() to neighboring nodes.
Last revised on 10 August 2026.