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

Authors: Jun Zhou; Guangchuan Liang; Tao Deng; Jing Gong
Journal: International Journal of Chemical Engineering
 (2017)

---

## Abstract

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.


---

## Body

## 1. 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 A
∗ algorithm to study the optimal route of gas-liquid two-phase flow pipeline, yet A
∗ 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.


## 2. 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 two-phase 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 gas-liquid 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.


## 3. 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 two-phase pipeline route on complex topography, using digital topographical data to decide the optimal route. The overview of the optimization tool is shown in Figure1.Figure 1
Optimization tools.


### 3.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).Figure 2
Topographical sample (approximately showing real topography).


### 3.2. Algorithm

On the issue of shortest route, the researchers studied several intelligence algorithms [6–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.Figure 3
The block diagram of genetic algorithm.To carry out the hydraulic calculation of gas-liquid two-phase 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 Figure4. The starting point is N
0, ending point is N
n, and the nodes divide the pipeline into many sections. The starting and ending points of pipe section j are N
j and N
j
+
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.Figure 4
Discretization sketch of gas-liquid two-phase pipeline.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 Figure5. Calculation accuracy can be guaranteed when the mesh spacing is small enough.Figure 5
Discretization sketch of pipeline route.In route optimization, assuming that there is a ground area with limited boundaries, starting point is Ax
0
,
y
0
,
z
0 and ending point is B x
n
,
y
n
,
z
n. 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 containsm routes; the route i in generation k is expressed as(1)
r
k
i
=
x
k
0
i
,
y
k
0
i
,
z
k
0
i
,
x
k
1
i
,
y
k
1
i
,
z
k
1
i
⋯
x
k
n
-
1
i
,
y
k
n
-
1
i
,
z
k
n
-
1
i
,
x
k
n
i
,
y
k
n
i
,
z
k
n
i
.The length of routei in generation k is expressed as(2)
L
k
i
=
r
k
i
=
∑
j
=
0
n
-
1
x
k
j
+
1
i
-
x
k
j
i
2
+
y
k
j
+
1
i
-
y
k
j
i
2
+
z
k
j
+
1
i
-
z
k
j
i
2
.Taking hydraulic conditions into consideration, we have the following.The pressure drop between adjacent nodes isd
p
k
j
i, so the pressure drop along the route i in generation k is expressed as(3)
D
P
k
i
=
∑
j
=
0
n
-
1
d
p
k
j
i
x
k
j
+
1
i
-
x
k
j
i
2
+
y
k
j
+
1
i
-
y
k
j
i
2
+
z
k
j
+
1
i
-
z
k
j
i
2
.Pressure dropd
p
k
j
i can be calculated by many methods.Fitness function is expressed as(4)
Fitness
k
i
=
1
D
P
k
i
.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 Figure3 till the best individual is found.


### 3.3. 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. Figure6 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.Figure 6
Performance of the GA in finding the best solution.Figure 7
Routes sketch of different generations in optimization.


### 3.4. 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.(5)
z
x
,
y
=
∑
i
=
1
h
h
i
×
exp
⁡
-
x
-
x
c
i
u
i
p
i
-
y
-
y
c
i
v
i
q
i
.Parameters of topographical function are shown in Table1.Table 1
Parameters of topographical function.
i
x
c
y
c
p
q
u
v
h
1
25
87
1.5
1.5
30
20
57
2
64
28
2
3.5
65
12
19
3
34
53
3
2
21
13
−32
4
77
92
2
2
6
25
38
5
94
55
3
3
11
14
24
6
65
24
1.5
1.5
13
9
−22
7
15
11
3
2
11
16
−14
8
93
14
3
3
13
11
−17Here is the route programming of complex topography with grid data. The example digital map is in Figure8. Mesh number is 20 × 20 and mesh size is 5 × 5.Figure 8
Digital profile of topographical surface.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. Figure9 shows the averages results of ten independent operations at different probabilities. Two genetic algorithms are sensitive to CP and MP. Both of them can obtain best function evaluation values when CP is big. Yet the MP of GN GA is small but that of SS GA is big.Figure 9
Effect of variations of CP and MP on the performance of gGA (a) and ssGA (b).
(a)
(b)The optimal results of two GA are shown in Table2. 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.Table 2
Best result obtained from ssGA and gGA.
GN GA
SS GA
CP, MP
0.9, 0.005
1.0, 0.1
Average evaluation value (over ten times)
172.19
173.09
Best evaluation value (over ten times)
163.18
167.34Figure 10
Result of route curves.


## 3.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).Figure 2
Topographical sample (approximately showing real topography).


## 3.2. Algorithm

On the issue of shortest route, the researchers studied several intelligence algorithms [6–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.Figure 3
The block diagram of genetic algorithm.To carry out the hydraulic calculation of gas-liquid two-phase 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 Figure4. The starting point is N
0, ending point is N
n, and the nodes divide the pipeline into many sections. The starting and ending points of pipe section j are N
j and N
j
+
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.Figure 4
Discretization sketch of gas-liquid two-phase pipeline.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 Figure5. Calculation accuracy can be guaranteed when the mesh spacing is small enough.Figure 5
Discretization sketch of pipeline route.In route optimization, assuming that there is a ground area with limited boundaries, starting point is Ax
0
,
y
0
,
z
0 and ending point is B x
n
,
y
n
,
z
n. 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 containsm routes; the route i in generation k is expressed as(1)
r
k
i
=
x
k
0
i
,
y
k
0
i
,
z
k
0
i
,
x
k
1
i
,
y
k
1
i
,
z
k
1
i
⋯
x
k
n
-
1
i
,
y
k
n
-
1
i
,
z
k
n
-
1
i
,
x
k
n
i
,
y
k
n
i
,
z
k
n
i
.The length of routei in generation k is expressed as(2)
L
k
i
=
r
k
i
=
∑
j
=
0
n
-
1
x
k
j
+
1
i
-
x
k
j
i
2
+
y
k
j
+
1
i
-
y
k
j
i
2
+
z
k
j
+
1
i
-
z
k
j
i
2
.Taking hydraulic conditions into consideration, we have the following.The pressure drop between adjacent nodes isd
p
k
j
i, so the pressure drop along the route i in generation k is expressed as(3)
D
P
k
i
=
∑
j
=
0
n
-
1
d
p
k
j
i
x
k
j
+
1
i
-
x
k
j
i
2
+
y
k
j
+
1
i
-
y
k
j
i
2
+
z
k
j
+
1
i
-
z
k
j
i
2
.Pressure dropd
p
k
j
i can be calculated by many methods.Fitness function is expressed as(4)
Fitness
k
i
=
1
D
P
k
i
.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 Figure3 till the best individual is found.


## 3.3. 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. Figure6 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.Figure 6
Performance of the GA in finding the best solution.Figure 7
Routes sketch of different generations in optimization.


## 3.4. 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.(5)
z
x
,
y
=
∑
i
=
1
h
h
i
×
exp
⁡
-
x
-
x
c
i
u
i
p
i
-
y
-
y
c
i
v
i
q
i
.Parameters of topographical function are shown in Table1.Table 1
Parameters of topographical function.
i
x
c
y
c
p
q
u
v
h
1
25
87
1.5
1.5
30
20
57
2
64
28
2
3.5
65
12
19
3
34
53
3
2
21
13
−32
4
77
92
2
2
6
25
38
5
94
55
3
3
11
14
24
6
65
24
1.5
1.5
13
9
−22
7
15
11
3
2
11
16
−14
8
93
14
3
3
13
11
−17Here is the route programming of complex topography with grid data. The example digital map is in Figure8. Mesh number is 20 × 20 and mesh size is 5 × 5.Figure 8
Digital profile of topographical surface.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. Figure9 shows the averages results of ten independent operations at different probabilities. Two genetic algorithms are sensitive to CP and MP. Both of them can obtain best function evaluation values when CP is big. Yet the MP of GN GA is small but that of SS GA is big.Figure 9
Effect of variations of CP and MP on the performance of gGA (a) and ssGA (b).
(a)
(b)The optimal results of two GA are shown in Table2. 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.Table 2
Best result obtained from ssGA and gGA.
GN GA
SS GA
CP, MP
0.9, 0.005
1.0, 0.1
Average evaluation value (over ten times)
172.19
173.09
Best evaluation value (over ten times)
163.18
167.34Figure 10
Result of route curves.


## 4. Example Analysis

The existing pipeline data and simulation parameter is shown in Table3.Table 3
Parameter of pipeline simulation.
Parameter
Parameter value
Volume flow rate of gas, m3/d
4000
Volume flow rate of liquid, m3/d
0.3
Starting pressure, MPa
1.5
Pipe diameter, m
0.2The 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 Figure11 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 km2 and mesh number of 250 × 250.Figure 11
Topography file in TIF of some block.Figure 12
Pipeline route in contour map.In Figure12, 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.Figure 13
Pipeline route in 3D topographical map.The calculation results are presented in Table4. 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.Table 4
Calculation results.
Real value
Calculation result
Pipeline length
5433.804 m
5570.194 m
Pipeline pressure drop
1.021 MPa
0.644 MPaFigure 14
Elevation along the line.Figure 15
Pressure along the line.


## 5. 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 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.



---

*Source: 1640303-2017-01-19.xml*