Probabilistic failure assessment of oil pipelines due to internal corrosion

Oil and gas pipelines play a key role in the safe and efficient delivery of energy resources around the world. Crude oil by itself is not corrosive, but oil extracted from geological reservoirs is accompanied by varying amounts of water and acidic gases such as carbon dioxide (CO2), which can form a corrosive combination. Estimating the corrosion rate and depth in pipelines is essential for predicting their failure probability. In the present study, a Bayesian network has been developed for predicting the distribution of corrosion rate in oil pipelines given the point estimates generated using an empirical corrosion simulation model. For this purpose, the simulation model considers corrosion parameters such as pipe diameter, flow temperature, flow velocity, and CO2 partial pressure, among others. With the corrosion rate distribution predicted by the Bayesian network, corrosion depth–rate relationships have been employed to convert the corrosion rate distribution into failure probability distribution.

Although there are steel alloys that resist corrosion effectively, mild steel (a type of carbon steel with low carbon content) is widely used in the construction of pipelines and process equipment in the oil and gas industry, because of its cost effectiveness. The corrosive environment in the presence of acidic gases of CO 2 and H 2 S is classified as sweet and sour corrosion, respectively. 7 The severity of both types of corrosion is controlled by the combination of several operational parameters such as temperature, pressure, flow velocity, and the environmental parameters such as the pH of the fluid inside the pipeline.
Data about the rate and extent of corrosion are usually collected by intelligent pigging, which is a highly sophisticated instrument for measuring the pipeline wall thickness through electromagnetic waves or electrochemical potential noise. 8 If the corrosion rate cannot be determined from thickness inspection data, rough estimates may be established using expert elicitation, 9 or predictions can be made using deterministic and probabilistic models based on measurement of the key corrosion parameters. [10][11][12][13][14][15][16][17][18] Generic failure frequencies of process equipment and pipelines, due to internal and external corrosion, are also available 19 but they need to be tailored before use by taking factors such as management systems, inspection history, an so on, into account.
Based on the underlying physicochemical processes of corrosion, many models have been developed to calculate the corrosion rate of pipelines, including mechanistic models, 14,20 semiempirical models, 21 empirical models, 22,23 neural networks, 24,25 and numerical simulation of corrosion differential equations. 26 The Bayesian network (BN) has been effectively used for modeling and failure assessment of engineering systems and structures where uncertainty may impede the application of conventional techniques. 27 BNs developed or enhanced on the basis of physical models (also known as physical-model-based BNs) have recently been employed as a promising alternative for corrosion analysis [28][29][30][31][32] and for estimating the remaining useful life and reliability of pipelines 33 and for other engineering systems. 34,35 The superior performance of BN over most conventional techniques is mainly due to its ability in reasoning under uncertainty and updating the prior probabilities should new information become available.
In the present study, a probabilistic method based on BN and Weibull distribution is proposed for predicting the failure probability of an oil pipeline due to CO 2 corrosion. Considering the radial corrosion rate as a key factor in corrosion-related failure of pipelines, 14 a corrosion rate simulation model 23 is used to generate point estimates of corrosion rate (mm/year) given the pipe diameter, flow temperature, flow velocity, CO 2 concentration (as its partial pressure), and so on. The output of the simulation model is used to develop a BN and learn its parameters via the maximum likelihood estimation algorithm.
With the distribution of the corrosion rate predicted by the BN, a Weibull distribution is used to predict the corrosion depth and the respective failure probabilities.
The steps taken to develop the methodology are illustrated in In Section 2, the basics of CO 2 corrosion and BN are briefly reviewed (Step 1 is covered in Section 2.1). Section 3 demonstrates the development and validation of the developed BN model for predicting corrosion rates through an illustrative case study (Step 2 is covered in Section 3.1 while Step 3 is covered in Section 3.2). In Section 4, a Weibull distribution is used to estimate the corrosion depth and predict the respective failure probabilities (Step 4 is covered in Section 4). Section 5 concludes the paper.

| CO 2 corrosion mechanism
The initiation of corrosion damage is a random process, depending on the microstructure of the material, the surface condition (e.g., the F I G U R E 1 Steps taken to generate the failure probability distribution in the present study presence of surface defects), and other environmental factors. 17 Aqueous CO 2 corrosion of mild steel is an electrochemical process involving the anodic dissolution of iron (Fe) and the cathodic evolution of hydrogen (H 2 ) as 3 The presence of CO 2 can increase the rate of hydrogen evolution and thus accelerate the rate of corrosion. As an oil well ages, the production of oil starts to decline, whereas the flow of water and gas, which usually contain highly corrosive agents such as CO 2 , tends to increase. This, in turn, accelerates the corrosion process inside the pipeline. 3 Compared to that of CO 2 , the role of iron carbonate (FeCO 3 ), which is usually formed at higher temperatures in the form of solid films (also known as scales), is twofold: it can be protective and decelerate the corrosion, or it could be non-protective, depending on the environmental conditions under which it is created. 36 Iron can also be anodically dissolved individually in acid solutions as As a result, carbonic acid (H 2 CO 3 ) can react with free electrons and enable hydrogen evolution even at pH >5: However, carbonic acid is believed to serve as an extra source of hydrogen ions (H + ), which in retraction with electrons can lead to the evolution of more hydrogen:  15 A detailed analysis of CO 2 corrosion mechanism can be found elsewhere. 3

| Bayesian network
A BN can be defined as an acyclic directed graph BN = (G, θ), where G denotes the structure of the graph (nodes and edges) and θ denotes the parameters. 37 Based on the chain rule and the d-separation criteria, the joint probability distribution of the nodes (each node represents a random variable) in a BN can be factorized as the product of the conditional probabilities of the nodes given their immediate where X i is a random variable, and pa(X i ) is the parent set of X i , that is, the set of nodes from which there are direct edges to X i . The condi- By maximizing either the likelihood function in Equation (6)   The steps taken to enter the input parameters in the M-506 simulator are as follow: • Step 1. Insert the fluid temperature (in C) in the Temperature box.
• Step 2. Insert the internal pressure (in bar) in the Pressure box.
• Step 3. Insert the CO 2 partial pressure (in bar) in the box with the same name.
• Step 4. Click "Calculate shear stress" to calculate the shear stress.
The calculated value will automatically appear in the Shear stress box (in Pa).
• Step 5. Click "Calculate pH" to calculate the fluid pH. The calculated value will automatically appear in the pH box.
• Step 6. If glycol has been added to the fluid to prevent it from freezing, insert its concentration in the Glycol concentration box (in %). The model is valid for temperatures 5-150 C, pH 3.5-6.5, shear stress 1-150 Pa, and pCO 2 0.1-10 bar, although it may mis-predict the corrosion rate when pCO 2 is less than 0.5 bar. The model is applicable to corrosion rates only when CO 2 is the corrosive agent. In other words, it does not include the additional effects of other constituents that may influence the corrosivity, including contamination of O 2 and H 2 S, which are more common in water and gas pipelines.
To validate the developed BN in Section 3.2, the experimental values reported in Peng and Zeng 36 for the temperature (T), pCO 2 , and flow velocity (V) are adopted in the present study, as listed in Table 1.
As the same parameters will be used for the root nodes of the BN, to facilitate the discretization of the nodes later in Section 3.2, the values reported in Table 1 were discretized as T = (60, 70, 75), while the corrosion rates were observed to vary from 1 to 4 mm/year.
A sample of the generated data is presented in Table 2.

| Development of the Bayesian network
The parameters and the way they are considered by the M-506 to calculate the shear stress, pH, and, finally, the corrosion rate can be used  Table 3.
Using data generated in Section 3.1, the parameter learning module of the GeNIe software 41 was employed to learn the conditional probabilities of the nodes pH, Shear, and Corrosion rate in the BN using the MLE algorithm presented in Equation (6)  To examine the impact of pH on the corrosion rate, node pH was instantiated to pH 1 = 4.2, which is the most acidic state among the others, to update the states of node Corrosion rate. As can be noted from the updated BN in Figure 4, this more acidic pH makes the probability distribution of Corrosion rate more skewed to the right, increasing the probability of r4 = 3-4 mm/year from 0.2 (in Figure 3) The nodes of the BN in Figure 3 and their states. The probability distributions of the root nodes are identified by the user (uniform distribution), while the distributions of the child nodes are identified by the BN using the maximum likelihood function F I G U R E 4 Updated BN given an instantiation of pH node. Corrosion rate distribution is skewed to the right, given a more acidic pH and 0.26 (in Figure 4). As such, a more acidic pH (3.5-4) would be expected to further increase the likelihood of r = 3-4 mm/year in the BN, making the prediction even more consistent with the experiment.

| ESTIMATION OF FAILURE PROBABILITY
The aim of pipeline corrosion analysis is to estimate the residual strength and failure probability of pipelines with the purpose of risk assessment or identifying maintenance schedules. One approach to relate the corrosion rate to the probability of failure (POF) of the pipeline is to first find the corrosion depth given the age of the pipe, and One simpler approach is based on a comparison between the corrosion depth and the nominal wall thickness of the pipe. 9 As pointed out in Larin et al., 17 at the operational pressure, a corroded pipe may incur plastic strains at spots where the corrosion depth (d) is larger than half of the pipe thickness (h). They also argue that at startup and shutdown pressures, which may be twice the operational pressure of the pipe, there is a 70% probability of failure where the corrosion depth is about one-third of the pipe thickness.
Following the latter approach (i.e., a comparison between the corrosion depth and the nominal wall thickness), in the present study we assume that the POF of the pipeline is conservatively equal to the probability of the corrosion depth exceeding one-third of the pipe wall thickness, that is This assumption is also in agreement with that in Opeyemi et al., 43 where the failure probabilities were obtained for d h ≥ 0:3, and in Hasan et al., 44 where 0:15 < d h < 0:40 was proposed. Therefore, if the corrosion depth and its distribution can be predicted based on the calculated corrosion rates, Equation (7) can be employed to derive the failure probability distribution of the corroded pipeline. In the next sections, we present two approaches to do so. In the first approach (Section 4.1), the corrosion rate predicted by the BN is assumed to have a Weibull distribution, 16,45 whereas in the second approach (Section 4.2) the corrosion rate predicted by the BN is directly employed with no further assumption regarding its distribution.

| First approach
Velazquez et al. 46 proposed that the growth of corrosion depth in low-carbon steel is a power-law function of the corrosion rate and the age (exposure time) of the pipeline: where r is the corrosion rate, and α is the exponential factor identified based on experimental data, ranging from 0.3 to 1.0; Larin et al. 17 proposed the value of α ¼ 0:6. Similar power-law functions have been proposed for uniform internal corrosion of pipelines. [47][48][49] Considering the relationship between time, corrosion rate, and corrosion depth in Equation (8), the POF modeled in Equation (7) can be presented as Using the probability distribution of the corrosion rate, the POF presented in Equation (9) can be calculated. Corrosion rate, as a random variable, is commonly believed to satisfy the Gamma, Weibull, or generalized extreme value distributions. 16,45 In the present study, we adopt a Weibull distribution for the corrosion rate, with a probability density function f(r) and cumulative density function F(R) as where k > 0 and γ > 0 are, respectively, the shape parameter and the scale parameter of Weibull distribution. Considering temporal variation of corrosion rate, a value of k < 1 indicates a decreasing corrosion rate, k = 1 indicates a constant corrosion rate, and k > 1 indicates an increasing corrosion rate over time. By combining Equations (9) and (11), the POF can be calculated using Equation (12) if the values of k and γ are known: The probability distribution of the corrosion rates predicted by the BN in Figure 3 can be used to estimate the values of k and γ for Equation (12). Since there are two unknown variables (k and γ), two equations would be required. Considering the corrosion rate probabilities, one equation can be P (2 ≤ r < 3) = 0.478 while the other can be P (3 ≤ r < 4) = 0.196 (any other two interval probabilities could be used for this purpose). Considering a nominal wall thickness of h = 12 mm for the pipeline, the foregoing equations would result in Solving the system of equations presented in Equation (13) Using Equation (14), the failure probability distribution of the pipeline can be presented, as in Figure 6. For example, at t = 3 years, the cumulative failure probability is calculated as POF 3 ð Þ¼e À 3:12Â3 À2:1 ð Þ = 0.73.

| Second approach
The corrosion depth in uniform corrosion mechanisms can be modeled as a power-law function of the exposure time as 47-49 where d is corrosion depth, t is exposure time, and α and β are constants to be determined using experimental or field measurements of d. Assuming a constant (but random) corrosion rate over time, β would be equal to r, and α would be equal to 1.0. Thus, Equation (15) can be simplified as Plugging Equation (16) in Equation (7), the failure probability can be calculated as With h = 12 mm, the probability mass distribution derived from the BN for the corrosion rate can be used to quantify Equation (17) for different values of t. This mass distribution is presented in Figure 5 for clarity. For instance, for t = 1 year, Equation (17) would be quantified as According to Figure 5, P(0 ≤ r < 1) = 0.05, P(1 ≤ r < 2) = 0. The higher failure probabilities in the second approach can be attributed to higher corrosion depths calculated using Equation (16) than Equation (8). This becomes clearer when we note that Equation (16)  Corrosion scales consist of hard mineral coatings, and corrosion deposits build up over time at the location of corrosion, providing a protection layer and reducing the corrosion rate. 50 Since most empirical models assume constant corrosion rates, deceleration of the corrosion rate can be taken into account through the value of α. In other words, α < 1 denotes a corrosion depth advancing with a decreasing pace (slowing corrosion rate), whereas α = 1 denotes a corrosion depth increasing with a constant rate (constant corrosion rate). Therefore, the difference between the failure probabilities can partly be attributed to the assumption of a more aggressive corrosion rate in the second approach (α = 1.0) than the first approach (α = 0.6).

| CONCLUSIONS
In this study, we presented a methodology based on BN for predicting the probability distribution of corrosion rate in oil pipe- lines. An empirical model, namely the M-506 corrosion rate F I G U R E 5 Corrosion rate mass distribution derived from BN in Figure 3 F I G U R E 6 Failure probability distributions. The Second approach has resulted in higher failure probabilities due to the assumption of constant corrosion rate over time simulator, 23 (14) can be recalculated using these updated k and γ to obtain updated failure probabilities.
The present study has not been aimed at advertising or validating the M-506 model; but it was to demonstrate how empirical models like M-506 can be coupled with BN and corrosion depth-rate relationships to predict the corrosion-induced failure of pipelines. As such, the accuracy of the method is expected to improve if more accurate models than the M-506 were employed.

ACKNOWLEDGMENTS
The authors are grateful to the two reviewers for their instructive comments that helped enhance the readability and quality of this study. The financial support provided by the Faculty of Community

AP PE NDIX A: Application of maximum likelihood function
Consider a BN consisting of three binary nodes, two root nodes X and Y, and a child node Z. X, Y, and Z as discrete random variables can assume values of 0 or 1. Given a dataset as in Table 4, the probability of (z = 1 j x = 1, y = 0), among others, can be estimated using the MLE algorithm. To do so, the estimated probabilities can be presented As such, the likelihood function (L) for observing the data pairs listed on lines 2, 4, 9, and 10 in Table 4 can be developed as To find the value of θ that maximizes the likelihood function, we can calculate the first derivative of the likelihood function with respect to θ, and then solve for the value of θ that makes this derivative equal to zero: As explained in Section 2.2, one may decide to maximize the loglikelihood function to find the value of θ: Using the MLE algorithm, the CPTs of nodes pH, Shear, and Corrosion rate in the BN have been determined by GeNIe. 41 The CPT of node pH is shown in Table 5 as an example.
T A B L E 4 Exemplary dataset to estimate the conditional probability of Z given X and Y T A B L E 5 CPT of node pH in the BN in Figure 3, which has been developed using the MLE algorithm in