Compartment
Models
Learn how to model flow between interconnected systems using differential equations: from drug dosing to population dynamics.
What Is a Compartment?
A compartment is an idealized container that holds a well-mixed quantity: a substance, population, or energy level. We track how that quantity changes over time by writing a rate equation for each compartment.
The Balance Law
Where Do We See Compartment Models?
The Single-Compartment ODE
The simplest model: a substance enters at a constant rate \( a \) and leaves proportionally to the current amount at rate constant \( k \).
Solving the Single-Compartment ODE
Visualizing the Solution Curve
Special Case: Pure Decay
When there is no input (\( a = 0 \)), the model reduces to pure exponential decay:
Open vs Closed Systems
| Open System | Closed System | |
|---|---|---|
| External input | Yes: material enters/exits environment | No: material stays within compartments |
| Total mass | Changes over time | Conserved: \( x_1 + x_2 + \cdots = \text{const} \) |
| Steady state | \( x_{\text{ss}} = a/k \) (nonzero equilibrium) | All material eventually collects in one compartment |
| Example | IV drip medication | Dye mixing between two connected tanks |
The Two-Compartment Model
How to Build a Compartment Model
Example 1: IV Drug Infusion
A patient receives a drug via IV at a constant rate of \( a = 5 \, \text{mg/hr} \). The drug is eliminated at rate \( k = 0.1 \, \text{hr}^{-1} \). Initially the bloodstream has no drug: \( x(0) = 0 \).
Example 1: Solution Curve
Example 2: Mixing Tank
A \( 100 \, \text{L} \) tank initially contains pure water. Brine with concentration \( 3 \, \text{g/L} \) flows in at \( 2 \, \text{L/min} \). The well-stirred mixture flows out at \( 2 \, \text{L/min} \). Let \( x(t) \) = grams of salt at time \( t \).
Example 3: Two Connected Tanks
Tank A (\( 50 \, \text{L} \)) and Tank B (\( 50 \, \text{L} \)) are connected. Fluid flows from A to B at \( 4 \, \text{L/min} \) and from B to A at \( 4 \, \text{L/min} \). Tank A starts with \( 10 \, \text{g} \) of salt, Tank B with \( 0 \, \text{g} \). No external inflow/outflow.
Common Mistakes
Question 1 of 5
A single compartment has constant input rate \( a = 12 \) and elimination rate constant \( k = 3 \). What is the steady-state value \( x_{\text{ss}} \)?
Question 2 of 5
In the ODE \( \frac{dx}{dt} = a - kx \) with \( x(0) = 0 \), which expression gives \( x(t) \)?
Question 3 of 5
A \( 200 \, \text{L} \) tank has brine flowing in at \( 5 \, \text{L/min} \) with concentration \( 2 \, \text{g/L} \) and outflow at \( 5 \, \text{L/min} \). What is the rate out of salt (\( \text{g/min} \)) when there are \( x \) grams of salt in the tank?
Question 4 of 5
In a closed two-compartment system with \( x_1(0) = 20 \) and \( x_2(0) = 0 \), what must be true for all \( t \geq 0 \)?
Question 5 of 5
A substance decays with rate constant \( k = 0.2 \, \text{hr}^{-1} \) and no input. Approximately how long until the amount drops to half its initial value?