An open API service indexing awesome lists of open source software.

https://github.com/mrquincle/sandpile

The prototypical sandpile model for self-organized criticality (SOC) to study self-organization principles
https://github.com/mrquincle/sandpile

Last synced: 7 months ago
JSON representation

The prototypical sandpile model for self-organized criticality (SOC) to study self-organization principles

Awesome Lists containing this project

README

          

##########################################################################################
# _ _ ______ _ _
# | | | (_____ (_) |
# \ \ ____ ____ _ | |_____) )| | ____
# \ \ / _ | _ \ / || | ____/ | |/ _ )
# _____) | ( | | | | ( (_| | | | | ( (/ /
# (______/ \_||_|_| |_|\____|_| |_|_|\____)
#
##########################################################################################
#
# SandPile simulator, the prototypical toys of theoretical physicists to study self-
# organised criticality.
#
# The code falls under the Lesser General Public License (LGPL GNU v3).

# Author: Anne C. van Rossum (Almende B.V.)
# Date: Oct 28, 2010
#
# ASCII Art generated by: http://www.network-science.de/ascii/ with font "stop".
#
# Copyright © 2010 Anne van Rossum
#
##########################################################################################

# Information for developers

This small program uses some boost libraries and a plotting library to stay small...

On Ubuntu install:
sudo aptitude install libplplot-dev libboost-program-options-dev libboost-filesystem-dev

And then use the following flags for your linker:
-lplplotcxxd -lboost_program_options -lboost_filesystem

Everything is compiled with "-Werror" so there should be errors nor warnings.

The cmake build system is added so you will be able to compile it very easily:

1.) mkdir build
2.) cd build
3.) cmake ..
4.) make

Eventually use "verbose=1 make" to debug. I prefer to enformce "out of source" builds, so
that the source directories are not cluttered with binaries. Everything will end up in the
directory "build". As soon as you created the "build" directory and made sure that cmake
created a proper Makefile, then you can compile subsequently within an IDE like Eclipse,
in which case you have to uncheck:

Project - Properties - C/C++ Build - Makefile generation - Generate Makefiles automatically

And subsequently change: Build location - Build directory:

${workspace_loc:/SandPile/build}

The script in "scripts/run_nx.sh" expects the SandPile binary in "build".

To use the simulator:

1.) mkdir output
2.) cd output
3.) ../build/Setup
4.) ../scripts/run_nx.sh 4

Here "4" indicates the number of runs created by the "Setup" binary. Please, see "Setup.cpp"
to adapt your experiment. The script creates "logX.txt" files with stdout and stderr of the
given runs (if you run it multiple times these log files will be appended with the new info).

You can plot everything in one plot by executing SandPile again:

1.) cd output
2.) ../build/SandPile --run 3

By default this will draw figures from "0" till "3" in one plot. Adjust "Main.cpp" to only
replot instead of plotting all of them.

The "config.ini" file of the given "run" directory will be used. This can be adjusted. Check
"Config.h" for the proper order of the fields. Please, take care if you change text, the
preceding number should reflect the new string length! The last number in "config.ini" is the
number of the run (and the directory). The penultimate number is a boolean which indicates if
the run needs to be performed again. If it is set to "1" everything will be overwritten. If it
is set to "0" nothing will be overwritten except for the plots.