Sandpile Avalanche
Grains fall on one cell of a grid. Any cell holding four gives one to each neighbour, and that topples the next. Nobody drew the shape.
About this piece
The rule is one sentence. Every cell of a 101×101 integer lattice holds a whole number of grains, and grains are dropped one at a time on a single cell. Any cell holding four grains or more topples: it gives four grains away, one to each of its four neighbours. That can push a neighbour up to four, which topples in turn, and the chain reaction is the avalanche. Grains pushed over the edge of the lattice fall off and are gone — that loss is the only thing keeping the heights bounded.
That is the entire program. Nothing is random: not the drop site, not the order things topple in. No floating-point number appears anywhere in the rule, so this is not an approximation of anything — the frame on your screen is the frame the same code draws on any other machine, cell for cell. Per Bak, Chao Tang and Kurt Wiesenfeld published the model in 1987 as the first concrete example of self-organized criticality; today it is usually just called the abelian sandpile, and it is the only cellular automaton in this catalogue.
Left alone a pile only grows, so the piece is cut into cycles. Each cycle drops 29 grains a frame for 900 frames — 26,100 grains, which cost 11,556,940 individual topplings when measured — then the finished pile is cross-faded out and a fresh lattice begins with the drop point moved 47.5° around a circle twelve cells wide. Moving the source is not decoration: it changes which edge the pile reaches first, and the pile is visibly flattened against that side. The drop point does not return to where it started for 144 cycles, roughly 28 minutes.
Why the order you topple in does not matter
Halfway through an avalanche there are usually several cells sitting on four or more grains at once, and nothing in the rule says which to handle first. It feels like it ought to matter. It does not. The stable configuration you finish on is the same whichever order you choose — and so is the number of times each individual cell topples on the way there. Deepak Dhar proved that in 1990, and it is what the word abelian in the name refers to.
That is a stronger statement than it first sounds. Adding grain A and then grain B leaves the lattice in exactly the state you reach by adding B and then A, so “the configuration after n grains” is well defined without anyone specifying a schedule. It also lets this page take two shortcuts and stay exact. It drops all 29 grains of a frame before toppling anything, and when a cell is sitting on 4k + r grains it topples that cell k times in a single step rather than k times around the loop. Both are licensed by the theorem, and both land on the configuration a strictly one-grain-at-a-time simulation would land on, to the grain.
The algebra under the name goes further than this plate needs but is worth knowing. The configurations a long-running pile keeps coming back to — the recurrent ones — form a finite abelian group under “add, then relax”, and Majumdar and Dhar showed in the early 1990s that they correspond one-to-one with the spanning trees of the lattice, with the boundary acting as a single sink. Counting stable sandpiles and counting spanning trees are the same problem in disguise.
Self-organized criticality, and how big an avalanche gets
The interesting claim in the 1987 paper was not about sand. It was that a system with no tuned parameter can drive itself to the knife edge where a tiny disturbance produces a response of any size. Add grains slowly and the pile fills until it is everywhere close to toppling; from then on one more grain may do nothing, or may set off a cascade that crosses the whole lattice. Nobody chose that state. It is where the dynamics ends up.
Here is what that looks like, counted over all 26,100 single-grain drops of one cycle on this lattice:
- 71.6% of grains topple nothing at all. They just sit there.
- Of the avalanches that do happen, the tail falls slowly: 12.7% of all drops move 10 or more grains, 6.8% move 100 or more, 3.6% move 1,000 or more, and 1.2% move 10,000 or more.
- The largest single grain of the run set off 100,781 topplings — nearly ten for every cell on the lattice.
Read that middle row again: for the first two decades each factor of ten in size costs only about half the probability, and it falls away faster only at the very top, where a 101×101 board runs out of room. A distribution with no characteristic scale is exactly what “critical” means, and it is why the same statistics get invoked for earthquakes, forest fires and network outages. Fit a slope to those numbers and the exponent comes out near 1.2, which is where published estimates for this model sit.
An honest caveat, because this is the part that gets oversold. The two-dimensional model on this page is not a clean power law. Its avalanche statistics are multifractal — no single exponent describes them at every scale — and it is now understood to sit in a different universality class from the stochastic sandpiles it is often lumped with. And a finite 101×101 lattice truncates the tail by construction: an avalanche cannot be larger than the board it runs on.
The shape it grows into
Watch the outline. A pile fed at one point does not spread into a disc and it does not spread into a square; it settles into a specific convex outline with flat facets, the same outline every time, and the closer you look the more structure appears inside it. Wesley Pegden and Charles Smart proved in 2013 that this shape is real — that the sandpile has a scaling limit at all — and in 2016, with Lionel Levine, they explained the interior: the pattern breaks into triangular patches of exactly periodic tilings, and the patches are indexed by an Apollonian circle packing. Which is the same object as plate 13 in this gallery, arrived at from an entirely different direction.
Self-similarity is the practical consequence. Blow up the middle of a big pile and you find arrangements you already saw in a small one, at a different size. That is what makes this a fractal in any useful sense of the word, and it is the reason the picture stays interesting as it grows instead of just getting bigger.
One number to hang on to: the average height inside the body of the pile settles at about 2.138 grains per cell as measured on this plate at the end of a cycle. The accepted value for the stationary density of this model on the infinite square lattice is 17/8 = 2.125. Three grains everywhere would be the densest stable state; the pile does not get there, and the deficit is where the pattern lives.
How to read the four colours, and what to watch
A cell holds 0, 1, 2 or 3 grains once it is stable, and nothing in between, so this plate uses four flat inks rather than a gradient — a legend, not a ramp. Interpolating between them would paint heights the automaton cannot hold.
- Page background — 0 grains. Bare lattice: outside the pile, and the scattered holes inside it.
- Coral — 1 grain. The rarest state, about 9% of cells, and the one that draws the fine diagonal filigree. It gets the accent colour because it is rare.
- Bright cobalt — 2 grains. Around 26% of the lattice.
- Deep cobalt — 3 grains. The most common state at roughly 49%, and the body of the pile.
Things worth watching for. The edge advances in jumps, not smoothly: it sits still while grains accumulate, then a single grain pushes it out several cells at once. The centre keeps rearranging long after it stops growing outward — a cascade that reaches the middle rewrites it. And the triangular patches resolve as the pile gets bigger: a region that read as noise at 5,000 grains is a clean repeating tile at 25,000.
Honest limits. Real sand does not obey this rule; “sandpile” is a metaphor from the 1987 paper, and laboratory piles show this behaviour only sometimes — the Oslo rice-pile experiment found power-law avalanches for long grains and not for rounder ones. The lattice here is 101 cells across whatever the size of your screen, so on a wide stage each cell is about twelve pixels; smoothing is deliberately switched off, so what you see is the cells themselves and you can count them. Grains that reach the boundary are lost, which means this is a finite-lattice sandpile and the limit shape gets clipped where it meets the edge rather than growing forever. And because 29 grains go in per frame, you never watch one avalanche in isolation: a frame is the sum of twenty-nine of them. Under prefers-reduced-motion the animation does not run at all — the pile is grown for 700 frames’ worth of grains and drawn once, as a still.
Curious how the loop and canvas fit together? Read how it works →
More from the gallery
- Plate 20 Moiré Interference Two line grids turning against each other into slow bands.
- Plate 21 Kuramoto Sync Scattered blinking lights pulling one another into step.
- Plate 22 Slime Mould Network Wandering specks laying trails that grow into a branching web.
- Plate 01 Quantum Fibonacci Golden-angle phyllotaxis blooming from the seed outward.
- Plate 02 Bitcoin Matrix A quiet rain of ₿ and hex sliding down the glass.
- Plate 03 Cosmic Circles Soft orbs drifting through slow orbital rounds.