Fire (evolved version)

1 collaborator

Katerina Benisi (Author)

Tags

fire

Tagged by Katerina Benisi about 1 month ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.3.0 • Viewed 40 times • Downloaded 1 time • Run 0 times

Info tab cannot be displayed because of an encoding error

Click to Run Model

```globals [
initial-trees
burned-trees
;; how many trees (green patches) we started with
]
breed [fires fire]    ;; bright red turtles -- the leading edge of the fire
breed [embers ember]

to setup
clear-all
;; make some green trees
ask patches with [(random-float 100) < Density]
[ set pcolor green ]
;; make a column of burning trees at the left-edge
if Starting_point_of_fire = "Center"  [ask patches [
if pxcor = 0 and pycor < 5 and pycor > 1
[ set pcolor red ]
]
]
if Starting_point_of_fire = "Left side" [ask patches with [pxcor = min-pxcor]
[ set pcolor red ]]
;; keep track of how many trees there are
set initial-trees count patches with [pcolor = green]
reset-ticks
end

to go
;; stop the model when done
if all? patches [pcolor != red]
[ stop ]

;; each burning tree (red patch) checks its 4 neighbors.
;; If any are unburned trees (green patches), change their probability
;; of igniting based on the wind direction
ask patches with [pcolor = red] [
;; ask the unburned trees neighboring the burning tree
ask neighbors4 with [pcolor = green] [

;; compute the direction from you (the green tree) to the burning tree
;; (NOTE: “myself” is the burning tree (the red patch) that asked you
;; to execute commands)
let direction towards myself

;; the burning tree is north of you
;; so the south wind impedes the fire spreading to you
;; so reduce the probability of spread
if (direction = 0 ) [
set probability probability - South_wind_speed ]

;; the burning tree is east of you
;; so the west wind impedes the fire spreading to you
;; so reduce the probability of spread
if (direction = 90 ) [
set probability probability - West_wind_speed ]

;; the burning tree is south of you
;; so the south wind aids the fire spreading to you
;; so increase the probability of spread
if (direction = 180 ) [
set probability probability + South_wind_speed ]

;; the burning tree is west of you
;; so the west wind aids the fire spreading to you
;; so increase the probability of spread
if (direction = 270 ) [
set probability probability + West_wind_speed ]
if random 100 < probability [
set pcolor red ;; to catch on fire
;; if big jumps is on, then sparks can fly farther
if Low_humidity_rates [
let target patch-at (West_wind_speed / 5) (South_wind_speed / 5)
if target != nobody and [ pcolor ] of target = green [
set pcolor red ;; to ignite the target patch
]
]
]
]
]
set pcolor red - 3.5;; once the tree is burned, darken its color
]

tick   ;; advance the clock by one “tick”
end

if mouse-down? [
set pcolor red
]
display
]
end