This simulation needs WebAssembly, and it could not start in this browser.
The image is a frame from a real run. Check that JavaScript is on, or try another browser.
Per Bak, Chao Tang and Kurt Wiesenfeld introduced the sandpile in 1987 as the first example of self-organized criticality: a system that, driven slowly and left alone, tunes itself to a critical state where disturbances of every size occur, with no parameter set by hand. Add grains of sand one at a time and most land quietly, but now and then one sets off an avalanche, and the avalanches follow a power law: no typical size, small ones common, huge ones rare but never absent. Bak argued that the same mechanism lies behind earthquakes, forest fires and other bursty events in nature.
What you see
A 200 by 200 grid. Each cell holds 0 to 3 grains: black for none, then darker to lighter purple for 1, 2 and 3. Grains fall one by one, and each topples to rest before the next one falls, so every frame shows stable sand.
Rule
A cell holding 4 grains or more topples: it loses 4 and each of its four nearest neighbors (up, down, left, right) gains one. Grains toppled over the edge of the grid are lost. A toppling can push neighbors to 4, which topple in turn, and the avalanche runs until every cell holds at most 3:
Deepak Dhar showed in 1990 that the order of topplings does not matter: the pile always reaches the same stable state, which is why the model is called Abelian. Under random drive the mean height settles at about 2.125 grains per cell, and the number of avalanches of size falls off as a power law with close to 1.2.
Presets
Pile at the center: 20 grains per step on the center cell of an empty grid, also the default. The pile spreads as a nearly round disk filled with a fourfold symmetric pattern of nested triangles and stripes. It reaches the edge of the grid after about 70,000 grains (one minute), and from then on grains spill over the edges.
Random rain: 20 grains per step on random cells, starting from random heights. The mean height rises from 1.5 to 2.12 grains per cell within 30 seconds and then stays there: grains leave over the edges as fast as they fall, in avalanches of every size.
Loaded grid: every cell starts with 3 grains, one below toppling, and single grains fall on the center. The first grain topples a cross that runs through the whole grid to all four edges. Later grains set off ever larger avalanches, and the pile slowly loses its excess: the mean height falls from 3 to 2.45 in two minutes, toward the same critical value as the rain.
Parameters
Grains per step: 1 to 100 grains each step.
Grains fall: on the center cell, or on random cells all over the grid.
Both apply immediately.