No preview image

1 collaborator

Default-person Coram Bryant (Author)



Tagged by Tim Denton about 5 years ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 4.1 • Viewed 651 times • Downloaded 25 times • Run 4 times
Download the 'Fire' 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 project simulates the spread of a fire through a forest. It shows that the fire's chance of reaching the right edge of the forest depends critically on the density of trees. This is an example of a common feature of complex systems, the presence of a non-linear threshold or critical parameter.


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.

The model assumes there is no wind. 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 direction.


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


When you run the model, how much of the forest burns. If you run it again with the same settings, do the same trees burn? How similar is the burn from run to run?

Each turtle that represents a piece of the fire is born and then dies without ever moving. If the fire is made of turtles but no turtles are moving, what does it mean to say that the fire moves? This is an example of different levels in a system: at the level of the individual turtles, there is no motion, but at the level of the turtles collectively over time, the fire moves.


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.

Try setting up and running a BehaviorSpace experiment (see Tools menu) to analyze the percent burned at different tree density levels.


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.


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, and doing it that way makes the code a little simpler. 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.


Percolation, Rumor Mill


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. (1997). NetLogo Fire 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 1997 Uri Wilensky. All rights reserved. See for terms of use.


Copyright 1997 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 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 developed at the MIT Media Lab using CM StarLogo. 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.

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.

Comments and Questions

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

Click to Run Model

globals [
  initial-trees          ;; how many trees (green patches) we started with
  burned-trees           ;; how many have burned so far
  fire-break-orientation ;; the orientation of upcoming fire-breaks

breed [fires fire]    ;; bright red turtles -- the leading edge of the fire
breed [embers ember]  ;; turtles gradually fading from red to near black

to setup
  set-default-shape turtles "square"
  ;; make some green trees
  ask patches with [(random-float 100) < forest-density]
    [ set pcolor green ]
  ;; make a column of burning trees
  ;ask patches with [pxcor = min-pxcor]
  ;  [ ignite ]
  ;; only ignite the center patch
  ask patch 0 0 [ignite]
  ;; set tree counts
  set initial-trees count patches with [pcolor = green]
  set burned-trees 0
  set fire-break-orientation 180

to go
  if not any? turtles  ;; either fires or embers
    [ stop ]

to forty-five
   set fire-break-orientation 45

to horiz
  set fire-break-orientation 90

to neg-forty-five
  set fire-break-orientation 135

to vert
  set fire-break-orientation 180

; Creates a fire-break, 30 units long and fire-break-width units wide
; If the wind is blowing, the fire-breaks is automatically built
; orthoganal to the wind.  Otherwise, it is build in the direction specified
; via the user interface buttons.

to fire-break
  if mouse-inside? and mouse-down?
    if wind-strength > 0
      set fire-break-orientation wind-direction + 90
    let width-rpt fire-break-width
    print width-rpt
    let length-rpt 30
    let start-patch patch mouse-xcor mouse-ycor
    repeat width-rpt
      let l 0
      repeat length-rpt
        if is-patch? start-patch
          ask start-patch 
          [let next-p patch-at-heading-and-distance fire-break-orientation l
            if is-patch? next-p [ask next-p [ set pcolor red - 4]]
        set l (l + 1)
      if is-patch? start-patch
        ask start-patch [set start-patch patch-at-heading-and-distance (fire-break-orientation - 90) 1]

to consume
ask fires
    ; if there is wind, blow an ember in the direction of the
    ; wind, according to the strength
    ifelse wind-strength > 0
      ; get the direction, taking into account variability
      let dir (wind-direction + (((random wind-direction-variability) * 2) - wind-direction-variability))
      ; get the wind strength, taking into account variability
      let str (wind-strength + (random gust-strength))
      ; Verify that we are landing the ember on a valid patch
      ; If so, ignite it
      let p patch-at-heading-and-distance dir str
      if is-patch? p
        ask p [ if pcolor = green [ ignite ]]
      ; burn local forest, taking into account wind direction
      let dir-min wind-direction - (45 - random 10) ;
      ;if dir-min < 0 [set dir-min 360 + dir-min]
      let dir-max wind-direction + (45 + random 10);
      if dir-max > 360 [
        set dir-max dir-max - 360
        Set dir-min dir-min - 360
      ask neighbors with [pcolor = green]
        ; if this patch is within our direction window, then burn it
        let corrected-dir towards myself
        ifelse corrected-dir >= 180
        [ set corrected-dir corrected-dir - 180 ]
        [ set corrected-dir corrected-dir + 180 ]
        if (corrected-dir >= dir-min) and (corrected-dir <= dir-max) [ignite]
      ; burn local forest, in all directions if there is no wind
      ask neighbors4 with [pcolor = green] [ ignite ]
    set breed embers

;; creates the fire turtles

to ignite  ;; patch procedure
  sprout-fires 1
    [ set color red ]
  set pcolor black
  set burned-trees burned-trees + 1

;; achieve fading color effect for the fire as it burns

to fade-embers
  ask embers
    [ set color color - 0.3  ;; make red darker
      if color < red - 3.5     ;; are we almost at black?
        [ set pcolor color
          die ] ]

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

There is only one version of this model, created almost 7 years ago by Coram Bryant.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.