Conservation Equation Model

Gregory Hancock
College of William and Mary,
Author Profile


Numerical models are widely used to simulate systems ranging from climate to traffic jams, yet a high percentage of college-level students have little awareness of how they are constructed and their limitations. This activity is intended to introduce students to the construction and use of a simple conservation equation model using MATLAB. Students will construct, with the help of the instructor, a MATLAB script to simulate inputs and outputs to and from a water tank and the tracking of water volume through time. The activity includes calibration and verification of their model using data on flows observed in the water tank.

Learning Goals

Students should gain a basic understanding of the application of conservation equations to simulate systems, an introduction to the planning and construction of a numerical model, assessment of assumptions in model construction, and concepts of calibration and validation of models, as well as a brief introduction to MATLAB. The construction of models requires critical and logical thinking, strategic troubleshooting of errors, how to cast verbal or written concepts into numerical expressions, and verbal presentation of the outcomes using figures generated in MATLAB. Using the model, students should be introduced to concepts such as steady state, transience, water balance, and residence time.

Context for Use

This exercise could be done at nearly any college level, assuming that sufficient time is provided for a brief introduction to MATLAB and a discussion of conservation equations and how they are used. This could be a classroom activity spanning 2 to 4 class days or one or two lab sections. If time is provided for discussing the basics of MATLAB, no prior knowledge is needed. Students should be familiar with the concept of conservation equations and have had some initial experience in using them for simple systems. This activity could be done in a small introductory course, any number of middle or upper level courses in which conservation equations are considered (e.g., hydrology, geomorphology, environmental geochemistry, climatology).

Description and Teaching Materials

Activity Handout (Microsoft Word 2007 (.docx) 292kB Sep30 16)
water balance script (MATLAB file) (Matlab File 3kB Sep30 16)
Inflow file (Excel file) (Excel 60kB Sep30 16)

Teaching Notes and Tips

I have used Getting Started with MATLAB by Rudra Pratap as a reference for students. I've identified short sections of the book that clearly illustrate how to use the MATLAB commands, etc., that are relevant. I ask that they do these on their own prior to the classes in which the model will be developed. Many students struggle with the coding, particularly the logic (if-then, loops) and troubleshooting errors. I find the troubleshooting part to be the most challenging for them, and having them learn how to strategically troubleshoot may be the most useful skill they learn from this exercise.


1) pseudocode: essentially a hand-drawn diagram showing the steps that will be followed in the model, and what commands will be used (5 pts)
2) numerical model: Does the model run without errors? Does the model produce reasonable outcomes? Is the model well documented? Are the generated graphics understandable? (10 pts)
calibration of outflow: 5 pts
3) validation: Does model reproduce the observed behavior in the tank? Does the discussion of the validation experiment compare the observed to the modeled outcome? Does the student defend the use of the calibration of outflow? (5 pts)
4) assumptions: Does the student identify significant assumptions? Does the student describe how those assumption may affect the outcome of the simulation? (5 pts)
5) three minute presentation (5 pts)

References and Resources