Chaos & Complexity ★★☆ Moderate

🏔️ Sand Pile Criticality

Drop grains of sand one by one onto a pile. Most land quietly — but occasionally a catastrophic avalanche cascades across the entire grid. The system organises itself to a critical state where avalanche sizes follow a power law: there is no typical size, only scale-free disorder at the edge of chaos.

Grains dropped: 0
Avalanches: 0
Current cascade: 0
Largest: 0
Mean size:
Critical state: building…

🌊 Self-Organised Criticality (SOC)

Bak, Tang and Wiesenfeld (1987) showed that many driven dissipative systems naturally evolve toward a critical state — without any fine-tuning of parameters. The sand pile is the archetype: add grains slowly, and the pile steepens until the average slope sits just at the stability threshold.

Toppling rule (BTW model):

if z[i,j] ≥ 4: z[i,j] −= 4, each neighbour += 1

Avalanche sizes n follow P(n) ∝ n−τ with τ ≈ 1 (log-log plot is a straight line). This power law means huge events are rare but inevitable — just like earthquakes and stock crashes.

About this simulation

This sandbox runs the Bak-Tang-Wiesenfeld model on a 55×55 grid: grains stack in each cell until a column reaches height 4, at which point it topples, giving one grain to each of its four neighbours (edge grains simply fall off the grid). One toppling can trigger a chain of others, and that chain — the avalanche — is tallied and logged into a live log-log histogram. Feed the pile long enough and, without tuning any parameter, the system settles into a critical state where avalanche sizes stop clustering around any typical value and instead follow a power law.

🔬 What it shows

A 55×55 grid where colour encodes grain height: navy is empty, blue is 1-2 grains, amber is 3 (one grain from collapse), and orange marks cells actively toppling. Beside it, a log-log histogram accumulates every avalanche size ever recorded, gradually revealing a straight-line power-law slope as the pile matures.

🎮 How to use

The Grains/frame slider (1-60) controls how many random grains land each animation frame — higher values speed up the run toward criticality. Pause freezes the grid mid-avalanche, Reset empties the pile and clears all statistics, and Big avalanche dumps 60 grains straight onto the centre cell to trigger a dramatic cascade on demand.

💡 Did you know?

The toppling rule z[i,j] ≥ 4 → z[i,j] −= 4, neighbours += 1 is deterministic and purely local, yet it produces the same scale-free statistics (P(n) ∝ n−τ, τ ≈ 1) seen in real avalanches, forest fires, and earthquake magnitudes.

Frequently asked questions

What exactly triggers an avalanche?

Whenever a cell's grain count reaches the critical threshold of 4, it topples: it loses 4 grains and each of its up-to-four neighbours gains 1. If that push raises a neighbour to 4 or more, it topples too, and the simulation processes this chain reaction cell by cell until no cell is at or above threshold. The total number of cells that toppled during that chain is the avalanche's size.

Why does the pile reach a "critical state" without any tuning?

This is the essence of self-organised criticality, described by Bak, Tang and Wiesenfeld in 1987. Because grains are added slowly (a few per frame) while avalanches redistribute them instantly, the average slope of the pile is automatically pulled toward the exact threshold where the next dropped grain could cause anything from nothing to a pile-wide cascade — no parameter needs to be hand-tuned to reach it.

What does the power law P(n) ∝ n−τ actually mean?

It means avalanche sizes have no characteristic scale: small avalanches are common and huge ones are rare, but the ratio between "twice as common" and "half as big" stays constant across all sizes. On the log-log histogram this shows up as a straight line rather than a bell curve. The simulation's exponent τ is close to 1, matching the theoretical BTW result.

What do the colours in the grid mean?

Each cell's colour tracks its grain count: near-black navy is 0 grains, dark blue is 1, mid blue is 2, amber is 3 (one grain away from collapse), and bright orange-red marks any cell at 4 or more grains that is actively toppling this frame. Watching amber turn to orange and spread is how you see an avalanche propagate in real time.

What does the "Big avalanche" button do differently from normal play?

Instead of waiting for random grains to accumulate near the threshold, it drops 60 grains directly onto the single centre cell in quick succession. This reliably forces a large, visually dramatic cascade so you can inspect avalanche mechanics without waiting for one to occur naturally.