Criticality Lab

A native Rust + wgpu lattice-physics playground: Ising model, sandpile avalanches, and forest-fire dynamics rendered in real time on Metal.

rustwgpusimulationphysicslocal-only

Self-organized criticality and phase transitions are more often read about than watched animating in real time; Criticality Lab is a native Rust and wgpu application for exploring lattice-based critical phenomena interactively, built to flip that. It bundles three independent models: Abelian sandpile avalanches (a 2D grid, an isometric voxel rendering of it, and a separate true 3D six-neighbor cubic lattice), the 2D Ising model with Metropolis spin trials, and the Drossel-Schwabl forest-fire model.

The sandpile implementation is the most mathematically direct of the three: a site topples once its grain count reaches twice its lattice dimension (four neighbors in 2D, six in 3D), redistributing one grain to each neighbor, and the simulator tracks the exact per-site toppling count — the odometer — that the Abelian property guarantees is the same regardless of toppling order. A “next wave” control implements the formal definition of an avalanche wave — topple the seeded center once, then legally topple every other unstable site without letting the center topple again — rather than an arbitrary animation frame, and a solver regression test checks that it reproduces the same final state as ordinary queue-based stabilization. The Ising model runs at its exact critical temperature (Tc = 2 / ln(1 + sqrt(2))) with connected-domain analysis and log-binned observables. A de-duplicated unstable-cell queue and per-frame physics budgets keep grids up to 2048x2048 responsive, with rendering uploaded to wgpu/Metal at an adaptive rate.

Status: source local-only. It builds and runs from source with cargo run --release, plus a script to produce a macOS app bundle; there is no packaged release.