globals [ initial-trees ;; how many trees (green patches) we started with burned-trees ;; how many have burned so far ] breeds [ fires ;; bright red turtles -- the leading edge of the fire embers ;; turtles gradually fading from red to near black ] to setup ca ;; make some green trees, leaving edges blank so ;; the fire can't wrap around the edges of the screen ask patches with [abs pxcor < screen-edge-x and abs pycor < screen-edge-y] [ if (random-float 100) < density [ set pcolor green ] ] ;; make a column of burning trees ask patches with [pxcor = (- screen-edge-x)] [ ignite ] ;; set tree counts set initial-trees count patches with [pcolor = green] set burned-trees 0 end to go if not any? turtles [ stop ] ask fires [ ;; use without-interruption to prevent the same patch ;; from igniting multiple times without-interruption [ ask neighbors4 with [pcolor = green] [ ignite ] set breed embers ] ] fade-embers end to ignite ;; patch procedure sprout 1 [ set breed fires set color red ] set pcolor black set burned-trees burned-trees + 1 end to fade-embers ask embers [ set color color - 0.3 ;; make red darker if color < red - 4 ;; are we almost at black? [ stamp color die ] ] end ; *** NetLogo Model Copyright Notice *** ; ; 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. ; ; Copyright 1998 by 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 model was converted to NetLogo as part of the project: ; PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN ; CLASSROOMS. The project gratefully acknowledges the support of the ; National Science Foundation (REPP program) -- grant number REC #9814682. ; Converted from StarLogoT to NetLogo, 2001. Updated 2003. ; ; To refer to this model in academic publications, please use: ; Wilensky, U. (1998). NetLogo Fire model. ; http://ccl.northwestern.edu/netlogo/models/Fire. ; Center for Connected Learning and Computer-Based Modeling, ; Northwestern University, Evanston, IL. ; ; In other publications, please use: ; Copyright 1998 by Uri Wilensky. All rights reserved. See ; http://ccl.northwestern.edu/netlogo/models/Fire ; for terms of use. ; ; *** End of NetLogo Model Copyright Notice *** @#$#@#$#@ GRAPHICS-WINDOW 200 10 612 443 100 100 2.0 0 10 1 1 1 CC-WINDOW 5 252 199 443 Command Center MONITOR 43 125 158 174 percent burned (burned-trees / initial-trees)\n* 100 1 1 SLIDER 5 82 190 115 density density 0.0 99.0 57.0 1.0 1 % BUTTON 106 35 175 71 go go T 1 T OBSERVER NIL BUTTON 26 35 96 71 setup setup NIL 1 T OBSERVER T @#$#@#$#@ WHAT IS IT? ----------- This project simulates the spread of a fire through a forest. The fire starts on the left edge of the forest, and spreads to neighboring trees. The fire spreads in four directions: north, east, south, and west. There is no wind in this particular model as it is. So, the fire must have trees along its path in order to advance. That is, the fire cannot skip over an unwooded area (patch), so such a patch blocks the fire's motion in that specific direction The fire's chance of reaching the right edge of the forest depends critically on the density of trees in the forest. HOW TO USE IT ------------- Click the SETUP button to set up the trees (green) and fire (red on the left-hand side). Click the GO button to start the simulation. The DENSITY slider controls the density of trees in the forest. (Note: Changes in the DENSITY slider do not take effect until the next SETUP.) THINGS TO NOTICE ---------------- Set the density of trees to 55%. At this setting, there is virtually no chance that the fire will reach the right edge of the forest. Set the density of trees to 70%. At this setting, it is almost certain that the fire will reach the right edge. There is a sharp transition around 59% density. At 59% density, the fire has a 50/50 chance of reaching the right edge. The black border around the edge prevents the fire from spreading off the edges of the screen. Each turtle that represents a piece of the fire is born and then dies without ever moving. Because no turtles are moving on the screen, one could say that the motion of the fire is a construction in our mind. This is an example of an emergent phenomena: each tree is either burning or not burning, but these collective local behaviors amount to an overall effect. The effect (moving fire) is created by the agents, even though it is not experienced by the agents. So is an emergent phenomenon the same as an optical illusion? That is, do you think that the motion of fire is an optical illusion? Is this the same as the illusion of motion running through a sequence of flashing neon lights? If not, why not? Arguably, there is no "thing" running along the neon lights -- just lights flashing. So, is fire a "thing" at all? If not, then how can it move? Moreover, how can it burn? EXTENDING THE MODEL ------------------- What if the fire could spread in eight directions (including diagonals)? To do that, use "neighbors" instead of "neighbors4". How would that change the fire's chances of reaching the right edge? In this model, what "critical density" of trees is needed for the fire to propagate? Add wind to the model so that the fire can "jump" greater distances in certain directions. NETLOGO FEATURES ----------------- Unburned trees are represented by green patches; burning trees are represented by turtles. Two breeds of turtles are used, "fires" and "embers". When a tree catches fire, a new fire turtle is created; a fire turns into an ember on the next turn. Notice how the program gradually darkens the color of embers to achieve the visual effect of burning out. The "neighbors4" primitive is used to spread the fire. You could also write the model without turtles, by just having the patches spread the fire. Written that way, the model would run much slower, since all of the patches would always be active. By using turtles, it's much easier to restrict the model's activity to just the area around the leading edge of the fire. See the "CA 1D Rule 30" and "CA 1D Rule 30 Turtle" for an example of a model written both with and without turtles. RELATED MODELS -------------- Percolation, Rumor Mill CREDITS AND REFERENCES ---------------------- This model was developed at the MIT Media Lab. See Resnick, M. (1994) "Turtles, Termites and Traffic Jams: Explorations in Massively Parallel Microworlds." Cambridge, Ma: MIT Press. Adapted to StarLogoT, 1997, as part of the Connected Mathematics Project. Adapted to NetLogo, 2000, as part of the Participatory Simulations Project. Updated 2003. To refer to this model in academic publications, please use: Wilensky, U. (1998). NetLogo Fire model. http://ccl.northwestern.edu/netlogo/models/Fire. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL. In other publications, please use: Copyright 1998 by Uri Wilensky. All rights reserved. See http://ccl.northwestern.edu/netlogo/models/Fire for terms of use. @#$#@#$#@ default true 0 Polygon -7566196 true true 150 5 40 250 150 205 260 250 @#$#@#$#@ NetLogo 2.0beta5 @#$#@#$#@ set density 60 setup repeat 180 [ go ] @#$#@#$#@ @#$#@#$#@