Glacier Flow Model and Introduction to Monte Carlo Methods

Dan Morgan, Vanderbilt University, Earth & Environmental Sciences
Author Profile

This activity was selected for the Teaching Computation in the Sciences Using MATLAB Exemplary Teaching Collection

Resources in this collection a) must have scored Exemplary or Very Good in all five review categories, and must also rate as “Exemplary” in at least three of the five categories. The five categories included in the peer review process are

  • Computational, Quantitative, and Scientific Accuracy
  • Alignment of Learning Goals, Activities, and Assessments
  • Pedagogic Effectiveness
  • Robustness (usability and dependability of all components)
  • Completeness of the ActivitySheet web page

For more information about the peer review process itself, please see

This page first made public: Sep 3, 2019


The goal of this assignment is for students to recognize that adding some randomization and "noise" to a model yields different results each time we run the model, and we can pull some useful statistics from these model results. This introduces the concept of a Monte Carlo method to the students.

Learning Goals

Students will learn some basic ways of calculating statistics in the exercise, and the basic concepts behind Monte Carlo methods. For Matlab, they should be able to create a loop to run the model multiple times and store the results of each model run separately. "For-loops" are a big topic in the course, and this exercise is hopefully intuitive for the students to execute. The exercise uses a published glacier flowline model and students are asked to adapt the model to experiment with different parameters and to build their own Monte Carlo method. Students are asked to write about "model results" and what can be learned from them, and we have a brief discussion about this in class when the students turn in their homework. Hopefully students gain critical thinking, data analysis, and model development skills from the exercise.

Context for Use

This is the final homework assignment (#10) in a semester long course designed to teach mathematical modeling and Matlab coding to early Earth & Environmental Science majors (mostly sophomores). It is a 2000-level course with 25 students max. Calculus is a pre-requisite for the course, but no prior coding experience is assumed.

Description and Teaching Materials

Students are first asked to read the article by Roe and Baker, 2014, that describes the glacier flow model. In other assignments, we have worked on annotated bibliographies of peer-reviewed articles, so in this assignment I shortened the reading exercises to focus on the key points.

Students then take the existing Matlab codes to run the one-stage model (that outputs an animation I find helpful to see), and the three-stage model that the authors developed as the next version of their model. Students will then add some code to the three-stage model to play with different climate parameters, and write a for-loop to run the model 100 times to see how the mean, max, min, and standard deviation of the glacier length changes between the default parameters and the change they made.

In class, when the students have turned in the homework, we have a 15-20 minute discussion to see what people observed. The students are allowed 1 week to complete this assignment.
Homework 10 Assignment (Acrobat (PDF) 104kB Sep3 19)
Roe and Baker 2014 (Acrobat (PDF) 8MB Sep3 19)
Matlab model for Three Stage Glacier (Matlab File 4kB Sep3 19)
Initial data for one stage model (Matlab .MAT File 806bytes Sep3 19)
Flowline Glacier Model that makes animation (Matlab File 10kB Sep3 19)

Teaching Notes and Tips

It is helpful to spend some time in class discussing what is meant by a "glacier length anomaly." We also spent some time discussing what a standard deviation is, and what it is to take a mean of a mean. It was fairly intuitive for the students to calculate the mean, max, min, and std. of one model run. Then they calculate this for each of these four parameters, so they should get 16 results, and this confused them a little bit (question 7b). But they eventually got there.


A lot was learned during the discussion when the students turned in the homework. We had a lively discussion about the usefulness and validity of "model results." We grade students code, ability to write the for-loop for the Monte Carlo method, and description of the paper. Grading this assignment is time consuming, but yields valuable feedback on what the students have gained from the course.

References and Resources