Impact of uncertainty in the physics-informed neural network on pressure prediction for water hammer in pressurized pipelines

In pressurized pipeline systems, accurate prediction of water hammer pressure is crucial for ensuring safe system operation. When the boundary conditions are unknown and measured data is sparse, both traditional methods fully based on physical equations and data-driven neural network methods have difficulty in accurately predicting water hammer pressure. The physics-informed neural network (PINN) overcomes these challenges by simultaneously incorporating measured data and physical equations during the network training process. However, PINN has uncertainties and their impact on the accuracy of pressure prediction is not yet clear. In this study, the valve closing water hammer in a reservoir-pipeline-valve system is taken as the research object, we investigate the influence of the uncertainty of physics and data in the PINN on prediction accuracy by using water hammer equations with various friction models and training data with various noise levels. The results show that using the water hammer equation with the Brunone model, the PINN model has higher prediction accuracy. Furthermore, data noise levels less than 10% have a relatively small impact on pressure prediction accuracy, indicating that the PINN model has good robustness in terms of data noise levels.


Introduction
As a transportation carrier for water and various energy resources, pressure pipelines play a crucial role in urban water supply and drainage, inter-basin water diversion, water intake for hydroelectric power stations, circulating cooling for thermal and nuclear power plants, as well as the transportation of oil and natural gas.In these large pressurized pipeline systems, improper operation or equipment failure of hydraulic devices such as valves, pumps, and turbines can trigger complex hydraulic transients, leading to extreme pressure fluctuations.This may further cause pipe bursts, or damage to other hydraulic equipment.Ultimately, it will have a serious impact on the development of the national economy and people's daily lives.Therefore, it is urgent to study the water hammer phenomena in pressurized pipelines.
The study of water hammer phenomena in pressurized pipelines can be traced back to 1858 [1].Subsequently, after a century and a half of efforts, researchers have gradually improved the analysis models [2] and developed a series of physics-based analysis methods for water hammer, such as the method of characteristics (MOC) [3], finite difference method (FEM) [4], and finite volume method (FVM) [5].These methods predict transient pressures by solving a set of governing equations of transient flow with accurate initial and boundary conditions.Therefore, the accuracy and reliability of the results depend on a thorough understanding of the boundary conditions and transient excitation.However, in practical water supply systems, it is difficult to accurately describe the hydraulic devices as boundary nodes and sometimes they are even unknown, making it challenging to simulate using traditional methods.
In recent years, with the development of smart water management, various sensors have been installed on pipelines for real-time online signal acquisition.This provides vital support for using datadriven neural networks methods to overcome the aforementioned challenges.Neural networks methods can directly obtain unknown information from data, eliminating the need for accurate physical models.However, in practical pipeline networks, the number of sensors is limited, resulting in sparse and uncertain data, which hinders the application of data-driven neural networks in transient flow analysis of pressurized pipelines.The physics-informed neural network (PINN) proposed by Raissi [6] incorporates physical equations into the neural network structure, serving as a powerful tool for solving the problem with incomplete boundary conditions and sparse data.Currently, PINN has been widely used in various fields, including medical science [7], material science [8] and power systems [9] due to its excellent capability in solving forward and inverse problems.In recent years, this method has also been applied to the study of transient flow in pressurized pipelines.Ye [10] used PINN to predict transient pressure caused by valve closure at given locations in a reservoir-pipelinevalve system.The results showed good consistency between the predicted and measured pressure.Karniadakis [11] pointed out in their review that PINN have at least three sources of uncertainty: uncertainty due to the physics, uncertainty due to the data, and uncertainty due to the learning models.Since it is usually hard to quantify the uncertainty due to the learning models, this study focuses on the impact of the first two sources of uncertainty on the accuracy of pressure prediction.At present, Ye [10] have explored the impact of uncertainties of pipe characteristics in one-dimensional (1D) water hammer equations on the performance of PINN, but the impact of physics uncertainty caused by different water hammer equations and data uncertainty caused by noise on the accuracy of PINN pressure prediction still needs further research.
In this study, the PINN model is trained using water hammer equations with different friction models and training data with different noise levels.The trained model is then used to predict transient pressures at given locations of the pressurized pipelines.Finally, the influence of uncertainty in the physics and data on the prediction accuracy of the PINN model is elucidated by comparing the errors between the predicted and experimental values on the test set.

1D water hammer equations
The horizontal layout of the pipeline in the water hammer experimental device used in this study, there is no slope, then there is no need to introduce Vsinθ to the equations.Where θ represents the angle between the pipeline and the horizontal plane.Therefore, the following form of 1D water hammer equation is chosen: Where V is the velocity of the fluid in the pipeline, and the downstream flow is positive, H is the pressure head, x is the spatial coordinate along the pipeline, taking the inlet of the pipeline as the origin, downstream is positive, t is the temporal coordinate, a is the wave speed of water hammer; g is the gravity constant, D is the pipe diameter, τω is the wall shear stress, ρ is the liquid density.
In order to obtain a closed-form water hammer equations, the expression for wall shear stress τω needs to be given.Let τω = 0, the motion equation of water hammer with no friction gets the following form: In conventional transient analysis, the quasi-steady wall shear stress model represented by the Darcy-Weisbach formulas is commonly used: Where f is Darcy-Weisbach friction factor.Substituting equation ( 4) into equation ( 2), and consider that the direction of frictional resistance and flow velocity is always opposite, the motion equation of water hammer with quasi-steady friction model becomes: To better simulate the water hammer phenomenon in pressurized pipelines, Brunone [12] established an unsteady friction model based on the assumption that the unsteady friction in pressurized pipelines is related to local acceleration and convective acceleration.The unsteady friction model based on instantaneous acceleration is: 3 Where the first term τωs on the right-hand side represents the quasi-steady component of friction, which is given by equation ( 4), the second term represents the unsteady component, k3 is the empirical unsteady friction coefficient.The shear decay coefficient method proposed by Vardy [13] is used to determine the non-steady friction coefficient in this study.Substituting equation ( 6) into equation ( 2) yields the water hammer equation based on Brunone unsteady friction:

PINN model for water hammer analysis
After establishing the water hammer equations, the PINN model for water hammer analysis, as shown in figure 1, can be constructed by introducing the water hammer equation into the loss function.
x t (8) Where ( ) x t (9) represent the spatio-temporal variable matrix of the observation points and the collocation points respectively.Nd and Nf represent the number of samples in the observation point and the collocation point data set respectively.The data matrix of output layer is , Where ( ) , , represent the matrices of the observation points and collocation points predicted by PINN, respectively.The matrix consists of pressure head and flow rate.
According to the PINN structure constructed in Figure 1, the loss function including partial differential equations and observation point data is established as follows: Where Wf is the weighting value of the equation loss, Ldata and LPDE represent the loss of data and equation respectively, the calculation formula is defined by ( ) Where θ represents the neural network parameters, including weights and biases, ˆj d H is the pressure head at the observation points calculated by the PINN model, H is the experimental pressure head at the observation point. 1 ( , ; ) F x t θ and 2 ( , ; ) Taking the no friction water hammer equations ( 1) and ( 3) as examples, the form of F1 and F2 in equation ( 14) is as follows: Where ˆQ AV = represents the predicted flow rate in the pipeline, V is the predicted velocity of fluid, A is the cross-sectional area of the pipeline。 The PINN is trained by back propagation algorithm.It consists of two steps: forward propagation and backward propagation.Firstly, data at observation and collocation points are fed to the PINN model, and forward propagation is used to calculate the predicted values of flowrate and pressure head as well as total loss.Secondly, the gradients of the total loss with respect to the neural network parameters θ are computed using the backward propagation rule.The adaptive moment estimation (Adam) algorithm and the L-BFGS-B optimizer are used to updated the parameters θ until the total loss converges.The convergence criterion used in this study is setting a maximum number of iteration steps.When the maximum number of iteration steps is reached, the iteration stops.The convergence of the iteration is determined by observing the loss function value during the iteration process.When the loss function does not decrease significantly, the network is considered to have converged.
Using the trained PINN model to predict the data 1 { , , } e N j j j e e e j x t H = in the test set, and the L2 relative error used for measuring prediction accuracy is defined as follows:

Results and analysis
Ye [10] conducted a valve closing water hammer experiment on a single copper pipeline in the reservoir-pipeline-valve system shown in Figure 2. In this experimental system, the upstream is a pressure tank, and the downstream is a closed inline valve.A side-discharge solenoid valve is located 144 mm upstream of the closed inline valve to generate transient pressure waves.The length of the pipeline is 37.21 m and the internal diameter is 22.14 mm.The wave speed of the pressure waves in this pipeline is a=1319 m/s.The Darcy-Weisbach friction factor is 0.012.Five pressure transducers are installed along the pipeline.The pressure data collected by Ye in the experiment is extracted as the dataset for the PINN model, as shown in Figure 3.
In the study on the impact of observation point locations on the accuracy of pressure prediction, it was pointed out that when the observation point is located closer to the boundary containing information of transient events, the accuracy of the pressure prediction for entire pipeline can be improved [10].Therefore, the pressure data at transducer 1, 2, and 4 were selected as the training set, and the pressure data at transducer 3 and 5 were selected as the test set.Using the water hammer equation with quasi-steady friction for hyperparameter analysis, the PINN structure shown in table 1 has the lowest L2 relative error on the test data.For comparison, all subsequent simulations used the same neural network parameters in table 1.
Table 1.Structure parameters of PINN network.

Effect of uncertainty of physics
Based on the experimental pressure data in figure 3, the uncertainty of physics caused by different water hammer equations was studied by using water hammer equations with no friction, quasi-steady friction, and Brunone friction model.Figure 4 and 5 shows the transient pressure head at transducer 3 and 5 obtained through experimental measurements as well as predicted by the PINN model with three water hammer equations, respectively.From figure 4(a) an 5(a), it can be observed that there is only a small difference among the predicted transient pressure using the three water hammer equations, and all can accurately predict the decay and distortion of the pressure wave.At transducer 3, the peak pressure head predicted by the three water hammer equations at each cycle is close to the experimental value.However, at transducer 5, the error between the predicted peak pressure and the experimental values at each cycle is significant, which may be attributed to the abnormal measured pressure head at transducer 4. From figure 3, it can be seen that the peak pressure head of each cycle at transducer 4 is obviously lower than that at transducer 3 and 5.They are located upstream and downstream of transducer 4, respectively.This phenomenon does not comply with the law of energy dissipation.The lower peak pressure head at training point 4 leads to the lower predicted peak pressure at test point 5.By analysing the transient pressure head in figure 4 (a), it can be seen that compared to the pressure head predicted by the other two water hammer equations, the agreement between the predicted transient pressure head using the no friction water hammer equation and the experimental values is poorer.This is specifically manifested in the lower initial pressure head at the beginning of the simulation and the lower peak pressure head in the last cycle.
Figure 4(b) shows a locally enlarged view of the peak pressure head in the first cycle (red box) from figure 4(a).From the figure, it can be seen that for the predicted peak pressure head of the entire simulation, the Brunone friction model has the best prediction accuracy, followed by the quasi-steady friction model, and the no friction model performs the worst.The total L2 relative errors of no friction, quasi-steady friction, and Brunone friction are 4.95%, 4.88%, and 4.84%, respectively.The difference among them is very small.In summary, the difference among the transient pressure head predicted using three different water hammer equations is very small.It indicates that using different 1D water hammer equations as equation constraints for PINN models has little impact on prediction accuracy.Among the three water hammer equations with different friction models, the Brunone unsteady friction model, which can better describe the friction effect in transient flow, has the best prediction accuracy.

Effect of uncertainty of data
The 1%, 5%, 10% and 15% Gaussian noise are introduced to the training data in this study, respectively.Figure 6 shows the transient pressure head at transducer 1, 2 and 4 obtained by experimental measurements and adding 1%, 5%, 10% and 15% Gaussian noise.The water hammer equation with quasi-steady friction model is used as the equation constraint of the PINN model in this section, and the PINN model is trained using data with different noise levels as shown in figure 6. Figure 7 and 8 shows transient pressure head at transducer 3 and 5 measured by experiment as well as predicted using data with different noise levels, respectively.From figure 7 (a) and 8(a), it can be seen that at transducer 3, the predicted transient pressure head using data with different noise levels has good consistency with the measured pressure head throughout the simulation time.However, at transducer 5, the difference among the predicted transient pressure using the data with different noise levels is small, but the error between the predicted peak pressure and the experimental values at each cycle is significant.The reasons for this phenomenon have been given in the analysis of the previous section.As shown in figure 7 (b) and 8(b), the predicted first cycle peak pressure head using data with 15% noise is significantly higher than that in experimental and other noise data.Figure 9 shows the peak pressure head predicted using data with different noise levels at each cycle.
From the graph, it can be seen that the peak pressure head at each cycle obtained from the experiment basically shows a linear decline.However, the peak pressure head of each cycle predict using noisy data shows a phenomenon that does not conform to the energy dissipation law.The peak pressure head in the later cycle is higher than that in the previous cycle during the transient process, which may be related to the introduction of data noise.The total L2 relative errors of no noise, 1%, 5%, 10%, and 15% noise are 4.88%, 5.06%, 4.98%, 4.92%, and 5.11%, respectively.To sum up, the difference between the transient pressure head predicted using data with different noise levels is very small, indicating that the PINN model used in this study demonstrates good robustness with respect to noise levels in the data.Even the noise corruption level is as high as 10%, it still achieves good prediction accuracy, which is consistent with the conclusion of Raissi [6].

Conclusions
In this study, the influence of uncertainties of physics and data in PINN training process on the accuracy of predicted transient pressure in pressurized pipelines was investigated by introducing different water hammer equations and training data with different noise levels.The conclusions are as follows: (1) Compared to water hammer equations that include no friction or quasi-steady friction models, the water hammer equation with the Brunone model achieves the best prediction accuracy.However, overall, different 1D water hammer equations have a relatively small impact on the prediction accuracy of the PINN model.
(2) The transient pressures predicted by the data with different noise levels show little difference and exhibit good consistency with experimental values.This indicates that the PINN model used in this study demonstrates good robustness with respect to noise levels in the data.Even the noise corruption level is as high as 10%, it still achieves a prediction accuracy of less than 5%.
the values of the water hammer equations F1 and F2 at the collocation points calculated by the PINN model, respectively.

Figure 3 .
Figure 3. Measured pressure in transient experiment.Using the water hammer equation with quasi-steady friction for hyperparameter analysis, the PINN structure shown in table 1 has the lowest L2 relative error on the test data.For comparison, all subsequent simulations used the same neural network parameters in table1.Table1.Structure parameters of PINN network.

Figure 4 .
Figure 4.The influence of different water hammer equations on the transient pressure head at transducer 3: (a) The transient pressure throughout the entire simulation time, (b) Locally enlarged view at the peak pressure of the first cycle (red box).

Figure 5 .
Figure 5.The influence of different water hammer equations on the transient pressure head at transducer 5: (a) The transient pressure throughout the entire simulation time, (b) Locally enlarged view at the peak pressure of the first cycle (red box).In summary, the difference among the transient pressure head predicted using three different water hammer equations is very small.It indicates that using different 1D water hammer equations as equation constraints for PINN models has little impact on prediction accuracy.Among the three water hammer equations with different friction models, the Brunone unsteady friction model, which can better describe the friction effect in transient flow, has the best prediction accuracy.

Figure 6 .
Figure 6.The transient pressure head with different noise levels at training points: (a) Transducer 1, (b) Transducer 2, (c) Transducer 4The water hammer equation with quasi-steady friction model is used as the equation constraint of the PINN model in this section, and the PINN model is trained using data with different noise levels as shown in figure6.Figure7and 8 shows transient pressure head at transducer 3 and 5 measured by experiment as well as predicted using data with different noise levels, respectively.From figure7(a) and 8(a), it can be seen that at transducer 3, the predicted transient pressure head using data with different noise levels has good consistency with the measured pressure head throughout the simulation time.However, at transducer 5, the difference among the predicted transient pressure using the data with different noise levels is small, but the error between the predicted peak pressure and the experimental values at each cycle is significant.The reasons for this phenomenon have been given in the analysis of the previous section.As shown in figure7(b) and 8(b), the predicted first cycle peak pressure head using data with 15% noise is significantly higher than that in experimental and other noise data.

Figure 7 .
Figure 7.The influence of different noise levels on the transient pressure head at transducer 3: (a) The transient pressure throughout the entire simulation time, (b) Locally enlarged view at the peak pressure of the first cycle (red box).

Figure 8 .
Figure 8.The influence of different noise levels on the transient pressure head at transducer 5: (a) The transient pressure throughout the entire simulation time, (b) Locally enlarged view at the peak pressure of the first cycle (red box).Figure9shows the peak pressure head predicted using data with different noise levels at each cycle.From the graph, it can be seen that the peak pressure head at each cycle obtained from the experiment basically shows a linear decline.However, the peak pressure head of each cycle predict using noisy data shows a phenomenon that does not conform to the energy dissipation law.The peak pressure head in the later cycle is higher than that in the previous cycle during the transient process, which may be related to the introduction of data noise.

Figure 9 .
Figure 9.The influence of different noise levels on the peak pressure head at each cycle in the transient process: (a) Transducer 3, (b) Transducer 5.The total L2 relative errors of no noise, 1%, 5%, 10%, and 15% noise are 4.88%, 5.06%, 4.98%, 4.92%, and 5.11%, respectively.To sum up, the difference between the transient pressure head predicted using data with different noise levels is very small, indicating that the PINN model used in this study demonstrates good robustness with respect to noise levels in the data.Even the noise corruption level is as high as 10%, it still achieves good prediction accuracy, which is consistent with the conclusion of Raissi[6].