HomeChemistry & MaterialsFHP Lattice Gas Automaton

💨 FHP Lattice Gas Automaton

Boolean particles on a hexagonal lattice collide and stream under simple conservation rules, coarse-graining into emergent fluid-like flow — Navier-Stokes behavior from pure discrete geometry.

Chemistry & Materials2DAdvanced60 FPS
fhp-lattice-gas ↗ Open standalone

How it Works

The FHP model places boolean "particles" on the nodes of a triangular lattice, where each node has six neighbors at 60° increments (0°, 60°, 120°, 180°, 240°, 300°). Exclusion means at most one particle can travel in each of the six directions at a node. Every time step applies two local operations everywhere at once: collision, a lookup table that rearranges occupied directions at a node while conserving particle number and momentum, and propagation, which slides each particle one lattice step along its direction.

Raw per-node occupation is just noise — one bit per direction. This simulator divides the lattice into small blocks and averages the direction vectors of occupied particles inside each block every frame, producing the smooth arrow field you see: this coarse-graining step is exactly how continuum hydrodynamics emerges from a discrete, reversible microscopic rule set. A paintable solid region reflects incoming particles (bounce-back), which is enough to generate stagnation points, separated shear layers and, at high inlet rates, shedding vortices behind the obstacle.

Directions: θ_i = i·60°, i = 0..5
Two-body collision: {i, i+3} → {i+1, i+4} or {i-1, i+2} (random, momentum-conserving)
Three-body collision: {0,2,4} ↔ {1,3,5} (60° rotation)
Coarse velocity: u(block) = (1/N)·Σ over occupied dirs of (cos θ_i, sin θ_i)

Frequently Asked Questions

What is a lattice gas automaton, and how does FHP differ from real molecular dynamics?

A lattice gas automaton (LGA) replaces continuous particle positions and velocities with boolean occupation numbers on a fixed lattice: each node can hold at most one particle per allowed direction. Unlike molecular dynamics, which integrates real-valued forces and trajectories, an LGA evolves through two discrete local steps, collision and propagation, applied simultaneously to every node. It is dramatically cheaper to compute and, remarkably, still reproduces the Navier-Stokes equations in the macroscopic limit.

Why did FHP require a hexagonal, 6-direction lattice instead of a square one?

An early square-lattice gas (HPP) conserves mass and momentum but has only 4-fold rotational symmetry, which leaks into the macroscopic equations as an unphysical dependence of pressure and viscosity on direction. The hexagonal lattice has 6-fold symmetry, the minimum needed for the fourth-rank viscosity tensor to become isotropic. Frisch, Hasslacher and Pomeau showed in 1986 that this single geometric change recovers correct, direction-independent Navier-Stokes behavior.

What do the collision and propagation steps actually do?

Propagation (streaming) moves every particle one lattice step along its direction of travel. Collision is a purely local lookup: two head-on particles (180° apart) scatter to one of the two perpendicular direction pairs, chosen randomly; three particles 120° apart rotate together by 60°; every other configuration passes through unchanged. Both rules only relabel which directions are occupied at a node, so total particle count and momentum never change there.

Why do these collision rules conserve mass and momentum?

Mass conservation is automatic because collisions never create or destroy occupied directions, only reassign them. Momentum conservation follows from symmetry: a head-on pair has zero net momentum, and both perpendicular output pairs also have zero net momentum, so the swap is momentum-neutral; the three-particle rotation maps one zero-momentum symmetric triple onto another.

How does coarse-graining turn discrete booleans into a smooth flow field?

A single node's occupation is essentially noise. Averaging over a block of many nodes, summing each occupied direction as a unit vector and dividing by the number of nodes, produces a local mean velocity that varies smoothly in space and time — exactly the procedure statistical mechanics uses to go from microscopic states to macroscopic fields.

How does FHP model flow around an obstacle and vortex shedding?

A solid region uses bounce-back boundaries: any particle entering a solid node has its direction reversed, so it re-emerges the way it came. Particles pile up upstream and rarefy behind the obstacle; in the coarse-grained velocity field this produces a stagnation point in front, separated shear layers, and, at higher inlet speeds, alternating vortices peeling off downstream — a lattice analogue of a von Kármán vortex street.

Who invented the FHP model and why does it matter historically?

The model is named for Uriel Frisch, Brosl Hasslacher and Yves Pomeau, who published it in 1986 after a square-lattice predecessor (HPP) had been shown to fail at isotropic hydrodynamics. FHP was the first cellular automaton proven to recover the Navier-Stokes equations, and it directly inspired the lattice Boltzmann method, now a standard tool in computational fluid dynamics.

What are the main limitations of the FHP lattice gas model?

Each node holds only a handful of boolean particles, so individual runs are extremely noisy; recovering a clean velocity field requires averaging over many nodes or runs. The model is restricted to low Mach numbers, has a velocity-dependent effective viscosity, and discrete exclusion limits achievable density. These issues motivated lattice Boltzmann methods, which largely superseded FHP for practical CFD.

What does the exclusion principle mean on the FHP lattice?

Exclusion means each node can hold at most one particle per direction, six at most in total, all moving at the same unit speed. This is a modeling simplification, not a physical requirement of real gases — it keeps each node's state a small boolean number and makes the automaton exactly reversible and easy to update in parallel.

What happens to particles at the edges of the simulated lattice?

The top and bottom edges wrap around periodically, avoiding artificial walls that would disturb the flow. The left edge acts as an inlet where new particles are continuously injected in forward-moving directions at a rate set by the density slider, and the right edge is an open outlet — particles that stream past it simply leave the domain, mimicking a wind tunnel with steady throughflow.

About this simulation

This simulator runs a real FHP lattice gas automaton: every node on a hexagonal grid holds up to six boolean particles, one per 60° direction, that collide under strict mass- and momentum-conserving rules and then stream to their neighbors. A single node's occupation is noise, but averaging direction vectors over small blocks each frame reveals a smooth, arrow-based velocity field — a wind-tunnel view of how Navier-Stokes-like flow can emerge from nothing but discrete, reversible geometry. Paint an obstacle, raise the inlet density, and watch stagnation points, shear layers and shedding vortices appear in the coarse-grained field.

🔬 What it shows

A hexagonal lattice gas automaton streaming rightward from a wind-tunnel inlet, coarse-grained into a block-averaged arrow field so the emergent flow pattern is visible instead of raw particle noise. A paintable solid region reflects particles via bounce-back, producing wakes and vortex shedding.

🎮 How to use

Pick a grid size, choose a circle, flat plate, or no obstacle from the dropdown, or click and drag directly on the canvas to paint your own solid cells (right-click to erase). Raise the inlet density slider to inject more particles from the left edge, and use the speed slider to run more automaton steps per rendered frame.

💡 Did you know?

FHP was the first cellular automaton mathematically proven to recover the incompressible Navier-Stokes equations in the continuum limit — a purely discrete, boolean rule set producing the same large-scale physics as the differential equations engineers use to design aircraft wings.

Frequently asked questions

Why do I see arrows instead of individual particle dots?

Raw particle occupation is boolean and extremely noisy at the scale of a single node. The simulator sums the direction vectors of occupied particles within each small block and divides by the block size every frame, which is exactly the coarse-graining step that recovers a smooth macroscopic velocity field from microscopic discreteness — drawing raw dots would just look like static.

What does the "Re (lattice units)" stat mean?

It is a simplified, dimensionless indicator built from the inlet injection rate and the obstacle's size in lattice cells, standing in for the true Reynolds number (which depends on physical viscosity, not just injection rate). Low values correspond to smooth, laminar-looking coarse-grained flow; high values correspond to visible vortex shedding behind the obstacle, the same qualitative trend real Reynolds numbers produce.

Why does the flow sometimes look different every time I reset?

The two-body collision rule scatters head-on particle pairs to one of two perpendicular outcomes at random, and injection at the inlet is also randomized. This built-in randomness is intentional — it mimics molecular chaos and means repeated runs at identical settings still produce slightly different, but statistically similar, flow patterns.

Why do the top and bottom of the grid wrap around?

Wrapping the vertical edges periodically avoids introducing artificial solid walls that would reflect particles and distort the flow field near the top and bottom of the visible domain. It effectively simulates an infinitely tall wind tunnel, so the only boundaries that matter physically are the inlet, the outlet, and whatever obstacle you paint.

Can I paint more than one obstacle?

Yes. Painting with the mouse adds solid cells on top of whatever shape the dropdown selected, so you can extend a circle, add extra blockers, or build custom geometry entirely by hand. Right-click and drag erases solid cells back to open, particle-carrying nodes.

Is this the same algorithm used in real engineering CFD software?

Not directly — production CFD mostly uses the lattice Boltzmann method, which FHP directly inspired, or continuum Navier-Stokes solvers. FHP itself is used today mainly for teaching and for exploring conceptual questions in statistical mechanics, because it demonstrates that hydrodynamics can emerge from a fully discrete, exactly reversible microscopic rule.

⚙ Under the hood

Boolean particles on a hexagonal lattice collide and stream under simple conservation rules, coarse-graining into emergent fluid-like flow — Navier-Stokes behavior from pure discrete geometry.

FHP ModelLattice GasCellular AutomatonFluid DynamicsCanvas 2D

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)