⛰️ Sandpile
BTW self-organised criticality
Grid
Simulation
Controls
Statistics
Grains dropped
0
Avalanches
0
Largest avalanche
0
Total topplings
0
SOC: The system self-tunes to a critical state where avalanches of all scales occur. Avalanche sizes follow P(s) ∼ s−τ.
Avalanche histogram
log-log scale — power law = straight line

Frequently Asked Questions

What is the Abelian Sandpile model?

The Abelian Sandpile model (BTW model) is a cellular automaton introduced by Bak, Tang, and Wiesenfeld in 1987. Grains are added to a grid; when any cell accumulates 4 or more grains it topples, distributing one grain to each of its four neighbours. This process repeats until the configuration is stable (every cell has fewer than 4 grains).

What is self-organised criticality (SOC)?

Self-organised criticality is a property of dynamical systems that automatically evolve toward a critical state — a boundary between order and chaos — without any external tuning of parameters. At criticality, disturbances (avalanches) of all sizes occur with frequencies following a power law: P(s) ~ s−τ.

Why is this called an "Abelian" sandpile?

The model is called Abelian because the final stable configuration is independent of the order in which topplings are performed. Whether you process unstable cells left-to-right or in any other sequence, you always reach the same result. This commutative (Abelian) property makes the model mathematically tractable and analytically beautiful.

What does the toppling rule look like mathematically?

For a cell at (i,j) with height h[i][j] ≥ 4: h[i][j] −= 4; h[i±1][j] += 1; h[i][j±1] += 1. Grains that topple off the boundary are lost (open boundary conditions). This rule is applied repeatedly until every cell has h < 4, marking the end of one avalanche.

What is a power law, and why does it matter here?

A power law P(s) ∝ s−τ means large events are rare but not impossibly so — there is no characteristic scale. In the 2D sandpile, avalanche sizes follow a power law with exponent τ ≈ 1.2. This scale-free behaviour is the fingerprint of criticality and appears in nature: earthquakes (Gutenberg-Richter law), solar flares, and neural cascades.

How does the simulation colour-code the grid?

Cells are coloured by their grain height: 0 grains → near-black; 1 grain → dark blue-grey (#37474f); 2 grains → steel blue (#546e7a); 3 grains → bright teal (#78909c). Cells that topple flash brightly, making the propagating avalanche visually striking against the background.

What real-world phenomena exhibit self-organised criticality?

SOC has been proposed for earthquakes (Gutenberg-Richter law), forest fires, neuronal avalanches in the brain, stock market fluctuations, solar flare intensities, and biological evolution (punctuated equilibrium). The sandpile is the canonical toy model illustrating these universal features without fine-tuning any parameter.

What happens at the edges of the grid?

The grid uses open (dissipative) boundary conditions. When an edge cell topples, grains that would leave the grid are destroyed. This dissipation is essential: it allows the system to reach a steady state where the average grain addition rate equals the average grain loss rate, sustaining the critical condition indefinitely.

How large can avalanches get?

In the critical state, avalanche sizes range from a single toppling (1 cell) up to O(N²) — essentially the entire grid. Large avalanches are rare but inevitable. The power-law distribution means there is no typical size: doubling the threshold for "large" reduces frequency by a constant factor (the hallmark of scale invariance).

Can I interact with the sandpile simulation?

Yes! Click or tap anywhere on the canvas to add grains at that location and trigger a localised avalanche. Use the left panel to change grid size (resets the simulation), drop rate, and simulation speed. The right panel shows the live avalanche-size histogram; watch it approach a straight line on the log-log plot as the critical state develops.

About this simulation

Written by MySimulator Team · Reviewed by MySimulator Editorial Review

Last updated: 5 July 2026

This simulation models the Abelian sandpile (Bak–Tang–Wiesenfeld) automaton: grains fall onto an 80×80 grid by default, and any cell that reaches 4 grains topples, handing one grain to each of its four orthogonal neighbours in a breadth-first cascade. Repeated grain drops push the grid towards a self-organised critical state, where avalanches span every scale from a single toppling to a cascade covering almost the whole grid. The live histogram bins avalanche sizes on log-log axes, and as the pile matures the bars settle onto the straight line that marks a power-law distribution — the statistical fingerprint of criticality.

🔬 What it shows

Grains are dropped at the centre of the grid; once a cell reaches 4 grains it loses 4 and each neighbour gains 1, and any neighbour this pushes to 4+ topples next, in a breadth-first chain. Grains that would leave the grid edge are simply lost (open boundaries). Colour tracks grain count — near-black for empty cells, brown-grey through steel blue as height rises, white on a cell mid-topple — while four live counters track grains dropped, avalanches, the largest avalanche so far, and total topplings.

🎮 How to use

Drag Size (40–160) to resize and restart the grid. Drop rate (1–20 grains/frame) sets how fast new grains land at the centre, and Topple steps/frame (50–5000) caps how many topplings run per frame, trading speed for smoothness on large avalanches. Click or tap the canvas to dump a cluster of 8 grains at that spot and trigger a localised avalanche there. Pause, Reset and Info sit in the left panel, next to a switch to the Ukrainian version.

💡 Did you know?

The same toppling rule mirrors real cascading events: earthquake magnitudes follow the Gutenberg–Richter power law, forest fires and neuronal firing avalanches in the brain show comparable scale-free statistics, and solar flare intensities cluster the same way. Self-organised criticality is one of the few known mechanisms that produces this behaviour without anyone tuning a control parameter — the system finds its own critical point.

Frequently asked questions

What actually happens when a cell reaches 4 grains?

The cell's count drops by 4 and each of its four orthogonal neighbours gains 1 grain. If that push takes a neighbour to 4 or more, it topples too, in a breadth-first chain that keeps running until every affected cell holds fewer than 4 grains — the whole chain counts as a single avalanche.

Why does moving the grid size slider reset my progress?

Changing Size rebuilds the grid array at the new dimensions (40–160 cells per side), so all statistics — grains dropped, avalanche count, largest avalanche and total topplings — are zeroed and the pile starts empty again.

What's the difference between Drop rate and Topple steps/frame?

Drop rate sets how many new grains land on the centre cell each animation frame (1–20). Topple steps/frame is a processing budget that caps how many individual topplings can run that same frame (50–5000), so a very large avalanche spills its remaining topplings into later frames instead of freezing the page.

Why do clicks on the canvas add 8 grains instead of 1?

Clicking or tapping drops a small cluster of 8 grains at that exact cell in one go, which reliably pushes the local area over the toppling threshold and produces a visible, localised avalanche rather than a single quiet grain that might not topple anything at all.

What should I look for in the avalanche histogram?

The panel bins avalanche sizes on a log2 scale and draws the bars on log-log axes. Early on the bars are ragged and uneven; as more grains accumulate and the pile approaches self-organised criticality, the bar heights line up into a straight line — exactly what a power-law size distribution looks like on that scale.