Tutorials › Calculus I › Combining Inflows, Outflows, And Internal Transfers

Calculus-Based Model Construction · Tutorial 1465 of 1495

Combining Inflows, Outflows, And Internal Transfers

Learn to write and check compartment-by-compartment balance equations, then combine them to find the net rate of change of the whole system.

Advanced 10 min read

What You'll Learn

  • Distinguish external flows across a system boundary from transfers within the system.
  • Write a rate balance for each compartment using a consistent direction convention.
  • Add compartment balances to obtain the rate of change of the combined stock.
  • Explain algebraically why each internal transfer cancels from the total balance.
  • Check model equations for sign, units, and conservation errors.

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.

Core principle: Write one balance for each compartment, with inflows positive and outflows negative. When those balances are added, every transfer between included compartments appears once with each sign and cancels. Only flows across the boundary of the combined system remain.

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.

Definition: A compartment balance equates the rate of change of its stock to the sum of its inflow rates minus the sum of its outflow rates. External flows and internal transfers must both be included in that compartment’s balance, each with a sign determined by whether it enters or leaves that compartment.

With the notation above, the balance for compartment \(i\) is

$$ S_i'(t) = I_i(t)-O_i(t) +\sum_{j\ne i}q_{ji}(t) -\sum_{j\ne i}q_{ij}(t). $$

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

$$ S_{\mathrm{tot}}'(t) = \sum_{i=1}^{n}\bigl(I_i(t)-O_i(t)\bigr) + \sum_{i=1}^{n}\sum_{j\ne i}q_{ji}(t) - \sum_{i=1}^{n}\sum_{j\ne i}q_{ij}(t). $$

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.

Theorem: If every internal transfer is between compartments included in \(S_{\mathrm{tot}}\), then $$ S_{\mathrm{tot}}'(t)=\sum_{i=1}^{n}I_i(t)-\sum_{i=1}^{n}O_i(t). $$ Thus the combined stock changes only through flows crossing the boundary of the combined system.

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,

$$ S_A'=12-3=9\ \text{L/min}. $$

For tank B, the transfer from A is an inflow of \(3\) L/min, and the external outflow is \(5\) L/min. Therefore,

$$ S_B'=3-5=-2\ \text{L/min}. $$

Add the compartment rates to obtain the combined rate:

$$ S_{\mathrm{tot}}'=S_A'+S_B' =9+(-2)=7\ \text{L/min}. $$

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

$$ S_A'=10-4-1=5\ \text{kg/min}. $$

In B, \(4\) kg/min arrives from A, \(2\) kg/min leaves for C, and \(3\) kg/min leaves the system. Thus,

$$ S_B'=4-2-3=-1\ \text{kg/min}. $$

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,

$$ S_C'=1+2-4=-1\ \text{kg/min}. $$

Add the three compartment rates:

$$ S_{\mathrm{tot}}'=5+(-1)+(-1)=3\ \text{kg/min}. $$

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:

$$ q_{XY}=0.1(30)=3\ \text{kg/hr}, \qquad q_{YX}=0.05(20)=1\ \text{kg/hr}. $$

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,

$$ X'=6-3+1=4\ \text{kg/hr}. $$

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,

$$ Y'=3-1-2=0\ \text{kg/hr}. $$

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:

$$ 10+(4+1+2)-(3+4)=10\ \text{kg/min}. $$

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.

Check: In a combined balance, ask whether every internal flow has been counted once as leaving its source and once as entering its destination. If only one side appears, the flow has not been treated consistently.

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.

1
Choose the included compartments.
State which stocks belong to the combined system. A flow between two included compartments is internal; a flow crossing the combined boundary is external.
2
Record each flow’s direction.
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.
3
Write one balance per compartment.
Add the rates entering that compartment and subtract the rates leaving it, including both external flows and internal transfers.
4
Add the balances and check.
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.

  1. For a transfer \(q_{12}\) from compartment 1 to compartment 2, what signed terms does it contribute to the two compartment balances?
  2. 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.
  3. 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?
  4. If a flow leaves an included compartment and enters a compartment omitted from the model, is it internal or external for the modelled system?
  5. What is the sign error in adding a transfer’s destination inflow to the combined total while omitting its source outflow?

Test yourself: Calculus I final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon