Inlet pressure simulation of pigging in uphill gas pipeline

. Pipe cleaning is a common operation in the oil and gas industry. In this paper, the governing equation of the pipeline inspection gauge (PIG, lowercase pig is commonly used) speed is combined with the gas ﬂ ow equations. The method of characteristics (MOC) is used to solve the transient equations of gas ﬂ ow. And the process of a pig passing over an uphill section of a gas pipeline is simulated. The results indicate that a pig may get stuck in uphill gas pipeline, due to the coupling of the gas and the pig. Under these circumstances, a higher pressure of the upstream could be helpful for driving the pig in motion. Additionally, the ratio of inlet pressure rise during the pigging process is primarily determined by the inclination of the uphill section. In addition, a formula to predict the inlet pressure during pigging in an uphill pipe is presented. Furthermore, the proposed method and solution can be utilized to predict the speed and position of the pig, as well as the gas pressure and the stoppage of the pig in hilly gas pipelines.


Introduction
Regular pigging for the gas pipelines has become a standard procedure for operators. Generally, a pig is a plug installed in the pipeline to execute certain operations, such as liquid removal, inspection of the pipe and cleaning out debris [1][2][3]. Fluid is a pumped upstream of the pig to push the pig forward. Because of the compressibility of gas and the coupling effect between gas and pig, the speed of pig in gas pipeline may be unstable [4][5][6][7]. Thereby, the prediction of speed and the position of the pig are essential for pigging operators [7,8].
In order to understand the dynamic characteristics of the pig, the fluid-structure interaction (FSI) method can be used to solve the pig motion equation and the gas equation [9][10][11][12]. There have already been some works relating to the dynamics of the pig in gas pipelines. The MOC is efficient in solving one-dimensional gas flow equation, so it is widely used in pigging model [13,14].
The maximum speed a pig achieves from a stoppage in gas pipeline is studied by Honggang and Zheng [15]. In this paper, the gas equations are solved by the MOC. The Runge-Kutta method is employed to address the speed equation of the pig and to solve the ordinary differential equations of the steady state equations of the gas. The dynamics of a pig with a fixed bypass in the gas pipeline have been studied by Hosseinalipour et al. [16]. Mirshamsi et al. presented a dynamic model of a long pig passing through a two-dimensional gas pipeline, and carried out simulation analysis [17]. Jingyuan and Changjun developed a pigging mathematical model coupling with the quasi-steady state flow model [18]. Flow control in natural gas and liquid pipeline were considered by Solghar [19].
The above pigging models mainly simulate the pigging process in horizontal or small-dip pipelines. In these pigging models, the friction of gas flow is considered as a scalar. For instance, the change of its direction generated by the backward flow of the gas is not considered. Thus, the simulation of pigging for hilly gas pipelines would be difficult for the pigging models.
In the pigging operations for hilly gas pipelines, occasionally the pig will get stuck in the pipeline, which can be identified by the increase of upstream pressure. At present, the operators tend to attribute this phenomenon to the increase of the resistance between the pig and the pipe wall, such as the corrosion of pipe, bends, welding lines, pipe deformation and other reasons. Nonetheless, it seems that very few researches would pay attention to the coupling of the gas and the pig in the hilly gas pipeline. Actually, the coupling of the gas and the pig would lead to a stoppage of the pig in the uphill gas pipe.
It seems that very few calculations or simulations focus on the pigging in hilly gas pipelines. This paper deals with the pigging model of a conventional pig moving through a hilly gas pipeline. In the model, the gas equation is solved by MOC method and the speed equation of pig is solved by Runge-Kutta method. Then, the process of a pig moving through an uphill gas pipeline is simulated. The results show that the ratio of the inlet pressure rise, during a pigging in an uphill gas pipe, is mainly determined by the inclination of the pipeline. Later, an empirical formula is presented to predict the inlet pressure of a gas pipeline with uphill sections during the pigging operation.
2 Mathematical modeling 2.1 Pig dynamic equation Figure 1 shows the forces acting on a pig in a twodimensional pipe. The dynamic equation of the pig can be written as follows [15]: In this equation, v pig is the velocity of the pig; m refers to the mass of the pig; F fp denotes the friction force of the pig. The driving force F P is derived from the pressure difference between the front and back of the pigging device. The pressure difference is calculated by the upstream and downstream flow dynamics in each calculation step.
Typically, a two-dimensional pipe is represented by elevation icons, so it can be discretized into a series of points in the form of elevation vs. distance. Thus, sinu in the equation (1) of each point can be expressed by the adjacent points. At each time step, the inclination parameter sinu of the current pig position can be obtained by the interpolation of the adjacent points. Subsequently, the speed and position of the pig can be solved from equation (1) by utilizing the Range-Kuta method. Additionally, the inclination parameter sinu in the gas equations can be calculated in the same way.

Gas flow model in hilly pipeline
The unsteady flow dynamics can be modeled based on the fundamental fluid dynamic equations as below [13][14][15]20,21]: where, u, p, r, g, x and t refer to velocity, pressure, density, gravity parameter, distance and time, respectively. In addition, notation u is the angle of the pipeline, A denotes the area of the pipe, S means the pipe perimeter, q is the rate of the heat inflow, g refers to the ratio of specific heat, and the friction force per unit pipe length is represented by F f . In the hilly gas pipelines, there would be an occasion that the gas flows backward, which causes the friction force F f to reverse. Therefore, the sign function of velocity sgn(u) should be added before the friction. The friction factor and the friction force per unit pipe length are provided respectively as below [22]: where, d, k, f, and Re are the diameter of the pipe, pipe wall roughness, friction factor, and Reynolds number, respectively. The solution of gas equations by using MOC is detailed in the Appendix A.

Initial and boundary conditions
Typically, the downstream gas pipeline is relatively long, and its outlet is connected to a tank or other pipeline. In this way, the outlet pressure is considerably consistent when the pig stops in the gas pipeline for a short time. Hence, the boundary condition of the constant outlet pressure and constant flow rate at the inlet is used, which stimulates the release of a stuck pig by increasing the upstream pressure. The assumption is made only for simplicity and would bring some errors when the pig is close to the outlet. It is assumed that the upstream and downstream flows are completely coupled by the pig. Therefore, the flow velocities at the tail and nose of the pig equal to the speed of pig [13][14][15]. The steady state momentum equation (3) and energy equation (4) for the gas flow can be transformed to ordinary differential equations, by assuming ∂/∂t = 0. Now the steady state equations can be obtained: The initial fluid variables u, p, and r for both upstream and downstream gas flows can be calculated by solving equations (7-9) with the use of the Runge-Kutta method.

Numerical solution
There are two parts of the pipeline, including the one in front of the pig and another one behind it, so as to facilitate the process of pigging in the gas pipeline [13][14][15]. The dynamic equations for the gas flows in downstream and upstream can be addressed to gain differential pressure between the pig's tail and nose. The Runge-Kutta approach in the next step can be used to solve the pig's speed equation and to gain the pig's new position and speed.
It is important to update the grids on the flows' downstream and upstream to calculate the parameters of gas as the pig moves across one or more grids in the step of t i . Later on, to calculate the motion of pig at the time step of t i+1 , the differential pressure at the pig's tail and nose can be derived. The calculations can be repeated till the time step reaches the end or the pig reaches a certain position in the pipeline [13][14][15].

Simulation of pigging in uphill pipeline
The values of the parameters are shown in Table 1. A pipeline curve with an inclination section of 27.5 degree is adopted in the simulation, which is figured in Figure 2.
The pig speed of the calculation is shown in Figure 2, which indicates that the pig stops and moves backward when it gets to the uphill section. After hesitating for several times, the pig finally gets to a middle position of the climbing section, and then starts to accelerate. When the pig passes over the uphill segment, a maximum speed of approximately 17 m/s can be achieved.
The inlet pressure, compared with the pig speed, is presented in Figure 3. It can be seen that the inlet pressure increases significantly to drive the pig through the uphill  section. After the pig passes the uphill section, the inlet pressure is then reduced to the normal level. The backward movement of the pig is also shown in Figure 3. Within 60 to 70 s, the pig moves backward at a low speed of about 0.2 m/s. During the pigging, the pressure on the pig tail and nose, the inlet pressure and the pressure difference between the front and rear of the pig are indicated in Figure 4. It can be seen that when the pig moves to the uphill section, the gas pressure at the front of the pig increases due to the compression generated by the pig. Additionally, when the gas in the inclined pipe stops flowing, the pressure rise is more obvious due to the action of gravity. As a result, the pressure difference at the front and rear of the pig reverses, which means the pressure at the front of the pig is much higher now. In this way, as shown in Figures 2 and 3, the pig stops quickly after starting. After hesitating for approximately 70 s, the pig finally gets to a middle position of the climbing section, and then moves smoothly.
The distributions of gas parameters during the pigging are shown in Figure 5. It can be seen in Figure 5A that the gas velocity is coupled with the speed of the pig. As the pig moves at a high speed, the gas flow rate increases accordingly. Additionally, as the pig climbs the uphill segment during 60 ∼ 120 s, the gas pressure rises significantly, which is shown in Figure 5B. When the pig passes through the uphill section, the gas pressure later returns to normal.
The parametric sensitivity analysis of pigging in the uphill segment is then carried out. As shown in Figure 6, the following parameters have little effect on the ratio of inlet pressure rise: mass of the pig, friction of the pig and the pipe, pipe diameter, gas pressure, gas speed and the length of the uphill. The ratio of inlet pressure rise during the pigging process is mainly determined by the inclination of the pipe and requires the uphill pipe to exceed a certain length.

Calculation of inlet pressure rise generated by a stoppage
A series of pipes with different inclination angles (10 ∼ 90 degrees), as shown in Figure 7A, is utilized to calculate the ratio of inlet pressure rise. Using the parameters listed in Table 1, the inlet pressures during the pigging are shown in Figure 7B. The minimum length of the uphill pipe and the ratio of the inlet pressure rise, as calculated from the results of the pigging simulations, are fitted to the formulas as follows:     (10) and (11) are compared in Figure 8, which indicates a good agreement. Now, to predict the ratio of inlet pressure rise generated by an uphill segment of gas pipeline, the following steps can be used: to determine whether the inclined pipe exceeds the minimum length calculated by the equation (10); then to use equation (11) to calculate the pressure increment. It should be noticed that the inclination of the pipe determines the ratio of inlet pressure rise during the pigging process. Therefore, the increase in the gas pressure in the high-pressure pipe is more pronounced than in the low-pressure pipe. Last but not least, as the boundary condition of the constant inlet flow rate and constant outlet pressure is adopted in the above simulations, the formula presented would bring some errors when the pig is close to the outlet of pipeline.

Conclusion
A pigging model using FSI to estimate the dynamic behavior of the pig has been shown. The process of pigging in a hilly gas pipeline is also simulated. The inlet pressure rise during pigging in an uphill segment of gas pipeline is studied.
The results show that the pig gets stuck in the uphill segment of the pipe, due to the coupling between the gas and the pig. In this condition, a higher pressure of the upstream would be needed to pull the pig through the uphill segment. The ratio of inlet pressure rise, during a pigging in an uphill gas pipe, is mainly determined by the inclination of the pipe. The formula presented can be utilized to predict the inlet pressure of a gas pipeline with uphill sections, and to determine whether the pig passes through a particular uphill section of pipeline.
In addition, the proposed method and solution can be used to predict the gas pressure, pig speed, the stoppage of pig as well as the position of pig in pigging operation for a hilly pipeline. Appendix A: Solution of Gas Equations using MOC MOC can effectively transform the partial differential equations of gas flow into ordinary differential equations that can be solved numerically. The solution steps are shown below [13][14][15].

Nomenclature
Equations (2)(3)(4) can be rewritten in the following form: where, : The nonlinear hyperbolic partial differential system of equation (12) can be transformed into ordinary differential equations integrated by the finite differences. Matrix A has 3 real eigenvalues l: In which c refers to the sound speed. The compatibility equations are obtained by multiplying the system given by the eigenvectors. The eigenvectors of matrix A are: For each pair of l and y, equation (12) can be rewritten in the form: By writing equation (12) along the characteristics line, now we can obtain the compatibility equations: Þur The relationship between the fluid variables u, p, and r at the time step t jÀ1 and at following time step t j . is presented in Figure A1. At the time step t jÀ1 , variables u, p, and r at grid points S, M and R are obtained from the linear interpolation of the data on O, N and L. Subsequently, the gas flow parameters at point P can be derived from the previous calculated grid points S, M and R.
Equations (14)(15)(16) are integrated along the corresponding characteristic line dx/dt to obtain the desired variables. From linear interpolation, equations (17)(18)(19) can be obtained. In these equations, X will be replaced by the desired calculating values, including u, p, or r.
According to the equations (14-16), we get: where, The space step, Dx, and the time step, Dt, are chosen under the stability condition [22].