Research on Formation Mechanism of Trailing Oil in Product Oil Pipeline

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 mixed, the main flow speed should be kept 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.


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 deadlegs.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 dead-leg, which leads to contamination.Initially,convection is the main factor.When half of the preceding batch in the deadleg 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 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 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 reduced 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 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 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 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 trailiing oil caused by the dead-legs.
An extensive literature exits 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 calculate 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.

Method
First, we assumed that the convection-diffusion process is the most basic factor for the formation of contamination [19][20][21].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 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), Repj 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 a 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-Palfery formula [9].Generally, the mixing length in the range of 99% to 1% of oil concentration is regarded as the contamination length.When 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 of contamination.For this condition, the formula for calculating the contamination length is: When the Reynolds number is less than the critical Reynolds number of contamination,the equation is: The critical Reynolds number is: The flow state of these fluids for the two different conditions is distinguished by the critical Reynolds number Rej, and the contamination characteristics of the oil for the different conditions can be are 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 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.

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

Preceding batch
Following batch

Physical property 92# 0#
Density(kg/m 3 ) 724 842 viscosity(10 -6 m 2 /s) (20℃) 0.404 5.069 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 can not be selected for a simulation [23].The near wall model method is more suitable for simulating the model wall formed by trailing oil [24].For the formation of trailing oil layer, we adopted the volume of fluid (VOF) model in the multiphase flow model, and we used a structured hexahedron to 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 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 2m.The pumping station had a 508mm pipe diameter, and the pipe diameter of the bypass was 168mm.According to the calculation results, the following batch has flowed through two-thirds of the cross-section of the pipeline in 4 seconds, so we took the volume fraction of the oil at 4 seconds 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 603042,1532451,2034861,and 3021581,and a step length independence verification was conducted for four time steps of 0.0005, 0.001, 0.01, and 0.05.When the grid number changes from 600,000 to 3 million, the oil volume fraction changes very little with the increase of grid number, indicating that these four grid numbers have little influence on the calculation results.See Table 2 and Figure 4.It can be assumed that the grid number of 600,000 has reached grid independence.Therefore, the grid number of 600,000 was taken as the calculation grid.As the step length decreases, the change in the oil volume fraction becomes smaller and smaller.When the time step is 0.001s, the oil volume fraction can be considered to be approximately stable.If the step size is too small, the calculation cycle will be sharply increased.If the step size is too large, the calculation accuracy will be affected.For comprehensive consideration, the time step size for our work was 0.001s.

Analysis of the mechanism of dead-leg mixing
Figure 5a shows a series of contamination concentration distributions at a flow rate of 1.4m/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 that is called 'gravity flow' takes about 26s.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.15m/s.
The Reynolds number calculated from the arithmetic mean of the viscosity of the two fluids is 259894.03,which shows that outcome flow in pipe is turbulent [34].
Figure 5a shows that at 20 s, the advance gravity flow height at the closed end was about 0.056m, 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.21m/s.The flow rate of 0.15m/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 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.21m/s.
When diesel oil flows into the dead-leg from the junction, the same volume of gasoline flows out of thedead-leg and into the main run.This flow is called "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 gasoline outflow changes 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 is caused by the interfacial shear force between gasoline and diesel oil.Therefore, more contamination will appear in the dead-leg, and the concentration distribution of contamination will be 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 is 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 is the time from the contact between the two kinds of oil to the time they reach the junction.At 30s, when the gravity flow returns to the junction from the closed end, about half of the gasoline has formed lock exchange flow with diesel oil due to gravity, and then it flows 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 will take longer to outflow from the pipes, because the mechanism of the flow is turbulent diffusion, which mainly occurred in the joints.Diesel oil slowly penetrates by turbulent diffusion into the dead-leg, where it replaces the gasoline.This is why the contamination interface in the gravity flow stage in the dead-leg fluctuates, while the contamination interface in the turbulent diffusion stage does not.The movement of the diesel oil drains the gasoline in the pipeline away.Figure 7 shows that after passing through the dead-leg along the conveying direction, there is 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 are formed when gasoline in the dead- leg enters the main pipe under the action of gravity and turbulent diffusion.The trailing oil will increase the amount of contamination, so the real amount of contamination is greater than that predicted by theory.Figure 8 show that because the statistical data started at 1s, the gasoline in Section 1 of the pipeline has been replaced, so the volume fraction of gasoline in Section 1 has not changed with time.Section 2 is located before the dead-leg, so Section 2 is not filled with gasoline from the dead-leg.Therefore, the volume fraction of Section 2 only reflects the volume fraction of gasoline in the main run.The other three curves in Figure 8 show a certain regularity in the gentle phase.With an increase in distance along the pipeline, the maximum value of the gentle phase increases, and the slope of the curve increases.These increases are due to the fact that after Section 2, the volume fraction of gasoline at each cross-section is influenced by the dead-leg.The volume fraction of these cross-sections is 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 is, the less the influence of the dead-leg has.The faster the volume fraction of gasoline decreases, the larger the slope of the curve is.
The oil in the dead-leg will flow out due to gravity, and the two kinds of liquids will form a lock exchange flow at the junction.At this time,the main factor causing the contamination is convective transmission.When about half of the preceding batch is replaced in the dead-leg, the influence of convection is gradually reduced, and diffusion transfer begins to play a role.After turbulent diffusion, the following batch gradually flows into the dead-leg and the liquid is slowly replaced.In these two processes, the time of turbulent diffusion is obviously longer than that of convection, and the forward batch from the dead-leg will form trailing oil in the main pipe run.For the flow rate of 0.8m/s, Stage 1 lasts about 4s,but for 1.6m/s, Stage 1 lasts only about 2s.Next, at the end of the Stage 2, about 40% of the gasoline remained for the flow rate of 0.8m/s, and only about 5% remained for 1.6m/s.Finally, in Stage 3, the rate of decline of gasoline volume fraction is 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.8m/s, but it was only about 0.4 s for 1.2m/s.These differences show that in the initial mixing stage, the faster the flow rate is, the faster the diesel oil will reach each crosssection, and the faster the oil replacement speed will be.This stage is only about 2 seconds.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 is, the faster the diesel oil will carry the gasoline, forming less trailing oil will be formed.Figure 11a shows that when the flow rate in a dead-leg varies, the rate of decrease for the gasoline volume in the dead-leg stays basically essentially the same.The gasoline in the deadleg enters the main pipe run mainly because of the lock exchange flow formed by gravity.The diesel oil with higher viscosity enters the dead-leg due to gravity.In the first 20 seconds, the amount of gasoline entering the main pipe is about the same for the different speeds.From 20s to 30s, the main form of the lock exchange flow is still the gasoline entering the main run, but the turbulent diffusion becomes more important as the diesel enters the dead-leg.After 30s, nearly half of the liquid in the dead-leg is 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 takes to carry gasoline, and the less important the turbulent diffusion effect with the gasoline will be in the deadleg, even though the carrying capacity of the diesel oil per unit volume of gasoline is unchanged.This makes 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 slows down.The gasoline is considered to be completely replaced by diesel oil when the volume percentage of gasoline in the dead-leg is less than 1% [29,30].Figure 11b shows that when the flow rate is larger than 1.6m/s, the replacement time of dead-leg oil will increase rapidly.The length of the trailing oil formed in the main run will increase accordingly, so the flow rate should be kept at about 1.6m/s.

The influence of velocity on the trailing oil
According to the data in Figure 11b, the relationship between the replacement time and the flow velocity of dead-leg can be described as The simulation and analysis of different flow rates shows that in the main pipe run, faster flow speed leads to faster the oil replacement rates, shorter the contamination length, and the smaller the contamination content.In the dead-leg, faster the flow speed leads slower the oil replacement rates, longer trailing oil lengths in the main pipe run, and greater larger contamination.

The effect of the dead-leg length on trailing oil
For the system we considered, the diameter of the main pipe was d = 508mm,the length of the dead-leg is d, 2d, 3d, 4d, 5d, 6d, 7d.And the flow speed is 1.4m/s.The diameter of the bypass was 168mm, and the delivery sequence was diesel oil pushing gasoline.When the volume fraction of gasoline in the dead-leg is less than 1%, we considered it to be completely replaced [31][32][33].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 0.5878 64.547 d Te = (6) Figure 13 shows that when the length of the dead-leg is larger than 5 times of the main pipe diameter, the time required for the forward batch to be replaced by the backward batch in the deadleg increases sharply, which indicates that the effect of turbulent diffusion is still relatively large for this length.Beyond this length, the effect of turbulent diffusion will be significantly weakened, and the sample will form 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 changes back and forth between faster slower.There are three different trends in these changes.The first is that as time goes on, the slope of the curves decreases for each stage.This is due to the flow mechanism of dead-leg gasoline changing from lock exchange flow to turbulent diffusion, which takes longer to move the same volume of gasoline out.The second is that with an increase in the length of the dead-leg, the decrease in the rate of the gasoline volume fraction becomes smaller and smaller.This is because the longer the dead-leg length is, the less the turbulent diffusion effect on the closed end of the gasoline, and the longer the oil replacement time is.The third is that with an increase in the length of the dead-leg, the time between the changes between faster and slower rate changes becomes longer and longer.This is because the volume fraction of gasoline represented by the curve refers to the volume fraction of gasoline at "Section 8",which is 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 is required for gravity flowing back to the section, so the cycle time between faster and slower changes decreases Through the simulation and analysis of different length of dead-leg, it can be concluded that the longer dead-leg leads to a slower replacement rate of the oil in the dead-leg, a longer the length of trailing oil in main pipe, and a greater the amount of contamination.

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 is used to push gasoline.Using Matlab to simulate the oil replacing time, the dead-leg length, and the speed, we derived the following equations are obtained(Table 3): T V e =+ (7) Where T is the time to replace the oil in the dead-leg, V is the flow rate, and Lm is the length of the dead-leg.The determination coefficient R 2 of the fitting formula is 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 deadleg can be calculated: Because there are often many dead-legs in the station, the forward batch in the first dead-leg will inevitably affect 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.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 is 842 kg/m 3 and the density of gasoline in the forward batch is 722 kg/m 3 .The table shows that with an increase in the number of dead-legs, the average density of contamination decreases, oil substitution time in dead-leg increases, and the length of trailing oil increases correspondingly.The increasing rule is obtained through nonlinear fitting, and the Equation.( 8) is modified: Where N is the number of dead-legs.We also simulated the situation of contamination formed by dead-leg with different densities of the rear batch.Figure 14 shows that 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 bigger the densities between the two kinds of liquids leads to faster the outflow velocities of the forward batch in the dead-leg, and shorter the lengths of trailing oil formed.In the actual calculation of the length of contamination,only the oil of the unqualified part in the mixing oil section is usually thought to need contamination cutting.For the identification of contamination and the need for on-site contamination cutting, the length of contamination is calculated by the existing calculation formula when the volume fraction of oil in the forward batch is larger than 1%,so only this part is considered in the correction process based on the equation.The influence of most of the trailing oil on oil quality can be ignored.
Figure 14 shows that the volume fraction of gasoline at 6 s to 9 s is less than 1%.The distance between the two interfaces with 99% and 1% forward batch concentration is defined as the length of the contamination.Equation.( 9) can be modified to yield   9 0.21ln( ) 0.96 C N TV =+ (10) 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 f the pipeline was 21220.021t/d,and the contamination content at the end point was 334.109t.The contamination content calculated from the first method's equation (Equation.(1)) was 396.785t, and the second method's equation (Equation .(2)and Equation .(3))led to 314.415t.The contamination content of the second method with our correction was 331.067t, 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 is larger than the critical Reynolds number of contamination, the formula for calculating the contamination length is The above equations yield results that are closer to real data, so they provide a greater guide for accurate cutting of contamination, which has practical significance.

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, are the main factors for the formation of trailing oil.There are two stages of trailing oil formation in a dead-leg,a gravity flow stage and turbulent diffusion stage.The turbulent diffusion stage takes a longer time and the amount of mixed oil is larger.
(2) The effect of flow velocity on the replacement time of the oil in the dead-leg is opposite to that in the main pipe run.The oil replacement time in the main pipe is negatively correlated with the flow velocity, while the oil replacement speed in the dead-leg is positively correlated with the flow velocity, and the relationship between the two is exponential: T=345.59e 0.1252v .The longer the oil replacement time is, the longer the mixing length is,and the larger the contamination content will be.
Because the replacement time of oil in the dead-leg is greatly influenced by the flow rate, the flow rate should be controlled to about 1.6m/s in order to reduce the contamination content.
(3) The length of the dead-leg is 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.

Figure 1 .
Figure 1.Dead-legs formed by bypasses in valve chambers and pumping stations.

Figure 2 .
Figure 2. Schematic diagram of the model grid.

Preprints(b) Section 7 Figure 5 .
Figure 5. Cross section diagram of contamination concentration in the dead-leg at different times.

PreprintsFigure 6 .
Figure 6.Variation in the gasoline volume fraction at Section 8 with time.

Figure 7 .
Figure 7. Distribution of mixed oil density at different times during v=1.4m/s.

Figure 8 .
Figure 8. Curves of gasoline volume fraction varying with time at different pipe sections.

PreprintsFigure 9 .
Figure 9. Distribution of mixed oil density at different conveying speeds for 15s.

Figure 10 shows
Figure 10 shows the relationship between gasoline volume fraction and time for three different flow rates.The figure shows that there are three stages in the process.In Stage 1, diesel has not yet reached Section 3, which explains 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 is pushed away by diesel oil, so the volume fraction of gasoline drops rapidly, and the slope of the curve is very large.The duration of this stage is about 2 s for each flow rate.In Stage 3, the trailing oil forms as gasoline attaches to the wall of the pipe.The volume fraction of gasoline in this stage decreases slowly, and the slope of the curve is small.

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

Figure 12 .Figure 13 .
Figure 12.Relationship between the dead-leg length and the time required for gasoline replacement.

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

PreprintsFigure 15 .
Figure 15.Calculation of contamination content by three different ways.
number is larger than the critical Reynolds number of contamination,the equation becomes

Funding:
The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: 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) and open fund project of Sichuan Key Laboratory of Oil and Gas Fire Fighting (YQXF201603).

Table 1 .
Physical property parameters of oil.

Table 2 .
Variation of oil volume fraction with grid number and time step.

Table 4 .
The effect of the number of dead-legs on the trailing oil length.