How to run:
RUSTFLAGS="-C target-cpu=native" cargo build --bin abeliansandpile --releaseThen
time ./target/release/abeliansandpile 200 40000 [mirror] [format]Where:
200is the grid size40000is the number of sand particles[mirror](optional) is any value to enable mirroring along the diagonal[format](optional) is the output format: "csv", "html", "png", or "all" (default is "all")
Examples:
# Output to all formats (CSV, HTML, PNG)
./target/release/abeliansandpile 200 40000
# Output only to HTML format
./target/release/abeliansandpile 200 40000 mirror html
# Output only to CSV format
./target/release/abeliansandpile 200 40000 none csv(at the moment this takes about 15 minutes) (takes 1.7 seconds after optimizations)
Which produces the following:
Also this:
Found many useful tips in the Rust Performance Book.
Use the rustc-hash provided FxHashSet instead of the built-in HashSet. Gave almost double performance.
Comnpile with RUSTFLAGS="-C target-cpu=native".
Computations on sandpile models in SAGE https://doc.sagemath.org/html/en/thematic_tutorials/sandpile.html#introduction
https://mathoverflow.net/a/149934
Chip-Firing and Rotor-Routing on Directed Graphs
We give a rigorous and self-contained survey of the abelian sandpile model and rotor-router model on finite directed graphs, highlighting the connections between them. We present several intriguing open problems. https://arxiv.org/abs/0801.3306
gif https://docs.rs/gif/latest/gif/
Apollonian structure in the Abelian sandpile
The Abelian sandpile process evolves configurations of chips on the integer lattice by toppling any vertex with at least 4 chips, distributing one of its chips to each of its 4 neighbors. When begun from a large stack of chips, the terminal state of the sandpile has a curious fractal structure which has remained unexplained. Using a characterization of the quadratic growths attainable by integer-superharmonic functions, we prove that the sandpile PDE recently shown to characterize the scaling limit of the sandpile admits certain fractal solutions, giving a precise mathematical perspective on the fractal nature of the sandpile. https://arxiv.org/abs/1208.4839
Pattern formation in growing sandpiles https://arxiv.org/abs/0808.1732
Primer for the algebraic geometry of sandpiles https://arxiv.org/abs/1112.6163
Publications of Wesley Pegden https://www.math.cmu.edu/~wes/pub.html
Animation of steps one by one (also have an idea on how to parallellize) https://github.com/jamais-vu/sandpile
Python implementation https://github.com/kivyfreakt/sandpile

