Abstract
In this paper, the reliability analysis and residual life assessment model of gas pipelines with multiple 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-SS method can analyze the state space more efficiently and achieve faster convergence. In this paper, the HMC-SS method 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. The 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. The 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. This method provides a reliable theoretical basis for the integrity management of the gas pipeline.
1. 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. Therefore, 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. The most commonly used numerical simulation methods are a second-order moment method and MCS method. Teixeira et al. [5] used the first-order 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]. The 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. This 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. The 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. The improved MCS method, such as the SS simulation method, has obvious advantages in solving high-dimensional and small failure probability problems. The efficiency and robustness of the method are highly praised by many scholars [10–12]. Many researchers have applied the SS method to reliability analysis of bridges, buildings, and other engineering structures [13–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 high-dimensional 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 high-dimensional structural reliability [19]. Wang applies the subset simulation method based on MCMC to the reliability evaluation of steel bridges. The 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–25]. The HMC method has been applied to Bayesian analysis and reliability analysis of structural engineering problems perfectly [26–28]. There 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. The model of reliability analysis and residual life assessment of corrosion pipelines based on HMC-SS method is established. The results based on the HMC-SS method are compared with those of SS and MCS methods.
The 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. The 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. The conclusion and prospect are given in Section 6.
2. 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 is the failure pressure of the corroded pipeline and is the actual operating pressure of the pipeline. The failure probability of corroded pipeline can be expressed by the following formula:where 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 is the flow stress of the pipeline material, is the projected area of the corrosion defect on the side, is the original cross-sectional area of the pipeline at the corrosion defect, is the Folias expansion factor, which is related to the corrosion pipe outer diameter , wall thickness , and corrosion defect length , namely:
In equation (4), ( is the yield stress of pipeline material), where is the coefficient. For steel tubes, is usually 1.1 or 1.15, and in this paper, is 1.15. and ( is the maximum depth of the corrosion pit and is the maximum length of the corrosion pit). To predict the strength of a pipe at time , 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 .
In equation (6), denotes the depth and length of corrosion defects detected in , respectively. denote the depth and length of corrosion defects after service , respectively; denotes the radial corrosion rate; and denotes the axial corrosion rate. Substituting (6) into (4), the failure pressure 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 () of the pipeline, the limit state function of the corroded pipeline is established based on the reliability theory asWhen , the structure is in a reliable state; indicates that the structure is in a failure state; means that the structure is in the limit state.
3. SS Algorithm Based on Random Walk MCMC Sampling
The 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 function : , a series of thresholds can be introduced as . Failure events with nested relationships are composed of these thresholds. , and is the total number of intermediate events. At this time, . According to conditional probability theory, the target failure probability can be obtained as
To facilitate calculation, the intermediate conditional probability is set to a constant value and then the threshold value can be determined by the adaptive method. The traditional subset simulation method has a detailed process description in [31, 32]. The approximate value of the final failure probability can be obtained by the following equation:where is the number of samples falling into the last layer.
4. Reliability Analysis Model of Gas Pipelines Based on HMC-SS Algorithm
HMC-SS is an improvement on the traditional SS algorithm. This 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.
4.1. Principle of Hamiltonian Dynamics
Hamiltonian dynamics describes the time evolution of the system according to the position vector and momentum vector . The total energy of the system is a function of and , namely:where is the potential energy and is the kinetic energy.
Hamiltonian dynamics has several important properties: (1) reversibility, (2) conservation of the Hamiltonian, (3) volume preservation, and (4) symplecticness. These 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 are regarded as (i.e., ) of the Hamiltonian system and as independent variables with the same dimension, so and together form the extended initial position space; then, the position momentum state space of the Hamiltonian system is obtained. The potential energy function can be determined by the target probability density function :
In general, the kinetic energy function can be defined as follows:where 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 and . According to the energy function , we can define a regular distribution:where is the regularization coefficient and can guarantee . Then, is
Then, the regular distribution of Hamiltonian energy function can be expressed as
It can be seen from equation (14) that can be decomposed into the product of and . It can be seen that these two variables are independent of each other. So, we can sample from the joint probability density function of and . In the Hamiltonian system, 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:
The rationality and validity of applying Hamiltonian equation to the MCMC method are explained in [32, 34]. The common methods of discrete Hamiltonian equation are Euler method, improved Euler method, jump point method, and so on [34]. These 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, , is the number of iterations, and is the length of the path. The efficiency of the jump point method is very dependent on the selection of and . In this paper, when the average acceptance rate is about 65%, the corresponding 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–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 . The algorithm flow is as follows:(1)An initial momentum (where is the unit matrix) is generated from the normal distribution .(2)The initial momentum and the position of the seed sample are used as the initial conditions to generate a new state according to equation (16).(3)Receiving calibration: if and , where , receive the suggested sample as the next state; otherwise cannot be the next state, and the next state is still the current state , end.
HMC sampling can explore the state space more effectively than random walk MCMC sampling, which greatly improves the computational efficiency. The 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.


4.2. The Flow of Hamiltonian Monte Carlo Subset Simulation Algorithm
The flow of Hamiltonian Monte Carlo subset simulation algorithm is as follows:(1)The total number of samples and conditional failure probability are defined. Let .(2)According to the probability density function of the model, the Monte Carlo simulation method is directly used to generate 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 and the corresponding sample sequence , respectively.(4)Take , then ; let k = 2.(5)Take as the “seed” sample and generate groups of new samples that meet the conditional probability density function according to the HMC algorithm. Specific steps can be carried out as follows:(a)Through the “seed” samples, the Hamiltonian jump point method is used to generate groups of new samples.(b)The original groups of “seed” samples and groups of new samples are brought into the limit function to obtain the corresponding response value.(c)Reorder the response values in ascending order to get and the corresponding sample sequence . Take and get the intermediate conditional probability .(6)If at least response values in reach the threshold, i.e., , let go directly to (7); otherwise, let go to (5).(7)The number of samples falling into the failure domain 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. Therefore, the series system is more suitable for the failure assessment of corroded pipelines. The failure probability of pipelines can be estimated by using the reliability method of a series system [37, 38]:where represents the failure probability of the th corrosion pit, which can be calculated by (21). is the total corrosion points, and and 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.
5. 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. The 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. The 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 . When the failure probability of the pipeline is greater than , 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 and its result is approximate to the analytical result.
According to Figure 3, the pipeline runs for another 17 years, if the failure probability is ; the pipeline continues to run 18 years, if the failure probability is ; the pipeline residual life is 17 years because the failure probability of the pipeline is over the pipeline allowance of . The simulation results of SS method and HMC-SS method are also 17 years. The results of the three methods are in good agreement.

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 , , and . The corresponding running time is seconds, 13.818 seconds, and 11.281 seconds.
Through 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 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. Therefore, 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. The 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 () is calculated by equation (23), respectively:
Among them, is the failure probability of MCS (), is the failure probability calculated by simulation method, and 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. This 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 and 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 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. The remaining life of pipe decreases sharply with the decrease of pipe wall thickness, which is also consistent with the actual situation. The 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. The paper [38] provides the reliability sensitivity computation formula as follows: , from graphics can be very intuitive found that the most important factors affecting the failure probability and remaining service life of the gas pipeline are the corrosion rate, wall thickness, corrosion pit depth, and gas transmission pressure. The yield strength of the pipe material and the length of corrosion pits have almost negligible effects on the failure probability and remaining service life.

6. 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. The 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)The 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 in-service 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.
Conflicts of Interest
The authors have no conflicts of interest to declare.
Acknowledgments
The work described in this paper was supported by the Anhui Provincial Natural Science Foundation (No. 2008085QA22).