Open Access
This article is

- freely available
- re-usable

*Processes*
**2019**,
*7*(1),
7;
https://doi.org/10.3390/pr7010007

Article

Formation Mechanism of Trailing Oil in Product Oil Pipeline

Petroleum Engineering School, Southwest Petroleum University, Chengdu 610500, China

^{*}

Author to whom correspondence should be addressed.

Received: 7 November 2018 / Accepted: 17 December 2018 / Published: 25 December 2018

## Abstract

**:**

Trailing oil is the tail section of contamination in oil pipelines. It is generated in batch transportation, for which one fluid, such as diesel oil follows another fluid, such as gasoline, and it has an effect on the quality of oil. This paper describes our analysis of the formation mechanism of trailing oil in pipelines and our study of the influence of dead-legs on the formation of trailing oil. We found that the oil replacement rate in a dead-leg is exponentially related to the flow speed, and the length of the dead-leg is exponentially related to the replacement time of the oil. To reduce the amount of mixed oil, the main flow speed should be kept at about 1.6 m/s, and the length of the dead-leg should be less than five times the diameter of the main pipe. In our work, the Reynolds time-averaged method is used to simulate turbulence. To obtain contamination-related experimental data, computational fluid dynamics (CFD) software is used to simulate different flow rates and bypass lengths. MATLAB software was used to perform multi-nonlinear regression for the oil substitution time, the length of the bypass, and the flow speed. We determined an equation for calculating the length of the trailing oil contamination produced by the dead-leg. A modified equation for calculating the length of the contamination was obtained by combining the existing equation for calculating the length of the contamination with new factors based on our work. The amounts of contamination predicted by the new equation is closer to the actual contamination amounts than predicted values from other methods suggested by previous scholars.

Keywords:

pipeline; transportation; trailing oil; CFD; dead-leg; contamination## 1. Introduction

When two different liquids, such as diesel oil and gasoline, are moved in sequence through the same pipeline, there is some mixing of the two in the process. A considerable amount of oil contamination is caused by the presence of the trailing oil, which is the second fluid to move through the pipeline, in the fluid that moved first through the pipeline, and the contamination by the trailing oil on the quality of the initial oil is often overlooked. Properly controlling and removing the trailing oil contamination can improve the quality of the refined oil and increase its economic value. There are two main reasons for the formation of trailing oil contamination. One is the effect of the laminar flow boundary layer, and the other is the outflow of the preceding batch that remains in the dead-legs. Mass transfer in the bottom layer of the laminar flow restricts the change in the velocity distribution caused by the viscosity difference between the old and new batches, which leads to contamination of both two batches [1,2]. In the batch transportation of refined oil, the boundary layer formed by the preceding batch will be slowly mixed into the next batch to form trailing oil contamination.

There are many valve chambers and pump stations in pipelines for long-distance transportation of refined oil. When the oil products pass through these valve chambers, dead-legs are formed (Figure 1). When a new batch of oil flows through the dead-leg, which contains oil from the preceding batch, first due to gravity, the latter batch pushes the preceding batch out of the dead-leg. The two kinds of oil products will form a “lock exchange” flow [3] at the mouth of the dead-leg, which leads to contamination. Initially, convection is the main factor. When half of the preceding batch in the dead-leg is replaced, diffusion transfer gradually begins to play the main role. Under the effect of turbulent diffusion, the second batch gradually flows into the dead-leg, and the preceding batch is gradually replaced. The time of the turbulent diffusion stage is longer than the convection stage. The preceding batch flowing from the dead-leg will form trailing oil contamination in the main pipe run.

In the 2982 km Keystone pipeline from Canada into the U.S. [4], there are 39 pumping stations in the NPS30/36 pipeline. Bypasses in pipelines lead to contamination. For example, the amount of contamination increased by 37.5% in the first pump station of the Keystone pipeline with its four bypasses, and an additional 18.3% contamination was added after passing through the second pump station.

Long distance sequential transmission of oil products produces a considerable amount of mixed oil, and the treatment of this contaminated oil is expensive and reduces the economic benefits of oil [5]. Many scholars have studied the problem of contamination in batch transportation of refined oil from the perspective of both basic theory and experiment. Taylor et al. [6] found that when the contaminated oil slowly passes through a small-bore pipe, it will diffuse under the combined action of molecular diffusion and velocity change. Taylor et al. suggested that the change of velocity is very important in the axial diffusion of matter, and they proposed the Fick model to calculate the degree of axial diffusion. Aunicky [7] pointed out that there were certain defects in the Taylor study, and that the diffusion coefficient was not a constant value. Krantz et al. [8] modified the Taylor analysis method. They found that when the fluid approached the laminar flow area, the axial mixing increased rapidly, and the roughness would also lead to a small amount of axial contamination. Austin and Palfrey suggested that at a high Reynolds number, Taylor’s analysis would have errors due to the influence of the trailing oil. Austin et al. [9] also found that the turbulence model in Taylor’s analysis at a low Reynolds number ignored the deviation caused by the effect of viscosity near the wall. They proposed an equation with empirical constants for calculating the length of interfacial contamination. Scott et al. [10], through extensive experimental analysis, found that diffusion transfer is the main factor leading to oil mixing. Levenspiel [11] presented the idea that in a turbulent pipe, molecular diffusion does not cause any appreciable mixing. Deng [12] developed equations for a two-dimensional finite difference method that predicted the “tail effect” observed earlier by Austin [9]. Botros [13] proposed a non-mechanical separators model for predicting contamination in batch transportation. The governing equation of the model is a nonlinear boundary value problem, which is solved by coupling the finite element method with Newton method. Rachid et al. [14,15] proposed a new mixing calculation model. They found that the flow direction had no effect on the mixing volume with the same change in pipe diameter. The above research shows that the viscosity difference is the main factor that causes the tail of contamination, but these studies do not consider the special situations, such as dead-legs in a valve chamber, and are not closely integrated with practical engineering.

Patrachari et al. [16] and Botros et al. [17] studied the additional contamination problem in a main pipe run due to dead-legs. Their work shows that in a pump station with four pumps, the bypass line of each pump will form a dead-leg, and the four dead-legs will result in an additional 400 m to 420 m of contamination due to diffusion. They also found that the contamination formed by dead-legs was caused by the fluid stagnating in the bypass entering the main pipe that runs through the mouth of the dead-leg. There are two mechanisms for this. First, gravity causes the fluid stagnating in the dead-leg to flow out and contaminate the main flow, and then the turbulent mixing and diffusing effect of the slight infiltration into the dead-leg at the mouth of dead-leg leads to mixing. The first mechanism accounts for about half of the outflow volume. However, the second mechanism takes a longer time to discharge the same volume of fluid. Jamalabadi et al. [18] studied the effects of injection angle, density ratio, and viscosity on droplet formation in a microfluidic T-junction. The results show that contact angle, slip length, and injection angles near the perpendicular and parallel conditions have an increasing impact on the diameter of generated droplets, while flow rate, density ratios, viscosity ratios, and other injection angles had less effect on the diameter of the droplets. However, Patrachari et al. did not modify the traditional formula for calculating contamination content in the trailing oil caused by the dead-legs.

An extensive literature exsits on the mixing of different batches in pipelines. However, previous scholars have seldom studied the influence of dead-legs in pumping stations or valve chambers on the amount of oil mixing, especially mixing of trailing oil. This paper describes how we analyzed the mechanism for the formation of trailing oil in dead-legs, and the effect of trailing oil on the amount of contamination in oil. Through simulation analysis, we determined the best flow speed and the dead-leg length to reduce contamination during the delivery of refined oil. In this paper, we suggest a correction to obtain an equation for calculating the length of the contamination and the influence of the trailing oil. Using engineering data, the contamination predicted by the corrected equation is closer to the actual contamination than that predicted by other equation.

## 2. Method

First, we assume that the convection–diffusion process is the most basic factor for the formation of contamination [19,20]. For the two-dimensional convection–diffusion mechanism, the axial diffusion of mixing is caused by uneven speed, and the radial diffusion of mixing due to concentration difference. The diffusion effects tend to make the concentrations more uniform. The theoretical formula [21] used to calculate the contamination length in the symmetric range of concentration is:
where C is the contamination length (m), L is the length of pipeline (m), d is the pipe internal diameter (m), Re

$$C=4\alpha Z\sqrt{dL}\sqrt{\frac{3000+60.7{Re}_{pj}^{0.545}}{{Re}_{pj}}}$$

_{pj}is the average Reynolds number of two kinds of oil, and α is the correction coefficient. The thicker the laminar flow is, the greater the contamination content will be. Z is an integrated variable corresponding to the cutting concentration of contaminants. In the symmetrical concentration range, the mixing length derived from the diffusion theory is related to the flow regime, the pipe diameter, and the length of the mixing interface.Next, we calculated the contamination length by using the Austin–Palfrey formula [9]. Generally, the mixing length in the range of 99% to 1% of oil concentration is regarded as the contamination length. When the pipe diameter and pipe length are fixed, the Reynolds number has different effects on contamination length for two different conditions. The Reynolds number and the dimensionless quantity C

^{2}/Ld for both conditions are linear in the log-coordinate system. The first condition is when the Reynolds number is larger than the critical Reynolds number for contamination. For this condition, the formula for calculating the contamination length is:
$$C=11.75{d}^{0.5}{L}^{0.5}{Re}^{-0.1}$$

When the Reynolds number is less than the critical Reynolds number of contamination, the equation is:

$$C=18384{d}^{0.5}{L}^{0.5}{Re}^{-0.9}{e}^{2.18{d}^{0.5}}$$

The critical Reynolds number is:

$${Re}_{j}=1000{e}^{2.72{d}^{0.5}}$$

The flow state of these fluids for the two different conditions is distinguished by the critical Reynolds number Re

_{j}, and the contamination characteristics of the oil for the different conditions can be determined. Therefore, depending on which of the conditions applies, the proper equation is selected to calculate the contamination length. Our analysis shows that the equations do not take into account the influence of trailing oil on the contamination length. Therefore, after the simulation and data analysis, we used MATLAB software (MATLAB 8.3, The MathWorks, Natick, MA, USA, 2014) to perform multi-nonlinear regression for the oil substitution time, the length of the dead-leg, and the flow speed to calculate the contamination length [22]. We were able to correct the existing equation to bring its solutions to better fit the actual data.## 3. Model

We simulated the contamination situation in the batch transportation of oil in the Lan-Cheng-Yu pipeline. Table 1 shows the main parameters that we obtained from actual field data.

In the process of batch transportation, trailing oil contamination forms when the preceding batch sticks to the pipe wall and is carried away by the second batch. Therefore, the formation of trailing oil contamination is greatly affected by the viscosity of the oil adhering to the wall, especially considering the influence of the laminar bottom layer. In Fluent software, the wall function cannot be selected for a simulation [23]. The near-wall model method is more suitable for simulating the model wall formed by the trailing oil [24]. For the formation of the trailing oil layer, we adopted the volume of fluid (VOF) model in the multiphase flow model, and we used a structured hexahedron for the mesh [25,26]. We selected the velocity-inlet boundary condition and set the exit boundary as the outflow condition. The no-slip boundary condition is applied at the wall.

We used the commercially available computational fluid dynamics (CFD) software ANSYS FLUENT 14.5 (ANSYS 14.5, ANSYS.inc., Pittsburgh, PA, USA, 2012) to simulate mixing in a pumping station. The pump of the pumping station was equipped with a bypass pipe with a structure similar to Figure 2. The length between the check valve and the mouth of bypass was 2 m. The pumping station had a 508 mm pipe diameter, and the pipe diameter of the bypass was 168 mm.

According to the calculation results, the following batch had flowed through two-thirds of the cross-section of the pipeline in 4 s, so we took the volume fraction of the oil at 4 s for the grid independence verification and the step independence verification [27,28]. We analyzed the volume fraction of oil in Section 3, which is shown in Figure 3.

A grid independence verification was conducted for four grid numbers, including 603,042, 1,532,451, 2,034,861, and 3,021,581, and a step length independence verification was conducted for four time steps of 0.0005 s, 0.001 s, 0.01 s, and 0.05 s. When the grid number changed from 600,000 to 3 million, the oil volume fraction changed very little with the increase of the grid number, indicating that these four grid numbers had little influence on the calculation results (see Table 2 and Figure 4).

It can be assumed that the grid number of 600,000 reached grid independence. Therefore, the grid number of 600,000 was taken as the calculation grid. As the step length decreased, the change in the oil volume fraction became smaller and smaller. When the time step was 0.001 s, the oil volume fraction could be considered to be approximately stable. If the step size was too small, the calculation cycle sharply increased. If the step size was too large, the calculation accuracy was affected. For a comprehensive consideration, the time step size for our work was 0.001 s.

## 4. Simulation Results and Discussion

#### 4.1. Analysis of the Mechanism of Dead-Leg Mixing

Figure 5a shows a series of contamination concentration distributions at a flow rate of 1.4 m/s for different times. It shows the process of the following batch (diesel oil) entering the dead-leg. Because of the density difference, the diesel oil in the main pipe run moves to the closed end of the dead-leg and then returns to the mouth of dead-leg. This process, which is called “gravity flow,” takes about 26 s. In the first 13 s, it moves to the closed end, and in the last 13 s, it turns back to the mouth. The velocity of the gravity flow is 0.15 m/s.

The Reynolds number calculated from the arithmetic mean of the viscosity of the two fluids is 259,894.03, which shows that the outcome flow in the pipe is turbulent [29].

Figure 5a shows that at 20 s, the advance gravity flow height at the closed end was about 0.056 m, which was determined by the geometric structure relative to the pipe diameter of the dead-leg. In this case, the ratio between the wave characteristic height and the pipe diameter was 0.33, and the Froude number was 0.91. The non-viscous, frictionless, non-mixing gravity current velocity was 0.21 m/s. The flow rate of 0.15 m/s was about 44% less than the ideal flow rate at the same gravity flow height. There are three reasons for this: (1) Both gasoline and diesel oil have a significant viscosity, so the fluid is not non-viscous. (2) There are obvious signs of mixing at the interface between the two oils, where they exchange momentum, leading to a decrease in the velocity of the leading batch. (3) When gasoline enters the main run, hydraulic fluctuation occurs at the mouth due to the high flow rate of diesel oil in the main run. Without the above three factors to reduce the velocity of gravity flow, the gravity flow characteristic height would reach half of the pipe diameter and flow at a speed of 0.21 m/s.

When diesel oil flows into the dead-leg from the junction, the same volume of gasoline flows out of the dead-leg and into the main run. This flow is called the ”lock exchange” flow. Because the flow rate of gasoline is small and the main diesel flow rate is large, trailing oil will be formed at the junction, especially when gravity plays a dominant role.

After 30 s, the dominant effect of the gasoline outflow changed from gravity to turbulent diffusion, and the gasoline outflow from the dead-leg will form a turbulent mixing-like flow at a distance from joint of 2–3 times the pipe diameter. This was caused by the interfacial shear force between gasoline and diesel oil. Therefore, more contamination appeared in the dead-leg, and the concentration distribution of contamination was increased (see Figure 5b).

The gas volume fraction at Section 8 (at 1 m from the junction) began to decrease at 8 s (Figure 6). Since the flow rate of gravity flow in the dead-leg was 0.15 m/s, the time of diesel oil flow from the junction to the Section 8 was about 5 s, and the remaining 3 s was the time from the contact between the two kinds of oil to the time they reached the junction.

At 30 s, when the gravity flow returned to the junction from the closed end, about half of the gasoline had formed a lock exchange flow with diesel oil due to gravity, and then it flowed out of the dead-leg, which is consistent with the previous diagram of the concentration distribution of the contamination in the dead-leg. The remaining half of the gasoline took longer to outflow from the pipes, because the mechanism of the flow was turbulent diffusion, which mainly occurred in the joints. Diesel oil slowly penetrated via turbulent diffusion into the dead-leg, where it replaced the gasoline. This is why the contamination interface in the gravity flow stage in the dead-leg fluctuated, while the contamination interface in the turbulent diffusion stage did not.

The movement of the diesel oil drained the gasoline in the pipeline away. Figure 7 showed that after passing through the dead-leg along the conveying direction, there was a small amount of contamination adhering to the pipe wall at the upper end of the main pipe, either in a thin strip, or floating above the diesel oil in a droplet form. These mixtures were formed when gasoline in the dead-leg entered the main pipe under the action of gravity and turbulent diffusion. The trailing oil increased the amount of contamination, so the real amount of contamination was greater than that predicted by theory.

Figure 8 show that because the statistical data started at 1 s, the gasoline in Section 1 of the pipeline had been replaced, so the volume fraction of gasoline in Section 1 had not changed with time. Section 2 was located before the dead-leg, so Section 2 was not filled with gasoline from the dead-leg. Therefore, the volume fraction of Section 2 only reflected the volume fraction of gasoline in the main run. The other three curves in Figure 8 showed a certain regularity in the gentle phase. With an increase in distance along the pipeline, the maximum value of the gentle phase increased, and the slope of the curve increased. These increases were due to the fact that after Section 2, the volume fraction of gasoline at each cross-section was influenced by the dead-leg. The volume fraction of these cross-sections was the sum of the volume fraction of gasoline attached to the pipe wall and the volume fraction of gasoline flowing out of the dead-leg. As the distance increases, the sum of the two increases, increasing the mixing oil content. The slope increases because, due to diffusion, the farther away the cross-section was, the less the influence the dead-leg had. The faster the volume fraction of gasoline decreased, the larger the slope of the curve was.

The oil in the dead-leg flowed out due to gravity, and the two kinds of liquids formed a lock exchange flow at the junction. At this time, the main factor causing the contamination was convective transmission. When about half of the preceding batch was replaced in the dead-leg, the influence of convection was gradually reduced, and diffusion transfer began to play a role. After turbulent diffusion, the following batch gradually flowed into the dead-leg and the liquid was slowly replaced. In these two processes, the time of turbulent diffusion was obviously longer than that of convection, and the forward batch from the dead-leg formed trailing oil in the main pipe run.

#### 4.2. The Influence of Velocity on the Trailing Oil

Figure 9 shows that the higher the flow rate led to the faster the oil replacement rate and the smaller the amount of mixing. Figure 10 shows the relationship between the gasoline volume fraction and time for three different flow rates. The figure shows that there were three stages in the process. In Stage 1, diesel had not yet reached Section 3, which explained the straight line with a value of 1 for the gasoline fraction. In Stage 2, in the initial stage of mixing, most of the gasoline in the pipeline was pushed away by diesel oil, so the volume fraction of gasoline dropped rapidly, and the slope of the curve was very large. The duration of this stage was about 2 s for each flow rate. In Stage 3, the trailing oil formed as gasoline attached to the wall of the pipe. The volume fraction of gasoline in this stage decreased slowly, and the slope of the curve was small.

For the flow rate of 0.8 m/s, Stage 1 lasted about 4 s, but for 1.6 m/s, Stage 1 lasted only about 2 s. Next, at the end of Stage 2, about 40% of the gasoline remained for the flow rate of 0.8 m/s, and only about 5% remained for 1.6 m/s. Finally, in Stage 3, the rate of decline of the gasoline volume fraction was different. The time required for the volume fraction of gasoline to decrease from 20% to 15% was about 1 s for the flow rate of 0.8 m/s, but it was only about 0.4 s for 1.2 m/s. These differences show that in the initial mixing stage, the faster the flow rate was, the faster the diesel oil reached each cross-section, and the faster the oil replacement speed was. This stage was only about 2 s. In the initial mixing stage, the greater the flow rate, the stronger the diesel oil’s ability to carry gasoline. Finally, the faster the flow rate was, the faster the diesel oil carried the gasoline, and less trailing oil was formed.

Figure 11a shows that when the flow rate in a dead-leg varies, the rate of decrease for the gasoline volume fraction in the dead-leg stayed essentially the same. The gasoline in the dead-leg entered the main pipe run mainly because of the lock exchange flow formed by gravity. The diesel oil with higher viscosity entered the dead-leg due to gravity. In the first 20 s, the amount of gasoline entering the main pipe was about the same for the different speeds. From 20 s to 30 s, the main form of the lock exchange flow was still the gasoline entering the main run, but the turbulent diffusion became more important as the diesel entered the dead-leg. After 30 s, nearly half of the liquid in the dead-leg was diesel oil. Turbulent diffusion replaces gravity as the main driving force for gasoline to flow into the main run. At this time, the larger the main flow speed, the less time it took to carry gasoline, and the less important the turbulent diffusion effect with the gasoline was in the dead-leg, even though the carrying capacity of the diesel oil per unit volume of gasoline was unchanged. This made the remaining gasoline volume fraction in the dead-leg increase with the increasing diesel transmission speed in the main run; that is, the oil replacement speed in the dead-leg slowed down.

The gasoline was considered to be completely replaced by diesel oil when the volume percentage of gasoline in the dead-leg was less than 1% [30,31]. Figure 11b shows that when the flow rate was larger than 1.6 m/s, the replacement time of dead-leg oil increased rapidly. The length of the trailing oil formed in the main run increased accordingly, so the flow rate should be kept at about 1.6 m/s.

According to the data in Figure 11b, the relationship between the replacement time and the flow velocity of the dead-leg can be described as:

$$T=345.59{e}^{0.1252v}$$

The simulation and analysis of different flow rates shows that in the main pipe run, faster flow speed led to faster oil replacement rates, shorter contamination length, and smaller contamination content. In the dead-leg, faster flow speed led to slower oil replacement rates, longer trailing oil lengths in the main pipe run, and greater contamination.

#### 4.3. The Effect of the Dead-Leg Length on Trailing Oil

For the system we considered, the diameter of the main pipe was d = 508 mm; the length of the dead-leg was d, 2d, 3d, 4d, 5d, 6d, 7d; and the flow speed was 1.4 m/s. The diameter of the bypass was 168 mm, and the delivery sequence was diesel oil pushing gasoline. When the volume fraction of gasoline in the dead-leg was less than 1%, we considered it to be completely replaced [32,33,34].

Figure 12 shows that the relationship between the length of the dead-leg and the time needed for the replacement of the dead-leg oil product can be described as:

$$T=64.547{e}^{0.5878d}$$

Figure 13 shows that when the length of the dead-leg was larger than 5 times that of the main pipe diameter, the time required for the forward batch to be replaced by the backward batch in the dead-leg increased sharply, which indicated that the effect of turbulent diffusion was still relatively large for this length. Beyond this length, the effect of turbulent diffusion was significantly weakened, and the sample formed a long trailing oil in the main run.

Figure 13 shows that the rate of decrease in the gasoline volume fraction shown in each curve changed back and forth between faster and slower. There were three different trends in these changes. The first was that as time went on, the slope of the curves decreased for each stage. This was due to the flow mechanism of dead-leg gasoline changing from lock exchange flow to turbulent diffusion, which took longer to move the same volume of gasoline out. The second was that with an increase in the length of the dead-leg, the decrease in the rate of the gasoline volume fraction became smaller and smaller. This was because the longer the dead-leg length was, the lower the turbulent diffusion effect on the closed end of the gasoline, and the longer the oil replacement time was. The third was that with an increase in the length of the dead-leg, the time between the changes between faster and slower rate changes became longer and longer. This was because the volume fraction of gasoline represented by the curve referred to the volume fraction of gasoline at Section 8, which was 1 m away from the junction, not the volume fraction of gasoline in the whole dead-leg. The longer the dead-leg length, the longer the time required for gravity flowing back to the section, such that the cycle time between faster and slower changes decreased.

Through the simulation and analysis of different length of dead-leg, it can be concluded that the longer dead-leg led to a slower replacement rate of the oil in the dead-leg, a longer length of trailing oil in the main pipe, and a greater amount of contamination.

## 5. Formula Correction

Our data can be used to obtain the relationship between the length of trailing oil in a 508 mm pipeline for different pipe segments and the influencing factors when diesel fuel was used to push gasoline. Using MATLAB to simulate the oil replacing time, the dead-leg length, and the speed, the following equations were obtained (Table 3):
where T is the time to replace the oil in the dead-leg, V is the flow rate, and L

T = 119.1V + 15.48e

^{0.7756Lm}+ 175.3_{m}is the length of the dead-leg. The determination coefficient R^{2}of the fitting formula was as high as 0.9969, indicating that the formula is highly reliable. Knowing the time required to replace the oil in the dead-leg, the contamination length of the trailing oil, C, produced in the main pipe after passing through a dead-leg can be calculated using:
$$C=TV$$

Because there were often many dead-legs in the station, the forward batch in the first dead-leg inevitably affected the density of oil in the pipeline after re-entering the main pipe, thereby affecting the oil carrying speed and the trailing oil length in the subsequent dead-legs.

Table 4 shows the effect of the number of dead-legs on the length of trailing oil when the density of diesel oil in the rear batch was 842 kg/m
where N is the number of dead-legs. We also simulated the situation of contamination formed via dead-legs with different densities of the rear batch. Figure 14 shows that a higher density of the rear batch slows the decrease in the volume fraction of the forward batch in the main pipe. This shows that a greater difference in the densities between the two kinds of liquids led to faster outflow velocities of the forward batch in the dead-leg, and shorter lengths of trailing oil formed.

^{3}and the density of gasoline in the forward batch was 722 kg/m^{3}. The table shows that with an increase in the number of dead-legs, the average density of contamination decreased, oil substitution time in dead-leg increased, and the length of trailing oil increased correspondingly. The increasing rule was obtained through nonlinear fitting, and the Equation (8) is modified to:
$$C=\left[0.21\mathrm{ln}(N)+0.96\right]TV$$

Figure 14 shows that the volume fraction of gasoline at 6 s to 9 s was less than 1%. The distance between the two interfaces with 99% and 1% forward batch concentration was defined as the length of the contamination. Equation (9) can be modified to yield:

$$C=9\left[0.21\mathrm{ln}(N)+0.96\right]TV$$

According to the data from the Lan-Cheng-Chong pipeline, there are 16 stations along the 1250 km pipeline. The diameter for the Lanzhou-Jiangyou section is 508 mm, the diameter for the Jiangyou-Chengdu section is 457 mm, and the diameter for the Chengdu-Chongqing section is 323.9 mm.

The transportation of the pipeline was analyzed, and the initial throughput of the pipeline was 21,220.021 t/day, and the contamination content at the end point was 334.109 t. The contamination content calculated from the first method’s equation (Equation (1)) was 396.785 t, and the second method’s equations (Equation (2) and Equation (3)) led to 314.415 t. The contamination content of the second method with our correction was 331.067 t, and the relative error was 0.9% (Figure 15).

According to the above comparison, Equations (2) and (3) should be revised for calculating the contamination length considering the length of trailing oil.

When the Reynolds number was larger than the critical Reynolds number of contamination, the formula for calculating the contamination length is:

$$C=11.75{d}^{0.5}{L}^{0.5}{Re}^{-0.1}+9[0.21\mathrm{ln}(N)+0.96]$$

When the Reynolds number is larger than the critical Reynolds number of contamination, the equation becomes:

$$C=18384{d}^{0.5}{L}^{0.5}{Re}^{-0.9}{e}^{2.18{d}^{0.5}}+9[0.21\mathrm{ln}(N)+0.96]V$$

The above equations yield results that are closer to real data, therefore they provide a greater guide for the accurate cutting of contamination, which has practical significance.

## 6. Conclusions

This paper describes our analysis of the formation mechanism of trailing oil in pipelines and our study of the influence of dead-legs on the formation of trailing oil using numerical simulation with Fluent software.

(1) Dead-legs and the oil adhered to the walls, forming a laminar bottom, were the main factors for the formation of trailing oil. There were two stages of trailing oil formation in a dead-leg, a gravity flow stage and turbulent diffusion stage. The turbulent diffusion stage took a longer time and the amount of mixed oil was larger.

(2) The effect of flow velocity on the replacement time of the oil in the dead-leg was opposite to that in the main pipe run. The oil replacement time in the main pipe was negatively correlated with the flow velocity, while the oil replacement speed in the dead-leg was positively correlated with the flow velocity, and the relationship between the two was exponential: T = 345.59e

^{0.1252v}. The longer the oil replacement time was, the longer the mixing length was, and the larger the contamination content was. Because the replacement time of oil in the dead-leg was greatly influenced by the flow rate, the flow rate should be controlled to about 1.6 m/s in order to reduce the contamination content.(3) The length of the dead-leg was exponentially related to the oil substitution time: T = 64.547e

^{0.5878d}. In order to reduce the contamination content, the dead-leg length should be less than five times the diameter of the main pipe.(4) Based on the simulation results, we modified the theoretical formula for calculating the contamination length. The formula includes the influence of the trailing oil formed by the dead-leg on the contamination length, which makes the formula more consistent with real data.

(5) In order to reduce the amount of oil mixing, the flow rate should be controlled and the length of the dead-leg should be reduced. Reasonable removal of the trailing oil can improve the quality of the refined oil and increase its economic value.

## Author Contributions

Conceptualization and Methodology, E.L.; Software, Formal Analysis and Writing-Original Draft Preparation, W.L. and H.C.; Investigation, Resources and Data Curation, S.P.

## Funding

This work was supported by the special fund of Key Technology project of safety production of major accident prevention and control (sichuan-0002-2016AQ, sichuan-0013-2016AQ), open fund project of Sichuan Key Laboratory of Oil and Gas Fire Fighting (YQXF201603) and applied basic research project of Sichuan Province (19YYJC1078).

## Conflicts of Interest

The authors declare no conflict of interest.

## References

- Liu, L.; Han, X. Contaminated products in batch transportation pipeline of finished products and their treatment. Pet. Geol. Eng.
**2005**, 19, 68–69. [Google Scholar] - Cafaro, V.G.; Pautasso, P.C.; Cerdá, J.; Cafaro, D.C. Efficient planning of crude oil supplies through long-distance pipelines. Comput. Chem. Eng.
**2018**, 1–15. [Google Scholar] [CrossRef] - Shin, J.O.; Balziel, S.B.; Linden, P.F. Gravity Currents Produced by Lock Exchange. J. Fluid Mech.
**2004**, 521, 1–34. [Google Scholar] [CrossRef] - Parfomak, P.W.; Nerurkar, N.; Luther, L.; Burrows, V.K. Keystone XL Pipeline Project: Key Issues. Congressional Research Service; Congressional Research Service: Washington, DC, USA, 2011. [Google Scholar]
- Levenspiel, O. How much mixing occurs between batches? Pipe Line Ind.
**1958**, 24, 51–54. [Google Scholar] - Taylor, G. Dispersion of Soluble Matter in Solvent Flowing Slowly through a Tube. Proc. Math. Phys. Eng. Sci.
**1953**, 219, 186–203. [Google Scholar] [CrossRef] - Aunicky, A. The longitudinal mixing of liquids flowing successively in pipelines. Can. J. Chem. Eng.
**1970**, 48, 12–16. [Google Scholar] [CrossRef] - Krantz, W.B.; Wasan, D.T. Axial Dispersion in the Turbulent Flow of Power-Law Fluids in Straight Tubes. Ind. Eng. Chem. Fundam.
**1974**, 13, 56–62. [Google Scholar] [CrossRef] - Austin, J.E.; Palfrey, J.R. Mixing of Miscible but Dissimilar Liquids in Serial Flow in a Pipeline. Proc. Instn. Mech. Engrs.
**1963**, 178, 377–395. [Google Scholar] [CrossRef] - Scott, D.S.; Dullien, F.A.L. Diffusion of ideal gases in capillaries and porous solids. AIChE J.
**1962**, 8, 113–117. [Google Scholar] [CrossRef] - Levenspiel, O. Longitudinal Mixing of Fluids Flowing in Circular Pipes. Ind. Eng. Chem.
**1958**, 50, 343–346. [Google Scholar] [CrossRef] - Deng, S.; Pu, J. Application of convection-diffusion equation to the analyses of contamination between batches in multi-products pipeline transport. Appl. Math. Mech.
**1998**, 19, 757–764. [Google Scholar] [CrossRef] - Botros, K.K. Estimating contamination between batches in products lines. Oil Gas J.
**1984**, 82, 112–114. [Google Scholar] - Rachid, F.B.D.F.; Araujo, J.H.C.D.; Baptista, R.M. The Influence of Pipeline Diameter Variation on the Mixing Volume in Batch Transfers. In Proceedings of the 2002 4th International Pipeline Conference, Calgary, AB, Canada, 29 September–3 October 2002; pp. 997–1004. [Google Scholar] [CrossRef]
- Rachid, F.B.F.; Araujo, J.H.C.D.; Baptista, R.M. Predicting Mixing Volumes in Serial Transport in Pipelines. J. Fluids Eng. Trans. Asme
**2002**, 124, 528–534. [Google Scholar] [CrossRef] - Patrachari, A.R.; Johannes, A.H. A conceptual framework to model interfacial contamination in multiproduct petroleum pipelines. Int. J. Heat Mass Transf.
**2012**, 55, 4613–4620. [Google Scholar] [CrossRef] - Botros, K.K.; Clavelle, E.J.; Vogt, G.M. Interfacial Contamination Between Batches of Crude Oil to Dead-Legs in Pump Station Piping. J. Energy Resour. Technol.
**2016**, 138, 1–8. [Google Scholar] [CrossRef] - Jamalabadi, M.Y.A.; DaqiqShirazi, M.; Kosar, A.; Shadloo, M.S. Effect of injection angle, density ratio, and viscosity on droplet formation in a microfluidic T-junction. Theor. Appl. Mech. Lett.
**2017**, 7, 243–251. [Google Scholar] [CrossRef] - Li, X. Calculation method for length of oil mixtures in product pipelines. Oil Gas Storage Transp.
**2015**, 34, 497–499. [Google Scholar] [CrossRef] - Chen, Q. Calculations on the Mixing Volume of Products Pipeline with Variable Diameter Pipes. Oil Gas Storage Transp.
**1999**, 18, 7–8. [Google Scholar] - Neutrium. Calculating Interface Volumes for Multi-Product Pipelines. Available online: https://neutrium.net/fluid_flow/calculating-interface-volumes-for-multi-product-pipelines/ (accessed on 1 December 2018).
- De Arauro, J.H.C.; Gomes, P.D.; Ruas, V. Study of a finite element method for the time-dependent generalized Stokes system associated with viscoelastic flow. J. Comput. Appl. Math.
**2010**, 234, 2562–2577. [Google Scholar] [CrossRef] - Liu, E.; Lv, L.; Ma, Q.; Kuang, J.; Zhang, L. Steady-state optimization operation of the West-East Gas Pipeline. Adv. Mech. Eng.
**2019**, 11, 1–14. [Google Scholar] [CrossRef] - Menter, F.; Egorov, Y. The Scale-Adaptive Simulation Method for Unsteady Turbulent Flow Predictions. Part 1: Theory and Model Description. Appl. Sci. Res.
**2010**, 85, 113–138. [Google Scholar] [CrossRef] - Liu, E.; Yan, K.; Peng, B. Noise silencing technology for manifold flow noise based on ANSYS fluent. J. Nat. Gas Sci. Eng.
**2016**, 29, 322–328. [Google Scholar] [CrossRef] - Liu, E.; Tan, H.; Peng, S. A CFD simulation for the ultrasonic flow meter with a header. The. Vjesn.
**2017**, 24, 1797–1801. [Google Scholar] [CrossRef] - Liu, E.; Peng, S.; Yang, T. Noise silencing technology for upright venting pipe jet noise. Adv. Mech. Eng.
**2018**, 10, 1–15. [Google Scholar] [CrossRef] - Pan, Z.; Chen, B.; Shang, L. Numerical Simulation of V-cone Flow Meter in Product Oil Pipeline of Batch Transportation. Pet. Sci. Technol.
**2010**, 28, 925–933. [Google Scholar] [CrossRef] - Lebon, B.; Nguyen, M.Q.; Peixinho, J.; Shadloo, M.S.; Hadjadj, A. A new mechanism for periodic bursting of the recirculation region in the flow through a sudden expansion in a circular pipe. Phys. Fluids
**2018**, 30, 1–5. [Google Scholar] [CrossRef] - Jiang, L.; Wang, S.; Zhang, Z.; Guo, Q.; Xu, Y. Effects of mixed oil tailing of products pipeline on cutting concentration. Oil Gas Storage Transp.
**2014**, 33, 848–851. [Google Scholar] [CrossRef] - Yuan, Q.; Wu, C.; Yu, B.; Han, D.; Zhang, X.; Cai, L.; Sun, D. Study on the thermal characteristics of crude oil batch pipelining with differential outlet temperature and inconstant flow rate. J. Pet. Sci. Eng.
**2018**, 160, 519–530. [Google Scholar] [CrossRef] - Yong, C.; Xu, P.; Hao, Y. Mechanical performance experiments on rock and cement, casing residual stress evaluation in the thermal recovery well based on thermal-structure coupling. Energy Explor. Exploit.
**2017**, 35, 591–608. [Google Scholar] [CrossRef] - Wang, Z.; Fu, X.; Ping, G.; Tu, H.; Wang, H.; Zhong, S. Gas-liquid flowing process in a horizontal well with premature liquid loading. J. Nat. Gas. Sci. Eng.
**2015**, 25, 207–214. [Google Scholar] [CrossRef] - Wang, Z.; Tu, H.; Guo, P.; Zeng, F.; Sang, T.; Wang, Z. Fluid behavior of gas condensate system with water vapor. Fluid Phase Equilibria
**2017**, 438, 67–75. [Google Scholar] [CrossRef]

**Figure 5.**Cross-section diagram of contamination concentration in the dead-leg at different times (

**a**) Section 6; (

**b**) Section 7.

**Figure 10.**The relationship between gasoline volume fraction and time at Section 3 for different flow rates.

**Figure 11.**(

**a**) Relationship between contamination and speed in Section 8, and (

**b**) relationship between replacement time and speed of liquid in a dead-leg.

**Figure 14.**Relationship between the contamination volume fraction in Section 3 and time for different densities of the rear batch.

Preceding Batch | Following Batch | |
---|---|---|

Physical property | 92# | 0# |

Density (kg/m^{3}) | 724 | 842 |

Viscosity (10^{−6} m^{2}/s) (20 °C) | 0.404 | 5.069 |

Grid Quantity | 603,042 | 1,532,450 | 2,034,860 | 3,021,580 |

Oil Volume Fraction | 0.188 | 0.186 | 0.192 | 0.188 |

Relative Error | 1.06% | 3.13% | 2.08% | |

Time Step (s) | 0.0005 | 0.001 | 0.005 | 0.01 |

Oil Volume Fraction | 0.19 | 0.188 | 0.32 | 0.48 |

Relative Error | 1.05% | 41.25% | 33.33% |

Time (s) | Velocity (m/s) | Length of Dead-Leg (m) |
---|---|---|

421 | 0.4 | 3.19 |

468 | 0.6 | 3.37 |

441 | 0.61 | 3 |

501 | 0.8 | 3.49 |

562 | 1.0 | 3.68 |

603 | 1.2 | 3.8 |

672 | 1.4 | 3.99 |

720 | 1.6 | 4.1 |

920 | 1.8 | 4.52 |

979 | 1.86 | 5 |

1324 | 2.0 | 5.14 |

2248 | 3.19 | 6 |

4186 | 4.18 | 7 |

Number of Dead-Legs | Average Density of Contamination (kg/m^{3}) | Oil Substitution Time in Dead-Leg (s) | Trailing Oil Length (m) |
---|---|---|---|

1 | 832 | 672 | 136 |

2 | 820 | 690 | 148 |

3 | 810 | 705 | 158 |

4 | 802 | 717 | 166 |

5 | 795 | 727 | 173 |

6 | 789 | 735 | 179 |

7 | 784 | 742 | 185 |

8 | 781 | 749 | 190 |

9 | 779 | 754 | 195 |

10 | 778 | 758 | 200 |

11 | 777 | 760 | 201 |

12 | 777 | 762 | 202 |

© 2018 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).