1Demonstration 1 of 4
A falling inflow can still fill the tub
If the inflow falls every minute, does the tub empty?
Each step adds dt x (inflow - outflow). When the outflow is below every inflow reading the net flow stays positive and the level rises, more slowly each minute, even as the inflow falls.
stock(t) is the water in the tub at minute t, in litres. inflow and outflow are rates in litres per minute. dt is the step length, one minute here.
Predict first. With the inflow falling from 10 to 6 and the outflow at 8, does the level end above or below 50 litres?
Choose an example
Constructed example: the chapter's own five-minute tables, recomputed with the pack's integrate function.
Calculated values
- Inflow direction
- falling every minute
- Net flow by minute (l/min)
- 6, 5, 4, 3, 2
- Level after 5 minutes (l)
- 70
- Change in level (l)
- 20
Each minute adds inflow minus outflow. The net flows are 6 + 5 + 4 + 3 + 2, so the level is 50 + 6 + 5 + 4 + 3 + 2 = 70 litres. The tub gained water, by 20 litres, while the inflow was falling. The direction of the level follows the sign of the net flow, not the direction of either rate.
Use the idea
Before reading a headline about a rate as news about a level, write the other flow and the starting level next to it and add up the net flows.
Where the conclusion applies
Five one-minute steps, constant rates within each minute, a 50 litre start, and no floor. The conclusion fails if an unlisted flow also moves the stock.
Check your understanding: With the inflow rising 5, 6, 7, 8, 9 and the outflow at 9, what is the level after five minutes?
Chapter 4 source: section "Reading the graph, slowly". Demonstration C04-D01.
2Demonstration 2 of 4
The step length turns a rate into an amount
What goes wrong if dt is left out of the update?
Kept, dt scales each step so that five minutes always add 30 litres. Dropped, every step adds the full rate, so more, shorter steps add more water and the answer depends on the step length.
dt is the step length in minutes. inflow is 10 and outflow 4 litres per minute, so the net flow is 6 litres per minute; dt x 6 is litres.
Predict first. If the step shrinks to a quarter minute and dt is dropped, how many litres does the tub show after five minutes?
Choose an example
Constructed example: rates from the chapter's first table, advanced with the pack's advance_stock function.
Calculated values
- Step length dt (minutes)
- 1.00
- Steps in 5 minutes
- 5
- Litres added per step
- 6.0
- Level after 5 minutes (l)
- 80
With dt = 1.00, each step adds 1.00 x (10 - 4) = 6.0 litres. 5 steps x 6.0 = 30, so the tub ends at 50 + 30 = 80 litres whatever the step length.
Use the idea
Check that every term added to a stock carries the stock's units, which is the cheapest unit test a model has.
Where the conclusion applies
Constant rates for five minutes from 50 litres. With changing rates a long step also adds integration error, the subject of Chapter 19.
Check your understanding: With dt = 0.5 kept, how many litres does each step add, and how many steps fit in five minutes?
Chapter 4 source: section "Notation, second". Demonstration C04-D02.
3Demonstration 3 of 4
Read every flow, then write every stock
When tub A drains into tub B, does the update order change the answer?
Computing the flow from the state at time t moves the same litres out of A and into B. Updating A first lets B see a level that does not exist yet, so B receives less than A lost.
A and B are litres in each tub. A drains a fixed fraction of its level per step, and that flow is B's inflow. One step, dt = 1.
Predict first. If A is updated first and B's inflow is read from A's new level, does the total water stay at 100 litres?
Choose an example
Constructed example: the two-tub structure from the chapter, with the drain fraction defined for this reader.
Calculated values
- Update order
- flows first
- Flow out of A (l)
- 50
- Flow into B (l)
- 50
- A + B after one step (l)
- 100
- Water created or lost (l)
- 0
Read the flow from A at time t: 0.5 x 100 = 50 litres. Then A = 100 - 50 = 50 and B = 0 + 50 = 50. Together 100 litres, the same 100 the step began with.
Use the idea
In any multi-stock model, compute every flow from the old state before writing any stock.
Where the conclusion applies
Two stocks, a drain proportional to A's level, a 100 litre start in A and an empty B. A step too long for that rule calls for a shorter step, not a different order.
Check your understanding: With a drain fraction of 0.8 and A updated first, how much water disappears in one step?
Chapter 4 source: section "When two tubs are connected". Demonstration C04-D03.
4Demonstration 4 of 4
A floor is a claim, and conservation can see it
What does holding a stock at zero do to the conservation check?
Without a floor the stock goes negative and the records agree. With a floor, the path stops at zero while the flows keep recording a deficit, and the gap appears as a positive residual.
\[apply_floor(stock, floor=0.0)\]
The stock starts at 10. The inflow is 5 per minute and the outflow is chosen. apply_floor holds the stock at zero; the conservation residual is the change in the stock minus the accumulated net flow.
Predict first. With the outflow at 12 and the floor applied, is the conservation residual zero, positive or negative?
Choose an example
Constructed example: values defined for this reader, run through the pack's apply_floor and conservation_error functions.
Calculated values
- Floor at zero
- applied
- Net flow per minute
- (-4)
- Stock after 5 minutes
- 0
- Conservation residual
- 10
The flows say the stock should change by 5 x (5 - 9) = (-20). The path changed by 0 - 10 = (-10). Residual = (-10) - (-20) = 10. The floor removed a deficit the flows still record, so a reader who checks conservation finds it.
Use the idea
A floor suits a tank or a workforce, not an account with an overdraft. Writing it in the model makes the claim checkable.
Where the conclusion applies
Five one-minute steps with constant flows. A residual here comes from the floor alone; in real records it can also come from unreported transfers or definition changes.
Check your understanding: With the outflow at 9 and the floor applied, what is the residual?
Chapter 4 source: section "Bounds are claims about the world". Demonstration C04-D04.