Module for the Compartment Model

Numerical Methods for O. D. E.  using Mathematica. (c) John H. Mathews, 2003

The Compartment Model I.

    The "compartment" model is used to describe the concentration of a dissolved substance in several compartments in a system.  For example, the "three-stage system" consists of three tanks containing  [Graphics:Images/CompartmentModelMod_gr_1.gif]  gallons of solute.  Pure water flows at the rate  r  into the first tank and is mixed, then flows at the rate  r  into the second tank and is mixed, then flows at the rate  r  into the  third tank and is mixed, and finally flows out of the third tank at the rate  r.  We define the constants  [Graphics:Images/CompartmentModelMod_gr_2.gif].  Then the differential equation for the system is

    [Graphics:Images/CompartmentModelMod_gr_3.gif]  

Example 1.  Find the solution to the "three-stage system" where  

[Graphics:Images/CompartmentModelMod_gr_4.gif]

with the initial conditions  

[Graphics:Images/CompartmentModelMod_gr_5.gif].

Plot the solution curves for  [Graphics:Images/CompartmentModelMod_gr_6.gif]  for  [Graphics:Images/CompartmentModelMod_gr_7.gif].

Solution 1

The Compartment Model II.

    Another "compartment" model is used to describe the concentration of a dissolved substance in several compartments in a system.  For example, the "closed" three-stage system consists of three tanks containing  [Graphics:Images/CompartmentModelMod_gr_78.gif]  gallons of solute.  The liquid flows at the rate  r  from the first tank and is mixed, then flows at the rate  r  into the second tank and is mixed, then flows at the rate  r  into the  third tank and is mixed, and finally flows out of the third tank and back into the first tank at the rate r.  We define the constants  [Graphics:Images/CompartmentModelMod_gr_79.gif].  Then the differential equation for the system is

    [Graphics:Images/CompartmentModelMod_gr_80.gif]  

Example 2.  Find the solution to the "closed" three-stage system where  

[Graphics:Images/CompartmentModelMod_gr_81.gif]

with the initial conditions  

[Graphics:Images/CompartmentModelMod_gr_82.gif].

Plot the solution curves for  [Graphics:Images/CompartmentModelMod_gr_83.gif]  for  [Graphics:Images/CompartmentModelMod_gr_84.gif].  

Solution 2.

Research Experience for Undergraduates


Converted by Mathematica      January 28, 2003