SandPile Model

The SandPile model simulates the development of a sand pile to which a grain of sand is added at each time step. At a critical slope level, the sandpile relaxes and distributes grains onto the surrounding cells.

The model is initialized with a random distribution of sand, with the slope exceeding the critical value everywhere. It is then relaxed (sand topples) such that the model ends the initial iteration step with a slope below the critical slope everywhere. In each further iteration, a grain of sand is added at a random position. If the slope exceeds the critical value, sand topples to the neighboring positions. If this leads to a neighboring position exceeding the critical slope, the sand topples again. This goes on during each timestep until the slope is below the critical value everywhere. The borders of the model’s grid are fixed at a given (sub-critical) slope value, such that each sand may “fall off” the borders of the grid.

In each timestep, the rearrangement of grains can affect any number of positions. It is possible that the slope only changes in one position, or that a single grain added causes an avalanche that affects almost the entire grid. These features of unpredictability and lack of characteristic scale make the model interesting.

Default Model Configuration

Below are the default configuration parameters for the SandPile model:

# --- Space parameters --------------------------------------------------------
# The physical space this model is embedded in
space:
  periodic: false

# --- CellManager -------------------------------------------------------------
cell_manager:
  grid:
    structure: square
    resolution: 32      # in cells per unit length of physical space

  neighborhood:
    mode: vonNeumann

  cell_params:
    # Cells are randomly initialized using a uniform distribution in the given
    # closed range.
    # Choose values such that this is supercritical
    initial_slope_lower_limit: !is-unsigned 5
    initial_slope_upper_limit: !is-unsigned 6

# --- Dynamics ----------------------------------------------------------------
# The critical slope; beyond this value, sand topples
critical_slope: !is-unsigned 4

Available Plots

The following plot configurations are available for the SandPile model:

Default Plot Configuration

# --- A plot of the slope (mean - critical_slope) -----------------------------
mean_slope:
  based_on: mean_slope


# --- Plot the avalanche area fraction time series ----------------------------
# Depending on the number of cells, you will perhaps need to adjust the
# y limits of the plot accordingly. Set the minimum smaller or equal to
# 1/num_cells
area_fraction:
  based_on: area_fraction


# --- A plot of the cluster size distribution ---------------------------------
cluster_size_distribution:
  based_on: cluster_size_distribution


# --- A plot the complementary cumulative probability distribution ------------
compl_cum_prob_dist:
  based_on: compl_cum_prob_dist


# --- An animation of the CA `slope` state ------------------------------------
slope_anim:
  based_on: .ca.state.anim_ffmpeg  # update to *_frames to save frames
  enabled: false

  model_name: SandPile

  # Select the properties to plot
  to_plot:
    # The name of the property to plot with its options
    slope: &anim_slope
      title: Slope
      cmap: copper


# --- An animation of the CA `avalanche` state --------------------------------
avalanche_anim:
  based_on: .ca.state.anim_ffmpeg  # update to *_frames to save frames
  enabled: false

  model_name: SandPile

  # Change the properties to be plotted to use the avalanche data
  to_plot:
    avalanche: &anim_avalanche
      title: Avalanche
      limits: [0, 1]
      cmap: 
        static: black
        mobile: orange


# --- An animation of the slope and avalanche side by side --------------------
slope_and_avalanche_anim:
  based_on: .ca.state.anim_ffmpeg  # update to *_frames to save frames
  
  model_name: SandPile

  to_plot:
    # Re-use the information from above
    slope: *anim_slope
    avalanche: *anim_avalanche

Base Plot Configuration

# --- A plot of the slope (mean - critical_slope) -----------------------------
mean_slope:
  based_on: .default_style_and_helpers

  creator: universe
  universes: all
  
  # Use the SandPile-specific plot functions
  module: model_plots.SandPile
  plot_func: mean_slope

  # Select that the critical slope value should be added to the plot
  show_critical_slope_value: true

  # Add a title
  helpers:
    set_title:
      title: Mean Slope

  # Arguments passed to plt.plot
  linestyle: 'None'
  marker: '.'


# --- Plot the avalanche area fraction time series ----------------------------
area_fraction:
  based_on: .time_series.density

  # Adjust helpers
  helpers:
    set_labels:
      y: Rel. Area $[1/A]$
    set_scales:
      y: log
    set_limits:
      y: [1.e-5, 1.]
    set_title:
      title: Avalanche Size Area Fraction

  # Specify which data to use
  model_name: SandPile
  path_to_data: avalanche
  
  # Select states from which to calculate the density; result is binary mask
  preprocess:
    - create_mask: [==, 1]
  
  mean_of: [x, y]

  # And that the avalanche sizes are to be used as dot sizes. The sizes are
  # normalized by dividing through the maximum size, which allows scaling the
  # scatter dots via the `size_factor` argument
  sizes_from: avalanche_size
  size_factor: 42.

  # Arguments passed on to plt.scatter ...
  # Adjust such that they don't have an edge
  marker: 'o'
  alpha: .9


# --- A plot of the cluster size distribution ---------------------------------
cluster_size_distribution:
  based_on: .distribution.histogram

  # Specify which data to calculate the histogram of
  model_name: SandPile
  path_to_data: avalanche_size

  # Set scales, limits, and title
  helpers:
    set_title:
      title: Cluster Size Distribution
    set_labels:
      x: $\log_{10}(A)$
      y: $N_A$
    set_scales:
      y: log
    set_limits:
      x: [0, max]
      y: [0.8, ~]

  # Preprocess the histogram
  preprocess:
  # Apply a base-10 logarithm; histogram makes no sense otherwise
    - log10

  # Configure the histogram
  histogram_kwargs:
    bins: 25
    range: [0, ~]  # None is resolved to data.min() or data.max()

  # Arguments passed to plt.bar
  # ...


# --- A plot of the complementary cumulative probability distribution ---------
compl_cum_prob_dist:
  based_on: .distribution.histogram.complementary_cumulative

  # Specify basic configuration for this model
  model_name: SandPile
  path_to_data: avalanche_size

  helpers:
    set_title:
      title: Compl. Cum. Prob. Distr. of Avalanche Sizes
    set_scales:
      x: log
      y: log
    set_labels:
      x: Cluster Size $[A]$
      y: $P_A(A)$
    set_limits:
      x: [0.8, ~]

  # Arguments passed to plt.plot
  # ...

For the utopya base plots, see Multiverse Base Configuration.

References

  • Bak, P., K. Chen and C. Tang, 1990: Self-organized criticality: An explanation of the 1/f noise, Phys. Rev. Lett., 59, 4, 381–384, doi: 10.1103/PhysRevLett.59.381.

  • Kurt Roth: Complex, Chaotic and Evolving Environmental Systems (Lecture Notes). Chapter 7.2 (Discrete Complex Systems - Contact Processes)