# Percolation

### 1 collaborator

Uri Wilensky (Author)

### Tags

earth science

Tagged by Reuven M. Lerner almost 11 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 374 times • Downloaded 106 times • Run 0 times

## WHAT IS IT?

This model 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 paper (see "Forest Fires, Oil Spills, and Fractal Geometry", Mathematics Teacher, Nov. 1998, p. 684-5).

## HOW IT WORKS

The soil is modeled as a checkerboard of hard particles (gray squares) and semi-permeable spaces in between these hard particles (brown squares). (You may need to zoom in to see the individual squares.)

Oil cannot enter the solid gray squares, but it may pass through the brown squares.

Some soils are more porous ("holey") than other soils. In this model the porosity value of the soil determines the probability that the oil will be able to enter any given brown soil square.

The model represents an oil spill as a finite number of oil "particles", or simply oil drops.

The oil spill starts at the top of the view, and percolates downward.

The leading edge of the oil spill is represented by red squares, and every square that oil has passed through (or "saturated") is shown as black.

The oil drops sink downward through the soil by moving diagonally to the right or left, slipping between the hard gray particles.

## HOW TO USE IT

Push the SETUP button to place the soil and start the oil spill (shown as red) at the top of the view.

Press the GO button to run the model.

The POROSITY slider controls the percent chance that oil will be able to enter each brown square, as it works its way downward.

The model can be run as long as you like; if the spill reaches the bottom of the view, the bottom row of squares is moved to the top, and the model continues to run from where it left off, starting at the top of the view. (Think of this as a camera panning downward, as necessary, to show the deeper percolation.)

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

## THINGS TO NOTICE

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 wider view.

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?

## EXTENDING THE MODEL

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?

## NETLOGO FEATURES

This is a good example of a cellular automaton, 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.

In the pen-and-paper activity the soil was represented by rectangles arranged in a brickwork pattern, where each rectangular cell had two neighboring rectangular cells below it. Since NetLogo's patches are always squares in an aligned grid, our replica of the model uses a checkerboard pattern instead. Can you see how the two models would have the same behavior, despite having different ways of visualizing them?

## RELATED MODELS

"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.

## HOW TO CITE

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

• Wilensky, U. (1998). NetLogo Percolation model. http://ccl.northwestern.edu/netlogo/models/Percolation. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
• Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.

This model was created as part of the project: CONNECTED MATHEMATICS: MAKING SENSE OF COMPLEX PHENOMENA THROUGH BUILDING OBJECT-BASED PARALLEL MODELS (OBPML). The project gratefully acknowledges the support of the National Science Foundation (Applications of Advanced Technologies Program) -- grant numbers RED #9552950 and REC #9632612.

This model was converted to NetLogo as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227. Converted from StarLogoT to NetLogo, 2001.

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
clear-all
set total-oil 0
reset-color
]

;; set up top row
set current-row patches with [pycor = max-pycor]
if pxcor mod 2 = 1
[ set pcolor red ]  ;; This code initializes the "oil spill".  Red
;; patches represent the leading edge of the spill.
]
reset-ticks
end

;; This procedure sets the color for the patch, according to the checkerboard pattern.

to reset-color ;; patch procedure
ifelse (pxcor + pycor) mod 2 = 1
[ set pcolor brown ]
[ set pcolor gray - 1  ]
end

to go
if not any? current-row with [pcolor = red]
[ stop ]
percolate
wrap-oil
tick
end

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

;; this procedure moves the colors from the bottom row of patches up to the top row
;; and resets all the patches below the top, so that we can see the oil continue
;; to run deeper into the ground.

to wrap-oil
if [pycor = min-pycor] of one-of current-row
[
[ set pcolor [pcolor] of myself ]
]
ask patches with [ pycor < max-pycor ] [
reset-color
]
set current-row patch-set [patch-at 0 -1] of current-row
]
end

```

There are 10 versions of this model.

Uri Wilensky almost 11 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky over 11 years ago Updated version tag Download this version
Uri Wilensky over 11 years ago Updated to version from NetLogo 5.0.3 distribution Download this version
Uri Wilensky over 12 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky almost 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky almost 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky almost 14 years ago Updated from NetLogo 4.1 Download this version
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