Governing equations
This is a one-dimensional, linear water-hammer model. It advances pressure p and mean fluid velocity u along a pipe:
∂p/∂t + ρa² ∂u/∂x = 0
∂u/∂t + (1/ρ) ∂p/∂x = 0
The pressure-wave speed is a, water density is ρ, and the upstream reservoir holds gauge pressure at zero. At the downstream valve, velocity falls linearly from its initial value to zero over the selected closing time.
Useful estimates
Δp ≈ ρaΔu (rapid closure)
Δp ≈ 2ρLU₀/Tc (slow linear closure)
The reference used by the checks is the smaller of those two pressure rises. The critical comparison time is the round trip, 2L/a.
Numerical method
Pressure is stored at cell centres and velocity at cell faces. A staggered, explicit finite-difference update advances both fields with a fixed time step and a Courant number of 0.78. The time step is recalculated from pipe length and wave speed, not from the display frame rate. The grid uses a scaled Courant number of 0.78.
What is simplified
Textbook reference constants are water density 998 kg/m³, atmospheric pressure 101,325 Pa and approximate water-vapour pressure 2,330 Pa at 20 °C. The pipe is straight, uniform and lossless. The water and pipe wall are represented together by one chosen wave speed. The model omits friction, fittings, branches, nonlinear valve characteristics, pipe-wall stress, cavitation dynamics and the actual fracture of a pipe. If pressure reaches the water-vapour threshold, the run pauses because a single-phase linear model is no longer valid.
What is illustrative
The pipe pressure rating is a user-set teaching threshold, not a product specification. Geometry is drawn to fit the screen and is not to scale. The water density, atmospheric pressure and approximate vapour pressure are textbook reference values near 20 °C; the selected pipe and flow settings are illustrative.
Educational engineering model. It is not a design tool for real pipework or pressure systems.