Feedback Mechanisms and Atmospheric Models
Lab 1 Introduction to Computer Simulations

Return to Feedback Mechanisms and Atmospheric Models

The Sample Problem


Description


Take a cup of boiling-hot coffee (  assume that it behaves like an ideal liquid and doesn't evaporate away at an appreciable rate) and set it on a table. One would expect that the temperature of the cup will decrease. This behavior (cooling) will be modeled. The first activity would be to decide on what factors might affect the rate of cooling and try to find the mathematical relationships between these factors.

For a certain system, the rate of change of temperature decreases as the liquid's temperature approaches room temperature. The temperature at any given time during this process is dependent on the initial temperature, room temperature, and the time. Implicit in this description is that the coffee is in an imperfectly insulated cup or mug (if it was a perfect insulator, the temperature of the coffee would not change). The insulation value of the cup also needs to be considered and can be experimentally determined.  In fact, this is a particularly interesting cup because the all parts of the cup cool at the same rate (and so our mathematical task is greatly simplified).
 

Approximate Solutions

Newton's Law of Cooling can be written several ways, but for this experiment, we can use the discrete form shown in equation 1.  This is also known as a finite difference method.
 
 
(Equation 1)
T = Ti (Troom – Ti)×Dt T = temperature at time t
Dt = a finite time interval
Ti = the initial temperature before Dt elapses
Troom = room temperature
 a = the cup insulation factor (constant)

Using equation 1, a temperature-time profile can be easily calculated with either a handheld calculator or a variety of computer programs (e.g., spreadsheets such as Microsoft Excel, or using languages such as BASIC, C++, etc.).

As a side note, while this situation is relatively simple, the number of equations quickly increases as the model gains complexity.  A more graphical approach to modeling the system can sometimes be useful.  In this case, the Stella 5.0 program is used as an example.  The cooling coffee cup experiment can be represented by figure 1 below.  Notice that no equations or numbers are needed to initially draw the system (using this part of the program is directly analogous to using the ubiquitous Paintbrush-type program) so that the relationships between the different system components can be quickly indicated.


Figure 1 - Stella 5.0 model of coffee temperature

A useful feature of a graphical interface such as the one shown above is that is allows rapid construction of the model and then a translating algorithm converts the graphical representation into a series of the more familiar mathematical formulas show below in figure 2.
 
coffee_temp(t)    = coffee_temp(t - dt) + (- rate_of_loss) * dt

INIT coffee_temp  = 100
rate_of_loss      = insulation_factor*(coffee_temp - room_temp)
insulation_factor = 0.1
room_temp         = 20

figure 2 - Stella 5.0 equations for model of coffee temperature


The Exact Solution


If the cup insulation factor remains a constant, only the choice of Dt will affect the accuracy of the temperature-time profile. In this special case, we actual do know the "right" answer, so we can compare the effect of chosing different values for Dt.  Without going into the details of arriving at the so-called exact solution (see any calculus textbook for the details), equation 2 describes the temperature of a cup of coffee as a function of time.

(Equation 2)
T = Troom + (Tinitial – Troom)e(-t) T = temperature at time t
t = time
Ti = the initial (maximum) temperature before cooling
Troom = the final (minimum) room temperature
a = the cup insulation factor (constant)


Introduction
Experimental
Procedure
b
The Woodrow Wilson National Fellowship Foundation
CN 5281, Princeton NJ 08543-5281 - Tel:(609)452-7007 - Fax:(609)452-0066
Technical contact: lpt@woodrow.org