Giter Site home page Giter Site logo

araujo88 / avalanche Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 22.51 MB

Bak-Tang-Wiesenfeld sandpile avalanche model

License: GNU General Public License v3.0

C 93.90% Makefile 6.10%
bak-tang-wiesenfeld sandpile-model avalanche automata self-organized-criticality

avalanche's Introduction

avalanche

Bak-Tang-Wiesenfeld Sandpile Model

The code on this folder aim to model the sandpile avalanche model as presented by Bak, Tang and Wiesenfeld (1988). The user is required to enter three parameters: the size of the matrix (which represents a 2D plane), the number of grains which will be randomly distributed along the matrix and the time interval between them. The program computes each iteration and, if a condition for avalanche is met (which is the rule that a single element from the matrix cannot contain more than 4 grains), the four grains are distributed to the adjacent elements, remaining 1 grain. The aim of this simulation is to show how simple systems evolve into chaotic configurations. The output can be visualized in Paraview (www.paraview.org).

Reference: Bak, Per, Chao Tang, and Kurt Wiesenfeld. "Self-organized criticality." Physical review A 38.1 (1988): 364.

Requirements

Paraview (https://www.paraview.org/) is required for data visualization.

Compilation and running

Compilation:

make clean

make all

To run the program, 4 arguments are needed: matrix size, total number of grains, grain printing interval and type of simulation (0 for grain at center point or 1 for grain at random point).

Examples

Grain at center point

./avalanche 50 5000 5 0

This command will run the program with matrix size of 50, 5000 total number of grains (5000 iterations), matrix output every 5 grain interval and grain always placed at the center point at each iteration. A video with this example can be found on the /examples folder.

Alt text

Video snapshot at the end of the simulation

Grain at random point

./avalanche 50 10000 5 1

This command will run the program with matrix size of 50, 5000 total number of grains (5000 iterations), matrix output every 5 grain interval and grain always placed at a random point at each iteration. A video with this example can be found on the /examples folder.

Alt text

Video snapshot at the end of the simulation

Data visualization

For visualization of the program output, run the following command:

paraview output/

In Paraview, choose "open files" and then select the generated .vtk files.

avalanche's People

Contributors

araujo88 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.