# Modeling and Simulation of Pigging for a Gas Pipeline Using a Bypass Pig

Authors: Liang Zhang; Jiawei Zhou; Honggang He
Journal: Mathematical Problems in Engineering
 (2020)

---

## Abstract

The pipeline inspection gauge (PIG, lowercase pig is commonly used) with a bypass valve is widely used in pipeline inspection because it operates at a low speed without reducing the flow rate. Understanding the dynamics of a bypass pig in a gas pipeline would contribute to the design of the pig and the control of pig speed. This paper deals with the dynamic model for the process of a bypass pig travelling through a hilly gas pipeline. The method of characteristics (MOC) is used to solve the equations of unsteady gas flow. The backward flow of the gas in the bypass valve and pipe is shown by a simulation of pigging for a hilly gas pipeline. Parametric sensitivity analysis of pigging in the horizontal gas pipe using a bypass pig is then carried out. The results indicate that the speed of a bypass pig is most sensitive to the gas speed in the pipe followed by the bypass area and the friction of the pig. A formula, obtained from the results of the simulations using response surface methodology (RSM), is presented to predict the steady speed of a bypass pig in the horizontal gas pipeline.


---

## Body

## 1. Introduction

Regular pigging for the gas pipelines is one standard procedure for the operators. Generally, a pig is a piston that is installed in a pipe to perform certain operations such as liquid removal, inspection of the pipe, and cleaning out debris. Fluid is pumped upstream of the pig to drive it in motion [1–3]. In many cases, the flow rate in the pipelines is required not to decrease too much during the pigging operations because of the demand of the downstream [4–6]. However, the pig speed needs to be limited to within a moderate range during such operations [7, 8]. In particular, intelligent pigs for pipeline inspection require that the pigging speed be limited to medium. Therefore, implementation of a bypass control strategy is the only appropriate technique for several such pigging operations [9, 10].In general, a bypass control strategy uses a bypass valve to adjust the pressure difference between the tail and nose of the pig. As a part of the fluid pours out of the bypass hole through the pig body, the pig speed can be reduced to a desired range.A literature investigation indicates that few studies focus on bypass valve pigs. Nguyen et al. performed modeling and simulation of pig flow control in a natural gas pipeline [11]. The dynamics of a pig with a fixed bypass in the gas pipeline was studied by Hosseinalipour et al. In this research, the basic equations of gas flow were discretized by the finite difference method [12]. Tan et al. studied a new butterfly-shaped bypass valve and presented its working principle [13]. Lesani et al. explored the derivation and solution of two- and three-dimensional (2D and 3D, respectively) dynamic equations for the pig passing through the liquid pipeline [5].The prediction and control of the pig speed is critical to the pigging operation. To understand the dynamic behavior of the pig, the pig dynamic equation must be coupled with the governing equations of flows [14–16]. The method of characteristics (MOC) was employed to transform the partial differential equations of flows to ordinary differential equations [17–19]. This method is quite efficient to solve the governing equations of transient gas flows.There already exist some works relating to the dynamics of the pig in gas pipelines. Esmaeilzadeh et al. presented a mathematical model of the dynamics of a pig travelling through gas pipelines [17]. The process of a pig restarting from a stoppage in a horizontal gas pipe was simulated by Nguyen et al. In this paper, the gas equations were solved by MOC [11]. Xu and Li developed a pigging mathematical model coupling with the quasi-steady-state flow model [20]. In addition, Mirshamsi and Rafeeyan analyzed the process of a pig through a 3D gas pipeline by assuming the pig as a rigid body with a bypass [21, 22]. It seems that few of the studies pay attention to the backward flow of gas in the bypass valve and pipe. Therefore, the simulation of pigging for hilly gas pipelines would be a difficulty for these pigging models.A literature survey reveals that very few papers focus on the simulations of pigging in hilly gas pipelines using a pig with a bypass valve. Also, there are few calculations or simulations for estimating the speed of the bypass pig in gas pipelines. This paper deals with the dynamic model for the process of a bypass pig travelling through a hilly gas pipeline. The equations for unsteady gas flow are solved by MOC. The bypass flow through the pig is assumed to be incompressible for calculating the pressure difference between the tail and nose of the pig. In this pigging model, the backward flow of gas in the bypass valve and pipe is taken into account, which is shown by a simulation of pigging for a hilly gas pipeline. Parametric sensitivity analysis of pigging in the horizontal gas pipe using a bypass pig is then carried out. Lastly, RSM is used to study the steady speed of a bypass pig in the horizontal gas pipeline. A formula, obtained from the results of the RSM simulations, is presented to predict the steady speed of a bypass pig in the horizontal gas pipeline.


## 2. Mathematical Modeling

### 2.1. Pig Dynamic Equation

The model of a pig moving in a pipeline with a bypass valve is shown in Figure1. An amount of the flow in a pipeline passes through the bypass hole and builds up a pressure difference between the tail and nose of the pig, which drives the pig in motion. The dynamic equation of the pig can be expressed as follows:(1)mvpig′=Fp−sgnx˙Ffp−mgsinθ,Fp=Ap−Ahptail−pnose,where m, vpig, Ap, Ah, ptail, pnose, Ffp, Fp, and θ are the mass of the pig, velocity of the pig, cross-sectional area of the pipe, area of the bypass hole, pressure on the pig tail, pressure on the pig nose, friction force of the pig, driving force generated by the pressure difference, and angle between the pipe and the horizontal plane, respectively.Figure 1
Bypass pig moving in an inclined pipeline.As is known, there are occasions that the pig stops in the pipeline and requires a larger driving pressure to push it in motion. Thus, the relationship between the static frictionFsta and dynamic friction Fdyn of the pig can be expressed in the following form:(2)Ffp=Fp−mgsinθ,ifFp−mgsinθ<Fsta,whenvpig≈0;Fsta,ifFp−mgsinθ>Fsta,Fdyn,whenvpig≠0.


### 2.2. Model of Gas Flow in a Hilly Pipeline

The following assumptions are adopted to simplify the pigging model:(1)
The gas is an ideal gas(2)
The gas flow is quasi-steady heat flow(3)
The fluid in the pipeline is a single-phase gas(4)
The diameter of the pipeline is unchanged during piggingThe unsteady flow dynamics can be modeled based on the fundamental fluid dynamic equations [11, 17, 18, 23]: continuity equation, momentum equation, and energy equation, respectively, as follows:(3)∂ρ∂t+u∂ρ∂x+ρ∂u∂x=0,(4)∂p∂x+ρu∂u∂x+ρ∂u∂t=−sgnuFfAp−ρgsinθ,(5)∂p∂t+u∂p∂x+γρ∂u∂x=γ−1ApsgnuFfu+qS+Apuρg sinθ,where u, ρ, p, x, g, and t are the velocity, density, pressure, distance, gravity parameter, and time, respectively. In addition, Ff, Ap, γ, S, and q are the friction force, cross-sectional area of the pipe, ratio of specific heat, pipe perimeter, and rate of heat inflow, respectively.In gas pipelines, there are occasions that the gas flows backward, which causes the friction forceFf to reverse. Therefore, the sign function of velocity sgn (u) should be added before the friction force Ff. From the perspective of the fluid mechanics books and papers, the friction factor and the friction force are given, respectively, as follows [24]:(6)f=0.11kd+68Re0.25,Ff=fρApdu22,where Re, d, k, and f are the Reynolds number, diameter of the pipe, pipe wall roughness, and friction factor, respectively. Equations (3)∼(5) can be rewritten in the following form:(7)∂u∂t+A∂u∂x=B,where(8)u=ρupT,A=uu1ργpu,B=0−sgnuFfρApγ−1ApsgnuuFf+qS+Apuρg sinθ.The nonlinear hyperbolic partial differential system of equation (7) can be transformed into ordinary differential equations which can be integrated by finite differences. Matrix A has 3 real eigenvalues, λ:(9)λ=uu+cu−c,c=γpρ,where c is the sound speed. Thus, the eigenvectors of matrix A can be written as(10)υ=uρ0−uγp01cγp01−cγp.For each pair ofλ and υ, equation (7) can be rewritten in the form(11)υTdudt−B=0.By writing equation (7) along the characteristic line, now we get the compatibility equations:(12)dudt+cγpdpdt=γ−1cqSρAp+sgnuFfρAp+gsinθuγ−1c−1alongdxdt=u+c,(13)dudt−cγpdpdt=−γ−1cqSρAp−sgnuFfρAp+gsinθuγ−1c+1alongdxdt=u−c,(14)dpdt−c2dρdt=γ−1qSAp+sgnuFfρAp+gsinθγ−1uρalongdxdt=u.Figure2 shows the relationship between variables u, p, and ρ at the time step tj−1 and at the following time step tj [17, 25]. At the time step tj−1, variables u, p, and ρ at grid points S, M, and R are obtained from linear interpolation of the data on O, N, and L. Then, the gas flow parameters at point P can be derived from previously calculated grid points S, M, and R.Figure 2
Characteristics used in MOC.Equations (12)∼(14) are integrated along the corresponding characteristic line to obtain the desired variables. Equations (15)∼(17) are obtained by linear interpolation. In the following three equations, X denotes the desired parameters u, p, or ρ:(15)XR=XN+XL−XNuN+cNΔtΔx,(16)XM=XN+XL−XNuNΔtΔx,(17)XS=XN−XO−XNuN−cNΔtΔx.According to equations (12)∼(14), we get(18)pP=γcR/pR+cS/pSuR−uS+cR+cSγ+E1R−E2SΔt,uP=uR+cRγpRpR−pP+E1RΔt,ρP=ρM+1cM2pP−pM−E3MΔt,where(19)E1R=γ−1cRqSρRAp+sgnuFfρAp+gsinθuRγ−1cR−1,E2S=−γ−1cSqSρSAp−sgnuFfρAp+gsinθuSγ−1cS+1,E3M=γ−1qSAp+sgnuFfρMAp+gsinθγ−1uMρM.The sampling time,∆t, and the sampling distance, ∆x, are chosen under the CFL stability condition [24]:(20)Δt<Δxu+c.


### 2.3. Pressure Difference Generated by the Bypass

Generally, a bypass valve is used in a smart pig for pipeline inspection. Several conventional pigging operations for liquid and debris removal should be done before using the smart pig. In a clean pipe, the pressure difference between the tail and the nose of the pig is generally in the range of 0.3∼1.5 bar. Therefore, the pressure disturbance generated by the pig is negligible compared to the gas pressure, typically up to several megapascals. In addition, when the speed of natural gas is less than 200 m/s, it can be treated as incompressible with an error less than 5% [25].With the assumption that the gas can be treated as incompressible as it passes through the bypass valve, the gas velocity on the tail and nose of the pig can be written as the following:(21)utail=unose=vpig+AhApvh−vpig,where utail, unose, and vh are the gas velocity on the tail of the pig, on the nose of the pig, and in the hole of the pig, respectively.In gas pipelines, the speed of pigs can be erratic, which makes the driving pressure of the pig positive or negative. From the perspective of the fluid mechanics books and papers, the pressure difference generated by the bypass valve is given as follows [10]:(22)ptail−pnose=ρ2vh−vpigApChAh2,ptail>pnose,pnose−ptail=ρ2vh−vpigApChAh2,ptail<pnose.In this equation,Ch is the discharge coefficient of the valve, which is determined by the structure of the valve and the properties of the medium. Generally, Ch is between 0.6 and 0.8.


### 2.4. Boundary Conditions

In this paper, the boundary conditions are considered as constant inlet flow rate and constant pressure at the outlet. As shown in Figure3, using the backward and forward characteristics next to the pig, the pressure on the tail and nose of the pig can be expressed as follows [25]:(23)ptail=pRtail+γpRtailcRtailuRtail−utail+E1RtialΔt,pnsoe=pSnose+γpSnosecSnoseunose−uSnose−E2SnoseΔt.Figure 3
Characteristics for calculating the pressure at the tail and nose of the pig.To calculate equation (23), the gas parameters at points Rtail and Ntail should be obtained firstly, which can be solved as the following steps [25]:(1)
Calculate the gas parameters at pointNtail by linear extrapolating from two points L and N:(24)XNtail=XL+XN−XLxNtail−xLxN−xL.(2)
Find out the position of pointRtail:(25)xRtail=xpig−uNtial+cNtailΔt.(3)
Calculate the flow parameters at pointRtail by linear interpolating from two points L and N:(26)XRtail=XL+XN−XLxR−xLxN−xL.With the gas parameters at pointsT and O, the gas parameters at points Nnose and Snose can be calculated in the same way, which can be expressed as follows:(27)XNnose=XO+XT−XOxNnose−xOxT−xO,xSnose=xpig+Lpig−uNtial−cNtailΔt,XSnose=XO+XT−XOxSnose−xOxT−xO.Ifptail>pnose, substituting equations (21) and (23) into equation (22), we get the relationship(28)a1vh−vpig2+b1vh−vpig+c1=0,where(29)a1=ρ2ApChAh2,b1=γAhAppRtailcRtail+pSnosecSnose,c1=pSnose−pRtail+γpRtailcRtail+pSnsoecSnosevpig−γpRtailcRtailuRtail−pSnosecSnoseuSnose+pRtailcRtailE1RtailΔt−pSnosecSnoseE2SnoseΔt.By solving equation (28) under the condition of vh > vpig, the velocity of bypass flow can be written as follows:(30)vh=vpig+−b1+b12−4a1c12a1.Ifptail< pnose, substituting equations (21) and (23) into equation (22), we get the relationship(31)a2vh−vpig2+b2vh−vpig+c2=0,where(32)a2=ρ2ApChAh2,b2=−γAhAppRtailcRtail+pSnosecSnose,c2=pRtail−pSnose−γpRtailcRtail+pSnosecSnosevpig+γpRtailcRtailuRtail+pSnosecSnoseuSnose+pRtailcRtailE1RtailΔt+pSnosecSnoseE2SnoseΔt.By solving equation (28) under the condition of vh < vpig, the velocity of bypass flow can be written as follows:(33)vh=vpig+−b2−b22−4a2c22a2.Substitutingvh into equation (21), the values utail and unose can be calculated. Now, parameters ptial and pnose can be obtained by solving equation (23).


### 2.5. Initial Conditions

Steady-state momentum equation (4) and energy equation (5) for gas flow can be converted into ordinary differential equations by assuming ∂/∂t = 0. Now, we get the steady-state equations:(34)ρu=ρouo,(35)dudx=1ρc2−u2sgnuγFfuAp+γ−1qSAp+γuρg sinθ,(36)dpdx=sgnu1−γu2−c2c2−u2FfAp−uc2−u2γ−1qSAp+1−γu2−c2c2−u2ρg sinθ.The initial fluid variablesu, p, and ρ for both upstream and downstream gas flows can be calculated by solving equations (34)∼(36) using the Runge–Kutta method.


### 2.6. Numerical Solution

In general, a number of discrete points are adopted to express the pipe curve. Thus, sinθ in equation (1) of each point can be expressed by the adjacent points. At each time step, sinθ of the current pig position can be obtained by interpolation of the adjacent points. Then, the speed and position of the pig can be solved from equation (1) by using the Runge–Kutta method.To simulate the pigging process in the gas pipeline, the pipeline is divided into two sections: one behind the pig and the other in front of it. At the first time step, the dynamic equations for both upstream and downstream gas flows are solved to obtain the driving pressure of the pig. In the next step, the Runge–Kutta method is used to solve the speed equation of the pig to obtain speed and the new position of the pig. The calculations are repeated until the pig arrives at a given position in the pipeline or the time step reaches the end.


## 2.1. Pig Dynamic Equation

The model of a pig moving in a pipeline with a bypass valve is shown in Figure1. An amount of the flow in a pipeline passes through the bypass hole and builds up a pressure difference between the tail and nose of the pig, which drives the pig in motion. The dynamic equation of the pig can be expressed as follows:(1)mvpig′=Fp−sgnx˙Ffp−mgsinθ,Fp=Ap−Ahptail−pnose,where m, vpig, Ap, Ah, ptail, pnose, Ffp, Fp, and θ are the mass of the pig, velocity of the pig, cross-sectional area of the pipe, area of the bypass hole, pressure on the pig tail, pressure on the pig nose, friction force of the pig, driving force generated by the pressure difference, and angle between the pipe and the horizontal plane, respectively.Figure 1
Bypass pig moving in an inclined pipeline.As is known, there are occasions that the pig stops in the pipeline and requires a larger driving pressure to push it in motion. Thus, the relationship between the static frictionFsta and dynamic friction Fdyn of the pig can be expressed in the following form:(2)Ffp=Fp−mgsinθ,ifFp−mgsinθ<Fsta,whenvpig≈0;Fsta,ifFp−mgsinθ>Fsta,Fdyn,whenvpig≠0.


## 2.2. Model of Gas Flow in a Hilly Pipeline

The following assumptions are adopted to simplify the pigging model:(1)
The gas is an ideal gas(2)
The gas flow is quasi-steady heat flow(3)
The fluid in the pipeline is a single-phase gas(4)
The diameter of the pipeline is unchanged during piggingThe unsteady flow dynamics can be modeled based on the fundamental fluid dynamic equations [11, 17, 18, 23]: continuity equation, momentum equation, and energy equation, respectively, as follows:(3)∂ρ∂t+u∂ρ∂x+ρ∂u∂x=0,(4)∂p∂x+ρu∂u∂x+ρ∂u∂t=−sgnuFfAp−ρgsinθ,(5)∂p∂t+u∂p∂x+γρ∂u∂x=γ−1ApsgnuFfu+qS+Apuρg sinθ,where u, ρ, p, x, g, and t are the velocity, density, pressure, distance, gravity parameter, and time, respectively. In addition, Ff, Ap, γ, S, and q are the friction force, cross-sectional area of the pipe, ratio of specific heat, pipe perimeter, and rate of heat inflow, respectively.In gas pipelines, there are occasions that the gas flows backward, which causes the friction forceFf to reverse. Therefore, the sign function of velocity sgn (u) should be added before the friction force Ff. From the perspective of the fluid mechanics books and papers, the friction factor and the friction force are given, respectively, as follows [24]:(6)f=0.11kd+68Re0.25,Ff=fρApdu22,where Re, d, k, and f are the Reynolds number, diameter of the pipe, pipe wall roughness, and friction factor, respectively. Equations (3)∼(5) can be rewritten in the following form:(7)∂u∂t+A∂u∂x=B,where(8)u=ρupT,A=uu1ργpu,B=0−sgnuFfρApγ−1ApsgnuuFf+qS+Apuρg sinθ.The nonlinear hyperbolic partial differential system of equation (7) can be transformed into ordinary differential equations which can be integrated by finite differences. Matrix A has 3 real eigenvalues, λ:(9)λ=uu+cu−c,c=γpρ,where c is the sound speed. Thus, the eigenvectors of matrix A can be written as(10)υ=uρ0−uγp01cγp01−cγp.For each pair ofλ and υ, equation (7) can be rewritten in the form(11)υTdudt−B=0.By writing equation (7) along the characteristic line, now we get the compatibility equations:(12)dudt+cγpdpdt=γ−1cqSρAp+sgnuFfρAp+gsinθuγ−1c−1alongdxdt=u+c,(13)dudt−cγpdpdt=−γ−1cqSρAp−sgnuFfρAp+gsinθuγ−1c+1alongdxdt=u−c,(14)dpdt−c2dρdt=γ−1qSAp+sgnuFfρAp+gsinθγ−1uρalongdxdt=u.Figure2 shows the relationship between variables u, p, and ρ at the time step tj−1 and at the following time step tj [17, 25]. At the time step tj−1, variables u, p, and ρ at grid points S, M, and R are obtained from linear interpolation of the data on O, N, and L. Then, the gas flow parameters at point P can be derived from previously calculated grid points S, M, and R.Figure 2
Characteristics used in MOC.Equations (12)∼(14) are integrated along the corresponding characteristic line to obtain the desired variables. Equations (15)∼(17) are obtained by linear interpolation. In the following three equations, X denotes the desired parameters u, p, or ρ:(15)XR=XN+XL−XNuN+cNΔtΔx,(16)XM=XN+XL−XNuNΔtΔx,(17)XS=XN−XO−XNuN−cNΔtΔx.According to equations (12)∼(14), we get(18)pP=γcR/pR+cS/pSuR−uS+cR+cSγ+E1R−E2SΔt,uP=uR+cRγpRpR−pP+E1RΔt,ρP=ρM+1cM2pP−pM−E3MΔt,where(19)E1R=γ−1cRqSρRAp+sgnuFfρAp+gsinθuRγ−1cR−1,E2S=−γ−1cSqSρSAp−sgnuFfρAp+gsinθuSγ−1cS+1,E3M=γ−1qSAp+sgnuFfρMAp+gsinθγ−1uMρM.The sampling time,∆t, and the sampling distance, ∆x, are chosen under the CFL stability condition [24]:(20)Δt<Δxu+c.


## 2.3. Pressure Difference Generated by the Bypass

Generally, a bypass valve is used in a smart pig for pipeline inspection. Several conventional pigging operations for liquid and debris removal should be done before using the smart pig. In a clean pipe, the pressure difference between the tail and the nose of the pig is generally in the range of 0.3∼1.5 bar. Therefore, the pressure disturbance generated by the pig is negligible compared to the gas pressure, typically up to several megapascals. In addition, when the speed of natural gas is less than 200 m/s, it can be treated as incompressible with an error less than 5% [25].With the assumption that the gas can be treated as incompressible as it passes through the bypass valve, the gas velocity on the tail and nose of the pig can be written as the following:(21)utail=unose=vpig+AhApvh−vpig,where utail, unose, and vh are the gas velocity on the tail of the pig, on the nose of the pig, and in the hole of the pig, respectively.In gas pipelines, the speed of pigs can be erratic, which makes the driving pressure of the pig positive or negative. From the perspective of the fluid mechanics books and papers, the pressure difference generated by the bypass valve is given as follows [10]:(22)ptail−pnose=ρ2vh−vpigApChAh2,ptail>pnose,pnose−ptail=ρ2vh−vpigApChAh2,ptail<pnose.In this equation,Ch is the discharge coefficient of the valve, which is determined by the structure of the valve and the properties of the medium. Generally, Ch is between 0.6 and 0.8.


## 2.4. Boundary Conditions

In this paper, the boundary conditions are considered as constant inlet flow rate and constant pressure at the outlet. As shown in Figure3, using the backward and forward characteristics next to the pig, the pressure on the tail and nose of the pig can be expressed as follows [25]:(23)ptail=pRtail+γpRtailcRtailuRtail−utail+E1RtialΔt,pnsoe=pSnose+γpSnosecSnoseunose−uSnose−E2SnoseΔt.Figure 3
Characteristics for calculating the pressure at the tail and nose of the pig.To calculate equation (23), the gas parameters at points Rtail and Ntail should be obtained firstly, which can be solved as the following steps [25]:(1)
Calculate the gas parameters at pointNtail by linear extrapolating from two points L and N:(24)XNtail=XL+XN−XLxNtail−xLxN−xL.(2)
Find out the position of pointRtail:(25)xRtail=xpig−uNtial+cNtailΔt.(3)
Calculate the flow parameters at pointRtail by linear interpolating from two points L and N:(26)XRtail=XL+XN−XLxR−xLxN−xL.With the gas parameters at pointsT and O, the gas parameters at points Nnose and Snose can be calculated in the same way, which can be expressed as follows:(27)XNnose=XO+XT−XOxNnose−xOxT−xO,xSnose=xpig+Lpig−uNtial−cNtailΔt,XSnose=XO+XT−XOxSnose−xOxT−xO.Ifptail>pnose, substituting equations (21) and (23) into equation (22), we get the relationship(28)a1vh−vpig2+b1vh−vpig+c1=0,where(29)a1=ρ2ApChAh2,b1=γAhAppRtailcRtail+pSnosecSnose,c1=pSnose−pRtail+γpRtailcRtail+pSnsoecSnosevpig−γpRtailcRtailuRtail−pSnosecSnoseuSnose+pRtailcRtailE1RtailΔt−pSnosecSnoseE2SnoseΔt.By solving equation (28) under the condition of vh > vpig, the velocity of bypass flow can be written as follows:(30)vh=vpig+−b1+b12−4a1c12a1.Ifptail< pnose, substituting equations (21) and (23) into equation (22), we get the relationship(31)a2vh−vpig2+b2vh−vpig+c2=0,where(32)a2=ρ2ApChAh2,b2=−γAhAppRtailcRtail+pSnosecSnose,c2=pRtail−pSnose−γpRtailcRtail+pSnosecSnosevpig+γpRtailcRtailuRtail+pSnosecSnoseuSnose+pRtailcRtailE1RtailΔt+pSnosecSnoseE2SnoseΔt.By solving equation (28) under the condition of vh < vpig, the velocity of bypass flow can be written as follows:(33)vh=vpig+−b2−b22−4a2c22a2.Substitutingvh into equation (21), the values utail and unose can be calculated. Now, parameters ptial and pnose can be obtained by solving equation (23).


## 2.5. Initial Conditions

Steady-state momentum equation (4) and energy equation (5) for gas flow can be converted into ordinary differential equations by assuming ∂/∂t = 0. Now, we get the steady-state equations:(34)ρu=ρouo,(35)dudx=1ρc2−u2sgnuγFfuAp+γ−1qSAp+γuρg sinθ,(36)dpdx=sgnu1−γu2−c2c2−u2FfAp−uc2−u2γ−1qSAp+1−γu2−c2c2−u2ρg sinθ.The initial fluid variablesu, p, and ρ for both upstream and downstream gas flows can be calculated by solving equations (34)∼(36) using the Runge–Kutta method.


## 2.6. Numerical Solution

In general, a number of discrete points are adopted to express the pipe curve. Thus, sinθ in equation (1) of each point can be expressed by the adjacent points. At each time step, sinθ of the current pig position can be obtained by interpolation of the adjacent points. Then, the speed and position of the pig can be solved from equation (1) by using the Runge–Kutta method.To simulate the pigging process in the gas pipeline, the pipeline is divided into two sections: one behind the pig and the other in front of it. At the first time step, the dynamic equations for both upstream and downstream gas flows are solved to obtain the driving pressure of the pig. In the next step, the Runge–Kutta method is used to solve the speed equation of the pig to obtain speed and the new position of the pig. The calculations are repeated until the pig arrives at a given position in the pipeline or the time step reaches the end.


## 3. Simulation of Pigging for a Hilly Gas Pipeline Using a Pig with a Bypass

A pipe curve shown in Figure4 is used for the simulation of pigging in a hilly natural gas pipeline using a pig with the bypass hole. Numerical values of the parameters used in this pigging simulation are shown in Table 1.Figure 4
Pipe curve for the simulation.Table 1
Numerical values for simulation.
ParameterUnitValveParameterUnitValvepiBar50Fdynbar0.15ρikg/m335.2Fstabar0.35vm2/s3.47 × 10−7Qim3/s2Γ—1.44kmm0.03Apm20.2mkg300Ahm20.013Ch—0.7In order to test the mesh independence, numerical solution is carried out by utilizing the grid systems with 800,000 cells, 1,250,000 cells, 5,000,000 cells, and 20,000,000 cells at an initial position of 4700 m and in a computing time of 200 s. The pig speed of these simulations is figured out in Figure5. The pig speed gap between grid systems of 5 M and 20 M cells is much smaller than the gap between 0.8 M and 1.2 M. Thus, to balance computational economy and prediction accuracy, the grid system of 5 M cells is chosen for this study.Figure 5
Mesh independence results.The pig speed and the gas speed in the bypass valve are figured out in Figures6 and 7, which show that the two speeds increase to a high level when the pig moves into a downhill section. In addition, the pig stops quickly when it rushes into the uphill section because the pressure difference between the tail and nose of the pig reduces to a level that is insufficient to overcome the friction, shown in Figure 8. This way, the gas in the bypass flows backwards for a period of time. After 10 seconds, the gas speed in the bypass value increases to about 12 m/s, building up a pressure difference of about 0.35 bar to drive the pig in motion.Figure 6
Pig speed vs. gas speed in the bypass distributing along simulation time.Figure 7
Pig speed vs. gas speed in the bypass distributing along pipe length.Figure 8
Pressure on the nose and tail of the pig and the pressure difference during pigging.The pressure on the pig tail and nose and pressure difference between the tail and nose of the pig during pigging are shown in Figure8. It can be seen that when the pig moves to the uphill section, the gas pressure on the nose of the pig increases because of the compression generated by the pig. Additionally, the pressure on the pig nose rises in the uphill section due to the action of gravity. As a result, it is difficult to establish the pressure difference at the tail and nose of the pig, and it requires an increase of gas pressure on the pig tail. This way, the pig speed decreases after starting. After hesitating for about 12 seconds, the pig then can move smoothly.The distributions of gas pressure and speed are presented as 3D diagrams shown in Figures9(a) and 9(b), respectively. It can be seen that the gas pressure increases when the pig climbs the uphill section and decreases when the pig travels in the downhill section. In addition, the shock wave of the gas speed, generated by a high speed of the pig, will continue to move forward.Figure 9
Distributions of gas parameters: (a) gas pressure; (b) gas velocity.
(a)(b)


## 4. Simulation of Pigging in the Horizontal Pipe Using a Bypass Pig

Typically, natural gas pipelines are primarily horizontal or near horizontal. Therefore, the design of bypass pigs and pigging operations generally considers pigging in horizontal pipelines. In this study, a 5 km horizontal gas pipeline is used for calculating the steady speed of the bypass pig. The parameters of the pigging system are listed out in Table1. The pressure on the pig tail and nose and pressure difference between the tail and nose of the pig are shown in Figure 10(a). The pig speed and the gas speed in the bypass hole are figured out in Figure 10(b). The results show that the pressures and speeds fluctuated within 60 seconds after the pig was started and then gradually reached a stable value.Figure 10
Results of the simulation for pigging in the horizontal gas pipe using a bypass pig. (a) Pressure on the nose and tail of the pig and the pressure difference. (b) Pig speed vs. gas speed in the bypass.
(a)(b)Parametric sensitivity analysis of pigging in the horizontal gas pipe using a bypass pig is then carried out. As shown in Figure11, the steady speed of a bypass pig is primarily determined by the pipe diameter, gas speed in the pipe, bypass area, and the friction force of the pig. The mass of the pig makes little difference to the results. Additionally, the pig speed is most sensitive to the gas speed in the pipe followed by the bypass area.Figure 11
Parametric sensitivity analysis of pig speed in the horizontal pipeline: (a) change of pig mass, (b) change of pipe diameter, (c) change of gas pressure, (d) change of inlet speed, (e) change of bypass area, and (f) change of friction force.
(a)(b)(c)(d)(e)(f)


## 5. Calculation of Steady Speed of the Bypass Pig Using RSM

Response surface methodology (RSM) is a statistical experimental method for optimizing stochastic processes. The objective is to find out the quantitative law between the experimental index [26, 27]. In this research, RSM is used to study the steady speed of a bypass pig in the horizontal gas pipeline. The steady speeds a pig achieved from each run of RSM are listed out in Table 2. An empirical formula for estimating the steady speed of a bypass pig in the horizontal gas pipeline, obtained from the results of the RSM simulations, is as follows:Table 2
Simulations of steady speed of the bypass pig in the horizontal pipe using RSM.
Run numberPipe diameterA: 0.3∼1 mGas pressureB: 20∼100 barGas speedC: 5∼15 m/sBypass areaD: 5∼20%Friction forceE: 0.3∼1.5 barPig speed (m/s)10.65605200.93.1720.360512.50.94.2630.65601550.914.974160512.50.94.2950.6560550.94.8860.6560512.51.54.0870.65601012.50.99.2880.651001012.51.59.3390.6520512.50.93.76100.651001512.50.914.49110.3601012.50.39.521211001012.50.99.48130.656015200.913.16140.65601012.50.99.28150.65201050.99.80161601512.50.914.30170.31001012.50.99.46181201012.50.98.73191601050.99.89200.65601012.50.99.28210.65601512.50.314.58220.656010200.38.85230.65201012.51.58.35240.65601512.51.514.09250.65100512.50.94.482616010200.98.17270.3201012.50.98.70280.656010201.57.64290.6510010200.98.66300.6560512.50.34.58311601012.50.39.59320.65601051.59.85330.65601050.39.95340.652010200.96.73350.65601012.50.99.28360.65601012.50.99.28370.651001012.50.39.69380.651001050.99.92390.3601512.50.914.26400.65201012.50.39.27410.65201512.50.913.76421601012.51.59.08430.3601012.51.59.06440.36010200.98.10450.3601050.99.89(37)vpig=0.253+0.133A+2.38×10−4B+0.994C−0.034D−0.277E−2.57×10−4AB+1.86×10−3AC+7×10−3AD−0.05AE+1.625×10−5BC+1.51×10−3BD+5.81×10−3BE−6.6×10−4CD+6.67×10−4CE−0.062DE−0.098A2−1.2×10−4B2+6.33×10−4C2−4.8×10−3D2+0.139E2.In this equation,A, B, C, D, and E are the pipe diameter (m), gas pressure (bar), gas speed in the pipe (m/s), proportion of the bypass area to the cross-sectional area of the pipe (%), and driving pressure of the pig generated by the friction of the pig (bar), respectively. Model graphs of equation (37) are shown in Figure 12. The actual value and predicted value of pig speed are compared in Figure 13, which shows a good agreement within an error of 5%.Figure 12
Model graphs of the obtained formula.Figure 13
Residuals of the RSM results.Obviously, the speed of a bypass pig is mainly determined by the gas speed in the pipeline and can be reduced in several ways: by reducing gas speed and pressure, increasing the bypass valve area, and increasing friction force of the pig.


## 6. Conclusion

A calculation scheme using MOC to solve the equations of gas flow for estimating the dynamics of the bypass pig has been shown. In this model, the backward flow of the gas in the bypass valve and pipe was taken into account, which was shown by a simulation of pigging for a hilly gas pipeline. Parametric sensitivity analysis of pigging in the horizontal gas pipe using a bypass pig was then carried out. Then, RSM was used to study the steady speed of a bypass pig in the horizontal gas pipeline.The results indicate that the steady speed of a bypass pig is primarily determined by the pipe diameter, gas speed in the pipe, bypass area, and the friction force of the pig. Additionally, the speed of a bypass pig is most sensitive to the gas speed in the pipe followed by the bypass area and the friction of the pig.Furthermore, the formula obtained from the results of the RSM simulations can be used to predict the steady speed of a bypass pig in the horizontal gas pipeline. Thus, it could contribute to the design of the bypass pig and the control of pig speed.Last but not the least, the proposed method and solution can be used to predict the speed of a bypass pig, the gas parameters, and the position of the pig after a given time in pigging operation for a hilly or horizontal gas pipeline.



---

*Source: 2047352-2020-07-15.xml*