Simulation Model and Case Study of Drainage Process After Pressure Test of Large Drop Natural Gas Pipeline

The drainage process of a large drop natural gas pipeline after a pressure test is a complicated transient flow process. This process is a gas-phase and liquid-phase flow process connected by a pig, in which the pressure inside the tube, and the flow velocity of gas and liquid, and the movement state of the pig are constantly changing. At the same time, there are also a variety of complicated working conditions such as liquid evaporation and water hammer. Based on the pig transient model, a transient simulation model is established for the upstream gas section and downstream liquid sections of the pipeline in this paper, and the discrete vapor cavity model is used to simulate the drainage process. Taking a large drop pipe section of natural gas pipeline as an example, the paper studied the influences of key parameters such as flow velocity and pressure on the inlet and outlet of the pipeline on the drainage process and analyzed the complicated conditions such as discrete cavity and water hammer in the pipeline during the drainage process. In this paper, the law of pressure variation in the pipe is obtained, and the method of adjusting the inlet and outlet pressure and flow velocity of the pipe section by segmentation is proposed to avoid the occurrence of complex working conditions such as discrete cavity and water hammer.


I. INTRODUCTION
With the continuous expansion of the natural gas pipeline laying area in China, the number of pipelines built in areas with complex terrain and large drop has increased year by year, which has brought many new problems to the pipeline production [1], [2]. And if the operating parameters of the drainage process are not accurately controlled, it will cause serious pipe explosion accidents, such as two pipe explosion accidents in the second west-east gas transmission line [3], [4]. Before the natural gas pipeline is put into production, the pipeline will be filled with water to check the pressure resistance of the pipeline, and drainage work will be performed after the pressure test. In order to The associate editor coordinating the review of this manuscript and approving it for publication was Giovanni Angiulli . drain the water in the pipeline as much as possible, a pig is usually added to the pipeline and then the pig is pushed to drain the water. This process is an extremely complex transient movement because the motion states of the gas section, liquid section, and pig in the pipeline are constantly changing, as shown in FIGURE 1 (a)-(d). Initially, the pig started from a relatively gentle pipe section and passed the uphill section of the pipeline at a non-constant speed. During this period, the residual gas in the pipe, and the gas escaped by the transient flow of the liquid, and the water vapor formed by evaporation will gather at the height of the pipe to form a larger cavity. When the pig is downhill, if the pig speed is less than the liquid velocity, the cavity volume will increase and the pipeline pressure will decrease. On the contrary, if the movement speed of the pig is greater than the velocity of the liquid flow, the pig squeezes the cavity, and  the cavity pressure increases sharply, resulting in the water hammer. It can be seen from the above description that in order to build a model consistent with this process, multiple aspects need to be considered. First, there must be corresponding transient flow models for gas and liquid sections to describe the flow of gas and liquid sections. So far, many scholars have studied the gas-liquid two-phase flow in pipelines, as shown in Table 1. Secondly, a pig model needs to be used to couple the gas section with the liquid section, so that the flow process is more complete. In addition, since cavities may appear in the liquid section of the pipeline in this process, and even the water hammer phenomenon may occur, the drainage process also needs to introduce the discrete vapor cavity model. In this paper, We summarized the researches of many scholars on the discrete vapor cavity model, as shown in Table 2.
As can be seen from Table 1, many scholars have studied and made relevant achievements in the gas-liquid two-phase flow process in pipelines. However, we can find one thing in common is that most studies focus on single-phase flow or gas-liquid mixed flow in pipelines, which is completely different from the model established in this paper. During the drainage process of the natural gas pipeline, the pig was added to separate the gas section from the liquid section. More precisely, the model established in this paper is two single-phase flow processes connected by a pig.
By means of summarizing Table 2, the discrete vapor cavity model has great application in analyzing the complicated working conditions of the pipeline, and the introduction of this model can more completely analyze the drainage process. The drainage process after a pressure test of large-drop natural gas pipelines has already been applied in engineering practice, but based on previous literature surveys, systematic research on this aspect is still insufficient. Therefore, a corresponding drainage model is established in this paper. Taking a large drop pipe as an example, a comprehensive analysis was made of the speed change of the pig, and the pressure change in the pipe, and various unstable states (such as liquid column separation and water hammer) that may occur in the pipe, and corresponding solutions were proposed to verify the accuracy of the model. The rest of this paper is organized as follows: In section 2, a transient analysis model for the drainage process of large drop pipes is established by combining the gas-liquid transient flow model, the pig model, and the discrete cavity model. At the same time, an actual case was introduced in section 3, which mainly analyzed the flow process of the pig, the pressure change in the pipe, and the analysis of the unfavorable working conditions in the pipe, and proposed the corresponding solutions. In section 4, the main conclusions of this paper are summarized from the two aspects of case analysis and model evaluation.

A. MATHEMATICAL MODEL
As shown in Figure 2, it is assumed that gas and liquid cannot be mixed through the pig, so the pipe is divided into two parts by the pig: the upstream gas part and the downstream liquid part. This process is considered to be a constant temperature state, so the flow of gas and liquid must satisfy the mass conservation equation and momentum conservation equation [31]- [33]. Meanwhile, the gas section and the liquid section are coupled with the pig. 1) Gas section transient simulation model Mass conservation equation: Momentum conservation equation: In which: p-gas pressure in the pipeline, Pa; g-gravity acceleration, m/s 2 ; θinclination between the pipeline and the horizontal plane, rad; λfriction coefficient; D-the inner diameter of the pipeline, m; ρgas density, kg/m 3 ; v-gas velocity, m/s; x -pipe length variable, m; t-running time, s. The gas density is determined by the equation of state of the gas p ρ = ZRT , where p is the absolute pressure of the gas (Pa), Z the compression factor of the gas, and T the temperature of the gas (K), R the gas constant(8.314J/(mol·K)).
2) Liquid section transient simulation model Mass conservation equation: Momentum conservation equation: In which: p-gas pressure in the pipeline, Pa; g-gravity acceleration, m/s 2 ; θinclination between the pipeline and the horizontal plane, rad; D-the inner diameter of the pipeline, m; λfriction coefficient; a-water hammer wave velocity, m/s; ρliquid density, kg/m3; v-liquid velocity, m/s; x-running distance, m; t-running time, s. VOLUME 8, 2020 The above is the transient model of the gas section and the liquid section in the pipeline, which can be solved by using the characteristic line method [34]- [36] and coupled with the pig transient equation below.
3) Pig dynamics analysis The pig is mainly affected by its own gravity, friction and the pressure exerted by the upstream gas and the downstream liquid in the pipeline. The pressure at the head of the pig is the pressure from the downstream liquid, and the pressure at the tail of the pig is the pressure from the upstream gas. By establishing the momentum conservation equation of the pig, the pig motion and fluid flow in the pipeline can be coupled [37]- [39].
Transient motion differential equation of the pig: In which: V pig -the velocity of the pig, m/s; m pig -the mass of the pig, kg; P 1 -upstream pressure of the pig, N/m 2 ; P 2 -downstream pressure of the pig, N/m 2 ; F c -the axial contact force between the pig and the pipe wall, N. The Adams-Bashforth mathematical method is used to solve the differential equations of the pig's motion. The key issue in establishing a transient motion model for a pig is how to find the position of the pig at each time step and complete the numerical simulation requirements for tracking the pig. As shown in Figure 3, the pig is located between the grid points i and i + 1, assuming the position of the pig is X P . The pipeline grid unit where the pig is located is further divided into two small grid units, so we temporarily set a movable grid node on the coordinates. Therefore, when the pig moves in the pipeline, the new coordinates of the pig can be obtained by applying formula (6): In which: V k+1 pig -the instantaneous speed of the pig, m/s; Assume that the pig speed is the same as the upstream gas section and the downstream liquid section next to the pig: V t+ t pig = V t+ t l (8) In which: V pig , V g , V l -the speed of the pig, gas, and liquid, m/s Similarly, the tail and head pressure of the pig is also the same as the pressure of the upstream gas section and the pressure of the downstream liquid section: P t+ t l = P t+ t pigb (10) In which: P pig , P g , P l -the pressure of the pig, gas, liquid, Pa. If the pig does not move to the next node of the grid, that is, at a position between the two nodes (FIGURE 4), then the speed of point p can be obtained by the following difference formula: In which: V p -the instantaneous speed of the pig, m/s; x-the location of the different nodes, m. The pressure at the end of the pig p tail can be obtained by the following heterodyne formula: In which: p p , p p-1 -the pressure of the pig at the nodes p, p-1, Pa; x-the location of the different nodes, m. As shown in Figure 5, the pig moves to the next node, and after the pressure at the tail of the pig is calculated, the flow parameters of p +1 that can be obtained by the next iteration.
The same method can be used to determine the flow parameters of the pig head: In which: p nose -the head pressure of the pig, Pa; V p , V p +1 , V pig -the speed of the pig at p , p + 1, and the speed of the pig itself; x-the location of the different nodes, m. By solving the liquid transient model and the gas transient model, the head and tail pressures of the pig are obtained. Then the head pressure and tail pressure of the pig are brought into the pig model to calculate the speed of the pig. 4) Discrete Vapour Cavity Model (DVCM) Establishing a discrete vapor cavity model is to determine whether liquid column separation will occur in the pipeline [40]- [46]. As shown in Figure 6, we make the following assumptions: When the steam chamber is concentrated at section i, the incoming flow is Q i,in and the outgoing flow is Q i,out . It is assumed that the height at section i relative to the baseline is z, the piezometric head of the pipeline is H i , and the atmospheric pressure head is H A . Therefore, the absolute head of the liquid in the pipeline is (H i + H A ) − Z i , and the saturated steam head of the liquid is H V = P V γ . The following is to determine whether liquid column separation occurs in section i.
Then there will be no lowpressure vaporization at section i, and the volume of the steam cavity V L = 0. This hydraulic transition process can be calculated according to the water hammer calculation method of a simple pipeline. ( Then low-pressure vaporization and liquid column separation will occur at section i, and the volume of the steam cavity V L > 0. At this time, the pressure at section i is considered to be equal to the liquid saturated vapor pressure, that is, The volume increment of the steam chamber during this calculation period t is: In which: t-interval time, s; Q i,in -Calculate the inlet flow at i at the beginning of the period, m 3 /s; Q i,out -Calculate the outlet flow at i at the beginning of the period, m 3 /s; Q Pi,in -Calculate the inlet flow at i at the end of the period, m 3 /s; Q Pi,out -Calculate the outlet flow at i at the end of the period, m 3 /s.
If V L t > 0, it indicates that the steam chamber is still in the development and expansion stage, and the next time period is calculated.
If V L t ≤ 0, it is considered that the steam chamber has collapsed and the two separated water columns are instantly bridged.

B. MODEL SOLVING STEPS
During the drainage of the simulated pipeline, the pipeline is divided into two parts. The first part is the gas part from the inlet of the pipeline to the tail of the pig, and the second part is the liquid part from the head of the pig to the outlet of the pipeline.
In the first step, the gas section equation is solved to obtain the gas pressure immediately adjacent to the tail of the pig. Then, the liquid section equation is solved to obtain the liquid pressure immediately adjacent to the head of the pig.
In the second step, the dynamic analysis of the pig is completed, and the pig head pressure and the pig tail pressure obtained in the first step are substituted into the pig transient motion model, and the Adams-Bashfor method is used to obtain the speed of the pig and the differential method is used to obtain the new position coordinates of the pig.
When the calculation node is located at the high point or inflection point of the pipeline, the discrete vapor cavity model is used for calculation. The flow chart is shown in FIG-URE 7.

A. BASIC PARAMETERS OF THE PIPELINE
A large drop pipe section is introduced as a practical case in this paper, as shown in FIGURE 8, four special position points on the pipe section are taken as observation points. The section along the line is mostly mountainous, and the terrain is undulating. The entrance of the pipe section is located at an elevation of 2290.94 meters. The length of the line is 6935.1 meters, the highest point is 2519.53 meters, the lowest point is 2140 meters, the maximum slope is 24.32 • , and the pipe diameter is 1016mm. The equivalent roughness of the pipeline is 0.1mm.
The detailed data along the pipeline are shown in Table 3. The pig used in the simulated section is a straight plate pig and its main data are shown in Table 4.
In addition, this pipe section uses water as the pressure test medium. The water supply source is clean (the total suspended solids should not be greater than 50mg/L) and noncorrosive (PH value is 6 ∼ 9). The physical parameters of the water used are shown in Table 5.
And the kinematic viscosity of the gas section behind the pig is 0.000015m 2 /s.

B. INITIAL STATE OF THE TUBE
Before the pipeline is drained, the pressure distribution of the pipeline is shown in FIGURE 9.
Before the drainage operation, the pipeline is completely filled with water and is in a full flow state. As can be seen from the comparison of FIGURE 9 and FIGURE 8, the pressure at     In order to explore the change law of the pig's moving speed with time, it is assumed that the inlet pressure is 3.5MPa and 4MPa, and the outlet flow velocity is controlled to be 0.8-2.2m/s, and the speed interval is 0.2m/s. The relationship between the running time of the pig and the outlet velocity is shown in FIGURE 10. It can be seen from FIGURE 10 that as the flow velocity of the outlet increases, the running time of the pig gradually decreases, indicating that the higher the flow velocity of the outlet, the greater the speed of the pig. At the same time, under 3.5MPa and 4MPa pressure conditions, the operation curves of the pigs almost coincide, indicating that the operation speed of the pigs is independent of the inlet pressure. Here, when the inlet pressure is 3.5MP and the outlet flow rate is 1.2m/s, the change curve of the pig's moving speed with time is shown in FIGURE 11.
It can be seen from FIGURE 11 that in the initial stage of the drainage process, the pig in the pipe vibrates, which is because the initial conditions in the pipe are not very consistent with the relevant parameters during the pipe operation, such as the pressure difference between the head and tail of VOLUME 8, 2020 the pig is very big or the flow velocity of gas and liquid is not consistent. The oscillating process can consume the energy inside the pipe so that after a period of time the liquid, gas, and pig in the pipe can reach a new stable state. And the maximum value of pig speed oscillation occurs when the movement time is the 30s, the speed value is 2.14m/s, and the minimum value occurs when the movement time is the 40s, the speed value is 0.82m/s, and the vibration amplitude reaches 1.32m/s. In the subsequent pigging movement time, the change range of its movement speed is becoming smaller and smaller. At about 480s, the speed of the pigging is basically maintained at 1.5m/s, but the speed value will fluctuate slightly at different times.

2) PRESSURE ANALYSIS AT SPECIAL POINTS
In order to study the change of pressure in the pipeline under the conditions of fixed initial pressure and outlet flow rate, the boundary conditions of inlet pressure of 3.5 MPa and pipeline outlet flow of 1.2 m 3 /s are taken as an example, and the process of pressure change with time at each special point is studied. FIGURE 12 shows the change of pressure in the tube with time at position point 1. As can be seen from the figure, the lowest pressure at this position occurs at the beginning of the drainage process, which is about 0.8 MPa. Then, as the pig moves steadily forward, the liquid on the left side of point 1 continues to flow out, and the pressure gradually rises at this position. Comparing with the topographic map of the pipe section, it can be found that the trend of pressure rise coincides with the trend of the pipe section elevation before the point. When the pig running time reaches 1640 s, the pressure at this point reaches a maximum value of 3.5 MPa.  At the beginning of the operation of the pig, the pressure in the pipe at position 1 showed a regular decreasing reciprocating oscillation process like the pig. As the energy is consumed, the oscillating process gradually disappears, and the duration is approximately the same as the pig oscillating time. It can be inferred that the initial stage of the pigging operation, the oscillating process of the pig and the oscillating process of the fluid in the pipe are synchronized and mutually influential.     shows the pressure versus time curve at the pipe outlet, and the initial pressure at this position is about 5 MPa. When the pig passes the highest point of the pipeline, the point has a maximum pressure of 7.69 MPa, and when the pig passes the lowest point, the point has a minimum pressure of 3.52 MPa. It can be seen from the figure that the pressure change amplitude in the pipe section is basically consistent with the pipe section elevation change. When the pig is in the uphill section, the pressure at the outlet rises. When the pig is in the downhill section, the pressure at the outlet decreases.
In summary, under the premise of fixed inlet pressure and outlet flow rate, with the movement of the pig, the pressure change process of each point on the pipeline is as follows: when the pig moves in the uphill section, the pressure at each point will rise; when the pig moves in the downhill section, the pressure at each point will fall. 2) Controlling the inlet flow rate Based on the study of the relationship between the fluid velocity in the tube and the movement speed of the pig in the previous section, in order to make the movement speed of the pig within a reasonable range, the inlet flow rate of the pipeline gas was selected to be 1.3 m/s. The simulation results of the movement speed of the pig along with the change of mileage are shown in FIGURE 17.
From FIGURE 17, we can see that the speed of pig motion fluctuates greatly in the whole simulation time. When the pipeline mileage is about 2700m, the pig motion appears the phenomenon of cycling. In this regard, we have explained as follows: At the 743m mileage, as the pig entered the uphill stage and the hydrostatic pressure of the liquid column was constantly reduced, the running speed of the pig began to increase gradually. When it reached the first high point of the pipeline, the pig speed also increased to 4.69m/s. Then the pig went downhill. Due to the large pressure in the liquid section in front of the pig and the insufficient pressure in the gas section behind the pig, the speed of the pig dropped sharply, which caused the pig to retreat. The maximum backward speed of the pig was −0.65m/s. Before reaching point 2, the pressure of the pig's head and tail must be constantly changed to keep the gas pressure and liquid pressure in a balanced state as much as possible. During this time, the pig will move back and forth until the pig moves to point 2.
It is worth noting that the instantaneous speed near the outlet of the pipeline in FIGURE 17 reached 21m/s, which indicates that the water hammer phenomenon occurred in the pipeline at this time. The reason for this phenomenon is that when the pig moves back and forth before reaching point 2, the liquid on the left side of point 3 flows slowly, but the liquid on the right side is continuously lost due to gravity, causing the pressure at point 3 to gradually decrease. When the pressure drops to the saturated vapor pressure, the liquid at point 3 begins to evaporate and vaporize. After a certain period of time, a cavity will be formed at this point. When the pig passes point 3, the cavity created here also moves downstream. With the decrease of the pig's moving speed in the last downhill section, the pig began to squeeze the steam cavity. When the pressure reached a certain value, the steam cavity collapsed and quickly closed. The pig's speed increased sharply and eventually hit the front liquid section forms a water hammer and there is a danger of tube explosion. Here, the pressure curves of point 2 and point 3 with time are shown in the following figures. The change of pressure at position 2 with time is shown in FIGURE 18. Before the pig reaches this point, the pressure here is always in a high-pressure state, and the pressure peak is about 4 MPa. And the pressure value reciprocates with the change of the pig's moving speed. When the pig passes through the position, the pressure inside the pipe becomes the pressure of the gas section and continues to decrease, maintaining at 2.6 MPa or more.  shows the pressure change process with time at point 3. It can be seen from the figure that after the pig moves to the downhill section and starts to do reciprocating motion, the pressure at point 3 starts to gradually reduce, and the pressure reduction process lasts for about 1000s until the saturated vapor pressure of the liquid at this temperature is reached. When the pressure is lower than the saturated vapor pressure, it is considered that the pressure in the cavity will not decrease any more, and it will be kept as the saturated vapor pressure of the liquid. As the pig passes through point 3, the pressure value at point 3 will become the pressure value of the gas section.
Based on the above analysis, the main reason for the water hammer is that when the pig moves in the first downhill section, a cavity is formed due to the difference in the flow velocity of the upstream and downstream liquids at the position point 3. Therefore, as long as the reciprocating oscillation of the pig is solved, the problem of the water hammer can be solved.
In order to solve the above-mentioned problem of the reciprocating motion of the pig and the water hammer problem, the method of controlling the boundary condition in sections is adopted to achieve the purpose of controlling the moving speed of the pig. The specific scheme is shown in Table 6. After the pig is moved to the position of 3810.6 m, the inlet flow rate is set to 0 m/s in order to make full use of the remaining pressure energy of the gas section, while achieving the purpose of reducing the pressure of the gas section and saving energy. In addition, in order to control the liquid flow rate, appropriate back pressure should be added at the outlet. By applying the above-mentioned segmented control scheme, a curve of the pig speed with time as shown in FIGURE 20 is obtained. It can be seen from the figure that through the adjustment of the boundary conditions, although the speed of the pig fluctuates between 4000m and 5000m, the speed of the pig does not show a negative value, and there is no phenomenon of the pig receding during the whole operation of the pig. At the same time, the velocity of the pig at the end of the pipeline is effectively controlled, and there is no water hammer in the whole process.
In addition, we also apply this scheme to the drainage process of the large drop pipeline. Comparing the actual data with the model simulation data, we find that the velocity deviation of the pig is smaller, the maximum deviation of velocity is 0.307% in the mileage of 4000-5000m, and 0.76% at the end of the pipeline, which shows the accuracy of the model. In summary, when controlling the inlet flow rate to control the drainage process, it is possible to prevent the water hammer by adjusting the inlet flow and the outlet pressure in stages.

IV. CONCLUSION
Based on the study of the drainage process of a natural gas pipeline with a large drop, the following conclusions can be drawn in this paper: (1) When controlling the inlet pressure and outlet flow, the inlet pressure of the pipeline does not have a significant effect on the moving speed of the pig, and the outlet flow rate is the main factor affecting the moving speed of the pig.
(2) Under the premise of controlling the inlet pressure and outlet velocity, the pressure change of each point in the pipe is approximately similar to the elevation change before the point. If the pig is in the uphill phase, the liquid pressure in front of the pig is in the rising state; when the pig is moving in the downhill section, the liquid pressure in front of the pig is in the falling state.
(3) When controlling the inlet gas flow rate, if a water hammer occurs in the drainage process, it can be solved by adjusting the inlet flow rate and outlet pressure in stages.
In addition, because the research content of this paper has been verified in engineering practice, it shows the correctness of the drainage model established in this paper. For this model, we think it has the following advantages: (1) The drainage process of a large drop natural gas pipeline is a gas-liquid-solid complex coupling process that uses a gas to push the pig, and the pig pushes the liquid, which is essentially different from the liquid pushing process when the liquid pipeline is pigged. The simulation model of the drainage process of the large drop natural gas pipeline established in this paper is of more practical value.
(2) The simulation model established in this paper can well reflect the complex flow process of liquid-pushed by gas in the drainage process of large-drop natural gas pipelines. The model can be used to analyze the influence of the flow rate and pressure of the pipeline inlet and outlet, the pressure change inside the pipe, the transient movement of the pig, and some other complicated problems such as the liquid vaporization at the higher point and the water hammer. Dr. Azimi has received several National and International awards for his inventions in the field of innovative engineering, such as Intelligent Earthquake Resistant Beam-Column Connectors (SEER-iSPRING) and Intelligent Flood Management Software (i-FLOOD). His latest invention Multi-Functional Green Interlocking Mortarless Concrete Block (LOCKBLOCK) manages to win several international awards, such as the Best American Inventor Award, Gold, and Special Award from SVIIF 2018-Silicon Valley. VOLUME 8, 2020