Abelian sandpile model
Switch branches/tags
Nothing to show
Clone or download
Latest commit d5e379c Dec 24, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
sandpile Add plotting cmd line arguments Nov 4, 2017
.gitignore Add saving and restoring from checkpoints Sep 6, 2017
LICENSE Add license Dec 24, 2017
README.md Add license Dec 24, 2017
requirements.txt Add requirements.txt Sep 9, 2017
sandpile_main.py Add plotting cmd line arguments Nov 4, 2017
setup.py Change dir structure and rename the main file Sep 7, 2017


Abelian sandpile

This code allows to create, grow and visualize Abelian sandpiles.

Example sandplie

For the description of the model see wiki or p. 52-53 in Bak (1996).


Install requirenemtns and build Cython code to make it run signingicantly faster.

pip install -r requirements.txt
python setup.py build_ext --inplace


Pour sand on the sandpile and save the sandpile after each 1000 grains.

./sandpile_main.py pour --verbose \
  --grid_size 200 --n_steps 1e5 --checkpoint_every 1e3 \
  --checkpoint_dir ./checkpoints  --store_avalanche_sizes

Plot the sandpile grid.

./sandpile_main.py plot \
  ./checkpoints/sandpile-000007470000.pckl.gz ./data/plots/ 


This code was written by Paweł Mandera and is licensed under the Apache License 2.0.


Bak, P. (1996). How Nature Works: The Science of Self-Organized Criticality. New York: Copernicus.