Development of Smoothed Particle Hydrodynamics based water hammer model for water distribution systems

ABSTRACT Smoothed Particle Hydrodynamics (SPH) method is used to solve water hammer equations for pipeline systems due to its potential advantages of easily capturing column separation and slug impact. Currently, the SPH-based water hammer model has been only developed to simulate single pipe flow with simple boundary conditions. It is still a challenge to apply the SPH-based water hammer model to practical water distribution systems (WDSs). To address this issue, this study develops a complete SPH-based Water Hammer model for Water Distribution System (SPH-WHWDS). Within the proposed method, the complex internal and external boundary condition treatment models of the multi-pipe joint junction and different hydraulic components are developed. Buffer and mirror particles are designed for boundary treatment coupling with the method of characteristics (MOC). Two benchmark test cases, including an unsteady pipe flow experiment and a complex WDS, are used to validate the proposed model, with the data from the experimental test in the literature and the simulation results by the classical MOC. The results show the proposed SPH-WHWDS model is capable to simulate transient flows with accurate and robust results for pipeline systems, which may provide further insights and an alternative tool to study water hammer phenomena in complex WDSs.


Introduction
Transient flow is a common phenomenon in practical water distribution systems (WDSs) (Alawadhi & Tartakovsky, 2020;Kim, 2022), which is usually caused by the rapid change of one or more boundary conditions in the system, such as pump start-up or shut-off, instantaneous valve operation, etc.This phenomenon, commonly known as pressure surge or water hammer, is characterised by fast and violent fluctuations in pressure and velocity in the pipeline systems.If not managed properly, it may damage the pipelines and associated hydraulic machinery.Therefore, the prediction, analysis, and prevention of water hammer in engineering practice are of great significance to pipeline design, construction and operation.To this end, an accurate simulation of water hammer becomes crucial to such practical applications and theory development.
Several numerical approaches are available to simulate water hammer problems, among which the onedimensional (1D) models and methods are widely applied because of their efficiency for simulations and CONTACT Hexiang Yan hxyan@tongji.edu.cnTongji University, No.1239 Siping Road, 200092, Shanghai, People's Republic of China convenience for implementation (Duan et al., 2020).Wylie and Streeter (1978) used a set of two hyperbolic partial differential equations (PDEs) to describe the transient flows.These equations are solved by using the method of characteristics (MOC), which transforms the governing pair of PDEs into four coupled ordinary differential equations (ODEs).Wiggert and Sundquist (1977) predicted pipeline transients with fixed-grid intervals and demonstrated the effects of interpolation and grid size on numerical attenuation and dispersion, while Goldberg and Wylie (1983) proposed the interpolations in time had more advantages for applying the MOC to wave problems in hydraulics.Sibetheros et al. (1991) utilised the MOC with spline polynomials for interpolations on water hammer analysis, which was more accurate than linear interpolations and second-order explicit finite difference techniques.Later, Karney and Ghidaoui (1997) introduced a hybrid interpolation approach as a pre-processing step for discretization in pipe networks.
In addition to the MOC, the finite-difference method (FDM) and the finite-volume method (FVM) have also been utilised to solve transient equations.Chaudhry and Hussaini (1985) analysed a second-order accurate explicit finite-difference scheme for water hammer simulation, while Samani and Khayatzadeh (2002) used the FDM coupled with a fixed-grid MOC to handle the disproportionate pipes in networks.Besides, Zhao and Ghidaoui (2004) solved the water hammer problems with first and second-order explicit finite volume Godunovtype schemes.Unlike the scheme of Zhao and Ghidaoui (2004), Leon et al. (2007) proposed a secondorder accurate FV scheme for modelling water hammer flows by using the conservative form of the water hammer equations.Later, Leon et al. (2008) introduced an FV shock-capturing scheme for simulating one-phase and two-phase water hammer flows.Daude et al. (2018) utilised the quasi-1D FVM model to simulate water hammer events with cavitation-induced column separation.Furthermore, Zeng et al. (2022) proposed an elastic water column model coupling with the graph-theoretic approach for simulating transients in water distribution networks.So far, these developed 1D numerical models and simulation methods have been widely used in practical applications such as system design and evaluation as well as theoretical development such as transient-based pipeline assessment (Duan et al., 2020).Recently, some meshless numerical methods, such as the lattice Boltzmann method (LBM) and smoothed particle hydrodynamics (SPH), are also applied to water hammer analysis.The LBM method was first used for water hammer simulation by Cheng et al. (1998).Budinski (2016) utilised the LBM method with the adaptive grid to simulate 1D water hammer and gave detailed complex boundary conditions (such as pump, surge tank, reservoir, and valve, etc.) in WDSs, but didn't consider the unsteady friction model for water hammer pipe flow.Later, Louati et al. (2019) modelled the two-dimensional (2D) water hammer flows using the multiple relaxation times LBM.Zeidan and Ostfeld (2022) developed a friction model for Lagrangian methods in transient flows and validated it in a looped water system, but the study didn't consider some hydraulic components like pumps.The SPH approach was first proposed for astrophysical simulations by Lucy (1977) and Monaghan and Lattanzio (1985) and has become increasingly popular in simulating fluid flow due to its flexibility in tracing moving boundaries and adaptability to complicated geometries (Liu & Liu, 2003).Thus, the SPH method is widely used in complex flow simulations, such as flooding (Albano et al., 2016;Vacondio et al., 2013), multi-phase flow (De Padova et al., 2022;Dong et al., 2022;Meister & Rauch, 2016), and fluid-structure interactions (Basser et al., 2019;Lin et al., 2015;Ming et al., 2018).In addition, the SPH method has been applied in simulating channel and pipe flows with open boundaries (Chang & Chang, 2021;Nomeritae et al., 2018;Sun et al., 2022).The first application of the SPH on water hammer simulation was considered by Hou et al. (2011).Later, Pan et al. (2022) further considered the unsteady friction model in the SPH-based water hammer model, but it was only suitable for the simple pipeline.Compared with the traditional grid-based numerical methods, the SPH method showed an advantage in capturing the discrete process in transient pipe flow systems, such as column separation, rapid filling, and slug impact, because of its meshless feature (Hou et al., 2012).However, the majority of existing SPH-based water hammer models have been only developed for single or simple pipeline systems, and it is still a challenging task for complex pipeline systems such as WDSs, which has greatly limited its applications in practical engineering.And the main difficulties and challenges focus on the boundary treatments of various hydraulic components.Therefore, it is valuable and significant to build appropriate boundary treatment models and further investigate the application of the SPH method in WDSs.
Compared with the previous studies, this paper proposes an improved SPH model for Water Hammer simulation in WDSs (SPH-WHWDS), and the main contributions are as follows: (1) developing a more systematic and complete SPH model for water hammer problems; (2) extending the boundary conditions of the SPH model to complex pipeline systems, such as N-way nodal junctions, valves, reservoirs, surge tanks, and pumps, which greatly broadens the model's applicability and is capable to simulate transient flows in practical WDSs; and (3) exploring the effects of various parameters in the SPH-WHWDS model, such as particle spacing and smoothing length, compared with experimental data.
The rest of this paper is structured as follows.In section 2, the governing equations of the 1D transient flow are presented, and the SPH formulation and computational domain are introduced.Besides, a detailed introduction to the solution of boundary parameters for various WDS components is provided in this section.In section 3, two benchmark cases, including the unsteady pipe flow experiment and a complex WDS, are investigated to verify and validate the proposed SPH-WHWDS model and the protection of the air chamber against water hammer is analysed.Finally, section 4 summarises the results and conclusions.

Governing equations
In general, 1D transient flow (water hammer) in pipes can be expressed by a set of two partial differential equations, namely the continuity and momentum equation (Wylie et al., 1993): where H is the pressure head, v is the mean flow velocity, ρ is the fluid density, g is gravitational acceleration, S 0 is the slope of the pipe, and S f is the friction slope.Wave speed a is calculated as: where K is the bulk modulus, D is the inner pipe diameter, E is Young's modulus, e is the pipe wall thickness, and the parameter φ is determined by the pipe anchors.
Equations ( 1)-( 2) can alternatively be written in the Lagrange form: where D/Dt is the total time derivative D Dt = ∂ ∂t + v ∂ ∂x .

The SPH method
The formulation and principle of applying the SPH method for simulating water hammer flows are elaborated in this section.

SPH formulation
In the SPH method, the fluid is discretized into a set of particles.An interpolation procedure is used to approximate particle properties (e.g.velocity, pressure) over neighbouring particles within a domain determined by a weighting function (Liu & Liu, 2003).Any physical quantity of particle i (f i ) can be computed by the integral approximation: where m j is the mass of particle j, ρ j is the density of particle j, x i is the position of particle i, h i is the smoothing length of particle i, W(|x i − x j |, h i ) is the kernel function of particle i. Herein, the cubic spline function (Monaghan & Lattanzio, 1985) is selected as the kernel function: where R is the relative distance between two particles, The following are two commonly used SPH formulas for the spatial derivative of f i :

Discretization of the governing equation of water hammer
The discretized SPH form of Equations ( 4) to ( 5) can be approximated by Equations ( 8) and (9) as follows: where ij is the artificial viscosity required for the numerical method to be stable; h ij = 0.5(h i + h j ) is the average smoothing length of particles i and j; α, β and η are constant coefficients; ∇W i is the correction of the spatial derivative of kernel function as (Chen et al., 1999): In this study, the computational domain of each pipe is divided into three zones, i.e. upstream buffer zone, in-pipe fluid zone (between the inflow boundary and the outflow boundary), and downstream buffer zone, as shown in Figure 1.Additionally, the computational domain has three types of particles: upstreamdownstream buffer particles, fluid particles, and mirror particles.The parameters of buffer particles are determined by upstream and downstream boundary conditions, while mirror particles are used to simulate solid wall boundaries, such as closed valves or dead-end pipelines.The upstream and downstream zones of the pipe are usually nodes, valves, pumps, or other hydraulic components.To achieve the connection between the pipe and the hydraulic components, the study first calculates the upstream and downstream boundary parameters at the next moment, such as velocity and pressure, then assigns them to the buffer particles, and finally applies the SPH method to update the parameters of the fluid particles in the pipe.

Time-marching scheme
To integrate the particle pressure and velocity in time, the conditionally stable Euler forward method with firstorder accuracy is used (Hou et al., 2012): The time step ( t) must satisfy the Courant-Friedrichs-Levy (CFL) condition as: where CFL is the Courant number (CFL ≤ 1), x 0 is the initial particle spacing.

Boundary treatments for typical WDSs
WDSs typically have complex boundary conditions which include a variety of hydraulic components (nodal junctions, valves, surge tanks, pumps, etc.).Therefore, one of the important tasks for transient pipeline flow modelling in complex looped WDS is the proper treatment of boundary conditions.To ensure the accuracy of the SPH-WHWDS model, the values of the unknown variables (pressure and velocity) of buffer particles at in/out-flow boundary must be defined at the start of the next time step.In this section, the solution of boundary parameters of different hydraulic components is developed and introduced in detail.
In order to specify the proper in/out-flow boundary conditions, the classic MOC method is used.Based on the directions of characteristic lines, characteristic equations (Chaudhry, 1993) are divided into positive and negative forms, as shown in Equations ( 19) to ( 22): along and In addition, the specified time interval method (Chaudhry, 1993;Sturm, 2010) is used to calculate the unknown variables at in/out-flow boundaries along the positive and negative characteristic lines for each time step, as shown in Figure 2. The pressure and velocity at points L and R are determined by linear interpolation, one can refer to Federico et al. (2012), Chang andChang (2013), andAristodemo et al. (2015) for more details about this method.

N-way nodal junction
The nodal junction is the most common structure in WDSs.As shown in Figure 3, an N-way nodal junction boundary consists of m 1 inflowing pipes and m 2 outflowing pipes, with N = m 1 + m 2 .2N + 1 variables are unknown at the N-way nodal junction boundary, namely the pressure head at the node, the flow velocity and the pressure head at each pipe boundary, which are defined before the next time step.Based on the assumption of pressure head equality at the node and the mass conservation relationship, we can obtain Equations ( 23) to ( 24), and the equations of m 1 positive characteristic lines and m 2 negative characteristic lines are given by Equations ( 25) to ( 26).The node demands are based on the instantaneous pressure head and demand discharge coefficients, which allow the actual demands to change with the instantaneous local pressure, simulating more practical conditions (Gorev & Kodzhespirova, 2013;Xing & Sela, 2020).Therefore, a nonlinear system of equations is presented, involving Equations ( 23) to ( 27), which can be solved by the Newton-Raphson method (He, 2004).with where A i is the cross-sectional area of pipe i, Q d is the demand discharge of the nodal junction, k is the demand discharge coefficient, H demand is the minimum service head, subscripts L and R denote the foot of the negative characteristic line and positive characteristic line, respectively.

Valve
A pipe valve (Figure 4) can regulate the flow of water while causing large energy loss.By applying the conservation equation of mass and energy, the following equation can be obtained: where ξ v is the loss coefficient, and A v is the crosssectional area of the valve.Two characteristic equations are also included: By solving Equations ( 29) to (32), we can obtain the unknown variables at the valve.However, when the valve is fully closed, it can be considered as a solid wall boundary, and the virtual boundary particle (VBP) method (Ferrari et al., 2009) is used to handle this condition.The mirror particles are placed outside of the end valve.The mirror particle and the corresponding actual particle are at the same distance from the valve.The pressure of the mirror particle is the same as the corresponding fluid particle, while the velocity is the opposite.

Reservoir
For a reservoir located at the beginning or end of the pipe (Figure 5), providing a constant pressure head, the parameters of buffer particles are determined by the reservoir and the particles closest to it.Using the mass and energy equation, the following equations are derived (Figure 5): where ξ in is the head loss coefficient.

Surge tank or air chamber
The surge tank is usually used to reduce and eliminate surges caused by the water hammer effect, including the open surge tank and the air chamber, as shown in Figure 6.During the transient simulation, the open surge tank connected to the pipeline stores or supplies water according to pressure changes in the system, thereby moderating pressure transients.
To introduce the open surge tank as a boundary condition, the following set of equations is used: where For small WDSs, an air chamber is a more practical solution to relieve pressure transients.Compared to the open surge tank, the air chamber utilises air pressure to slow down the deceleration or the acceleration of water flow, thus reducing the size and cost of the device.To introduce the air chamber as a boundary condition, the following set of equations is used: H ac = z ac + P ac ρg (42) where Q ac is the flow into the air chamber, H ac is the total head, z ac is the water level, A ac is the cross-sectional area of the air chamber, V ac is the volume of the air in the air chamber, P ac is the air pressure, P atm is the standard atmospheric pressure, c is the polytropic index.With two characteristic equations [Equations (31) to (32)], nine unknowns (Q p1 , Q p2 , Q ac , H p1 , H p2 , H ac , z ac , V ac , P ac ) can be solved at each time step.

Pump
Pump is an important power device in the WDSs, and pressure fluctuations occur when the pump is start-up or shut-off.In this study, the simulation of pump start-up and shut-off is achieved by changing the pump rotation speed over time.The boundary condition at the pump can be solved by using one characteristic equation, the affinity law [Equation ( 46)], and the pump characteristic curve at a given rotation speed [Equation ( 45)].Additionally, the study assumes that the check valve prevents the pump from reversing, and the pump shutting down due to power failure has not been considered yet.To introduce the pump as a boundary condition, the following set of equations is utilised: It is noted that only the typical elements in practical WDSs are developed and listed in this study, while for other specific or special elements, a similar treatment way can be applied as long as their hydraulic characteristics are known for the SPH formulation.

Results and discussion
In this section, the performance of the proposed SPH-WHWDS model is evaluated by two test cases: (1) the unsteady single-pipe flow experiment by Bergant et al. (2001), with two reservoirs, one pipe, and one valve; and (2) a complex WDS, with two reservoirs, two pumps, nineteen pipes, a valve, and an air chamber.In the first case, the proposed model is validated with experimental data, and the Brunone friction model (Brunone et al., 1991) is utilised to calculate the unsteady friction.In the second case, we choose valve closure and pump shut-off, which are the most common reasons for inducing transient flows in WDSs, for assessing the proposed numerical model on more practical conditions and comparing the results calculated by the proposed model with the classic MOC scheme.Additionally, the effect of the air chamber on water hammer protection is demonstrated in the second test.

Experiment test
In this test case, a simple reservoir-pipe-valve experiment by Bergant et al. (2001) is chosen to evaluate the effectiveness of the proposed model in unsteady pipe flow, and the transient event is generated by the instantaneous closing of the valve.
The Brunone friction model (Brunone et al., 1991), which is dependent on instantaneous mean flow velocity v, the local acceleration ∂v/∂t, and the convective acceleration ∂v/∂x, is used to calculate the friction slope S f in Eq.( 2), and can be expressed as follows: where λ q is the steady friction factor, sign(v) is the sign of velocity (+1 for v ≥ 0 or − 1 for v < 0), k b is Brunone's friction coefficient, which is empirically estimated by trial and error.The local acceleration is solved by the explicit scheme between the n − 1 and n time step for particle i: The convective acceleration is calculated by the implicit scheme, which can be derived from Equation (8) as follows: As shown in Figure 7, the experimental apparatus consists of two pressurised tanks connected by a straight copper pipe measuring 37.23 m in length, with an internal diameter of 22.1 mm and a wall thickness of 1.63 mm, and a downstream instantly closed valve.A computerised pressure control system regulates each of the tanks' pressure to a constant value.Other parameters of the experimental apparatus are as follows: wave speed a = 1319 m/s; valve closure time t v = 0.009 s; pipe slope s 0 = 5.45%.Based on Bergant's experiment (Bergant et al., 2001), three water hammer cases with different initial velocities (0.1, 0.2, 0.3 m/s) are chosen to verify the performance of the proposed model.The pressure fluctuations at the valve (H v ) and the middle of the pipe (H m ) are recorded during the experiment.In the simulations, the spacing between the particles is 0.15 m ( x = 0.15m), which means 249 particles are evenly distributed along the pipe, the time step is 9 × 10 −5 s (CFL = 0.8), and the smoothing length h = 1.3 x is adopted here.Figures 8-10 depict the results of experimental data and numerical simulation for the three selected water hammer cases at the midpoint and valve, respectively.The results demonstrate the proposed SPH-WHWDS model can obtain almost the same pressure oscillations as the experimental data, which implies the method is reliable in unsteady pipe flow simulation.With the evolution of transient events, the pressure oscillation period of the SPH-WHWDS model is slightly shorter than the experimental data, which is similar to the numerical simulation results of Bergant et al. (2001), and this difference becomes more significant as the initial velocity increases.The reason may be that a constant wave speed is used in the simulation, whereas the actual wave speed may slightly decrease in that test system.
In order to test the influence of particle spacing in the SPH-WHWDS model, we take the case with initial velocity v 0 = 0.1 m/s as an example and adopt five different particle spacing configurations ( x = 0.05, 0.1, 0.15, 0.25, 0.5 m).Hence, the corresponding numbers of particles are 745, 373, 249, 149, and 75, while for the corresponding time steps, t = 3 × 10 −5 s, 6 × 10 −5 s, 9 × 10 −5 s, 1.5 × 10 −4 s, and 3 × 10 −4 s are utilised.A comparison of the pressure heads at the midpoint with   five different particle spacing configurations is shown in Figures 11 and 12. Except for x = 0.5 m, it is clear that the other four curves can reproduce the historical traces of pressure fluctuations and only subtle differences can be seen in the later periods of the simulation.The comparison of results also indicates that the amplitude of pressure fluctuation decreases with the increase of particle spacing, especially after 0.4 s.As shown in Figure 13, with the decrease of particle spacings, the highest and lowest pressure heads near the upstream tank are more accurate, while the results at the middle pipe and the downstream valve are similar.Additionally, although the computation time reduces with fewer particles involving the computational domain, the model causes more pressure dissipation and the accuracy decreases gradually, which can be seen in the magnified view at 0.24s ∼ 0.29s in Figures 11 and 12. Therefore, the appropriate particle spacing should be selected during the simulation to balance the efficiency and accuracy of the developed SPH-WHWDS model.Specifically, in this benchmark test case, particle spacing with x = 0.1m ∼ 0.15 m is proven to be more appropriate.
According to the conclusion of Hou et al. (2012), when the smoothing length coefficient is less than 1, it will lead to evident dispersion errors, so only cases with smoothing length coefficients greater than 1 are considered in the study.Therefore, we also take the situation with initial velocity v 0 = 0.1 m/s and particle spacing x = 0.15 m for demonstration, applying five different smoothing length configurations (h = 1.0 x, 1.3 x, 1.5 x, 2.0 x, 2.5 x).As shown in Figures 14 and 15, except for h = 2.5 x, the remaining four curves almost coincide with each other, and the differences can only be seen in the later simulation stages.Based on the magnified plot at 0.24s ∼ 0.29 s in Figures 14 and 15, it can be observed that the model's prediction of the pressure amplitude at the midpoint decreases gradually with the increase of the smoothing length h.While the smoothing length h is 1.0 x, the predicted peak value of pressure fluctuation is slightly smaller at the valve, and an oscillation error  occurs around 0.1 s, and this error is noticeable in pressure head envelope curves, as shown in Figure 16.Hence, for the unsteady pipe flow modelling investigated herein, the selection of smoothing length coefficients between 1.3 and 1.5 is proven to be more appropriate.

A complex water distribution system
In the second case, a more practical and complex WDS, as shown in Figure 17, is utilised to evaluate the proposed SPH-WHWDS model.The system is composed of two reservoirs, two pumps, nineteen pipes, seventeen nodes, a valve, and an air chamber.All the pipes in this test case have some similar characteristics: Darcy-Weisbach friction factor = 0.02; bed slope = 0; wave speed = 1000 m/s.Other relevant parameters for the system are depicted in Figure 17 and Table 1.The initial steady state conditions, such as the flow of the pipelines and the pressure heads of the nodes, are calculated by EPANET.After establishing the initial state of the WDS, the transient events are generated by valve closure and pump shut-off respectively.To validate the protection of the air chamber against the water hammer effect, the transient events with and without an air chamber are compared, resulting in four different cases in total.Before the simulation, the spacing or number of particles in each pipe needs to be specified.Due to the different    lengths of pipes in the looped multi-pipe system, the particle spacing of each pipe can be the same or adjusted adaptively, and the time step is determined by the smallest particle spacing.In this study, we choose the same particle spacing ( x = 0.8 m) for each pipe, for the longest pipes p 1 and p 2 , the number of particles is 188; while for the shortest pipe p 16 , the number of particles is 45.For testing and verification of the developed SPH-WHWDS model, a publishing transient simulation package TSNet (Xing & Sela, 2020) is used in this case, which adopts the classic MOC scheme as the solution technique.The grid size set in TSNet is the same as the particle spacing in the SPH-WHWDS model for a fair comparison.
In addition, to investigate the numerical accuracy, the L 2 relative error norm based on the variable ϕ as shown in Equation ( 45) is therefore introduced.
where ϕ SPH−WHWDS i and ϕ MOC i are the simulated results by the SPH-WHWDS model and the MOC scheme, respectively.

Scenario 1: water hammer by valve closure
First, the transient regime of the system is induced by the instantaneous closing of the valve after node N 17 in Figure 17.This triggers the water hammer effect, which is followed by intense pressure and flow changes throughout the system.An air chamber is designed and installed at node N 4 to protect the upstream pumps from severe damage caused by drastic pressure fluctuations during transient events.The basic parameters of the air chamber are as follows: the cross-sectional area A ac = 1 m 2 , height H = 3 m, initial water level z ac0 = 1.5 m, initial air volume V ac0 = 1.5 m 3 , and the loss coefficient of the connection pipe is ignored.For the time step and smoothing length, value t = 6.4 × 10 −4 s (CFL = 0.8) and h = 1.5 x are adopted respectively.To compare results from the SPH-WHWDS and MOC method, the upstream node N 3 and the downstream node N 5 near the air chamber are selected.Comparisons of the simulated pressure heads are shown in Figures 18 and 19.Furthermore, the highest and lowest pressure head along the main pipe (p 1 , p 3 , p 4 , p 9 , p 12 , p 13 , p 19 ) are recorded and compared in Figure 20.
As illustrated in Figures 18(a) and 19(a), without an air chamber in the system, the pressure heads of nodes N 3 and N 5 reach the maximum value of about 100 m at t = 0.6 s, and the minimum value of 5 m at t = 0.8 s.Subsequently, the energy gradually dissipates and the pressure tends to be stable.While with an air chamber equipped in the system, as shown in Figures 18(b) and 19(b), the pressure head at node N 5 still fluctuates violently, but the pressure at node N 3 fluctuates very slightly, remaining around 48 m.In Figure 20, it is evident that the air chamber at node N 4 can moderate and prevent the downstream violent pressure oscillation from propagating upstream when the downstream valve is suddenly closed, thus ensuring the normal operation of upstream pumps.According to Equation ( 51), without an air chamber, the L 2 (H N3 ) and L 2 (H N5 ) are calculated as 5.21% and 4.62%, respectively; while with an air chamber, the L 2 (H N3 ) and L 2 (H N5 ) are calculated as 0.83% and 5.01% respectively.Through the comparison of the results for different cases, it is clear that the SPH-WHWDS results show good agreement with the MOC solutions in valve closure events.In addition, at the crest and trough, the SPH-WHWDS model captures pressure fluctuations more smoothly, while the MOC is more detailed.Although the simulation results of node pressure heads are smoother, the proposed SPH-WHWDS model is still reliable in predicting the cycles and peaks of pressure fluctuations in complex WDSs.

Scenario 2: water hammer by pump shut-off
The second water hammer event is induced by a controlled pump shut-off at Pump 2 in Figure 17.During the simulation, the pump rotational speed of Pump 2 reduced linearly to zero within 5 s, while Pump 1 operated normally.Due to the check valve behind the pump, the reverse flow to the pump was not considered in this case.The time step and smoothing length are the same as in scenario 1, i.e. t = 6.4 × 10 −4 s and h = 1.5 x.The upstream and downstream nodes (N 3 and N 5 ) of the air chamber are also selected for analysis.Comparisons of the obtained pressure heads for these two nodes are presented in Figures 21 and 22, respectively.And the highest and lowest pressure heads along the main pipe are shown in Figure 23.
Without an air chamber in the WDS, as shown in   when the pump is shutting down, a significant transient can be produced in the WDS.Therefore, it is important to assess the impact of pump operation on piping and propose appropriate procedures to guide and protect pump operation, such as the installation of water hammer protection devices.As a result, when an air chamber is installed at node N 4 , as shown in Figure 21(b) and 22(b), the pressure fluctuations of nodes N 3 and N 5 are greatly changed compared to former situations without an air chamber.Specifically, node N 3 is located between the pump and the air chamber, and the pressure heads reduce from 47.43 m to approximately 40 m within 2s (i.e. about 7 m reduction only) and then begin to fluctuate, with a range between 35 and 50 m.While node N 5 is located downstream of the air chamber, its pressure drops gradually from 45.78 m to 37 m, but without obvious pressure fluctuation.As shown in Figure 23, with an air chamber in the system, the amplitude of pressure fluctuation along the main pipe reduces from 20 m to 10 m in the downstream pipeline.In conclusion, when the upstream pump is shutting off, the air chamber can prevent the severe pressure fluctuation from spreading downstream, effectively protecting the downstream WDS.Besides, without an air chamber, the L 2 (H N3 ) and L 2 (H N5 ) are calculated as 2.73% and 3.72% through Eq.( 51), respectively; while with an air chamber, the L 2 (H N3 ) and L 2 (H N5 ) are calculated as 1.79% and 1.06%, respectively.Similar to scenario 1, although the SPH-WHWDS model may slightly underestimate the pressure head results in comparison with the classical MOC scheme, the overall simulation results demonstrate that these two models are almost consistent in terms of both the phase shift and amplitude attenuation of pressure heads.From this perspective, it is evident that the SPH-WHWDS model is capable of simulating water hammer events in complex WDSs, which can provide an alternative tool for practical applications.Based on the developed SPH-WHWDS model in this study, it is worthy of further exploring and visualising the complex flow phenomena and dynamic processes such as column separation and slug flow in practical WDSs in future work.

Conclusions
This study aims to extend the SPH-based water hammer model to more complex WDSs.Compared with the previous SPH model, which could only simulate a single pipe with reservoirs or valves, the developed SPH-WHWDS model in this study combines the MOC to solve the complex boundary conditions for simulating water hammer problems in complex WDSs.A detailed method for solving various and typical boundary conditions of pipeline and hydraulic components is formulated for the developed SPH-WHWDS framework.Two benchmark test cases, including a simple reservoir-pipe-valve experiment and a looped complex WDS, are investigated to validate and verify the performance of the developed SPH-WHWDS model.The key results and findings can be summarised as follows: (1) The developed SPH-WHWDS model in this study overcomes the limitations of the existing SPH-based water hammer model, which further extends the applicability of the advantageous SPH method to complex WDSs, thereby improving the foundation for future research on complex water hammer phenomena in WDSs.
(2) The proposed SPH-WHWDS model is capable to reproduce the experiment results in unsteady pipe flows.Besides, with the increase of the smoothing length h and particle spacing x, the amplitude of pressure fluctuation decreases gradually in later wave periods.For Bergant's unsteady pipe flow experiment investigated herein, to ensure numerical accuracy and computational efficiency, the particle spacing is recommended to be between 0.1 and 0.15 m, and the smoothing length factor is suggested to be between 1.3 and 1.5.(3) The proposed SPH-WHWDS model can also accurately simulate the water hammer events caused by both valve closing and pump shut-off in WDS.The boundary conditions of hydraulic components in the system are solved accurately and reliably.In addition, the numerical simulation results reveal that the air chamber can moderate the pressure fluctuations in the downstream pipelines, indicating the proposed model can evaluate the performance of water hammer protection devices in the WDS, which is helpful to guide pipeline design and operation.
Finally, the application results in this study demonstrate the capability of the developed SPH-WHWDS model to reproduce both the results from the experimental data and the MOC scheme.Such extension of the SPH model can provide an alternative tool and approach to understanding and capturing the complex flow phenomena in practical WDSs such as column separation, slug flows, and rapid filling, which deserves further investigations in future work.

Figure 1 .
Figure 1.Sketch of the computational domain of pipe.

Figure 2 .
Figure 2. Schematic of the specified time interval method.

Figure 3 .
Figure 3. SPH Schematic of an N-way nodal junction boundary.

Figure 8 .
Figure 8.Comparison of numerical and experimental measured pressure heads traces (0.1 m/s): (a) at the midpoint (H m ) and (b) the valve (H v ).

Figure 9 .
Figure 9.Comparison of numerical and experimental measured pressure heads traces (0.2 m/s): (a) at the midpoint (H m ) and (b) the valve (H v ).

Figure 10 .
Figure 10.Comparison of numerical and experimental measured pressure heads traces (0.3 m/s): (a) at the midpoint (H m ) and (b) the valve (H v ).

Figure 11 .
Figure 11.Comparison of pressure head traces at the midpoint with different particle spacings (0.1 m/s).

Figure 12 .
Figure 12.Comparison of pressure head traces at the valve with different particle spacings (0.1 m/s).

Figure 13 .
Figure 13.Pressure head envelope curves with different particle spacings.

Figure 14 .
Figure 14.Comparison of pressure head traces at the midpoint with different smoothing lengths (0.1 m/s).

Figure 15 .
Figure 15.Comparison of pressure head traces at the valve with different smoothing lengths (0.1 m/s).

Figure 16 .
Figure 16.Pressure head envelope curves with different smoothing lengths.

Figure 17 .
Figure 17.Schematic layout of a practical water distribution system.

Figure 18 .
Figure 18.Comparison between the SPH-WHWDS and MOC results of pressure heads at node N 3 in scenario 1: (a) without an air chamber; (b) with an air chamber.

Figure 19 .
Figure 19.Comparison between the SPH-WHWDS and MOC results of pressure heads at node N 5 in scenario 1: (a) without an air chamber; (b) with an air chamber.
Figure 20.The SPH-WHWDS and MOC results of pressure head envelope curves along the main pipes in scenario 1: (a) without an air chamber; (b) with an air chamber.

Figure 21 .
Figure 21.Comparison between the SPH-WHWDS and MOC results of pressure heads at node N 3 in scenario 2: (a) without an air chamber; (b) with an air chamber.

Figure 22 .
Figure 22.Comparison between the SPH-WHWDS and MOC results of pressure heads at node N 5 in scenario 2: (a) without an air chamber; (b) with an air chamber.

Figure 23 .
Figure 23.The SPH-WHWDS and MOC results of pressure head envelope curves along the main pipes in scenario 2: (a) without an air chamber; (b) with an air chamber.
tank is the flow into the open surge tank, H tank is the water head in the tank, A pt is the crosssectional area of the connection pipe, ξ t is the loss coefficient of the connection pipe, A tank is the crosssectional area of the open surge tank.With two characteristic equations [Equations (31) to (32)], six unknowns (Q p1 , Q p2 , Q tank , H p1 , H p2 , H tank ) can be solved at each time step.

Table 1 .
Parameters of pipeline in Case 2.