Application of HMC-SS Method in Pipeline Reliability Analysis and Residual Life Assessment

In this paper, the reliability analysis and residual life assessmentmodel of gas pipelines withmultiple corrosion pits are established. Aiming at the simulation evaluation of small failure probability of gas pipelines, a new method for reliability analysis and residual life assessment of gas pipelines with multiple internal corrosion pits is proposed, which is called the Hamiltonian Monte Carlo subset simulation (HMC-SS) method. Compared with the traditional MCS (Monte Carlo simulation) algorithm, the HMC-SS method has the advantages of less sampling, low cost, and high accuracy. And compared with the random walk SS method, the HMC-SSmethod can analyze the state space more efficiently and achieve faster convergence. In this paper, the HMC-SSmethod is applied to the reliability analysis and residual life assessment of gas pipeline engineering, and the sensitivity analysis of the random parameters affecting the failure probability of the pipeline is carried out. 'e results show that the corrosion rate, the depth of corrosion defects, and the wall thickness of the pipeline have great influence on the residual life of the pipeline, while the yield strength, working pressure, and the length of corrosion pits have no obvious influence on the failure probability and residual life of the pipeline. 'e analysis shows that the proposed HMC-SS method can be used as a reasonable tool for failure assessment of natural gas pipelines affected by corrosion to determine the remaining life of the pipeline system. 'is method provides a reliable theoretical basis for the integrity management of the gas pipeline.


Introduction
Pipeline transportation is an important part of gas production process. With the increasing service time of existing pipelines, the gas pipeline will inevitably be affected by an internal transport medium, external soil medium, and stray current in the long-term operation process, which will cause pipeline corrosion [1]. Corrosion will cause the pipeline wall thickness reduction, perforation, leakage, strength reduction, and cracking; serious cases will cause pipeline leakage or explosion, not only will cause serious casualties and major economic losses but also pollute the environment and cause bad social impacts. erefore, once the oil and gas pipeline is put into operation for a period of time, the reliability analysis and remaining service life assessment of the pipeline are very important. At present, the assessment of corrosion pipelines mainly includes ASME-B31 G [2], DNV RPF101 [3], API579 [4], and other standards. Many scholars have carried out reliability analysis and residual life assessment of corrosion pipelines through these standards. e most commonly used numerical simulation methods are a second-order moment method and MCS method. Teixeira et al. [5] used the firstorder reliability method (FORM) and MCS simulation method to analyze the failure probability of the pipeline affected by internal pressure corrosion; Carr [6] points out that the failure probability obtained by MCS is more accurate and applicable than that obtained by FOSM because MCS is independent of the dimension of random variables and the complexity of limit state function; Li et al. [7] use MCS to evaluate the probability of pipeline instability. Although the first-order reliability method is simple to calculate, the error of the structural function with high nonlinearity increases sharply [8].
e MCS method is widely used in the failure probability analysis of structures and residual life assessment due to its robustness and unbiased calculation results [9]. It can solve any model, especially when the sample size tends to be infinite, the accurate solution can be obtained, and the calculation results are often used as the standard to test the accuracy of other calculation methods. However, the sample size required by MCS is inversely proportional to the failure probability. is means that in order to ensure the accuracy and comprehensiveness of failure probability calculation, a large number of samples are needed when we use MCS to deal with the problem of high-dimensional small failure probability (for example, ≤10-3), and MCS is difficult to accept by the project. e failure analysis and residual life assessment of corrosion pipeline are high-dimensional and small failure probability problems. In order to solve this problem, an accurate and effective method is urgently needed. e improved MCS method, such as the SS simulation method, has obvious advantages in solving high-dimensional and small failure probability problems. e efficiency and robustness of the method are highly praised by many scholars [10][11][12]. Many researchers have applied the SS method to reliability analysis of bridges, buildings, and other engineering structures [13][14][15][16]. In the current practice of subset simulation, the most widely used method is to generate the required condition samples by various MCMC (Markov chain Monte Carlo) algorithms based on random walk. Au and Beck apply this method to the reliability problem of highdimensional small failure probability, thus improving the calculation accuracy of subset simulation [17]. Miao and Ghosn use the subset simulation method based on MCMC to the safety and reliability analysis of structural systems [18]. Papaioannou et al. believe that the subset simulation method based on MCMC can effectively solve the problem of highdimensional structural reliability [19]. Wang applies the subset simulation method based on MCMC to the reliability evaluation of steel bridges. e results show that this method is a good choice to solve the fatigue problems of nonlinear and multidimensional LSF [20]. Although this method has many advantages and is widely used, MCMC sampling method based on random walking makes Markov chain converge to the fixed distribution function p (x), and the resulting conditional samples have high autocorrelation, so the accuracy of simulation results is poor and the efficiency is still very low [21]. In order to overcome these shortcomings and solve the practical problems of engineering, a new MCMC algorithm, which is more efficient and accurate, is adopted in this paper. HMC is used to calculate the future state of Markov chain rather than probability distribution by using the concept of dynamics in the physical system [22]. In this way, the state space can be analyzed more efficiently and the convergence can be achieved faster.
In recent years, HMC has been widely used and developed rapidly and has made remarkable achievements in various statistical applications [23][24][25]. e HMC method has been applied to Bayesian analysis and reliability analysis of structural engineering problems perfectly [26][27][28]. ere is no research on this aspect in the reliability analysis and residual life assessment of corrosion pipelines. In this paper, the system reliability analysis method is used to evaluate the pipelines with multiple corrosion pits. e model of reliability analysis and residual life assessment of corrosion pipelines based on HMC-SS method is established.
e results based on the HMC-SS method are compared with those of SS and MCS methods. e structure of this paper is as follows. In Section 2, the reliability analysis model of the gas pipeline based on reliability theory is established. In Section 3, the SS method based on random walking is reviewed. e fourth section describes the calculation details and flow of HMC-SS algorithm in detail. Section 5 proves the effectiveness of the method by a specific engineering example and further analyzes the sensitivity of the random variables that affect the remaining life of the gas pipeline. e conclusion and prospect are given in Section 6.

Reliability Analysis Model of Gas Pipelines Based on Reliability Theory
Based on the reliability theory, the state function of pipeline failure due to corrosion can be expressed by the following formula: where F f is the failure pressure of the corroded pipeline and F 0 is the actual operating pressure of the pipeline. e failure probability of corroded pipeline can be expressed by the following formula: where P is the probability of the event, ∅ is the cumulative distribution function, and β is the reliability index of the structure. For gas pipelines with corrosion defects, according to the revised ASME-B31 G standard measurement, the failure stress formula of corrosion pipeline is as follows: where σ y is the flow stress of the pipeline material, A is the projected area of the corrosion defect on the side, A 0 is the original cross-sectional area of the pipeline at the corrosion defect, F is the Folias expansion factor, which is related to the corrosion pipe outer diameter D, wall thickness t, and corrosion defect length L, namely: In equation (4), σ y � kσ s (σ s is the yield stress of pipeline material), where k is the coefficient. For steel tubes, k is usually 1.1 or 1.15, and in this paper, k is 1.15. A 0 � Lt and A � 0.85dL (d is the maximum depth of the corrosion pit and L is the maximum length of the corrosion pit). To predict the strength of a pipe at time T, it is necessary to estimate the corrosion growth rate. In [29,30], a reasonable linear model is proposed to predict the corrosion growth of steel pipes and estimate the size of corrosion pits at time T.
In equation (6), d 0 , L 0 denotes the depth and length of corrosion defects detected in T 0 , respectively. d and L denote the depth and length of corrosion defects after service T, respectively; ] d denotes the radial corrosion rate; and ] L denotes the axial corrosion rate. Substituting (6) into (4), the failure pressure F f of the pipeline with corrosion defects can be obtained as follows: Since the failure pressure of the corroded pipeline is relatively independent of the actual operating pressure (F 0 ) of the pipeline, the limit state function G of the corroded pipeline is established based on the reliability theory as When G > 0, the structure is in a reliable state; G < 0 indicates that the structure is in a failure state; G � 0 means that the structure is in the limit state.

SS Algorithm Based on Random Walk MCMC Sampling
e basic idea of SS algorithm based on random walk MCMC sampling is to convert the small failure probability into the product of a series of large conditional failure probability events by introducing reasonable intermediate failure events. In the failure region for the functional Failure events with nested relationships are composed of these thresholds. . According to conditional probability theory, the target failure probability P f can be obtained as To facilitate calculation, the intermediate conditional probability is set to a constant value P 0 and then the threshold value b m can be determined by the adaptive method.
e traditional subset simulation method has a detailed process description in [31,32]. e approximate value of the final failure probability can be obtained by the following equation: where N E m is the number of samples falling into the last layer.

Reliability Analysis Model of Gas Pipelines Based on HMC-SS Algorithm
HMC-SS is an improvement on the traditional SS algorithm. is method combines Hamiltonian dynamics with MCMC algorithm and applies it to subset simulation, which has the advantages of faster convergence, higher accuracy, and better efficiency.

Principle of Hamiltonian Dynamics.
Hamiltonian dynamics describes the time evolution of the system according to the position vector q and momentum vector p. e total energy of the system H is a function of q and p, namely: where U(q) is the potential energy and K(p) is the kinetic energy.
Hamiltonian dynamics has several important properties: (1) reversibility, (2) conservation of the Hamiltonian, (3) volume preservation, and (4) symplecticness. ese properties are the most important conditions for Hamiltonian dynamics to be applied to Markov chain Monte Carlo updating, and the analysis and proof process are described in detail in references [28,33]. In order to connect the Hamiltonian dynamics with the Markov chain Monte Carlo method, firstly, the random variables x are regarded as q (i.e., x ≡ q) of the Hamiltonian system and p as independent variables with the same dimension, so x and p together form the extended initial position space; then, the position momentum state space of the Hamiltonian system is obtained. e potential energy function U(x) can be determined by the target probability density function π(x): In general, the kinetic energy function K(p) can be defined as follows: where M is a positive definite, symmetric "mass" matrix, generally taking the scalar product of the unit matrix (the scalar matrix). Equation (11) can be rewritten as follows: We use the knowledge of statistical mechanics to connect Hamiltonian functions H(x, p) and π(x). According to the energy function E(θ), we can define a regular distribution: Mathematical Problems in Engineering where Z is the regularization coefficient and can guarantee π(θ)dθ � 1. en, E(θ) is en, the regular distribution of Hamiltonian energy function can be expressed as It can be seen from equation (14) that P(x, p) can be decomposed into the product of P(x) and P(p). It can be seen that these two variables are independent of each other. So, we can sample from the joint probability density function of x and p. In the Hamiltonian system, H(x, p) is a constant value, which describes how the kinetic energy and potential energy are transformed into each other in the process of system motion. It can be analyzed quantitatively in the form of differential equation as follows: e rationality and validity of applying Hamiltonian equation to the MCMC method are explained in [32,34]. e common methods of discrete Hamiltonian equation are Euler method, improved Euler method, jump point method, and so on [34]. ese methods have been described in detail in reference [34]. Because the jump point method is simple, reversible, and retains the symplectic structure of the phase space, it has high efficiency and high accuracy in solving Hamiltonian equation. In this paper, the jump point method is used, and the formula is as follows: where ε is the time step, L � (τ/ε), L is the number of iterations, and τ is the length of the path. e efficiency of the jump point method is very dependent on the selection of ε and L. In this paper, when the average acceptance rate is about 65%, the corresponding L and ε are selected. Generally, it is assumed that the value between 60% and 80% is the best, which is determined by dual algorithm. It is described in [34][35][36] in detail. Hamiltonian function is applied to the MCMC method, which is called HMC algorithm in this paper. HMC algorithm is used to extract samples from conditional probability density function f(x/E k−1 ). e algorithm flow is as follows: (1) An initial momentum P init (where M is the unit matrix) is generated from the normal distribution N(0, M). (2) e initial momentum P init and the position x init of the seed sample are used as the initial conditions to generate a new state (x * , p * ) according to equation (16).
where rand ∼ U([0, 1]), receive the suggested sample x * as the next state; otherwise x * cannot be the next state, and the next state is still the current state x init , end.
HMC sampling can explore the state space more effectively than random walk MCMC sampling, which greatly improves the computational efficiency. e following is a binary Gaussian distribution, where the mean value of position variable is 0, and the covariance matrix is [1, 0.9; 9, 1], the momentum variable is 0, and the covariance matrix is [1, 0; 0, 1]. At this time, Hamiltonian function can be defined as the following formula: From Figures 1 and 2, we can see that HMC algorithm has higher probability of accepting samples than traditional random walk sampling methods and can analyze state space more efficiently, thus achieving faster convergence.

e Flow of Hamiltonian Monte Carlo Subset Simulation
Algorithm.
e flow of Hamiltonian Monte Carlo subset simulation algorithm is as follows: (1) e total number of samples N and conditional failure probability P 0 are defined. Let Ns � NP 0 and Nt � N − Ns.
(2) According to the probability density function of the model, the Monte Carlo simulation method is directly used to generate N independent samples. (3) Take the samples into the limit function to get the response value of the corresponding samples and sort them from small to large to get G (1) j , j � 1, 2, . . . , N and the corresponding sample sequence x (1) j , j � 1, 2, . . . , N , respectively. (4) Take b 1 � G Ns , then P(E 1 ) � P 0 ; let k � 2. (5) Take x (k−1) j , j � 1, 2, . . . , Ns as the "seed" sample and generate Nt groups of new samples x l , l � 1, 2, . . . , Nt that meet the conditional probability density function f(x/E k−1 ) according to the HMC algorithm. Specific steps can be carried out as follows: Ns � b, let k � 2 go directly to (7); otherwise, let k � k + 1 go to (5). (7) e number of samples falling into the failure domain E m is calculated, i.e., When a pipeline has multiple corrosion points, the failure occurring at each corrosion point constitutes the total failure of the pipeline. erefore, the series system is more suitable for the failure assessment of corroded pipelines. e failure probability P f,s of pipelines can be estimated by using the reliability method of a series system [37,38]: (22) where P f,i represents the failure probability of the ith corrosion pit, which can be calculated by (21). n is the total corrosion points, and LB P f,s and UB P f,s represent the lower and upper ascertainments of the failure probability of the system, respectively. According to the requirements of the geographical location of the pipeline on the risk level, when the failure probability of the corroded pipeline is greater than the acceptable failure probability over time, it is considered the pipeline damage; that is, the remaining life of the corroded pipeline is calculated.

Numerical Examples
Taking the secondary high-pressure gas pipeline in a corrosion area as an example, under the assumption of independent random variables, the pipeline has been running for 20 years. e pipe specifications are as follows: 273 × 7, 20# steel, yield strength of 245 MPa, and maximum allowable working pressure of 0.7 MPa. And, one of the sections is sampled. e results show that there are three corrosion pits, and the gas pipeline parameters and geometric features of the corrosion pits are shown in Tables 1 and 2. According to the target reliability of the API579 standard (see Table 3), the geographical location of the pipeline is in the middle risk area and the allowable failure probability of the corroded pipeline is 10 − 3 . When the failure probability of the pipeline is greater than 10 − 3 , the initial time is the remaining life of the pipeline.
In the corrosion failure process of a gas pipeline, the failure probability of the corroded pipeline is calculated by the upper bound of equation (22). To improve the accuracy of the calculation, the sample number of the MCS method is 10 9 and its result is approximate to the analytical result. It can be seen from Table 4 that the failure probability calculated by the MCS method, SS method, and HMC-SS method for another 18 years of pipeline operation is 5.29 × 10 − 3 , 1.4 × 10 − 3 , and 2.08 × 10 − 3 . e corresponding running time is 1.0561 × 10 2 seconds, 13.818 seconds, and 11.281 seconds.
rough the comparative analysis, it can be seen that the MCS calculation for the pipeline with three corrosion pits needs a lot of calculation cost, about 0.915 × 10 2 seconds. When using SS, HMC-SS algorithm only needs 1% of MC samples to achieve the same accuracy, and the running time is less than 8.49% and 8.77% of MCS algorithm. erefore, the SS and HMC-SS algorithms can be more easily applied to the system reliability analysis and life prediction with multiple corrosion points. RMSE (root mean square error) is used to measure the deviation between the simulated value and the accurate value. e smaller the RMSE is, the higher the accuracy of the simulation value is. In this paper, the root mean square error between the failure probability of 1000 : 1000 : 5000 (the number of samples is 1000 to 5000, with a step of 1000) and MCS (N � 10 6 ) is calculated by equation (23), respectively: Among them, Pf MCS is the failure probability of MCS (N � 10 6 ), Pf(i) is the failure probability calculated by simulation method, and m is the number of simulations.
In order to obtain clear observation results, Figure 4 takes logarithmic coordinates, and it can be seen from Figure 4 that RMSE of HMC-SS and MCS methods is smaller than that of SS and MCS methods. is shows that compared with the SS method, the HMC-SS method has higher accuracy and more effective calculation failure probability.
It can be seen from Figure 5 that with the increase of the working pressure of the gas pipeline, the failure probability of the pipeline increases and the remaining life decreases gradually. When the working pressure increases from 0.25 MPa to 1.25 MPa, the corresponding remaining life decreases from 22 years to 16 years. It can be seen from Figure 6 that the change of corrosion rate has greater influence on the remaining life of the pipeline, when the corrosion rate ] d and ] l increased from 0.113 mm·a −1 to 0.458 mm·a −1 , the service life of gas pipeline is reduced from 23 years to 14 years. Without replacing the gas pipeline, the corrosion treatment should be strengthened actively to delay the corrosion rate of the pipeline and ensure the safety of the gas pipeline.
It can be seen from Figure 7 that the yield strength σ s of the gas pipeline has little influence on the remaining life of the pipeline, while it can be seen from Figure 8 that the geometric shape of the gas pipeline has a significant influence on the remaining life of the pipeline. e remaining life of pipe decreases sharply with the decrease of pipe wall thickness, which is also consistent with the actual situation. e thicker the pipe wall is, the stronger the corrosion resistance is, and the less likely it is to fail.
To make a more detailed and intuitive analysis of the influence of random variables on the failure probability and the remaining service life of gas pipelines, the reliability sensitivity of the mean value of random variables is shown in Figure 9. e paper [38] provides the reliability sensitivity       Mathematical Problems in Engineering

Conclusions
In view of the characteristics of multimode failure and small failure probability in the residual life of urban gas transmission and distribution pipelines, a reliability residual life calculation model of gas pipelines with multiple corrosion pits is established in this paper. e MCS, SS, and HMC-SS methods are used to calculate the residual life of gas pipelines, and the influence of relevant parameters is discussed.
(1) In the case of a small failure probability problem with multiple corrosion pits, HMC-SS has advantages of less sampling, saving time, and high calculation accuracy. (2) e analysis of sensitivity shows that the corrosion rate, wall thickness, corrosion defect depth, and gas transportation pressure of the pipeline have obvious influences on the failure probability and the remaining service life of the gas pipeline, while the yield strength of the pipe and the length of the corrosion pit have little influence on the failure probability and the remaining service life of the pipeline.
(3) Considering that the corrosion rate and wall thickness of the pipeline have an obvious influence on the remaining service life of the gas pipeline, it is suggested to select the appropriate pipe type according to the geographical location of the pipeline to meet the safety requirements and make it economical. (4) According to the sensitivity of factors affecting the remaining life of gas pipelines, it is necessary to prioritize the maintenance or replacement of inservice pipelines and select the materials for laying pipelines to provide theoretical guidance.

Data Availability
Some or all data, models, or codes generated or used during the study are available from the corresponding author upon request.   Mathematical Problems in Engineering 9