Teach the Earth > Complex Systems > Teaching with Computer Models > Bathtub
Devil's Bathtub, Hocking Hills State Park. Image from Wikimedia Commons.

Overflowing Bathtub Model

Moore and Derry's (1995) Coleman cooler/bathtub example provides a nice entry into numerical modeling for beginners. Students start with a physical model of a bathtub with an inflow of water from a faucet and an outflow through a drain. Instructors can lead students through the identification of reservoirs (the tub itself) and fluxes (the inflow and outflow) and discuss conservation of mass. They can introduce the idea of boundary conditions by asking students to think about the physical dimensions of the tub and what would happen if the drain were plugged while the tap ran freely. Getting students to observe the state of the tub before the inflow or outflow fluxes are employed introduces the idea of initial conditions.

Based on the physical model, the class can move on to develop a numerical model of the system. This numerical model can start with a logic diagram and progress to a box-modeling software package such as STELLA. Fig. 1 shows a very simple STELLA representation of the bathtub system. Values of inflow, outflow, and the initial volume of the bathtub are specified in dialog boxes that appear when double clicking on each model element, and the instructor can ask students to predict what kind of behavior the system should exhibit given different combinations of inflow and outflow. STELLA's included graphing tool can be used to display the results of different model runs (Fig. 1).

Fig. 1: Top - STELLA model of a bathtub, faucet, and drain with inflow and outflow set to constant values and tub initially empty. Bottom – Embedded graphic showing values of inflow and outflow, and the change in volume of water in the bathtub over time. Units of fluxes are volume per time and unit of the reservoir is volume.

As students work with the STELLA model they realize that the simulation deviates from the physical model of a real bathtub. For example, bathtubs in real life cannot fill forever: they eventually overflow, hopefully through an emergency overflow drain (the boundary conditions), but the STELLA model shown in Fig. 1 does not incorporate this reality and will fill forever since the inflow exceeds the outflow. This means that the model is missing an essential component of the physics of the real system, a fact that the instructor can use to teach students to evaluate modeling results critically, along with the assumptions underlying the models.

In the case of the bathtub example, the behavior of the real system prompts a revision to the STELLA model to ensure that the tub volume does not exceed the dimensions of the tub, which allows the introduction of if-then-else logical statements (Fig. 2).

Fig. 2: Top – Revision of the original STELLA model to incorporate an emergency overflow drain. Pink linking arrow shows the dependency of the overflow drain flux on the amount of water in the bathtub, and the flux itself is specified by an if-then-else logical statement that compares the volume of water in the bathtub to the maximum amount the tub can hold. In this particular example, the following statement controlled the overflow drain flux: if(bathtub volume >=20)then(bathtub volume – 20)else(0). Bottom – As the bathtub volume (blue line) approaches 20 units, the net addition of the inflow from the faucet minus the outflow from the regular drain exceeds the 20 unit volume threshold necessary to trigger the movement of water into the emergency overflow drain, thereby causing the overflow drain flux (green line) to climb above zero. Steady state conditions eventually prevail when the emergency overflow drain flux becomes large enough that its combination with the regular outflow drain flux matches the inflow from the faucet.

Another issue not included in the models in Fig. 1 or 2 is the fact that as water depth increases in a tub, water pressure increases the outflow from the drain. In STELLA, this can be represented by including a pink linking arrow that shows the dependency between the outflow from the drain and the bathtub volume (Fig. 3). As in the case of Fig. 2, a steady state between inflow and outflow is eventually reached, leading to a steady state volume for the bathtub. Instructors can use this opportunity to discuss transient versus steady state behavior.

Fig. 3: Top - STELLA model incorporating dependency of outflow on volume in the tub, this time without an overflow drain. Bottom – Results show that as the volume in the tub increases (blue line buried beneath pink line), so too does the outflow from the drain (pink line). Depending on the size of the inflow and outflow fluxes, the emergency overflow drain shown in Fig. 2 may or may not be necessary to fully capture the behavior of the bathtub system.

Once students master the basic concepts illustrated by the bathtub system, it is relatively straightforward to move on to systems that behave in similar ways, such as Earth's radiative equilibrium with the sun, crustal heat flow and the geothermal gradient, and radioactive decay.


Moore, A., and Derry, L., 1995, Understanding natural systems through simple dynamical systems modeling, Journal of Geological Education, v. 43, p.152-157.
New TTE Logo Small

Complex Systems resources from across Teach the Earth »

Complex Systems resources from Teach the Earth include:

Specialized collections including

or search