You are on page 1of 7

World Applied Programming, Vol (3), Issue (2), February 2013.

68-74
ISSN: 2222-2510
2013 WAP journal. www.waprogramming.com

Modeling the Non-Stationary Flow Through Pipelines:


A Software Application to Solve the Navier-Stokes Equations
Daniela Tudorica
Petroleum-Gas University of Ploiesti, Romania
danatudorica@gmail.com

Abstract: This paper presents modeling of non-stationary flow of petroleum through pipelines. The model uses
the Navier-Stokes equations of mass and momentum conservation, with initial and boundary conditions.
Numerical solution of partial differential equations, based on a finite difference scheme, is performed to
simulate the flow in the following situations: flow through a pipe with a closed valve at the right end and
ignoring friction factor, flow with friction and open valve and flow with friction with the valve closed. The
application proposed in this paper is implemented in a visual programming environment CBuilder, with a
friendly user interface and with accurate graphical simulation of flow phenomena.
Keywords: pipeline, modeling, simulation, non-stationary, flow, Navier-Stokes

I.

INTRODUCTION

The non-stationary flow is characterized by the fact that the main parameters of the process flow (velocity, pressure,
temperature) are not constant over time. In non-stationary regime, the flow is described by the three fundamental
equations of conservation of mass, momentum and energy.
Modeling the non-stationary isothermal flow requires solving the equations of conservation of mass and momentum,
known as the Navier-Stokes equations. These are partial differential equations of hyperbolic type, which can be solved
numerically by different methods. For the solution exists and is unique, the partial differential equations need to be
supplemented by a set of relations representing the boundary conditions.

II.

SOLVING THE CONSERVATION EQUATIONS

Starting from the equations of conservation of mass and momentum for the case of isothermal flow, ignoring energy
losses through friction and introducing the speed of sound c0 , equations of conservation of mass and conservation of
momentum are:

p
p
v
v
c02
0
t
x
x
v
v p
v
0
t
x x

(1)

(2)

p
v
Allievi showed in 1913 that for speeds much less than the speed of sound, v
and v
are almost null. Thus, (1)
x
x
and (2) become:

p
v
c02
0
t
x
v p

0
t x

68

(3)
(4)

Daniela Tudorica, World Applied Programming, Vol (3), No (2), February 2013.

If case of a long pipe, the friction losses must be taken into account, so the equation (4) becomes:

v p f

vv 0
t x 2 d

(5)

In the above equations we used the following notations: v velocity of fluid; p - pressure;
sound ; d diameter of the pipe.

- density; c0 - speed of

The first step in solving partial differential equations is to transform them into algebraic form, suitable programming.
This stage is called discretization.
To solve the system consisting of partial differential equations (3) and (5) is present below a finite difference scheme,
according to the methodology described by S. Godunov in [5] which first solve the homogeneous system consisting of
partial differential differential equations (3) and (4), then the solution is corrected taking into account the dissipative term
in equation (5). Basically, we find a particular solution of the system of equations (3) and (5) satisfying the boundary
conditions imposed.
To define the finite difference scheme is considered a division of the domain D (x, t), which analyzes the phenomenon.
The domain is divided into equal intervals x x j x j 1 . Since we want to find the parameters v and p, the functions
that represent quantities (v, p) are considered network functions, denoted generically by f. The function f is considered
n

constant within a x j x j 1 range. This value is denoted by f j 1 / 2 and are considered in the middle of the range. The
current time step is denoted by the index "n" and the new values calculated for the next time step will be denoted by the
index "n +1". [5]
Iterative process of integration will use auxiliary values considered at half time interval, written with capital letters and
n1 / 2

with index "n +1 / 2", for example F j

Finite difference scheme for equation (4) is shown in Figure 1.

v nj11/ 2

t n 1

Pjn11 / 2

Pjn1 / 2

t n 1 / 2

v nj1 / 2

A
x j 1

tn

B
x j 1 / 2

xj

x
Figure 1. Finite difference scheme

Covering the counterclockwise direction, the closed contour defined by ABCD, network functions are defined on each
side.
xj

AB: velocity at time n:

n
j 1 / 2

v ( x, tn )dx
x xj 1

BC: auxiliary pressure P at half time interval, in j node:

69

(6)

n 1 / 2
j

t n 1

p( x , t )dt
j

tn

(7)

Daniela Tudorica, World Applied Programming, Vol (3), No (2), February 2013.

xj

CD: velocity at time n+1 : v

n1
j 1 / 2

v( x, t n1 )dx

(8)

x j 1

DA:auxiliary pressure P at half time interval, in j-1:

1
t

Pjn11 / 2

t n 1

p( x

j 1

, t )dt

(9)

tn

Applying (4) on the contours defined above, we obtain:

(v nj11/ 2 v nj1/ 2 )

t n1/ 2
Pj
Pjn11/ 2 0
x

(10)

From equation (10) we obtain a finite difference formula for calculating velocity:

v nj11/ 2 v nj1/ 2

t 1 n1/ 2
Pj
Pjn11 / 2
x

(11)

For the second equation is done similarly. Covering the way counterclockwise the closed contour considered, on the
horizontal sides is defined pressure and for the velocity are used for auxiliary quantities V, defined at half time interval.
xj

pressure at time n :

n
j 1 / 2

p( x, t n )dx
x xj 1

auxiliary velocity V at half time interval, in

n 1 / 2

j node: V j

(12)

1
t

tn 1

v( x , t )dt
j

(13)

tn

xj

pressure at time n+1 :

p nj11/ 2

1
p( x, t n1 )dx
x xj 1

V jn11/ 2

auxiliary velocity V at half time interval, in j-1:

(14)

1
t

tn 1

v( x

j 1

, t )dt

(15)

tn

Applying (3) on the contours defined above, we obtain:

p nj11/ 2 p nj1/ 2

t
c02 V jn1/ 2 V jn11/ 2 0
x

(16)

From equation (16) we obtain a finite difference formula for calculating the pressure:

p nj11/ 2 p nj1/ 2

t
c02 V jn1/ 2 V jn11/ 2
x

(17)

Equations (11) and (17) form a system that allows the calculation of speed and pressure, in time and space, in every
node.
III.

BOUNDARY CONDITIONS

In the previous section it was shown that finite difference method calculates the velocity and pressure at each point, at
some time, depending on speed and pressure from the neighboring points at the previous time period. The only problems
resulting from these calculations are at pipe ends. Thus, the numerical solution of partial differential equations system
requires the formulation of initial and boundary conditions. Boundary conditions must be formulated in such cases: tank
at one end of the pipeline, pumps or valves placed along the pipeline, a pipeline junction etc.

70

Daniela Tudorica, World Applied Programming, Vol (3), No (2), February 2013.

v nj11/ 2

A.

t n 1

t
Pjn11 / 2

B.

Pjn 1 / 2

C.
v nj1 / 2

A
x j 1

x j 1 / 2

t n 1 / 2

tn

xj

Figure 2. The ghost cells

If a valve is located at the right end of the pipe segment considered, as shown in Figure 2, the points B and C are not
actually there, so can not calculate the speed at point xj-1/2. The solution is to define imaginary points (outside end of
pipe).
If the valve open, the values in cells "ghost" is considered equal to the values of neighboring cells. If the valve closed
cell parameters of "ghost" must be null.

IV.

SOFTWARE APPLICATION FOR MODELING THE NON-STATIONAY FLOW

Application considers a valve located at the end of the pipe segment, a valve that can be closed or open. Through three
radio buttons can be selected valve condition and if the model takes account of losses due to friction. By pressing the
button START Simulation, in two graphical components are plotted the pressure and velocity variations along the pipe
and time. In the bottom left of the window, you can view the values of pressure and velocity according to the distance
traveled by the fluid in the pipe.
IV.1 Ignore friction valve closed
Considering that the baseline pipeline was filled with oil, start pumping produces a pressure wave that propagates to the
end of the delivery. This pressure wave is actually a discontinuity that separates two areas: the front (right) where the
pipe is oil, which is undisturbed rest (zero velocity and pressure is 1 bar) and behind (left) wave change parameters:
speed is 1.86 m / s and the pressure is 22 bar. Ignoring the friction, parameters behind the wave discontinuity remain
constant (see Figure 3).

Figure 3. Ignore friction valve closed (1)

71

Daniela Tudorica, World Applied Programming, Vol (3), No (2), February 2013.

If the valve closes the pipe end, it occurs the wave reflection. This is shown in Figure 4. Wave reflection from a solid
wall is accompanied by the phenomenon of capture shock, known as hydraulic hammer, characterized by increased
pressure wave velocity behind the reflected wave reflected cancellation. Thus, we see that the reflected wave propagates
backwards from the end to the pump delivery.

Figure 4. Ignore friction valve closed (2)

IV.2 With friction valve opened


Influence of the coefficient of friction on unsteady movement consists into diminishing intensity discontinuity in the
variation of the pressure wave as the wave moves to the end of the pipe. It is noted, however, that oil behind the wave
velocity remains constant, due to the mass conservation law (see Figure 5).

Figure 5.W ith friction valve opened (1)

72

Daniela Tudorica, World Applied Programming, Vol (3), No (2), February 2013.

If the valve is opened, there is no obstacle to the delivery end of the pipe, after passing the wave discontinuity, the
motion of oil becomes stationary, characterized by its constant velocity and linear pressure drop due to friction, as shown
in Figure 6.

Figure 6.W ith friction valve opened (2)

IV.3 With friction valve closed


Where there is an obstacle to the pipe end (valve is closed), the phenomenon of hydraulic hammer appears, as seen in
Figure 7.

Figure 7.W ith friction valve closed

73

Daniela Tudorica, World Applied Programming, Vol (3), No (2), February 2013.

V.

CONCLUSION

In this paper is proposed a mathematical model to simulate the process flow of petroleum through pipelines in unsteady
isothermal regime. The model is based on two fundamental laws of fluid dynamics: conservation of mass and
momentum conservation (Navier-Stokes equations).
The model is solved using finite difference method, through which there can be express values of process parameters
(velocity and pressure) at each point of time, depending on the values of the previous step.
The proposed software application treats the situation in which the end of a pipe segment is a valve that can be closed or
open. Are plotted velocity and pressure variation in the following cases: flow with a closed valve at the right end and
ignoring friction factor, flow with friction and open valve and flow with friction with the valve closed.
Application could be improved by using a model that takes into account the turbulent flow or flow in non-isothermal
regime.
REFERENCES
[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]
[9]
[10]

A. Soare, Transport and storage of fluids, vol. 1, Ed. UPG Ploiesti, 2002.
C. Taylor and P. Hook, A numerical solution of the Navier-Stokes equations using the finite element technique, Computers & Fluids, Vol. 1,
pp. 73-100. Pergamoo Press, 1973.
C. Trifan, M. Albulescu, S. Neacu, Elements of fluid mechanics and thermodynamics technical, Ed. UPG Ploiesti, 2005.
D. Apsley, Hydraulics, http://personalpages.manchester.ac.uk/staff/david.d.apsley/lectures.htm
Godunov, S. K., A Difference Scheme for Numerical Solution of Discontinuous Solution of Hydrodynamic Equations, 1959.
Ir.A.Segal, Finite element methods for the incompressible Navier-Stokes equations, J.M. Burgerscentrum, Research School for Fluid
Mechanics, 2011.
O. Bratland, Pipe Flow 1. Single-phase flow assurance, 2009.
Per-Olof Persson, Implementation of Finite Element-Based Navier-Stokes Solver, 2.094Project, 2002.
Wesseling, Pieter, Principles of Computational Fluid Dynamics, Springer-Verlag, 2001.
White, F.M., Fluid Mechanics (7th Edition), McGraw-Hill, 2011.

74

You might also like