Water Hammer Analysis Using An Implicit Finite-Difference Method PDF
Water Hammer Analysis Using An Implicit Finite-Difference Method PDF
307-318
ABSTRACT
The Implicit Finite-Difference Method (IFDM) for the solution of water hammer in pipe networks is presented.
All the equations necessary to calculate the flow and pressure in each node of the network are shown in detail.
Section-by-section coupling through the Karney equation allows obtain a system of equations for each pipe
section which is easy to solve applying the Thomas’ algorithm. Also, there are presented the original expressions
in the form of finite differences are presented for: (1) the frictional term RQP|Q| of the dynamics equation, (2)
the transient friction factor proposed by Brunone-Vítkovský, and (3) the short pipe replacement elements which
allow increase the time step. It is demonstrated that the proposed methodology allows modelling the transient
flow with higher level of stability and numerical accuracy in comparison to the Method of Characteristics
(MOC), especially when the Courant number (Cn) is less than 1. However, because of IFDM works with
weighting coefficients (θ1 and θ2) which must adopt values generally close to 0.5 depending on the analyzed
problem, the achievement of the best near-to-exact solution requires to analyze each case separately, being
obligatory to apply a trial/error procedure that can make the analysis cumbersome and time consuming.
Keywords: Pipe replacement element, preissman scheme, transient friction factor, water hammer,
weighting coefficients.
RESUMEN
Se presenta un Método de Diferencias Finitas Implícito (MDFI) para la solución del golpe de ariete
en redes de tuberías. Se muestran en detalle todas las ecuaciones necesarias para calcular el caudal
y presión en cada nodo de la red (interno y de borde), y cuyo acoplamiento tramo-a-tramo, mediante
la ecuación de Karney, permite obtener un sistema de ecuaciones (por cada tramo) de fácil resolución
aplicando el algoritmo de Thomas. Se muestran, además, expresiones originales desarrolladas por el
autor válidas para modelar, en forma de diferencias finitas: (1) el término friccional de la ecuación
de la dinámica RQP|Q|, (2) el factor de fricción transiente propuesto por Brunone-Vítkovský y, (3) los
elementos de reemplazo de tuberías cortas que permiten incrementar la magnitud del paso de tiempo
computacional. Se demuestra que la metodología propuesta permite modelar el flujo transitorio con
mayor nivel de estabilidad y precisión numérica en comparación con el Método de las Características
(MC), especialmente cuando el número Courant (Cn) es menor que 1. Sin embargo, debido a que el MDFI
trabaja con coeficientes de ponderación (θ1 y θ2) que deben adoptar valores generalmente cercanos a 0,5
dependiendo del problema analizado, la obtención de una solución cercana a la exacta requiere analizar
cada caso por separado, siendo obligatorio un procedimiento de ensayo y error que puede hacer que el
análisis se torne lento y engorroso.
1 Twyman Ingenieros Consultores. Pasaje Dos # 362, Rancagua, Chile. E-mail: [email protected]
* Corresponding author.
Ingeniare. Revista chilena de ingeniería, vol. 26 Nº 2, 2018
308
John Twyman Q.: Water hammer analysis using an implicit finite-difference method
K /ρ aΔt aNΔt
a= Cn = = ≤ 1.0 (4)
KD (3) Δx L
1+ Ψ
E e
With Δx = reach length, N = number of reaches
With K = water bulk modulus; ρ = liquid density; and L = pipe length. In order to get Cn = 1.0, some
E = pipe elasticity modulus (Young); e = pipe initial pipe properties can be modified (length and/
wall thickness and ψ = factor related with the pipe or wave speed). Another way is to keep the initial
supporting condition. conditions and apply numerical interpolations with
risk a of generating errors (numerical dissipation
METHOD OF THE and dispersion) in the solution [10]. In general,
CHARACTERISTICS (MOC) MOC gives exact numerical results when Cn =
1.0; otherwise, it generates erroneous results in the
The Method of Characteristics (MOC) is an Eulerian way of attenuations when Cn < 1.0 or numerical
numerical scheme [27] very used for solving instability when Cn > 1.0 [10].
the equations which govern the transient flow.
Because it works with “a” constant and, unlike IMPLICIT FINITE DIFERENCE METHOD
other methodologies based on a finite difference
or finite element, it can easily model wave fronts According to Figure 2, the state variables at time t
generated by very fast transient flows. MOC works have been calculated, being necessary to calculate
converting the computational space (x) - time new values at time t = t +Δt. To achieve this purpose,
(t) grid (or rectangular mesh, see Figure 1) in the partial derivatives in equations (1) and (2) may be
accordance with the Courant condition. It is useful approximated by finite differences, as follows [22]:
for modelling the wave propagation phenomena
in water distribution systems due to its facility for t+Δt t
introducing the hydraulic behavior of different ∂H (
H i+1 + H i+1 − H it+Δt + H it
) ( )
= (5)
devices and boundary conditions such as valves, ∂x 2Δx
pumps, reservoirs, etc. [16]. Some main advantages
of MOC are its ease of use, speed and explicit t+Δt
∂H (
H i+1 + H it+Δt − H i+1
) (t
+ H it )
nature, which allows calculate the variables Q and = (6)
∂t 2Δt
309
Ingeniare. Revista chilena de ingeniería, vol. 26 Nº 2, 2018
t+Δt t t+Δt t
(
∂Q Qi+1 + Qi+1 − Qi + Qi ) ( ) (7)
⎛ −gA ⎞⎡
c’4 = ⎜ t t
⎟ θ1H i+1 + (1− θ1 ) H i ⎤⎦
∂x
=
2Δx ⎝ Δt ⎠⎣
g
c4” = c’4 + Qit + Qi+1
( t
⋅ )
t+Δt
( t+Δt
∂Q Qi+1 + Qi
t
− Qi+1 + Qit ) ( ) 2Δx (19)
= (8) ⎡(1− θ ) H t − (1− θ ) H t ⎤
∂t 2Δt ⎣ 2 i+1 2 i ⎦
a 2 ⎡
On the other hand: c4 = c4” + t
. (1− θ 2 ) Qi+1 − (1− θ 2 ) Qit ⎤⎦
Δx ⎣
R t t
RQ Q = (
Qi + Qi+1 Qit + Qi+1
t
) (9) Where θ1 and θ2 are weighting coefficients, ε =
4
linearization constant and fav corresponds to an
⎛ t t ⎞
average value ⎜⎜ fi + fi+1 ⎟⎟.
Taking into account the equations (5) to (9), the
equations (1) and (2) can be represented as follows [22]:
⎝ 2 ⎠
d1Qit+Δt + d2Qi+1
t+Δt
− d3 H it+Δt + d3 H i+1
t+Δt
+ d4 = 0 (10) CALCULATION OF THE BOUNDARY
CONDITIONS
−c1Qit+Δt + c1Qi+1
t+Δt
+ c2 H it+Δt + c3 H i+1
t+Δt
+ c4 = 0 (11)
Karney [12] proposes a comprehensive and
Where the coefficients are the following [22]: systematic approach to model different boundary
conditions (with constant or variable consumption,
reservoirs, etc.). and which it allows linking the
θ 2 Δt Qit + Qi+1
( t
)+ f av Δtε Qit + Qi+1
t
hydraulic behavior of all piping, consumptions or
d1 = 2 (1− θ1 ) − (12)
AΔx 4DA tanks connected to each network node by:
θ 2 Δt Qit + Qi+1
( t
)+ f av Δtε Qit + Qi+1
t
H Pt+Δt = Cc − Bc ⋅Qext (20)
d2 = 2θ1 + (13)
AΔx 4DA
Where Cc and Bc are known constants and Qext is
d3 =
( 2θ 2 ) gAΔt the nodal consumption or flow rate that may be
(14) constant or a function of time. The importance
Δx
of equation (20) is that it enables to separate or
t decouple the pipelines of complex networks in
2 (1− θ 2 ) gAΔt H i+1 − H it
( )
d4’ = each node, restoring the flow continuity and the
Δx piezometric head in the node (when there is not
t
−2 ⎡⎣θ1Qi+1 + (1− θ1 ) Qit ⎤⎦ storage nor singular losses).
(15)
Δt
d4 = d4’ + t
.
( )
Qi+1 COUPLING EQUATIONS
AΔx
⎡(1− θ ) Q t − (1− θ ) Q t ⎤ Equations (10) to (19) and (20) can be used to
⎣ 2 i+1 2 i ⎦
construct a diagonal band system of dimensions
2X(N+1) -see Figure 3, which can be efficiently
a 2θ 2
c1 = (16) converted into a tri-diagonal system and then solved
Δx using the Thomas algorithm [17]. Figure 3 shows
the system of equations for a pipe divided into N
t t
c2 =
(1− θ1 ) gA − gθ 2 (Qi + Qi+1 ) reaches, where the first and last rows correspond to
Δt 2Δx
(17) H Pt+Δt value (equation 20) of each boundary node.
The remaining rows are generated from application
t t of the equations (10) and (11) in each pipe reach.
c3 = +
(
gAθ1 gθ 2 Qi + Qi+1 ) (18) All coefficients have a superscript that identifies the
Δt 2Δt reach number (for example, in c12 the superscript 2
310
John Twyman Q.: Water hammer analysis using an implicit finite-difference method
indicates that c1 is calculated using the reach 2 data). of approaches have been proposed for the friction
This indication is relevant because the state variables term of the dynamics equation, standing out the
may vary from one reach to another. For this reason, following approximation due to its general form [13]:
the matrix will not be always simmetrical although its
structure has a form of bands, as shown in Figure 3.
Each system of equations will have a different size
∫ Q Q dx = Qit Qit Δx + ε (Qit+Δt − Qit ) Qit Δx (21)
according to the number of reaches assigned to each
pipe. Once the network is disconnected, it generates Where dx = variation of x. The approximation given
a system of linear equations for each pipe of the by equation (21) can be represented in the dynamics
network. The calculation of the state variables is equation (10) by the IFDM as follows [22]:
realized in each pipe independently from the rest.
The algorithm works as follows for every pipe of θ 2 Qit + Qi+1
t
the system: d1 = 2 (1− θ1 ) −
( Δt ) +
AΔx
(22)
fav Δtε Qit + Qi+1
t
4SA
θ 2 Δt Qit + Qi+1
( t
)+ f av Δtε Qit + Qi+1
t
d2 = 2θ1 + (23)
AΔx 4DA
2θ 2 gAΔt
d3 = (24)
Δx
Figure 3. Band diagonal system for a pipe with N
reaches. t
(1− θ 2 ) 2gA ( H i+1 − H it ) Δt
d4 =
Δx
a) t = t + Δt t
− 2 ⎡⎣θ1Qi+1 + (1− θ1 ) Qit ⎤⎦ +
For each internal node i: Δt
(Qit + Qi+1
t
⋅ )
H it+Δt
and Qit+Δt for i = 2 to N using AΔt
• Compute
⎡(1− θ ) Q t − (1− θ ) Q t ⎤ + (25)
equations 10 to 19 arranged according to Figure 3. ⎣ 2 i+1 2 i ⎦
• Compute H Pt+Δt for each network node using
equation 20. fav Δt Qit + Qi+1
( t
Qit + Qi+1
t
) −
• Solve the system of equations (Figure 3) and 4DA
reassign doing H it = H it+Δt and Qit = Qit+Δt for
fav Δtε Qit + Qi+1
(t
Qit + Qi+1
t
)
i = 1 to N +1.
4DA
b) Back to a) until complete the simulation time.
Equation (21) provides an excellent way for
TERM RQ|Q| analyzing the effect of the friction factor on the
transient simulation [13]. It is suitable to adopt ε
Friction always acts against the direction of flow = 1.0 in equation (21) to obtain greater numerical
(reversal) and it must change its sign accordingly. stability, because when f value is high, instabilities
The effect of friction is expressed in terms of Q2 can be produced whenever Cn = 1.0 [11]. Hence the
in the basic differential equations, and it does not approximation of RQ|Q| using ε = 1.0 ensures a more
fulfill this requirement. Such difficulty can be stable value which is independent of f [11]. Wylie
eliminated by writing Q2 as Q|Q| which has the [28] has recommended the application of equation
same magnitude as just mentioned and it changes its (21) with ε = 1.0 to obtain an improved alternative,
sign automatically as flow reverses [20]. A number with only a minor penalty in computational effort.
311
Ingeniare. Revista chilena de ingeniería, vol. 26 Nº 2, 2018
Nevertheless, some authors [13] indicate that [4]. Brunone’s approximation has significantly
values of ε near 0.85 are almost optimal for most improved modeling of unsteady friction, and the
applications. The main advantage of equation (21) is decay coefficient k can be analytically deducted
which weighting term ε influences the friction factor from Vardy and Brown’s shear decay coefficient C*,
without requiring the discretization (Δx, Δt or a) obtaining with this procedure an unsteady friction
to be changed [13]. Hence, equation (21) provides model using a variable k based on instantaneous
an excellent way of assessing the sensitivity of a local conditions [25]. In general, equation (26) can
transient simulation to friction values. For example, be represented in the dynamics equation (2) by the
if two values of ε produce significantly different IFDM as follows [22]:
results, the MOC (or IFDM) grid is too coarse,
and smaller time step is required [13]. Finally, is θ 2 Δt Qit + Qi+1
( t
)+
convenient to state that the friction term analyzed d1 = 2 (1− θ1 ) −
AΔx (27)
in this section comes from stationary state that
introduces progressive distortion in the modeling of +k ⋅ ⎣(1− θ1 ) − θ 2Cn ⎦ ⋅ sign (Q )
⎡ ⎤
the phenomenon towards the middle and end cycles
of the transient wave, both in amplitude and phase. θ 2 Δt Qit + Qi+1
( t
) + k ⋅ [Q + Q C ] ⋅ sign (Q) (28)
d2 = 2θ1 + 1 2 n
AΔx
TRANSIENT FRICTION FACTOR
2θ 2 gAΔt
Another related problem with dynamics equation d3 = (29)
referrers to the determination of f, since the values Δx
of the friction factor of each pipe could affect the
t
magnitude of the water hammer pressures. In this 2 (1− θ 2 ) gAΔt H i+1 + H it
( )−
d4 =
sense some authors have stated a number of ways Δx
to determine f, going from theoretical approaches t Δt
up to others of practical nature. Among theoretical −2θ1Qi+1 + (1− θ1 ) Qit + Qit + Qi+1
( t
⋅ )
AΔx
methods highlights the following equation for j
modelling the transient friction factor [4]: ⋅⎡⎣(1− θ 2 ) Qi+1 − (1− θ 2 ) Qij ⎤⎦ +
(30)
fav Δt ⎡⎣Qit + Qi+1
t ⎤ t t
⎦ Qi + Qi+1
kD ⎛ ∂V ∂V ⎞
ft = fst + 2 ⎜ − a ⎟ (26) + −
V ⎝ ∂t ∂x ⎠ DA
t
−k ⎡⎣θ1Qi+1 + (1− θ )⎤⎦Qit +
Where ft = transient friction factor; x = axial
coordinate and k = decay coefficient which is
dependent on maximum piezometric heads (respect
( t
+kc1 1− θ 2 ⎡⎣ Qi+1 )
− Qit ⎤⎦ ⋅ sign (Q )
312
John Twyman Q.: Water hammer analysis using an implicit finite-difference method
= 1.0. This can worsen when there are relatively E5 = c1 + c3 Bc2 (39)
“short” pipes limiting the magnitude of Δt and N,
so that the most pipes are discretized with Cn < 1.0, E6 = −c4 − c2Cc1 − c3Cc2 (40)
forcing the application of interpolation processes
that can degrade the solution or to make adjustments Known Qext1 and Qext2 is possible to obtain the
to the wave speed which means modify the initial t+Δt
piezometric heads H P1 t+Δt
and H P2 for Δt applying
conditions of the problem. Alternatively, some equations (33) and (34) in (31) and (32).
authors [12-13] propose to replace the shortest pipe
of the network for a mathematical representation EXAMPLE OF APPLICATION 1
called “pipe replacement element” PRE (Figure 4)
for obtaining a greater Δt without altering the The single pipe apparatus [3] used for investigating
optimum conditions of stability and convergence water hammer waveforms comprises a metal
of MOC. PRE can be represented as lumped inertia (copper) pipeline of length 37.2 m, 22 mm
element (PRE-LIE) or as finite difference (PRE- internal diameter and 1.6 mm wall thickness that
FD) approximation [22]. This last option works is upward sloping (Figure 5). The transient event
with the following equations taking into account is generated by a rapid closure of the downstream
the equation 20 [22] -see Figure 4: end valve. The apparatus is installed in Robin
hydraulic laboratory of the Department of Civil
and Environmental Engineering at the University
of Adelaide [3]. The initial flow velocity is V0
= 0.2 (m/s), static head in the tank 2, HT = 32
(m), valve closure time Tc = 0.009 (s), and water
Figure 4. PRE (Finite Difference approximation). hammer wave speed a = 1319 (m/s). The number
of reaches for each computational run is N = 32,
and the time step (Δt) = 0.00088135 (s).
t+Δt
H P1 = Cc1 − Bc1 ⋅Qext1 (31)
t+Δt
H P2 = Cc2 + Bc2 ⋅Qext 2 (32)
With:
E2 E6 − E 3 E5
Qext1 = (33)
E2 E4 − E1E5
Figure 5. Single pipe apparatus [3].
E3 − E1Qext1
Qext 2 = (34)
E2
E1 = d1 + d3 Bc1 (35)
E2 = d2 + d3 Bc2 (36)
313
Ingeniare. Revista chilena de ingeniería, vol. 26 Nº 2, 2018
Figure 7. Results obtained by MOC and IFDM Figure 9. Results obtained by IFDM (Cn = 0.5)
when Cn = 1.0 (valve). and exact solution (pipe midpoint).
314
John Twyman Q.: Water hammer analysis using an implicit finite-difference method
EXAMPLE OF APPLICATION 2
Figure 13. Results obtained by MOC (f steady) and For analysis purposes, the initial pipe length was
IFDM (f transient) in the valve (Cn = 1.0). divided into three parts, and Table 3 shows the
adopted discretization in this case when Δt = 0.010
(s). Because pipe 2 is too short relative to pipes 1
Table 1. Maximum pressures comparison between
and 3, is convenient to replace it by a PRE in order to
MOC ( RQ|Q|, ε = 0.0) and IFDM (RQP|Q|,
avoid solving the problem using a too small time step.
ε = 1.0) when Cn = 1.0.
Maximum Pressure (m)
Table 3. Discretization for the single pipeline.
MOC IFDM
Node Pipe L (m) N Δx (m) Cn
RQ|Q| RQP|Q| RQ|Q| RQP|Q|
1 270 22 12.3 0.98
ε = 0.0 ε = 1.0 ε = 0.0 ε = 1.0 2 60 5 12.0 1.00
Midpoint 58.84 58.84 58.84 58.84 3 270 22 12.3 0.98
Valve 58.88 58.88 58.87 58.87
315
Ingeniare. Revista chilena de ingeniería, vol. 26 Nº 2, 2018
316
John Twyman Q.: Water hammer analysis using an implicit finite-difference method
317
Ingeniare. Revista chilena de ingeniería, vol. 26 Nº 2, 2018
318