Demo_Fire 

Cellular automata of a forest fire

Christophe Le Page, François Bousquet, Pierre Bommel (Cirad)

Purpose

This model illustrates how the principles of cellular automata are implemented in Cormas. The spatial entity of the model (the cell, here  named Plot), can take four states: #fire (red); #forest (green); #ash (grey); #empty (white). The initial state of each cell of the spatial grid is either set to #forest with a probability p or to #empty with a probability 1-p. At the beginning, one cell is set on fire, and then the spreading of the fire, defined in the cell transition function, occurs. The transition function is the following: a cell being a forest at time t-1 will turn on fire at time t if at least one of its 4 neighbours (North, East, South, West) is on fire at time t-1. The cells being on fire will become ash at the next timestep, the cells being ash will become empty at the next timestep.

Animation gif du modèle FireAutomata Animation gif du modèle FireAutomata
p = 0.53 p = 0.58

The probability to observe a resteint fire is high if p is lower than 0.55, whereas when p is greater than 0.55, a global fire is likely to occur. This "percolation" threshold characterizes cellular automata which are representing diffusion processes. See also (if you enjoy movie !) the animation made from a 100 x 100 spatial grid (p = 0.58).

The following four versions describe four different ways to implement a fire diffusion model on a grid.

For these 4 versions, we consider only three possible states: forest, fire, or empty (#forest, #fire, #empty). The fire doesn't extinguish by itself (except for version 4b).


Version 1 : standard cellular automata

    ** Select Fire_1_CA.pcl version from Demo_Fire **

This version provides a standard version of a cellular automaton. Here, only one class is created (Plot), subclass of SpatialEntityCell. It already contains two attributes: state and bufferState. Here, we declare #empty as default value:



To create the initial space, select one of the 3 initialization methods : init_4 (which creates a neighborhood space 4), init_6 (neighborhood of 6, or init_8 (neighborhood of Moore). Each of these methods uses the following general initialization:

code initialization
Note that xSize and ySize have been declared as 2 attributes (with 50 as default) at the model level.

For fire dynamics, the #newState method (also called "transition function") must be redefined in the Plot class, as follows :
code of fire
It is important to note here that the state of the cell is not modified but only its buffer state. For example, in the case of a cell in forest in contact with a fire, this one keeps its state as forest, and it just modifies its buffer state (self bufferState: #fire), so that this cell continues for this turn to be considered by the other cells as still being a forest.
At the #step: t method of the scheduler, it is necessary to make a simple call to :
       self stepSynchronouslyCA: t.
The #stepSynchronouslyCA: method is defined at the CormasModel level. It performs 2 complete loops of the whole cells. The 1st loop makes each cell execute the #newState method (without any effective change of state), then during the second loop, the #updateState method is executed. It is only then that the state of the cells is actually changed.

Version 2 : propagation from burning cells

    ** Select Fire_2_CAoptimized.pcl version from Demo_Fire **

This version supports a fire diffusion only from the burning cells. It is therefore necessary at each time step to select the cells on fire, then to activate for each one the propagation of the fire on its neighbours. Compared to version 1, two methods are added in the Plot class: #ignite (which changes the state of the cell to fire) and #spreadFire (which propagates fire on nearby forest cells).
To avoid artifacts related to regular cell scanning, the scheduler must first select the burning cells and then activate their diffusion:


This version also proposes a more optimized procedure that avoids scanning the grid in advance to select only the burning cells (cf. #step: t method).

Version 3 : a spatial entity (aggregate) spreads over the cells in the forest

    ** Select Fire_3_FireAggregate.pcl version from Demo_Fire **

In this version, fire represents a spatial area that spreads over the cells in forest that border it. This entity is called FireAggregate; it is a subclass of SpatialEntityAggregate. Here, only the FireAggregates entities are activated:
    self theFireAggregates do: [: f | f spread].
Each aggregate then executes the #spread method which consists of the following instruction:
    self swellConstraint: [: p | p state = #forest].
                         A fireAggregate entity (displayed with its bold outline)

Note that the display of the aggregate outline slows down the simulation. Without this display (pov -> FireAggregate -> #nil), simulations are as fast as in version 2.

Version 4 : Fire entities are moving

    ** Select Fire_4_FireEntity.pcl version from Demo_Fire **

In this version, entities called FireEntity are created. These are the only entities activated by the scheduler. Considered as active agents, these entities spread by creating new fire entities on neighbouring cells:



The #moveTo: method has been redefined to activate cell ignition when moving:


Version 4b : Fire entities are gradually consumed and then extinguished

    ** Select Fire_5_FireEntityAging.pcl version from Demo_Fire **


This version is a replication of NetLogo's Fire model. After igniting a plot, the fire is consumed and its intensity gradually decreases until it is extinguished (12 time steps).
In this version, the color of the fire according to its age is supported by EntityFire which defines a specific point of view (#povAge).
As with previous versions, an initialization method is proposed: #init_FireLine which creates a 100 x 100 grid with a fire front starting on the first column of the grid.
                                     
Fire propagation from the western border of the grid


Le Cirad Centre de coopération internationale en recherche agronomique pour le développement
Informations légales © Copyright Cirad 2001-2015 cormas-webmaster@cirad.fr