Route Optimization of Pipeline in Gas-Liquid Two-Phase Flow Based on Genetic Algorithm

. This paper describes the problems in route optimization of two-phase pipelines. Combining the hydraulic calculation with route optimization theory, this paper establishes an automatic route optimization model and adopts the general genetic algorithm (gGA) and steady-state genetic algorithm (ssGA) to solve the model, respectively, gets the optimal route, and discusses the influence of parameters setting to the result. This algorithm was applied in determining pipelines routes in coalbed methane gathering and transporting system in Shanxi Province, China. The result shows that the algorithm is feasible, which improves the hydraulic properties by reducing the pressure drop along the line while the pipeline length is still acceptable.


Introduction
In a recent decade, to meet the constant need of energy, although the global economy has come through a downturn, the oil-gas pipelines construction is still prosperous around the world.In 2013, the total length of pipelines under construction or planned to be constructed is about 188,108 km, and the length of those under construction is 53,180 km, 11.4% longer than that in the year 2012, 47,732 km.During the construction, the first step is to determine the pipeline route.The task is frequent and time-consuming and plenty of attempts have been made.Traditionally engineers would determine the route manually on a printed map or solve the problem with optimization theory.Early in the year 1971, Shamir [1] used dynamic programming to determine the optimal route on manual mesh.In years 2004 and 2012, Meisingset et al. [2] and Marcoulaki et al. [3] established the mathematical optimization models in terms of minimum investment separately for submarine pipelines and ground pipelines and solved the models with simulated annealing, but those models did not involve the hydraulic properties.
In the problem of oil-gas pipeline route optimization, pipe flow may be single-phase or multiphase.Multiphase pipe flow is different from single-phase pipe flow; the pressure drop is closely related to the height along the line.Both uphill section and downhill section can be energy-consuming, yet the energy loss in the uphill section cannot be replenished by the gravity effect of downhill section.Thus with the same starting/ending location and pipeline length, but different routes and different topographic reliefs, different pipelines possess different hydraulic properties.In literature, Xiao et al. [4] used  * algorithm to study the optimal route of gas-liquid two-phase flow pipeline, yet  * algorithm is not a global optimization algorithm, which is based on a combined algorithm between Dijkstra's algorithm and Best-First-Search algorithm.In this paper, the authors would use a global optimization algorithm-genetic algorithm (GA) to discuss the optimal route programming of gas-liquid two-phase flow pipelines.

Gas-Liquid Two-Phase Pipe Flow
In oil-gas field, people would usually use one pipeline to transport the product of several wells.As long as two-phase flow exists in the pipeline, the pipeline is defined as two-phase pipeline.In an oil-gas mixture transportation pipeline, the oil-gas ratio may vary a lot in different parts.In drainage pipes of oil-gas separators, the flowing liquid is basically crude oil, but along the pressure drop some dissolved gas would come out.In venting pipes of oil-gas separators, the flow inside is basically natural gas, yet along the flowing there may be water or heavy hydrocarbon condensated.For example, in the coalbed methane gas fields which are largely exploited, the gas came out from the well; along the gas flow there would be water condensation; then gas-liquid twophase flow would appear.At the same time, in gathering and transporting process, it is not economic to use two pipelines separately transporting crude oil and natural gas in small quantities.Thus in the surface gathering and transporting system, mixture transportation pipelines are widely used.Moreover, in some specific conditions, mixture transportation has some advantages that single-phase pipeline cannot compare with.For instance, in some places that are not suitable for installing gas-liquid separators and processing facilities (such as urban areas, desserts, lakes, ecological reserves, and swamplands), mixture transportation pipelines are necessary.Those pipelines tend to go through hills or mountainous areas, which does not cause any problems when the pipelines are single-phase, because the pressure energy loss during uphill section would be replenished during downhill section.Yet in two-phase flow the situation is much different.Since the liquid holdup and the density of the gasliquid mixture in downhill section are much smaller than those in uphill section, the pressure cannot be regained that much in downhill section.Therefore, as far as multiphase pipeline route determination is concerned, engineers must give high priority to the hydraulic properties of the pipe flow and combine it with the route optimization.
The distribution of gas and liquid in the two-phase pipe flow varies a lot, and flow patterns vary a lot too.These would influence not only the mechanical relationship of the two-phase flow but also the heat and mass transfer; thus the gas-liquid two-phase flow is very complicated.Currently there are plenty of calculation models of gas-liquid two-phase flow with their own advantages and disadvantages.Yet the research of two-phase models goes beyond our study in the paper.This paper plans to use existing gas-liquid two-phase Beggs-Brill [5] model to integrate hydraulic simulation with route optimization algorithm.

Optimization
Route determination involves many aspects, such as like pipeline's design, construction, operation, and maintenance, which include the security of the pipeline, hydraulic and thermal conditions, environmental conservation, historical sites, soil and hydrological conditions, and construction requirements.For route optimization based on intelligence algorithm, the route programming of oil-gas pipelines mainly deals with the following factors: oil-gas production; oil-gas physical properties; the starting point and terminal of the pipeline; the starting and ending pressure of the pipeline; the areas that the pipeline goes through; heights of different places; land types (rocky soil, sandy soil, etc.); forest covered area; source of water, rivers, roads, railroads, and impenetrable areas.The material and labor costs of pipeline construction; the pipes; regional regulation; constructing techniques; construction goal (usually minimum investment); and other factors influencing the pipeline construction.
We need to find the pipeline route from the starting point to the terminal, satisfy the gas-liquid two-phase flow characters and other constraint conditions, and then make the object function minimum.This paper focuses on the twophase pipeline route on complex topography, using digital topographical data to decide the optimal route.The overview of the optimization tool is shown in Figure 1.

Topographical Data
Digital Map.Automatic route optimization is carried out on digital maps, using discrete data (see Figure 2) to represent the continuous surface.Discrete data is the approximation of continuous surface.The higher the resolution is, the closer the approximation is to the real topography and the more accurate the route tracing is.Yet there is a highest resolution limitation.This form has a good compatibility and is consistent with the grid data of GIS (Geographic Information System).

Algorithm.
On the issue of shortest route, the researchers studied several intelligence algorithms [6][7][8].Among them, genetic algorithm was established simulating Darwin's evolution theory, which can be used to solve the problems of function optimization or machine learning.It imitates the procedure of inheritance and evolution, that is, selection, replication, crossover, and variation, and introduces the concept of "survival of the fittest" into the algorithm.The block diagram of genetic algorithm is shown in Figure 3.
To carry out the hydraulic calculation of gas-liquid twophase pipeline, we adopt the method of segmentation to calculate the pressure drop of different sections one by one.
The symbol of discretization is shown in Figure 4.The starting point is  0 , ending point is   , and the nodes divide the pipeline into many sections.The starting and ending points of pipe section  are   and  +1 .If only hydraulic calculation is conducted, it means to do hydraulic simulation on a determined route and to manually set the mesh spacing (usually equal mesh spacing).However, in three dimensions, the route is not determined.Therefore at the same time with route optimization, hydraulic calculation must be taken into consideration.
During the optimization, each route represents a pipeline.The nodes on the route divide the pipeline into pipe sections with different lengths, as shown in Figure 5. Calculation accuracy can be guaranteed when the mesh spacing is small enough.
In route optimization, assuming that there is a ground area with limited boundaries, starting point is A ( 0 ,  0 ,  0 ) and ending point is B (  ,   ,   ).There are many routes going from A to B. Assuming that the investment of pipeline is proportional to the pipeline length, the route optimization is to find a route that can minimize the construction investment or optimize other object functions.
The initial population contains  routes; the route  in generation  is expressed as The length of route  in generation  is expressed as ( Taking hydraulic conditions into consideration, we have the following.
The pressure drop between adjacent nodes is    , so the pressure drop along the route  in generation  is expressed as Pressure drop    can be calculated by many methods.Fitness function is expressed as Due to the grid data, in genetic algorithm we use integer coding, roulette wheel selection, single-point crossover, and single-point variation for calculatation; repeat the procedure in Figure 3 till the best individual is found.

Realization.
Due to the complexity of terrain pipeline optimization, it is often unable to obtain the best path.As we all know, under the plane condition, straight line between two points is the shortest [9].To test the program, we first optimize the shortest path between two points on the plane.Supposing the population size and the maximum number of iterations are 200 and 1000, respectively, crossover probability and mutation probability are 0.95 and 0.2, respectively.Figure 6 shows the algorithm convergence; as can be seen from the figure, the algorithm converges quickly and approaches the best solution after 250 iterations.Figure 7 shows the path graphs under different generations, and the path approaches a straight line between two points after 500 iterations.

Test Results and Discussion
. General and steady-state genetic algorithms with roulette wheel selection, arithmetic crossover, and uniform mutation are adopted.The computer is Samsung R408, Intel Pentium dual T3400, 2.16 Hz, 1 G RAM.
Generate the digital map with topographical model function.

𝑧 (𝑥, 𝑦
Parameters of topographical function are shown in Table 1.Here is the route programming of complex topography with grid data.The example digital map is in Figure 8. Mesh number is 20 × 20 and mesh size is 5 × 5. For genetic algorithms, crossover probability (CP) and mutation probability (MP) are extremely important parameters, which directly affect the optimization quality of the algorithm.In this paper, to analysis the sensitivity of the two GAs to the parameters, CP ranges from 0.4 to 1.0 and MP ranges from 0.0005 to 0.3.Figure 9 shows the averages results of ten independent operations at different probabilities.Two genetic algorithms are sensitive to CP and MP.Both of them  The optimal results of two GA are shown in Table 2.The average and best result of GN GA both are a little smaller than those of SS GA.The best evaluation value is 163.18.In Figure 10, the red curve is optimal route and it bypasses the low areas in the middle.

Example Analysis
The existing pipeline data and simulation parameter is shown in Table 3.
The calculation model of gas-liquid two-phase pipe flow is Beggs-Brill [8] model to calculate liquid holdup and pressure drop.For more detailed information of the model, please refer to Appendix A.
The topographical data comes from digital map, whose file format is TIF shown in Figure 11 and the pixel size in grid information is 21 m × 136.21 m.The elevation model of this block (red box in Figure 11) is shown in Figure 12, with an area of 27.5625 km 2 and mesh number of 250 × 250.
In Figure 12, point A is the starting point, point B the ending point, and dotted line the existing pipeline.It is obvious in the figure that the line passes through high mountains in the middle.With the model in this paper we can get the optimal route represented by solid line.From the starting point, the line goes down and bypasses the hills to the ending point.The route under three-dimension topography is shown in Figure 13.
The calculation results are presented in Table 4. Table 4 lists out the pipeline length and pressure drop of both optimal route and real route.From Figures 14 and 15, the variation of existing pipeline elevation is big while the optimal pipeline elevation goes gently.Pipeline length increased to 5570.194 m from 5433.804 m by 2.45%, yet which is still acceptable, and the pressure drop along the line reduced to 0.644 MPa from 1.021 MPa by 36.92%.This greatly improves the hydraulic properties of the pipeline.

Conclusions
(1) This paper establishes a pipeline route determination model combined hydraulic calculation in complex topography.With the digital topographical data, the optimal route can be automatically determined.
(2) Genetic algorithm can be used to select an optimal route for gas-liquid two-phase pipeline.The parameters of genetic algorithm would have an influence on optimization result.If topographical data and pipeline parameters are known, with a program the optimal International Journal of Chemical Engineering  route can be determined.As the example in paper, this method can reliably seek out the route.(3) This paper gives a structure of pipeline route design.
It is a reference for the engineers.They can add other expenses according to the real situation.In the equation,   is liquid holdup, dimensionless;  is average absolute pressure of flow in the pipe, Pa is hydraulic friction coefficient of gas-liquid mixed pipeline, dimensionless;   is density of gas and liquid, kg/m 3 ;  is mass flow rate of the gas-liquid mixture, kg/s;  is the flow velocity of gas-liquid mixture, m/s;   is apparent velocity of gas, m/s;  is inner diameter of pipes, m; and  is dip angle, degree.
Among all those calculating methods of gas-liquid mixture transportation pipeline with topographic relief, BB pressure drop calculating method is the only one taking downhill energy recovery into consideration.If liquid holdup equals 1 or 0, the method turns into calculating single-phase liquid or gas pipeline.

𝑖:
Ro u t en u m be ri ng e n e ti cal g o ri th m : Pipesectionn umber : Generation  in genetic algorithm   : Nodenumber (  ,   ): The coordinates of node     : The elevation of node      : Nodes set of the route  in generation     : Lengthofroute in generation     : The pressure drop along the route  in generation     : The pressure drop along pipe section  between nodes   and  +1 .

Figure 6 :
Figure 6: Performance of the GA in finding the best solution.

Figure 7 :Figure 8 :
Figure 7: Routes sketch of different generations in optimization.

Figure 9 :
Figure 9: Effect of variations of CP and MP on the performance of gGA (a) and ssGA (b).

B. 2 .
Figure16is the program chart of BB method to get pressure drop.

Table 1 :
Parameters of topographical function.

Table 2 :
Best result obtained from ssGA and gGA.
the MP of GN GA is small but that of SS GA is big.

Table 3 :
Parameter of pipeline simulation.

Table 5 :
Rules of flow pattern identification.

Table 6 :
Different coefficient of a, b, and c.

Table 7 :
Coefficient values.In the equation,   is volume liquid holdup and Fr is Froude dimensionless number.With different flow pattern, we use different coefficient to calculate , , and .The results are listed in Table6.  is liquid apparent velocity index.The coefficients , , , and  depend on flow patterns, as shown in