created by Alexander Dutine

**Abstract.** The sandpile model [1] is a cellular automaton, that, in spite of its trivial update scheme, shows behaviour present in a multitude of biological
relevenat systems. Prominently, the system exhibits self-organized criticality.

Consider a finite 2d-grid, where grains of sand are droppped on one of the cells. If a cell crosses a threshold value of grains it can hold, like a real sandpile, it topples and distributes one grain of sand to each neighbouring cell.

At first introducing some notation: The whole grid consists of $N \times N$ cells with $z_{n,m}$, $n, m \isin [1, N]$, sand grains on them. The threshold value is $z_{c}=3$ for the 2d-grid. The whole system is then updated as follows:

Each step, one grain of sand is dropped on a cell,
\[
z_{n,m} \rightarrow z_{n,m}+1
\]
If $z_{n,m}>z_{c}$, the pile topples and sand grains are spread to the nearest neighbouring cells,
\[
z_{n,m} \rightarrow z_{n,m}-4 \\
z_{n \pm 1,m} \rightarrow z_{n \pm 1,m}+1 \\
z_{n,m \pm 1} \rightarrow z_{n,m \pm 1}+1
\]
The total amount of sand in the system is not conserved, because of open boundary conditions: A cell toppling at the boundary drops grains of sand out of the system.

The system reaches critical configurations on its own, meaning the next addition of a grain leads to the pile toppling over, creating potentially an avalanche
of sand that travels through the system until the system reaches another stable configuration. The size of these avalanches differ from only one cell topppling over
to sand travelling over the whole system in a chain of topplings. These critical configurations are reached starting from arbitrary starting conditions,
which can be visualized with the following simulation of the model. Thus the sandpile model exhibits self-organized criticality.

Clicking on one of the cells of the grid lets you choose the position on which the sand is added to the system, turning the chosen cell grey until the simulation starts.
If no cell is chosen, the sand is added to the center cell by default. The color of the cells determine the amount of grains they hold: white, yellow, orange, red for zero, one, two, three grains respectively.

If the grains of sand should be added manually one at a time, switch the corresponding checkbox: Now each click on a cell adds one grain to that cell.

If the grains of sand should be added to random cells, switch the corresponding checkbox: The added grains are now distributed randomly over the grid.

Note: If both boxes are checked, clicking the grid anywhere adds a grain of sand randomly to one of the cells.

Instead of starting with an empty grid, it can be advantageous to either start with a random state, where every cell has a random amount of sand grains by checking the
third checkbox, or to speed up the simulation. For that, it is possible to skip the drawing simulation steps by adjusting the slider: skip = 1 is the default setting, where
every simulation step is shown. For higher skip values, only every specified simualtion step is explicitly drawn on the grid. Both possibilities enable the observation of
later states of the system.

The graph on the left plots the total percentage of sand grains in comparison to the minimally stable maximum (3 grains on every cell) for every added grain of sand during the simulation.
If skip is bigger than one, only the shown simulation steps will be considered in this plot. This graph shows directly, that the system never reaches the minimally stable state
when the sand is not manually added in such a manner that no toppling events occur. Instead, due to the loss of grains at the open boundary of the system settles into a regime, where
single topplings up to system wide avalanches, chains of topplings, can occur. This is the self-organized critical state of the system. The sandpile model therefore exhibits self-organized
criticality. Although the update equations coverning the dynamics of the system are quite simple, the system exhibits complex behaviour that can be regularly observed in nature.

- [1]
- Self-organized Criticality , Phys Review A 38( 1 ) 1988. :