P R O J E CT G U T S W AT E R R E S O U R CE S Mountain Snowmelt Model in StarLogo TNG Overview This model simulates snow melting off of the top of high mountain ranges. Snowpack is a vital source of water for many parts of the world, and is especially important in the Southwest and Western states which depend upon river flows generated from snowmelt in order to satisfy their water needs. In this model, snowmelt is simulated by creating an elevated surface, which is then covered in snow. When the model is running, and incoming solar radiation produces heat which melts the snow. The water then flows off the mountain, following the terrain until it lands in the surrounding flat basin where it is assumed to either enter the groundwater or evaporate. One of the minor dynamics at play in this model is ice albedo feedback, which is elaborated upon in its own writeup and model. Depending on the terrain the model plays out on, albedo effect can impact the results of the model in different ways. The Model This model simulates a mountain range during and after a melting period. Incoming solar radiation strikes the ground and generates heat, which then melts the snowpack generating water. The water then travels downslope and evaporates (or enters the groundwater) at the base of the mountain. There are five breeds in this model: a sun, solar radiation, reflected solar radiation, heat, and water. The sun generates solar radation which travels downwards. If solar radiation hits a white “snow” patch it reflects back up as reflected radiation. If solar radiation hits brown ground, it turns into heat. Heat moves around the world randomly. If it runs into snow it melts it, which generates water which then runs downhill. While the premise of the model is simple, the actual code involved is somewhat intricate. Instructors attempting to build this model from scratch with their students are advised to give plenty of time. An easier implementation of this model in the classroom is to deconstruct the model and then implement possible changes, elaborated on in the “expanding the model” section at the end of this document. PAGE 2 PAGE 2 CLIMATE CHANGE UNIT CLIMATE CHANGE UNIT Procedures Breeds There are five breeds in this model: sun, solar energy, reflected energy, heat, and water. Since the sun, solar energy, and water can be easily depicted as spheres and the heat agent will be hidden, make the sphere the default shape for all agents. Setup Setup is a complicated procedure in this model and works in three parts: 1). First, a “shared number” variable is used to keep track of the amount of snow in the world. A clear everyone block is used to preserve whatever terrain we might produce. Set snow 0 is used to set the initial value of snow to zero, which effectively resets any plots and monitors. PAGE 3 PAGE 3 CLIMATE CHANGE UNIT CLIMATE CHANGE UNIT INTRODUCTION PAGE 3 2). As with the ice albedo model, we create a temporary sun which will set up the snow. The sun begins in the lower left corner, and faces 0 degrees so that it can procedurally visit all of the patches. The sun then visits each patch testing to see if the patch it is on is higher than patch height 0. If it is, the sun stamps the patch color white and increases the count of snow by 1. If patch height is 0, the sun stamps it brown and moves on. “Set x xcor + 1” is used to move the sun from the left to the right. 3). Next, we create the sun in the sky. Create one sun and have it set altitude 100, set xy 0, 0 (high up in the middle of SpaceLand) and set its size to 5 and color to yellow. This will give the impression of the sun hanging high in the sky producing solar energy. Lastly, reset clock is used to clear any graphs or monitors. Make Solar Energy The “Make Solar Energy” procedure is used to rain down solar energy from the sun onto SpaceLand. The sun hatches, and “Set Breed: Breed Solar Energy”, “set color red” “set size .25” “set heading random” are used to generate the particles of solar energy coming from the sun. “set xy” is used to spread the solar energy so that it has a chance to land on every patch. “random 101 – 51” is used to cover the entire PAGE 4 CLIMATE CHANGE UNIT CLIMATE CHANGE UNIT PAGE 4 space. Solar Energy Step & Reflected Energy Step Solar energy step tells the solar energy to rain down, and what to do when it strikes the ground. To rain down from the sky, solar energy simply moves down one step if its altitude is greater than 0. If it is on the ground, solar energy step runs two checks: If it hits patch color white, it hatches a reflected energy breed. This reflected energy sets its color to orange, and the original solar energy dies. Else, (if it does not hit snow), it hatches a heat agent which then sets its heading random 360 and is hidden. The original solar energy then dies. Reflected Energy Step Reflected energy step is simple: it heads straight up from its original position. If it reaches an altitude of 75, it dies (assumed to be reflected back out into space). CLIMATE CHANGE UNIT CLIMATE CHANGE UNIT INTRODUCTION Heat Step & Collision Heat step tells heat agents how to move around the world. Starting from their origin facing a random direction, heat moves forward one step each iteration. If the heat steps on a patch that is on the mountain AND white, the heat agent stamps the patch brown (melts the snow), decreases the amount of snow (“inc snow -1”) and hatches a new agent. The new agent then sets its breed to water, color to blue, size to .2, and because the heat was previously invisible, “show agent” is used to make the new agent visible again. The heat then dies. Heat Collision The heat collision block makes heat agents that collide with other heat agents set both agents’ headings in a random direction. PAGE 5 PAGE 5 PAGE 5 PAGE 6 CLIMATE CHANGE UNIT CLIMATE CHANGE UNIT PAGE 6 Gravity (water procedure) Gravity tells newly created water agents how to flow downhill. First, the water agent tests to see if it is facing uphill. If it is, it turns to face a new random direction. If the water agent is facing downhill (slope is less than zero), it moves forward one step and turns its heading random 360 again. If the water encounters a white patch on the way down, it stamps the patch brown and decreases the amount of snow in the world. Finally, if water is on a flat section, it dies (is assumed to evaporate or seep into groundwater). Runtime/Forever The forever block calls each of the procedures: The sun makes solar energy. Solar energy moves down and interacts with the terrain. Reflected energy radiates back up. Heat moves around an interacts with the snow. Water flows downhill and interacts with snow. PAGE 7 PAGE 7 CLIMATE CHANGE UNIT CLIMATE CHANGE UNIT INTRODUCTION PAGE 7 Monitors In this model we keep track of several different variables: Reflected Energy: This graphs the ratio of energy that is reflected out into space compared to energy incoming. As ice decreases, so does the amount of reflected energy. Heat: This keeps track of how much heat is in the world. Note that there are no heat sinks in this model, so heat continually increases. Snow: This monitors the amount of snow remaining in the world. PAGE 8 CLIMATE CHANGE UNIT CLIMATE CHANGE UNIT PAGE 8 Running the Model First, raise the level of the ground using the Create Mound On Region tool in the Edit Terrain toolbox. Refer to figures 1-4 below. Figure 1 Figure 2 Figure 1 Figure 3 Next, click Setup and the mound will be covered with snow. Figure 4 CLIMATE CHANGE UNIT CLIMATE CHANGE UNIT INTRODUCTION PAGE 9 PAGE 9 PAGE 9 Finally, click on Forever and watch as incoming solar energy produces heat, which melts the snow starting at the base of the model. Note the monitors at the bottom: Snow pack decreases while heat ever increases. The amount of reflected energy largely depends on incoming energy randomly striking snow. This is represented as fluctuations, but the overall trend is a decreasing amount of reflected energy as the snowpack melts. Expanding The Model This model is a vastly simplified version the actual dynamics that occur on a snowpacked mountain. There are many ways to expand it to make it more realistic, or even to have fun and play around with it. 1). In the real world, the rate of snowpack melting is partially greatly determined by the reflection coefficient or albedo of the snow. Many factors can influence albedo, including dust in the air landing on snow. How might you simulate dust that lands on the snow, decreasing the albedo? 2). In the base snowmelt model, altitude does not affect the behavior of the heat agents in any way. In the real world, however, altitude and temperature are closely correlated. How might you model this phenomena? Hint: Agents can tell the height of the patches they are on, as well as the slope of those patches in front of them. 3). Water in this model does not flow very realistically. Is there a better way to make water trickle down the mountain? Perhaps have an agent remember its heading and slope ahead, and compare those numbers to a sample of the slopes around it. 4). Snowmelt over eons is one of the major factors in the erosion of mountains. Without the annual snowmelt, mountains would look very different than they do. How might you simulate erosion? (hint: agents can “stomp” terrain down or “yank” terrain up).