The science
All calculations use metres, seconds and cubic metres. The readouts convert cubic metres to litres (1 m³ = 1000 L).
Gravity-fed flow
a = π d² / 4 (outlet area, m²); Qout = Cd × u × a × √(2 g h) (m³/s).
g = 9.81 m/s², Cd ≈ 0.62 (dimensionless, approximate), h is water depth in metres, u is open fraction from 0 to 1, and d must be in metres.
Rainwater collection
Qin = (R / 1000 / 3600) × Ar × η (m³/s), where R is rainfall in mm/h, Ar is roof area in m², and η is capture fraction.
Water balance
At × dh/dt = Qin − Qout (m³/s), where At = 1.8 m². Maximum depth is 2.4 m; excess enters the overflow counter. The solver uses a fixed 1/120 s step and an explicit midpoint estimate.
Independent analytic baseline
Without rain and with a fixed opening, h(t) = max(0, √h0 − [Cd × u × a × √(2g) / (2At)] × t)² (m). The dashed line shows this dry baseline from the start, not a weather forecast.
Assumptions and simplifications
- Water is incompressible; the tank is cylindrical and its outlet is at the bottom.
- Cd ≈ 0.62 is a rough orifice estimate. Pipe friction and valve nonlinearity are simplified.
- Rain is uniform and enters instantly; gutter loss occurs only during the scripted clog. The displayed roof is one illustrative section of a larger connected catchment.
- The interchangeable nozzle and roof area controls are a teaching abstraction. Soil absorption and crop growth are not modelled.
What you can try
Set rainfall to zero and compare the chart lines; halve the opening and watch how slowly the tank empties; then raise roof area during rain and observe reserve protection. Try for all three stars: 1,200 L delivered, 1.00 m reserve depth, and 5 L or less overflow.