🌀 Lattice-Boltzmann Flow — D2Q9 CFD

BGK collision operator · Kármán vortex street · Draw obstacles

Actions

Parameters

Visualisation

Statistics

Reynolds Number
Max Velocity
Avg Density
Iteration0

🌀 What It Demonstrates

This simulator implements the Lattice-Boltzmann Method (LBM) with a D2Q9 lattice — a mesoscopic approach to computational fluid dynamics. Instead of solving the Navier-Stokes equations directly, LBM tracks probability distribution functions of fictitious particles streaming and colliding on a regular lattice. The BGK (Bhatnagar-Gross-Krook) single-relaxation-time collision operator drives the distributions toward a Maxwell-Boltzmann equilibrium. Macroscopic quantities — density ρ and velocity u — emerge naturally from moments of the distribution.

How to Use

Did You Know?

The Kármán vortex street is responsible for the "singing" of power lines in the wind, the oscillation of tall chimneys, and even the cloud patterns visible behind islands in satellite imagery. Theodore von Kármán first described the phenomenon mathematically in 1911. In LBM the same pattern emerges spontaneously once the Reynolds number exceeds ~47 — no special boundary conditions needed.

About the Lattice-Boltzmann Method

This simulation models two-dimensional fluid flow using the Lattice-Boltzmann Method (LBM) on a D2Q9 lattice, where each cell stores nine particle distribution functions streaming along discrete directions. Rather than solving the Navier-Stokes equations directly, it evolves these distributions through repeated streaming and collision steps. The BGK single-relaxation-time collision relaxes distributions towards a Maxwell-Boltzmann equilibrium, and macroscopic density and velocity emerge as moments of the distributions.

The viscosity slider sets the relaxation time via tau = 3 nu + 0.5, controlling turbulence; the inlet velocity slider drives flow from the left edge; and the brush slider sizes the obstacles you draw by clicking the canvas. Solid cells use bounce-back boundaries, so a default cylinder sheds a Kármán vortex street once the Reynolds number is high enough. LBM underpins real engineering CFD for porous media, aerodynamics and microfluidics.

Frequently Asked Questions

What is the Lattice-Boltzmann Method?

It is a computational fluid dynamics technique that tracks particle distribution functions on a regular grid instead of solving the Navier-Stokes equations directly. Particles stream to neighbouring cells and then collide, relaxing towards a local equilibrium. Averaging the distributions recovers familiar fluid quantities like density and velocity.

What does D2Q9 mean?

D2Q9 describes the lattice geometry: two dimensions (D2) with nine discrete velocity directions (Q9). These are the rest state, four axis-aligned moves and four diagonal moves, each carrying a weight of 4/9, 1/9 or 1/36. This nine-velocity set is the standard choice for accurate two-dimensional LBM simulations.

How do the streaming and collision steps work?

In the streaming step each distribution function moves one cell along its velocity direction. In the collision step the populations at every cell are relaxed towards their equilibrium values using the BGK operator. This simulation runs ten such sub-steps per animation frame so the flow develops smoothly in real time.

What does the viscosity slider actually change?

Viscosity sets the relaxation time through tau = 3 nu + 0.5, which governs how quickly distributions return to equilibrium. The slider spans roughly 0.002 to 0.080 in lattice units. Lowering viscosity raises the Reynolds number and produces more turbulent, vortex-rich flow; raising it smooths the motion towards laminar.

What is the Reynolds number shown in the statistics?

The Reynolds number is the ratio of inertial to viscous forces and predicts whether flow is laminar or turbulent. Here it is computed as Re = inlet velocity times a characteristic length divided by viscosity. Above about 47 the cylinder begins shedding vortices, and higher values give a fully developed Kármán vortex street.

How are the obstacles handled?

Cells you paint with the brush become solid barriers flagged in a grid. They use a bounce-back boundary condition: any distribution arriving at a solid cell is reflected back along the opposite direction. This enforces a no-slip wall, so fluid cannot pass through and instead flows around the shape you draw.

What do the visualisation modes display?

Velocity magnitude colours each cell by flow speed using a viridis-like map. Vorticity shows the curl of the velocity field on a blue-white-red diverging scale, highlighting clockwise and anticlockwise rotation. Density maps the local fluid density around its baseline of one, revealing compression and rarefaction waves.

Is this simulation physically accurate?

It captures the correct qualitative physics of incompressible flow, including vortex shedding, the Strouhal frequency of the wake and the dependence on Reynolds number. However, it is a real-time educational model in lattice units with a single relaxation time and modest grid, so it is not a substitute for validated, high-resolution research solvers.

Why does the Kármán vortex street form on its own?

Behind a bluff body the flow becomes unstable above a critical Reynolds number, and small disturbances grow into alternating vortices shed from each side. LBM reproduces this naturally because the discrete dynamics already contain the necessary nonlinearity. No special forcing is needed; the pattern emerges spontaneously once viscosity is low enough.

Where is the Lattice-Boltzmann Method used in practice?

LBM is widely applied in engineering for aerodynamics, automotive and aerospace flows, blood flow in arteries, flow through porous rock and soil, and microfluidic devices. Its locality makes it well suited to parallel and GPU computation, and commercial solvers use it for complex geometries that are awkward for traditional mesh-based methods.