Skip to main content

Water hammer: rectangular grid and specified intervals

Short answer

Use characteristic equations C+ and C- integrated by finite differences. On diagonal grid with dt=dx/a, no interpolation: K1=H_A+BpQ_A-RpQ_A|Q_A|, K2=H_B-BpQ_B+RpQ_B|Q_B|, Q_P=(K1-K2)/(2Bp), H_P=(K1+K2)/2. If dt is smaller, interpolate R and S with theta=a dt/dx, then use same formulas with R and S and friction length a dt.

Derive a numerical solution for evaluating the water hammer problem. (a) Using a rectangular grid, characteristics passing through the diagonal. (b) Using specified time intervals (characteristics not on the diagonal).

Water hammer is the pressure surge produced by a rapid change of velocity (valve closure, pump trip). It is solved with the characteristic equations of unsteady pipe flow.

For unsteady flow in a closed pipe (area ApA_p, diameter DD, wave speed aa, Darcy-Weisbach factor ff), with head HH and discharge QQ:

Momentum:

L1=∂Q∂t+gAp∂H∂x+f Q∣Q∣2DAp=0L_1=\frac{\partial Q}{\partial t}+gA_p\frac{\partial H}{\partial x}+\frac{f\,Q|Q|}{2DA_p}=0

Continuity:

L2=∂H∂t+a2gAp∂Q∂x=0L_2=\frac{\partial H}{\partial t}+\frac{a^2}{gA_p}\frac{\partial Q}{\partial x}=0

Along C+C^+ (dx/dt=+adx/dt=+a) and C−C^- (dx/dt=−adx/dt=-a):

C+: dHdt+agApdQdt+af2gDAp2Q∣Q∣=0,C−: dHdt−agApdQdt−af2gDAp2Q∣Q∣=0C^+:\ \frac{dH}{dt}+\frac{a}{gA_p}\frac{dQ}{dt}+\frac{af}{2gDA_p^2}Q|Q|=0,\qquad C^-:\ \frac{dH}{dt}-\frac{a}{gA_p}\frac{dQ}{dt}-\frac{af}{2gDA_p^2}Q|Q|=0

Let Bp=agApB_p=\dfrac{a}{gA_p}.

(a) Rectangular grid: characteristics through the diagonal

Divide the pipe into NN reaches of length Δx=L/N\Delta x=L/N and choose Δt=Δx/a\Delta t=\Delta x/a. The C+C^+ and C−C^- lines through P then pass exactly through the grid points A and B of the previous time level.

 t+dt :         P
               /|\
         C+  /  |  \  C-
 t    :    A----C----B

Integrating C+C^+ from A to P and C−C^- from B to P (friction at the known end), with Rp=fΔx2gDAp2R_p=\dfrac{f\Delta x}{2gDA_p^2}:

HP=HA−Bp(QP−QA)−RpQA∣QA∣,HP=HB+Bp(QP−QB)+RpQB∣QB∣H_P=H_A-B_p(Q_P-Q_A)-R_pQ_A|Q_A|,\qquad H_P=H_B+B_p(Q_P-Q_B)+R_pQ_B|Q_B|

With K1=HA+BpQA−RpQA∣QA∣K_1=H_A+B_pQ_A-R_pQ_A|Q_A| and K2=HB−BpQB+RpQB∣QB∣K_2=H_B-B_pQ_B+R_pQ_B|Q_B|:

QP=K1−K22Bp,HP=K1+K22Q_P=\frac{K_1-K_2}{2B_p},\qquad H_P=\frac{K_1+K_2}{2}

No interpolation is needed. Boundaries: upstream reservoir, HP=HresH_P=H_{res} and QP=(Hres−K2)/BpQ_P=(H_{res}-K_2)/B_p; closed downstream valve, QP=0Q_P=0 and HP=K1H_P=K_1.

(b) Specified time intervals: characteristics not on the diagonal

When Δt\Delta t and Δx\Delta x are chosen independently (for example to get the same Δt\Delta t in pipes of different length), the Courant condition aΔt≤Δxa\Delta t\le\Delta x must hold. The characteristics through P cut the time line at points R and S between grid points.

 t+dt :              P
                    /|\
              C+  /  |  \  C-
 t    :   A-----R----C----S-----B

With θ=aΔtΔx≤1\theta=\dfrac{a\Delta t}{\Delta x}\le1, linear interpolation gives

QR=QC−θ(QC−QA),HR=HC−θ(HC−HA)Q_R=Q_C-\theta(Q_C-Q_A),\quad H_R=H_C-\theta(H_C-H_A) QS=QC−θ(QC−QB),HS=HC−θ(HC−HB)Q_S=Q_C-\theta(Q_C-Q_B),\quad H_S=H_C-\theta(H_C-H_B)

The characteristic equations from R and S to P (friction length aΔta\Delta t, so Rp′=f aΔt2gDAp2R_p'=\dfrac{f\,a\Delta t}{2gDA_p^2}) are

HP=HR−Bp(QP−QR)−Rp′QR∣QR∣,HP=HS+Bp(QP−QS)+Rp′QS∣QS∣H_P=H_R-B_p(Q_P-Q_R)-R_p'Q_R|Q_R|,\qquad H_P=H_S+B_p(Q_P-Q_S)+R_p'Q_S|Q_S| QP=K1′−K2′2Bp,HP=K1′+K2′2,K1′=HR+BpQR−Rp′QR∣QR∣,  K2′=HS−BpQS+Rp′QS∣QS∣Q_P=\frac{K_1'-K_2'}{2B_p},\quad H_P=\frac{K_1'+K_2'}{2},\qquad K_1'=H_R+B_pQ_R-R_p'Q_R|Q_R|,\ \ K_2'=H_S-B_pQ_S+R_p'Q_S|Q_S|

The interpolation introduces numerical damping (diffusion), which grows as θ\theta departs from 1, so the diagonal grid of part (a) is preferred when possible.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Computational Techniques in Civil Engineering chapter 6 questions →