Governing equations
∂p/∂t + ρa² ∂u/∂x = 0
∂u/∂t + (1/ρ) ∂p/∂x = 0
These are the one-dimensional, linear water-hammer equations. Here p is pressure change, u is water velocity, ρ is density and a is the effective pressure-wave speed. The upstream reservoir holds p = 0; the valve imposes a linear reduction in flow.
Reference estimates
Fast closure: Δp = ρaΔu
Slow closure: Δp ≈ 2ρLΔu / T, when T > 2L/a
Thin-wall hoop stress: σ ≈ pgD / (2t)
The pressure estimate switches continuously at the round-trip time. The stress check uses the reservoir gauge pressure plus the estimated surge.
Numerical method
A staggered one-dimensional grid is advanced with fourth-order Runge–Kutta (RK4) and a fixed step, Δt = 0.42Δx/a. The Courant ratio stays below one. High detail uses more cells; Low detail uses fewer. Frame rate changes only how many fixed steps are accumulated, never the step size.
What is simplified
- Water is treated as a single-phase, slightly compressible fluid with constant textbook density ρ = 998 kg/m³.
- Pipe-wall elasticity is folded into the chosen effective wave speed; wall motion is not solved separately.
- Friction, branching networks, nonlinear valve flow, fluid-structure coupling and temperature effects are omitted.
- If absolute pressure falls to the textbook vapour-pressure threshold near 0.023 bar at 20 °C, the display warns that column separation may occur; it does not simulate a vapour cavity.
- The hoop-stress result is an illustrative thin-wall comparison, not a pipe certification or rupture simulation.
How to read the numbers
Live operating settings and outputs are illustrative; the equations and stated water properties are textbook; the pipe artwork and sensor spacing are scaled. The selected allowable stress is an illustrative limit, not a material datasheet value.