's a ... FIRE! A simulation of fire caused by gender reveal parties.

Sarah Patterson, Virginia Military Institute, Applied Math

Author Profile
Initial Publication Date: October 10, 2024

Summary

In this project, students create a simulation of a spreading fire through a forest using MATLAB. This simulation contains many different parameters that control the random spread. Students will complete a sensitivity analysis on one parameter of their choice. Then will write a paper about the simulation and the results of their sensitivity analysis.

Key words: Mathematical modeling, sensitivity analysis, cellular automata, introductory programming

Share your modifications and improvements to this activity through the Community Contribution Tool »

Learning Goals

  • Students will create a basic cellular automata model of a spreading fire.
  • MATLAB is used extensively in this project to create a simulation. Students will be introduced to basic project management skills since the project requires multiple helper functions with global and locally defined variables.
  • This activity requires students to define parameters as variables instead of hard coding values. This also allows students to engage in the mathematical modeling process by introducing the concept of sensitivity analysis.
  • Students will also practice various debugging techniques to verify their simulation is working properly.
  • Students will write a final paper based on the results of their simulation.

Context for Use

  • This project was completed in the first semester of a year-long MATLAB course for undergraduate stem majors. The typical class size is around 20 students.
  • This task could also be used for an introduction to a mathematical modeling course. Students could use entirely instructor-provided code and run sensitivity analysis on parameters.
  • This is a longer project. Students would need approximately two weeks to complete it. Giving additional code could allow students to finish this project faster.
  • Students should be fairly proficient with MATLAB and be able to write and run scripts and functions.

Description and Teaching Materials

Fire has had a dramatic effect on both shaped human history and the natural world. For example, fire in area like the western United States is natural and beneficial to plant communities there. Periodic fired help clear the forest floor of debris and promote the growth of sturdy, fire resistance trees. Unfortunately expanding human populations have intruded on previously uninhabited zones and developed communities in fire-prone areas. Other human activities, such as fire suppression, livestock grazing, and logging have increased the probability of hotter and more destructive fires.

Additionally, human activity has caused many unintentional fires over the years. For example, during the 2020 Labor Day weekend, a botched gender reveal party started the El Dorado Fire, which burned more than 22,000 acres and claimed the life of one firefighter.


Fighting fires is a very dangerous job, where the loss of life is a real possibility. In order to enhance the ability of fire and emergency services to effectively deal with fire and related emergencies, mathematical modeling can be employed to test different fire fighting strategies.

(This project is adapted from a fire spreading simulator found in the second edition of Introduction to Computational Science by Shiftlet and Shiftlet.)


Student Code for Fire Spreading (Zip Archive 8kB Oct7 24)
Completed Code for Fire Spreading (Zip Archive 9kB Oct7 24) 
Full Project Description and Directions (Acrobat (PDF) 372kB Oct7 24) 
Editable Tex Document (Zip Archive 312kB Oct7 24) 

Teaching Notes and Tips

For students to stay on track, I assigned periodic checkpoints. For each of these, students submit code to get feedback. Each of these check points could be completed in a single class session or done for homework.

Checkpoint 1
For your project, you will create a simulation of a fire spreading.

In order for you to stay on track, there will be periodic checkpoints. For each of these, you will need to submit some portion of code
For this first check-in, please submit your code progress. You should aim to have the following completed at this point:

  • The initialize function. Be sure to provide appropriate comments.
  • The displayForest function. Be sure to provide appropriate comments.
  • A script where you
    • Describe the project and author in the comments.
    • Add comments on all parameters.
    • Define and initialize all variables using your initialize function. 
    • The function fireSpread is called and the Forest is updated.

Checkpoint 2
In order for you to stay on track, there will be periodic checkpoints. For each of these, you will need to submit some portion of code. If you want to work ahead and submit more code to get feedback, that is acceptable. 
For this second check-in, please submit the following:

  • Everything from the first check-in. 
  • Create the update counts function
  • The following helper functions for fireSpread. 
    • isGrowth
    • isNeighborBurning
    • isCatch


Checkpoint 3
In order for you to stay on track, there will be periodic checkpoints. For each of these, you will need to submit some portion of code. If you want to work ahead and submit more code to get feedback, that is acceptable. 
For this check-in, please submit the following:

  • Everything from check-in 1 and 2. 
  • Complete all remaining helper function for fireSpread.
    • isParty
    • isBurnedDown
  • Complete all requirements for fireSpread.


Checkpoint 4
Congratulations! If you made it this far, that means you have successfully completed your first large Matlab Programming project. This is an impressive feat for a novel programmer!


Now is time to use the tool that you have created. For this final check-in you will run a sensitivity analysis on one of the parameters is the simulation to determining the effect of the spread of a virus. This will involve 3 steps.


1. Determine a base case. Play around with the parameter to find a case that looks good to you. It should have a decent number of people and it should end once all infected persons recover. Record the following:

  • All of the parameters that you used. 
  • The max number of people infected at one time and the total number of people infected. 
  • The number of iterations the simulation lasts. 
  • A graph of the results (S, I, R vs time). 
  • Graphs showing the position and infection classification of the people. You do not need to record every time step, just the initial, final, and a few intermediate graphs. If you want to make a video of your simulation, you can look at the following script for reference (CreateMovie.m ). 
  • Note, there are a lot of random parts of this simulation. To say anything about the results, you need to run the simulation multiple times and take the average of the results (i.e. run your simulation at least 5 times for a single set of parameters). 

2. Choose ONE of the following parameters from the simulation to investigate. Determine at least 5 reasonable values for that parameter.

  • probTree 
  • probBurn 
  • probGrowth
  • probParty
  • probCatch 
  • burnTime 


3. Run a set of simulations for each of the 5 parameter values. You only want to find the effect of that single parameter. Therefore, you must keep all other parameters exactly the same as in your base simulation from part 1. Record the following data: 

  • All of the parameters that you used. 
  • The max number of trees burning at one time and the total number of trees burning. 
  • The number of iterations the simulation lasts. 
  • A graph of the results. 
  • Graphs showing the position the fire at various times throughout the simulation.  You do not need to record every time step, just the initial, final, and a few intermediate graphs. If you want to make a video of your simulation, you can look at the following script for reference (CreateMovie.m). 
    Again, due to the randomness of the simulation (probabilistic nature), you need to run the simulation multiple times and take the average of the results (i.e. run your simulation at least 5 times for a single set of parameters). 

For this check-in, submit a spreadsheet with the results of your test simulation. You may also submit any pictures of videos if you want feedback.


Assessment

For this project, I had students complete 5 intermediate checkpoints.


For this project, students will you will write up your results from checkpoint 5. You need to use Latex.

Your paper needs to have 3 sections: introduction, results, and conclusions.

  • Introduction
    • Your parameter
    • Why does this parameter affect the simulation results?
    • What are the values you used for this parameter in your sensitivity analysis?
    • How did you choose the reasonable values for this parameter? 
    • Where there any modifications to the code required to implement this parameter? 
    • Other parameters
    • Create a chart or list to display these values nicely.
    • Description of how you choose these parameters for your base case.
  • Results
    • You should have a table or chart that shows the
    • average number of time steps each simulation lasted 
    • average max number of trees burning at one time
    • average total number of trees burning
    • Include a small sample of pictures or reference videos that help illustrate the results. 
  • Conclusions
    • What effect does varying your parameter have on the results?
    • What is the meaning of this in terms of the context (spreading of a fire)?
    • Is there a potential application in terms of slowing the spread of other things like infectious diseases? 
       

Turn in a compressed folder containing your Matlab code for the project, a tex file, all supplemental files like images and videos, and a pdf of your paper.