Water Drip
WHAT IS IT?
This project explores the formation of rivulets resulting from water dripping down an inclined plane or hill. The turtles (who are hidden) descend the inclide and leave water (lighter patches) in their path. The water accumulates and gets absorbed by the surface dirt.
HOW TO USE IT
Click the Start button to setup the environment and the hidden turtles. The number of drips slider controls the number of water drops that get dropped one at a time at the top of the incline. The soil absorbancy slider sets the absorbancy of soil. The slope of surface slider sets the slope of the incline.
THINGS TO NOTICE
Observe how a wandering drips form a plume over time
EXPLORATIONS
How does changing the slope of the surface affect the size and shape of the plume?
Turtle procedures
turtles-own [
counter ; turtles keep track of the number of times they go through the loop
energy ; current amount of energy
]
;;
;; drip procedure
;; called by the start observer procedure
;;
to drip
ht ; hide the turtle
pu ; put its pen in the up position, no trace left
set counter 0 ; initialize the counter
seth (random 300) - 60 ; the turtle gets a random heading
setxy 0 - xdim + 20 0 ; the turtle is positioned at the dropping point
set energy slope + .33 * sin heading ; the turtle's initial energy is calculated
loop [ ; In this loop, turtles move according to their energy
set counter counter + 1 ; increment the counter
repeat pour [ ; repeat pour # of times
ifelse who = 0 ; If I'm turtle zero
[
repeat soil [ ; I run evaporate procedure soil # of times
evaporate ; the higher the soil coefficient, the more absorbent the soil
]
]
[ ; Else I'm not the first turtle
if who < counter [ ; If it my turn to go, (turtles start one at a time)
recycle ; check to see if I should get recycled
fd energy / 3 ; move forward
seth (random 300) - 60 ; get a new random heading
; calculate the new energy value and stamp the patch
; lighter patches indicate more water
set energy max (energy + slope + .33 * sin heading) 0
set energy ((energy + pc ) / 2)
stamp min ((energy + pc) / 2) 9
]
]
]
]
end
;;
;; recycle procedure
;; called by the drip procedure
;;
to recycle
if (xcor > xdim - 4)
or (xcor < 0 - xdim + 4)
or (ycor < 0 - ydim + 4)
or (ycor > ydim - 4)
[
die
]
end
;;
;; evaporate procedure
;; called by the drip procedure
;; This is only performed by turtle with ID 0
;; Moving left to right, center to top and wrap around from bottom, darken the patch
;;
to evaporate
dotimes [:x xdim * 2 + 1] [ ; for every x value (uses wrapping)
dotimes [:y ydim * 2 + 1] [ ; for every y value
setxy-of 0 :x - xdim :y - ydim ; move turtle with ID 0 there
stamp max pc - .5 0 ; darken the current patch
]
]
end
Observer procedures
globals [
xdim ; the dimension in x, screen x-coordinates range from -xdim to +xdim
ydim ; the dimension in y, screen y-coordinates range from -ydim to +ydim
slope ; the slope of the board
]
;;
;; start procedure
;; called by the start button
;; Clears all then creates 200 turtles.
;; initializes the globals xdim, ydim, and slope
;; asks each turtle to perform the program1 turtle procedure
;;
to start
ca
crt 200
set xdim 100
set ydim 70
set slope .1 * slope1
ask-turtles [drip]
end
5285 reads
