From Individual Compartments to a Combined System
A system may contain several compartments that exchange material with one another while also gaining material from, or losing material to, their surroundings. A compartment's stock can rise or fall because of both external flows and internal transfers. The combined stock, however, changes only when material crosses the boundary of the whole system.
The key is to keep these two kinds of flow distinct. A transfer out of one included compartment is simultaneously a transfer into another included compartment. It changes where the stock is located, but not how much stock the included compartments contain altogether.
Definitions and Sign Convention
Let \(S_i(t)\) denote the stock in compartment \(i\) at time \(t\), for \(i=1,\ldots,n\). A stock is an amount, such as litres, kilograms, or items. Its derivative \(S_i'(t)\) is its instantaneous rate of change, measured in stock units per unit time.
For each compartment, let \(I_i(t)\) be the total external inflow rate and \(O_i(t)\) the total external outflow rate. Both are defined as nonnegative rates. “External” means that the flow crosses the boundary of the full system being modelled, not merely the boundary of one compartment.
For an internal transfer, write \(q_{ij}(t)\) for the rate moving from compartment \(i\) to compartment \(j\), where \(i\ne j\). The direction is part of the notation: \(q_{ij}\) leaves \(i\) and enters \(j\). We take \(q_{ij}\geq 0\) while using that direction convention. A transfer that is absent has rate zero.
With the notation above, the balance for compartment \(i\) is
The first sum collects transfers into \(i\): \(q_{ji}\) comes from compartment \(j\). The second collects transfers out of \(i\): \(q_{ij}\) goes to compartment \(j\). If a model has only some of the possible links, the other terms are simply zero.
Why Internal Transfers Cancel
Define the combined stock of all included compartments by \(S_{\mathrm{tot}}(t)=\sum_{i=1}^{n}S_i(t)\). Since this is a finite sum of differentiable stock functions, its derivative is the sum of their derivatives. Substituting the compartment balances gives
To see the cancellation, consider any one internal transfer from compartment \(a\) to compartment \(b\). It contributes \(-q_{ab}(t)\) to the balance for \(a\), because it leaves \(a\). The same transfer contributes \(+q_{ab}(t)\) to the balance for \(b\), because it enters \(b\). Their sum is \(-q_{ab}(t)+q_{ab}(t)=0\). This reasoning applies to each internal link.
This is the complete cancellation argument: every internal transfer has exactly one source and one destination among the included compartments, so its negative contribution at the source and positive contribution at the destination cancel in the sum. The result does not require the transfer rates to be constant. They may vary with time or depend on the compartment stocks; at each time, the paired terms still cancel.
The boundary of the model matters. If a transfer goes from an included compartment to a compartment left out of the model, it is an outflow from the modelled system, not an internal transfer for that system. If material enters from an omitted compartment, it is an external inflow relative to the chosen system.
Worked Example: Two Compartments with One Internal Transfer
Worked Example: Two Compartments with One Internal Transfer
Two tanks contain a liquid, and both tanks are included in the system. Liquid enters tank A from outside at \(12\) L/min. Liquid moves from A to B at \(3\) L/min. Liquid leaves tank B for the surroundings at \(5\) L/min. Write the balances and find the instantaneous change in the combined volume.
For tank A, the external inflow is \(12\) L/min and the internal transfer out is \(3\) L/min. Therefore,
For tank B, the transfer from A is an inflow of \(3\) L/min, and the external outflow is \(5\) L/min. Therefore,
Add the compartment rates to obtain the combined rate:
Check against the external flows alone: the system receives \(12\) L/min and loses \(5\) L/min, so its net external rate is \(12-5=7\) L/min. This agrees with the sum of the compartment balances. The \(3\) L/min transfer has reduced A’s stock and increased B’s stock by the same amount; it has not changed the combined volume.
Worked Example: Several Links in a Three-Compartment System
Worked Example: Several Links in a Three-Compartment System
Compartments A, B, and C are all included in one system. An external inflow of \(10\) kg/min enters A. Material moves from A to B at \(4\) kg/min and from A to C at \(1\) kg/min. It also moves from B to C at \(2\) kg/min. External outflows from B and C are \(3\) kg/min and \(4\) kg/min, respectively. Find each stock’s rate of change and the combined rate.
In A, the only external flow is the inflow of \(10\) kg/min. The two internal transfers leave A, so
In B, \(4\) kg/min arrives from A, \(2\) kg/min leaves for C, and \(3\) kg/min leaves the system. Thus,
In C, the transfers from A and B arrive at rates of \(1\) kg/min and \(2\) kg/min, and the external outflow is \(4\) kg/min. Thus,
Add the three compartment rates:
As a check, the only external inflow is \(10\) kg/min, while the external outflows total \(3+4=7\) kg/min. Their difference is \(10-7=3\) kg/min, matching the sum. Each internal link has also canceled: the \(4\) kg/min from A to B, the \(1\) kg/min from A to C, and the \(2\) kg/min from B to C each appears once as an outflow and once as an inflow.
Worked Example: Transfers That Depend on the Stocks
Worked Example: Transfers That Depend on the Stocks
Compartments X and Y contain a substance measured in kilograms. At a particular instant, \(X=30\) kg and \(Y=20\) kg. An external inflow of \(6\) kg/hr enters X, and an external outflow of \(2\) kg/hr leaves Y. The transfer rate from X to Y is \(q_{XY}=0.1X\), and the rate from Y to X is \(q_{YX}=0.05Y\), with the coefficients measured in hr\(^{-1}\). Find the two stock rates at this instant.
First evaluate each internal rate using the given stocks:
For X, the external inflow is \(6\) kg/hr, the transfer to Y is an outflow of \(3\) kg/hr, and the transfer from Y is an inflow of \(1\) kg/hr. Hence,
For Y, the transfer from X is an inflow of \(3\) kg/hr, the transfer back to X is an outflow of \(1\) kg/hr, and the external outflow is \(2\) kg/hr. Hence,
The combined rate is \(X'+Y'=4+0=4\) kg/hr. The external-only calculation also gives \(6-2=4\) kg/hr. This agreement checks both the substitution into the transfer formulas and the signs in the balances. The rates are evaluated at the stated instant; the cancellation holds even as the stocks, and therefore the transfer rates, later change.
A Common Sign Error
A frequent mistake is to count an internal transfer as an additional gain to the combined stock because it appears as an inflow in the destination compartment. That calculation includes the positive contribution but forgets the equal outflow from the source compartment.
For the three-compartment example, an incorrect total calculation might count the \(10\) kg/min external inflow, the \(4+1+2\) kg/min of internal transfers, and the \(3+4\) kg/min of external outflows:
This is wrong: it treats internal transfers as gains to the combined system. The correction is to include both sides of every transfer. For example, the A-to-B transfer contributes \(-4\) in A’s balance and \(+4\) in B’s balance, giving \(-4+4=0\). Applying the same pairing to all three links leaves only \(10-(3+4)=3\) kg/min, the correct combined rate.
Building and Checking a Balance Model
A reliable construction separates the modelling task into a few checks. These checks do not replace the equations; they help expose missing terms and sign errors.
State which stocks belong to the combined system. A flow between two included compartments is internal; a flow crossing the combined boundary is external.
For every internal transfer, identify a source and a destination. Use the same rate with a negative sign at the source and a positive sign at the destination.
Add the rates entering that compartment and subtract the rates leaving it, including both external flows and internal transfers.
Internal terms should cancel in pairs. Compare the remaining expression with total external inflow minus total external outflow, and check that all terms have units of stock per time.
This structure is useful whenever a model tracks stock in multiple connected parts of a system. Individual compartments can increase or decrease because material moves between them, even while the total changes only through boundary flows. Writing the balances first preserves that distinction and makes the combined result transparent.
Check Your Understanding
Use the convention that a transfer rate is named by its source and destination, and that external inflows and outflows are nonnegative.
- For a transfer \(q_{12}\) from compartment 1 to compartment 2, what signed terms does it contribute to the two compartment balances?
- Compartments A and B exchange material at \(5\) L/min. What is the net contribution of that transfer to \(S_A'+S_B'\)? Explain using the signs.
- In a three-compartment system, external inflows total \(14\) kg/hr and external outflows total \(9\) kg/hr. What is the combined stock rate, regardless of the internal transfer rates?
- If a flow leaves an included compartment and enters a compartment omitted from the model, is it internal or external for the modelled system?
- What is the sign error in adding a transfer’s destination inflow to the combined total while omitting its source outflow?