### HPC MPI Exercise 3: Hands-On Lab

#### Introduction

In this week's exercise, we will explore computational modeling -- the modeling of real-world processes or phenomena in software.

Computational modeling is useful in situations where experimenting with a real-world physical process is impractical, costly, or dangerous. A computer model of the physical phenomenon lets us experiment with the phenomenon, and perhaps come to understand how the process works, without the limitations, cost, or danger found in the real world.

The physical process we'll be modeling is a forest fire. The model we'll use is simplified so that we can understand it easily, which reduces its representational accuracy. This simplicity-vs-accuracy tradeoff is common in modeling: models are (by definition) imperfect representations of the phenomena they represent, and the more simplified the model, the less accurately it represents the complexities of the real world.

#### Getting Started

Begin by experimenting with this fire applet from the Shodor Foundation's Interactivate Project.

This model lets you start a forest fire by clicking on a tree, which lights it on fire. The fire then spreads probabilistically to neighboring trees, based upon the burn-probability, which models the likelihood of a fire spreading from a tree to its neighbors (e.g., perhaps reflecting local moisture levels).

When the fire burns out, the model displays the percentage of the forest that burned, and the time (number of iterations) the fire burned. Once your forest fire has burned itself out, you can "regrow" the forest by clicking the Regrow Forest button. Take a few minutes to experiment with the model, to get a sense of how it works.

#### Exercise

We want to use this model to explore these questions:

• What is the relationship between the burn probability and the percentage of the forest that burns?
• What is the relationship between the burn probability and how long the fire burns?
Click the Highlight Center Tree button to make it clear which tree is the center tree. Then for each of the burn probabilities 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, and 0.9:
1. Start a forest fire at the center tree. In a spreadsheet, record the probability, the percentage of the forest that burns, and the time (iterations) the forest burns.
2. Regrow the forest.
When you have finished, use the spreadsheet to create a chart in which you plot the percentage-burned and time (iterations) for each burn-probability. Compare your chart to the charts of your classmates. How do they compare?

#### The Monte Carlo Pattern

This model is an example of a class of computations called Monte Carlo simulations, that use statistical probabilities and pseudo-random numbers to represent physical phenomena. Because it uses probabilities and randomness, the model is non-deterministic: if you rerun the model several times with the exact same inputs (burn-probability, center tree), you are likely to get different outputs (percentage-burned, time). For this reason, it is usually necessary to do many trials or repetitions of a monte carlo simulation and then average the results, to determine the average or typical behavior.

Start a forest fire 2 more times for each burn probability, and add the percent-burned and time results to your spreadsheet so that you have six measurements (three percent-burned and three time) for each burn-probability. Then calculate the average of the three percent-burned and time measurements for each burn-probability, and create a new chart plotting these averages against the burn-probabilities.

1. How does your new chart compare to your first one?

2. How does it compare to your classmates' charts?

3. Are they more or less similar than before?

The Monte Carlo approach is one of the higher-level computational patterns, which you will be using in this week's homework project. Continue to experiment with the forest fire applet using different probabilities. When you feel you you have an intuitive understanding of how this model is working, proceed to the project.

CS > 374 > Exercise > 03 > Hands-On Lab

This page maintained by Joel Adams.