Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Build Status

Lattice Gas Explorer

Explore lattice gases, from the basics of implementation to the analysis of the flow patterns.

A visualisation of the eddies in the wake of an obstacle placed in a flow. The eddies alternate between clockwise and anti-clockwise.


The flow behind an obstacle, showing periodic fluctuations from side to side as vortices are shed.

The gas particles live on a square lattice, with at most one particle to a square. Here their colour indicates the direction they are moving (N,NE,E,SE, etc.). Grey particles are at rest, but actually jiggle about on the spot because of the way PI-LGA works.

More images:

A close-up of the lattice gas around a circular obstacle, showing the scale of the simulation. The density is visibly higher on the upstream side of the obstacle (left) than the downstream side. Vortices have formed behind the obstacle but these can't be seen without drawing flow lines.

The flowlines at a similar time to the image above, showing the flow around the obstacle and the vortices behind it. (The flowlines pass through the object but this is only because the flow average is taken over a large area.)

Another closeup of the gas particles, showing the underlying LGA-PI grid with room for up to four particles in each square. The cells' colour and the small flow lines show the direction they are travelling in. When the same flow lines are averaged over larger areas we see the flow patterns in the images above. (And the gas is usually at a much higher density.)

More information:

  • We currently only implement "pair-interaction lattice gases" (PI-LGA). Other methods could be added, to show their differences.
  • A blog entry says a little more about the context of lattice gases and has links to papers and so on:
  • The intention is that the program is useful as a demo, for learning about LGA. But it hasn't gone very far in this direction. Its implementation isn't particularly efficient, I'm sure you could do better.