1. Introduction
The water hammer pressure wave generated when a pipeline suddenly closes a valve can cause pipeline vibration, damage the valve, or cause a pipeline burst in severe cases, resulting in significant engineering accidents. Simulating, predicting, and controlling the water hammer phenomenon are critical research topics in relevant fields [
1,
2,
3]. The commonly used solution schemes, including the MOC and the finite difference method, attempt to calculate water hammers [
4,
5]. The MOC requires a regular grid, while the spatial step and time step are strictly constrained by the characteristic line, limiting its applicability. Many scholars have improved the classical difference solution schemes. For example, Chaudhry and Hussaini employed the MacCormack scheme to construct an explicit finite difference scheme for solving the pipeline water hammer problem [
6]. They found that the second-order finite difference scheme can achieve a computational accuracy higher than the MOC. Wan and others applied the MacCormack scheme of variable grids to transient flow simulation [
7]. The mentioned scheme adopts the two-step prediction correction method to realize the flexible division of the spatial grid. Wylie and Streeter proposed an implicit finite-difference scheme for solving the water hammer problem in pipe network systems [
8]. Although the main advantage of this scheme is that it remains stable for significant time steps, it requires a time-consuming iteration process. Harten proposed a scheme for solving hyperbolic partial differential equations and proved that this scheme has high resolution and no spurious oscillations at the discontinuities [
4]. The finite volume method has been widely utilized in recent years for solving water hammer waves in pipelines [
9]. It can provide better conservation performance and less computational time than the TVD (Total Variation Diminishing) difference scheme. Zhao and Ghidaoui constructed the first-order and second-order finite volume methods based on the Godunov scheme using the MUSCL-Hancock method to solve the water hammer problem [
10]. They indicated that the second-order accuracy has better conservation at a low Courant number. Waagan proposed the prediction-correction MUSCL-Hancock finite volume method, which guarantees the accuracy of the scheme while ensuring good stability [
11].
However, the second-order scheme is still limited in capturing accuracy for this aspect of strongly excited intermittent waves, and better computational results can be obtained using a higher-order scheme. The high-order ENO and WENO schemes significantly improve the capability for intermittent wave capturing [
12]. The ENO scheme selects only one template among the multiple templates as the computational template, leading to inefficient computation [
13]. In contrast, the WENO scheme utilizes all the templates by assigning corresponding weights to different templates through the convex combination between different templates to improve the intermittent capture performance without causing the waste of templates [
14,
15,
16,
17]. For example, Li et al. [
18] obtained a new global smoothness index through the Taylor expansion of the local smoothness index. In the framework of the traditional WENO-Z format, an improved third-order finite-difference WENO format was proposed. Li et al. [
19] established an improved third-order finite-difference WENO scheme based on convex combinations of different polynomials to calculate the numerical fluxes at the cell boundaries and its truncation errors and parametrization are smaller than those of other third-order WENO schemes. Moreover, the numerical results indicated that the proposed scheme performs better than other third-order WENO schemes.
To judge the performance of the model, in addition to the calculation accuracy of the model, the calculation efficiency of the model is also crucial. If the computational efficiency of the numerical scheme is too low, it will affect the scope of application, such as complex pipe network systems or timely warning of emergency events. Parallel computing is the primary strategy developed in recent years to improve computational efficiency, while the graphics processing unit (GPU) acceleration technology is the direction of rapid development [
20,
21,
22,
23]. Liang et al. [
24] employed the GPU acceleration technology to establish a high-efficiency and high-precision hydrodynamic model of a rapid movement process of surface water flow for simulating rain and flood in a large-scale watershed resulting in a good acceleration effect. Meng et al. [
25] combined the GPU technology with the MOC of a one-dimensional open channel and indicated that the GPU technology could significantly improve the computational efficiency when the number of grids is large. Some scholars applied the GPU technique to solve the system of shallow water equations by taking the WENO scheme and achieved a significant acceleration effect [
26,
27].
In this paper, the fifth-order WENO finite volume scheme is applied to a one-dimensional pipeline transient flow system, and a pipeline water hammer wave solution model is established based on GPU acceleration technology. This can provide technical support for the intelligent management of complex pipeline systems and rapid prediction of accident emergency dispatch.
2. Control Equations
To calculate water hammers in pipes, the following momentum and continuity equations can be employed [
1].
where
is the head of the pressure head,
is the average flow velocity of the pipe section,
is the resistance coefficient along the pipe,
is the roughness,
is the pipe diameter,
is the distance along the pipe axis, and
c is the wave speed in the pipe.
Equations (1) and (2) can be expressed in the following linear form:
where
Equation (3) can be written in the following approximate form, which can be solved by solving the Riemann problem [
28].
where
,
is the average flow velocity. If the effect of convective terms is ignored, it can be taken as
. This paper takes the arithmetic average proposed by Toro [
29] as
. The eigenvalues of the coefficient matrix
are
.
Figure 1 shows the schematic diagram of pipeline meshing, and the finite volume method is utilized to attain the discrete solution.
is the value of
interface flux and
is the mean value of
in cell
. Taking the control cell
as an example, Equation (4) can be integrated along the x-direction from the control cell interface
to the interface
(The range of
i is 0 to
N, and
N is the number of pipe grids).
Equation (5) is the conservation form of the momentum and continuity equations in the control unit
. Let
; if both sides of the Equation (5) are divided by
, the following equation can be obtained (
n is a known time step and
n + 1 is an unknown time step).
5. Model Validation and Case Analysis
To evaluate the model’s computational accuracy and efficiency, this paper selects typical working conditions for simulation and validation. It selects the MOC and the first-order and second-order Godunov schemes [
10] for comparison and analysis. The Courant number sensitivity of the model is qualitatively verified through the dissipation analysis of different schemes under the same Courant number. By increasing the number of grids, the acceleration effect of the GPU technology in dividing different grids is studied.
5.1. Parameter Sensitivity Analysis
By calculating and evaluating the numerical dissipation and surge intermittent capture performance of the pressure wave curve at the pipe’s valve at different Courant numbers, the sensitivity of different simulation methods to the Courant number is verified.
Assuming that the two calculation conditions are recorded as Case 1 and Case 2, the pipeline length is 1960 m and 39,200 m, the calculation time is 40 s and 800 s, the grid number is 20 and 40, and the Courant number is 0.1 and 0.01, respectively. Other parameters are the same. The pipe diameter is 1.0 m, the initial flow velocity is 0.5 m/s, the upstream constant water level is 10 m, the wave speed is 980 m/s, and the gravitational acceleration is 9.806 m/s2. The viscous term is ignored, so the roughness of the pipe is 0, and the end valve is suddenly closed.
Figure 5 shows the pressure fluctuation characteristics at the end valve and the 540 m upstream of the pipeline when the model Courant number is 0.1 and the model grid is 20 (case 1). According to the Joukowsky theorem, the change value of water hammer pressure:
The maximum pressure is 59.97 m, the minimum pressure is −39.97 m, and the phase length (the time for traveling one wavelength) of the pressure wave is
As shown in
Figure 5, the calculation results of the MOC and the first-order Godunov scheme indicate significant numerical dissipation with increasing time, while the peak pressure waves captured by both schemes are decreasing. The extreme value of the pressure wave at the end valve can be captured accurately during the calculation period using the second-order Godunov scheme. The calculation results at 540 m upstream exhibit a significant error, and the scheme’s numerical dissipation is still more severe. Simultaneously, the second-order Godunov scheme cannot capture the abrupt interruptions. In contrast, the fifth-order WENO scheme accurately captures the actual pressure wave peak and provides performance superior to the other three schemes in capturing the abrupt interruptions of the excitation wave.
Figure 5a shows that the second-order Godunov scheme captures a complete excitation interruption with a response time of about 4 s, while the fifth-order WENO scheme captures a complete interruption within 1 s. Besides, the non-physical oscillations generated by the fifth-order WENO scheme are so minimal that their impact on the actual results can be neglected.
Figure 6 shows the pressure fluctuation characteristics when the Courant number is taken as 0.01 and the model grid is 40 (Case 2). Similarly, the pressure change value is
and the phase length of the pressure wave is
Compared with
Figure 5, the numerical dissipation of the MOC and the first-order Godunov scheme decreases slightly by increasing the number of computational grids. However, the scheme cannot capture the pressure wave extremes after 100 s, and the scheme calculation results are almost distorted. The second-order Godunov scheme can better capture the intermittent excitation waves and slightly reduce the dissipation of the scheme values. The fifth-order WENO scheme has no significant nonphysical oscillations and numerical dissipation while maintaining high performance in capturing intermittent excitation waves. In summary, the fifth-order WENO scheme has lower numerical dissipation and better intermittent capture capability than the traditional MOC and Godunov scheme for calculating water hammer waves in pipes with low Courant number conditions.
5.2. Model Application and GPU Acceleration Performance Evaluation
The idealized long-distance water pipeline network shown in
Figure 7 is constructed to evaluate the simulation’s computational accuracy and the GPU program’s acceleration effect. It is assumed that all the pipelines are long-distance transmission pipes of several tens of kilometers, and points A and B are the branch points of the trig point. The relative elevation of the upstream reservoir constant water level Z1 and Z2 and the downstream water level Za and Zb are 85 m and 5 m, respectively, while the regulating valve at the end of the pipeline is closed by linear variation with a closing time of the 60 s. The MOC and second-order finite volume Godunov scheme are employed to validate the model. The calculation time step is taken as 0.01 s, and the gravitational acceleration is chosen as 9. 806 m/s
2. The pipeline model parameters are shown in
Table 2.
5.2.1. Comparative Analysis of the Results of Different Simulation Methods
Figure 8a shows the process of pressure wave curve change at valve C when the end valves C and D are simultaneously closed for the working condition shown in
Figure 7. The working condition first runs steadily for 800 s, and then the valve closes linearly within the 60 s. This paper adopts the fifth-order WENO finite-volume method to take 0.01 and 0.005, respectively. As shown in
Figure 8a, the calculation results of different schemes are almost the same, and the error of the extreme value point is within 1‰ when the WENO scheme and the MOC take 0.005. This means that the fifth-order WENO scheme for solving the pipeline water hammer wave can achieve a high accuracy under a very low Courant number.
Figure 8b compares the solution results after taking GPU acceleration with the CPU program’s results. The GPU is programmed with double-precision floating-point numbers to ensure calculation accuracy. The maximum error between the calculation result and the CPU program calculation result is 0.5‰, significantly below the allowable error in actual engineering.
Figure 9 shows the flow and water hammer wave variations at different locations when the end valves C and D are simultaneously closed. As shown in
Figure 9, due to the symmetry of points C and D location and the simultaneous closure of the valve, the pressure wave curves at valves C and D overlap entirely. Simultaneously, after the valve is closed linearly, the water hammer pressure wave reaches its maximum value (131.9 m). The flow rate at A gradually decreases to 0 with the closure of the valve, while the flow rate at B and C still decrease cyclical in the fluctuation changes due to the role of pipe friction, which gradually decreases the amplitude of fluctuations.
Figure 10 shows the flow and pressure head variations at different locations when the valve is closed only at C (linear closure within the 60 s). As shown in
Figure 10a, after closing valve C, the pressure head at C suddenly rises, and its peak reaches 95 m, then oscillates down and stabilizes at 64.3 m. After about 40 min, due to the horizontal arrangement of the pipe, the flow rate in pipe 4 drops to zero, while the pressure head at point C is equal to that at point B. The maximum pressure head generated by the whole process system is still at the end of valve C. It can be seen that the downstream valve is still the most likely place to generate damage, even for a complex bifurcated piping system.
5.2.2. Analysis of Model Computation Efficiency and GPU Acceleration Performance
The water hammer change process at the end valve was calculated in time steps of 0.02 s, 0.015 s, 0.01 s, and 0.005 s. The model’s computational efficiency can be derived by analyzing the computational time consumed by the different schemes, with a computational time of 4800 s. According to the CFL constraint, the MOC and the first-order Godunov scheme should meet Cr = 1, while the second-order Godunov scheme takes Cr = 0.5 to obtain the best calculation effect [
10], and the proposed fifth-order WENO finite volume scheme can meet Cr > 0.01. The total computation times for different schemes are presented in
Table 3 and
Figure 11. According to
Table 3, the second-order Godunov scheme takes the highest time, while the MOC and the first-order Godunov scheme take the middle time, and the WENO scheme takes the least time for different time steps, while the Courant number meets the scheme requirements. The fifth-order WENO scheme takes 35% to 90% of the MOC and 15% to 39% of the time of the second-order Godunov scheme when the calculation accuracy is guaranteed and the appropriate Courant number is chosen. It can be concluded that the fifth-order WENO finite volume scheme proposed for the water hammer solution model can significantly improve computational efficiency.
The computational time consumption of CPU programs and GPU programs at different grids was analyzed to evaluate the acceleration effect of the GPU-WENO scheme. The CPU model is Intel(R) Core (TM) i7-10700, and the GPU graphics card is NVIDIA GeForce GTX 1660Ti, and both of them are the latest electronic products in recent years. Still using the ideal operating conditions shown in
Figure 7, the pressure wave variation during sudden closure of the end valve was calculated for a total time of 48 s, as presented in
Table 4. As shown in
Table 4, when the grid number is uniformly divided into 600 and the grid length is 400 m, the single-threaded computation efficiency of the 8-core CPU is higher than that of the GPU. The reason is that the number of CPU program cycles is small, and the CPU core performance can be fully utilized for the small number of grids, while the GPU program is so time-consuming compared to the CPU program because the internal data is copied from the host side to the device side and then copied from the device side to the host side after completing the calculation. The computational efficiency of the GPU program is significantly higher than that of the CPU program when the number of grids reaches thousands and above. At this point, the CPU program’s large number of round-robin calculations is a critical factor in the program’s time consumption, while the efficiency of the GPU is superior to the CPU program by calling multiple threads on the kernel block to perform parallel calculations.
Figure 12 shows that when the number of threads reaches 32 or more, the GPU acceleration effect does not change with the increase of threads, indicating that for engineering problems within hundreds of thousands of grids, 32 threads can achieve the best acceleration effect. Besides, the acceleration effects of different graphics cards are significantly different. This model employs the NVIDIA GeForce GTX 1660Ti graphics card, while the acceleration effect can be more than 13 times compared with a single CPU program by using GPU parallel computing technology with a grid number of 500,000 and a grid accuracy of 0.4 m. With the GPU-WENO scheme, which has a high application prospect in solving practical engineering problems, the computation speed can easily reach more than tens of times that of the commonly used MOC or differential scheme.
7. Conclusions
Based on the one-dimensional pipeline non-constant flow equation set, the virtual boundary technique is adopted at the upper and lower ends of the model. The bifurcated pipeline boundary solution method is combined with the Lax-Friedrichs splitting method for flux decomposition, and the time term is discretized by the second-order Runge-Kutta method. Moreover, a fifth-order WENO finite volume scheme water hammer solution model is established for the long-distance water transmission system. The key results are as follows.
(1) The model is verified to ensure low numerical dissipation and lack of spurious oscillations at tiny Courant numbers under ideal conditions. The model is suitable for large and complex water conveyance systems. Compared to the commonly used MOC, the computation load of the model is 35% to 90% less than the MOC and 15% to 39% less than the second-order Godunov scheme while maintaining the accuracy of the results.
(2) Using GPU acceleration technology to accelerate the model, the model can achieve a significant acceleration effect while ensuring accuracy when the number of grids is greater than thousands. As the number of meshes increases, the GPU acceleration effect becomes more and more significant. The study found that GPU with 32 threads can deal with engineering problems within hundreds of thousands of grids with the best acceleration effect.