Ground Water Flow
WHAT IS IT?
This project explores the flow of water up and down hills (depending on gravitational direction). It generates a random landscape of hills (determined by the sliders) and then the water follows the slope of the hills into the valleys (or mountain tops). The slop influences both the speed and direction of water movement.
HOW TO USE IT
? Click setup to draw the landscape and go to run the model.
The hilliness slider changes the number of hills that there are on the landscape The Number of Turtles slider changes how many turtles (water molecules) are on the landscape the gravity direction slider determines whether the water molecules flow towards brighter (uphill) or darker (downhill) locations
WHAT TO EXPLORE Most of the exploration here is looking at the pathways which water molecules flow on the landscape. Try to slow down the model and look at the pathways that the molecules take at the intersection of neighboring hills and valleys. It is fun to let the water settle and then switch the gravity direction to have them go the other way.
Is the model reversible? Do water molecules wind up in the same spots when you repeatedly run the model forwards and backwards?
Turtle procedures
turtles-own [dx dy]
;the go procedure determines turtle movement
;turtles calculate their change in x and y direction by looking at the direction of flow (gravdir)
;as well as the change in gradient (height) between their patch and the surrounding patches
;the change effects both the direction (through seth) and speed (through fd) of movement
to go
setdx (gravdir * 2 - 1) * ((height-at 1 0) * -1 + (height-at -1 0) * 1)
setdy (gravdir * 2 - 1) * ((height-at 0 1) * -1 + (height-at 0 -1) * 1)
seth atan dx dy
wiggle
fd sqrt (dx * dx + dy * dy)
end
;wiggle adds a little random variation to the direction of movement
to wiggle
rt (random 10)
lt (random 10)
end
Observer procedures
patches-own [height]
;when the model is set up, one turtle is created
;that turtle goes to a random patch and randomly walks around and stamps from that location
;it repeats that a number of times (once for each hill)
;then the patches diffuse out some of that painted terrain to create the hilly landscape
to setup
ca crt 1
repeat hilliness ; create foundations for hills
[ask-turtles [setxy (random screen-height) (random screen-width)
setc 52
repeat 35 [stamp color seth random 360 fd 1]]]
ask-turtles [die] ; end of hill making
ask-patches [if pc = 52 [set height ((random 50) + 25) ]]; creates through difusion
repeat 45 [diffuse height .9]
;patches get scaled by their height
ask-patches [scale-pc green (int (height)) 0 10]
crt num-turtles
ask-turtles [setxy (random screen-height) (random screen-width)
setc 95]
end
;computes the average height at which the turtles are
to averageheight
output ((sum-of-turtles [height]) / count-turtles)
end
