Percolation 3D

Percolation 3D preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)


(This model has yet to be categorized with any tags)
Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 3D 4.1pre7 • Viewed 589 times • Downloaded 36 times • Run 0 times
Download the 'Percolation 3D' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


This model is a 3D version of the 2D model Percolation. It shows how an oil spill can percolate down through permeable soil. It was inspired by a similar model meant to be done by hand on graph paper (see "Forest Fires, Oil Spills, and Fractal Geometry", Mathematics Teacher, Nov. 1998, p. 684-5).


This model represents an oil spill as a finite number of oil "particles", or simply oil drops. The oil drops sink downward through the soil by moving diagonally down and northeast, southeast, northwest or southwest. The patches through which the drops spread represent the empty spaces in the soil the porosity (or "holeyness") is adjustable. Each drop's chance of actually moving on down is contingent on a certain probability, set by the POROSITY slider. That is, the higher the porosity, the higher the chance of a drop to percolate through it. This models the fact that in more porous soil, oil has a greater chance of continuing downward.


Push the SETUP button. The oil spill is represented by red patches, which start at the top of the world.

Press the GO button to run the model or the GO ONCE button to advance the oil drops one step.

The POROSITY slider can be changed at any time to adjust the probability that droplets of oil will percolate down through the soil.

It can be run as long as you like; it resets to the top of the world when it reaches the bottom. It stops automatically when the oil spill stops advancing.

The two plots show how large the leading edge of the spill is (red) and how much soil has been saturated (brown).


Try different settings for the porosity. What do you notice about the pattern of affected soil? Can you find a setting where the oil just keeps sinking, and a setting where it just stops?

If percolation stops at a certain porosity, it's still possible that it would percolate further at that porosity given a larger world.

Note the plot of the size of the leading edge of oil. Does the value settle down roughly to a constant? How does this value depend on the porosity?


Give the soil different porosity at different depths. How does it affect the flow? In a real situation, if you took soil samples, Could you reliably predict how deep an oil spill would go or be likely to go?

Currently, the model is set so that the user has no control over how much oil will spill. Try adding a feature that will allow the user to specify precisely, when s/he presses SETUP, the amount of oil that will spill on that go. For instance, a slider may be useful here, but you'd have to modify the code to accommodate this new slider. Such control over the to-be-spilled amount of oil gives the user a basis to predict how deep the oil will eventually percolate (i.e. how many empty spaces it will fill up). But then again, the depth of the spill is related to the soil's porosity. Can you predict the depth of the spill before you press GO?


This is a good example of a cellular automaton model, because it uses only patches. It also uses a simple random-number generator to give a probability, which in turn determines the average large-scale behavior.

This is also a simple example of how plots can be used to reveal, graphically, the average behavior of a model as it unfolds.


"Fire" is a similar model. In both cases, there is a rather sharp cutoff between halting and spreading forever.

This model qualifies as a "stochastic" or "probabilistic" one-dimension cellular automaton. For more information, see the "CA Stochastic" model.


If you mention this model in an academic publication, we ask that you include these citations for the model itself and for the NetLogo software:

- Wilensky, U. (2006). NetLogo Percolation 3D model. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

- Wilensky, U. (1999). NetLogo. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

In other publications, please use:

- Copyright 2006 Uri Wilensky. All rights reserved. See for terms of use.


Copyright 2006 Uri Wilensky. All rights reserved.

Permission to use, modify or redistribute this model is hereby granted, provided that both of the following requirements are followed:

a) this copyright notice is included.

b) this model will not be redistributed for profit without permission from Uri Wilensky. Contact Uri Wilensky for appropriate licenses for redistribution for profit.

This is a 3D version of the 2D model Percolation.

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

globals [
  current-row     ;; agentset of patches in current row
  total-oil       ;; keeps track of how much ground has been saturated
                  ;; since the simulation began.

to setup
  orbit-down 90
  orbit-left 45
  set total-oil 0
  ask patches [
    if (pzcor = max-pzcor)
      [ set pcolor black ]    ;; unsaturated soil
    if (pxcor = max-pxcor) or (pycor = max-pycor)
      [ set pcolor yellow ]  ;; Place a boundary on the right side of the screen.
                             ;; This prevents the oil from wrapping laterally.
  ;; set up top row
  set current-row patches with [pzcor = max-pzcor]
  ask current-row [
    if (pxcor mod 2 = 0) and (pycor mod 2 = 0) and (pcolor != yellow)
      [ set pcolor red ]  ;; This code initializes the "oil spill".  Red
                          ;; patches represent the leading edge of the spill.

to go
  if not any? current-row with [pcolor = red]
    [ stop ]

to percolate
  ask current-row with [pcolor = red] [
    ;; oil percolates to the four patches down and southwest, southeast
    ;; northeast, and northwest
    ask patches at-points [[-1 -1 -1] [1 -1 -1] [1 1 -1] [-1 1 -1]]
      [ if (pcolor = black) and (random-float 100 < porosity)
          [ set pcolor red ] ]
    set pcolor brown
    set total-oil total-oil + 1
  ;; advance to the next row
  set current-row patch-set [patch-at 0 0 -1] of current-row

to wrap-oil
  if [pzcor] of one-of current-row = max-pzcor
    [ ;; force a display update before we
      ;; return to the top of the world.
      ask patches with [pcolor = brown]
        [ set pcolor black ] ]

to do-plot
  ;; This plot displays the number of patches that are red (percolating oil).
  set-current-plot "Percolating Oil"
  plot count current-row with [pcolor = red]
  ;; This plot displays the number of patches that are black (saturated soil).
  set-current-plot "Saturated Soil"
  plot total-oil

; Copyright 2006 Uri Wilensky. All rights reserved.
; The full copyright notice is in the Information tab.

There are 3 versions of this model.

Uploaded by When Description Download
Uri Wilensky almost 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky almost 14 years ago Model from NetLogo distribution Download this version
Uri Wilensky almost 14 years ago Percolation 3D Download this version

Attached files

File Type Description Last updated
Percolation 3D.png preview Preview for 'Percolation 3D' about 11 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.