0% found this document useful (0 votes)
90 views11 pages

Optimal Gas Flow Simulation Methods

The document summarizes and compares different finite difference methods for simulating dynamic gas flow in pipelines based on a linear partial differential equation model. It presents four numerical schemes: (1) a two-time level Crank-Nicholson implicit scheme with unrestricted stability and error; (2) a two-time level fully implicit scheme with unrestricted stability and error; (3) a three-time level explicit Dufort-Frankel scheme with unrestricted stability and consistency requiring small time and space steps; and (4) a three-time level implicit scheme with unrestricted stability and error. The goal is to determine the optimal method that balances accuracy and computation time.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views11 pages

Optimal Gas Flow Simulation Methods

The document summarizes and compares different finite difference methods for simulating dynamic gas flow in pipelines based on a linear partial differential equation model. It presents four numerical schemes: (1) a two-time level Crank-Nicholson implicit scheme with unrestricted stability and error; (2) a two-time level fully implicit scheme with unrestricted stability and error; (3) a three-time level explicit Dufort-Frankel scheme with unrestricted stability and consistency requiring small time and space steps; and (4) a three-time level implicit scheme with unrestricted stability and error. The goal is to determine the optimal method that balances accuracy and computation time.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

INTERNATIONAL JOURNAL FOR NUMERICAL METHODS IN FLUIDS, VOL.

3, 125-135 (1983)

OPTIMAL NUMERICAL METHOD FOR SIMULATING


DYNAMIC FLOW OF GAS IN PIPELINES
A. OSIADACZ

Department of Control Engineering, Institute of Oil and Gas, Warsaw, Poland

SUMMARY
Finite difference methods for solving the linear model describing unsteady state flow in pipelines are
considered in the present paper. These methods are compared with each other in order to determine
the best one, which meets the criteria of accuracy and relatively small computation time.

KEY WORDS Gas Networks Computational Methods Simulation Optimization

1. INTRODUCTION
Gas plays an extremely significant role in the fuel-energetic balance of most industrialized
countries of the world. High calorific value combined with the facility of transport places it in
the group of most valuable row materials.
For that very reason its economic utilization is a problem of major importance. It should
be dealt with by the optimization (with regard to a given criterion) of both the process of
on-line control of gas transport system and the design of new or the reconstruction of
existing networks. One cannot properly realize any of the enumerated tasks without first
solving problems raised by network simulation.
In the process of system control the simulation supplies us with the information on the
values of pressures and flows indispensable in the selection of suitable parameters both for
compressor stations and reduction stations.
In the process of design the simulation allows us to correctly select network configurations,
geometrical dimensions of pipelines, as well as the sites of both compressor and reduction
stations for given parameters of gas supply and demand.
Two kinds of simulation are commonly differentiated: the static one and the dynamic one.
The present article deals with the dynamic simulation, i.e. with the case in which the
parameters characterizing the gas supply of the system and its load are functions of time (in
the static simulation they are independent of time).
Correct simulation of dynamic properties necessitates the selection of the suitable
mathematical model and the suitable numerical method enabling us to solve this model.
Finite difference methods for solving the model elaborated in Reference 1 are considered in
the present paper. These methods are compared with each other in order to determine the
best one, which meets the criteria of accuracy and relatively small computation time. The
investigations described have been undertaken chiefly because in many professional publica-
tions (e.g. References 2-4) various numerical schemes had been advanced, whereas the
criteria for their selection had not been presented.
0271-2091/83/020125- 11$01.10 Received I0 October I981
01983 by John Wiley & Sons, Ltd. Revised 22 April 1982
126 A. OSIADACZ

2. MATHEMATICAL MODEL FOR GAS PIPELINES


An explicit model of a dynamic, physical, ‘real-world’ system, such as gas flowing through a
pipeline, is a set of partial differential equations based upon the principles of conservation of
mass and momentum together with the equation of state. While developing the explicit
mathematical model for the dynamics of gas flow through a pipeline the following assump-
tions have been made:
( a ) the flow is turbulent
( b ) the gas process is isothermal
( c ) the pipeline is rectilinear.
These assumptions are used by Charnyis in describing the gas dynamics in a pipeline
explicitly by means of the following set of non-linear partial differential equations:

where
c =speed of sound in gas, m/s (it depends upon the gas chemical constitution and
temperature)
w = w(x, t ) = average gas velocity (averaged over the cross-section) in the pipeline, mls
p = p(x, t ) = average density (averaged over the cross-section) in the pipeline, kg/m3
g = 9-81= acceleration due to gravity, m/s2
a(o)= angle of pipeline inclination with respect to the horizontal plane
A =friction coefficient for the fluid in the pipeline
D = pipeline diameter, m
p = p(x, t ) = average gas pressure (averaged over the cross-section) in the pipeline, MPa
p = correction of Coriolis allowing for a profile of non-uniform velocities in the
stream.
The constituent factors a(pw)/at, Apw2/2D and pg sin a define the gas inertia, friction force
and force of gravity, respectively. The factor (l+/3)pw2 is determined by the flowing gas
dynamic pressure.
An optimum mathematical model for gas pipelines in real working conditions has been
evaluated. The investigations’ have shown that the pipeline dynamic should be defined by
means of a linear partial differential equation with respect to p2:

where :
F = cross-section area, m2
Q, =volume flow, m3/s
Because it was assumed that Qv(x, t ) would be averaged along the pipe for each time interval
At, equation (2) is linear with respect to the square of pressure for each interval of
approximation.
Under normal conditions of pipeline operation this equation was shown to be the best
compromise between an accurate physical description and a representation requiring small
computation time as compared to other analysed models of pipelines.
GAS IN PIPELINES 127

3. DESCRIF’TION OF THE FINITE-DIFFERENCE SCHEMES


We have solved equation (2) by the following finite-difference schemes;

A. Two time levels

where

and Ax is the quantization element.


In particular, for v = 0.5; 1 we have, respectively:
A l . Implicit scheme. (Figure l), unrestricted stability with error
E = O((At)’, (Ax)’)
A2. Implicit scheme. (Figure 2), unrestricted stability with error
E = O(At, AX)^)
B. Three time levels
When the derivatives 8Plat and 8’Pldx’ are approximated by the equations
ap p;+*-p.-l
-= +O(At)’
at 2At

and using the following formula


P;+I+ PE-1
Pr;=
2

we obtain the finite-difference approximation to (2)

n tl h+?

n n
k -? k k+l k-f k k+ 1
Figure 1. Crank-Nicholson implicit scheme, Figure 2. Implicit scheme, unrestricted
unrestricted stability stability
128 A. OSiADACZ

0
P i1

k-I k kil o-?

Figure 3. Dufort-Frankel explicit


scheme, unrestricted stability

The Dufort and Frankel explicit scheme (equation (6), Figure 3 ) provides unrestricted
stability with error
E =0(At, AX)^, (At/Ax)2)
The Dufort-Frankel method is consistent with equation (2) with truncation error going to
zero, only if (At/Ax)-+O as both A x and A t + O . Therefore, even though this method is
unconditionally stable, At << A x is required for consistency. Note that, if At and A x -+ 0 in
such a way that At/Ax = c, a constant, then the finite difference equation ( 6 )is consistent with
the following hyperbolic equation

Therefore, when using equation (6) in order to approximately solve equation ( 2 ) we should
make use of grids with sufficiently small c = At/Ax.
Another implicit method used to solve the one dimensional diffusion equation is shown in
Figure 4. It is a scheme of unrestricted stability with error,
E: = O(At, AX)^)
Using the scheme shown in Figure 4 we transform equation ( 2 ) into
p;+l- P; P:-P;-' P;'::-2P;+'+P:::+ o(At,
1.5 - 0.5 =a
At At

n- f
k -I k k +?

Figure 4. Three-time level implicit


scheme, unrestricted stability
GAS IN PIPELINES 129

The schemes shown in Figures 1-4 are presented in accordance with fundamental schemes
for solving parabolic equations of the following type?

au
_ _- a2u
a t - c ax r ~(a = const > 0) (9)

For the implicit schemes, the unknown values of P at any time level are found by solving a
set of algebraic equations:
Ap”+*= b (10)
Equations (10) take a tridiagonal form (elements occur on the main diagonal and on one
subdiagonal above and below). This system of equations was solved using the Thomas
algorithm.

4. BOUNDARY CONDITIONS
Initial conditions are determined on the basis of the pipeline state at the moment preceding
the start time of the simulation. Let us assume that the initial moment is t = 0 . Thus
Q:?(x, 0) = f(x), the initial flow and p(x, 0) = h(x), the initial pressure profile. It was assumed
that Q:(x, 0) = Q:,o = constant (steady-state flow). The steady-state flow of gas under NPT
conditions is given by Weymouth’s equation:
Q:,o = 389640D8’3 d(&)P$ - P N

where
L = length of pipeline, m
po = gas pressure at point x = 0, MPa
pN = gas pressure at point x = L, MPa
T = temperature, “K
2 = compression coefficient
S =specific gravity of gas
The pressure along the pipeline for the steady-state conditions of gas flow may be deter-
mined from the following relation:

Boundary conditions are determined by the way in which the pipeline is supplied and loaded.
It was assumed, for discussion purposes, that the pipeline section under investigation was
supplied from a compressor station at x = 0, and fed at x = L a receiver having a load Q:(t)
varying in time. To determine the form of function Q:(t) at point x = L of the pipeline,
statistical analysis was performed for the 24-hours reports covering the period of a year (the
reports included the values of pressures and flow rates for the selected points in the pipeline
system). Next, the most probable flow change at the pipeline end was defined. The solution,
Q:(L, t ) , is a discrete period function with a discrete step At = 2 h, the time interval being

t * Indicates under NIT conditions.


130 A. OSIADACZ

Figure 5 . Changes of flow with time (boundary condition)

t E [O, 24 h] (Figure 5). It is assumed that introducing appropriate changes of the capacity of
the compressor station the value of the pressure at the beginning of the pipeline may be kept
invariant. Thus
p(0, t ) = = constant (13)
Q3L t ) = f(t> (14)
The relation

where
(389640 D8'3)2
'= AxTSZ
is true only for the steady-state flow along the last discrete section Ax of the pipeline, being
used for manipulating condition (14) into the form necessary for solving equation (2).

5. INVESTIGATION RESULTS
Investigations were carried out for the schemes shown in Figures 1-4. The following were
taken for calculation:
po = 4.92 MPa
Q:,n = 83 m3/s
L = 10' m
D=0-6m
N = 15
The assumed values of a:,, and po are the most probable ones obtained, as in the case of
Q:(L, t), on the basis of the statistical analysis of 24-hours reports for a selected pipeline
section.
The calculations were made by means of a CDC 7600 computer. The simulation period
equal to 48 h was taken. The initial investigations verified that this period is ample enough
for the model to 'forget' the initial condition. The computation times and accuracy were
determined for every numerical scheme. The investigations have been carried out for
At = 5 S, 300 s, 600 s, 1200 s.
GAS I N PIPELINES 131

Table I
Errors ‘1’ MPa

AfOTIICT
300 0.041 0.041 0.037 0.037
600 0.086 0.057 0.052 0.052
1200 0.096 0.087 0.081 0.081

The accuracy of the results for A t = 300, 600 and 1200 has been estimated by comparing
the results with those for the accurate solutions obtained for A t = 5 s.
The results of investigations are shown in Tables I and 11.
Errors ‘3’ in Table I are absolute maximum errors and errors ‘2’ in Table I1 are mean
absolute errors for pressure values at discrete points.
Investigations have shown that the explicit Frankel-Dufort scheme is faster than implicit
schemes as far as the computation time is concerned.
Maximum savings of computation time are 15 per cent with respect to implicit schemes, of
which the scheme in Figure 2 is the fastest. The analysis of results has proved that, if A t
increases, the accuracy of the methods decreases.
Next, the relationship between the value of Ax and the efficiency of the computations was
investigated. The results corresponding to N = 10, 7, 4 (At = 5 s) were compared with those
corresponding to N = 15, A t = 5 s. The results are shown in Tables I11 and Table IV.

Table I1

Errors ‘2’ MPa

300 0.0040 0.0039 0.0041 0.0041


600 0.0210 0.0137 0.0114 0.0120
1200 0.0238 0.0193 0.0177 0.0179

Table 111

Erros ‘I‘ MPa

4 0-063 0-058 0-059 0.059


7 0.037 0.032 0.031 0.032
10 0.021 0.018 0.019 0.019
132 A. OSIADACZ

Table IV

Errors '2'MPa

4 0.025 0.024 0.021 0.022


7 0-016 0.015 0-012 0.013
10 0.008 0.007 0.007 0.007

The correct numerical process of simulation of a gas pipeline system should provide a
compromise between the computation time and the accuracy of the solution. It means that
the values of Ax and A t should be selected in such a way that the error of a numerical
solution is of the same order as the error of parameters which are measured on the object
(pressure, flow, temperature) and are used as the input data for the simulation program.
Error-free choice of Ax and At should be preceded by the analysis of measurement errors.
An analysis of the results of investigation has shown that for N = 4 and A t I= 600 s the
maximum numerical error was less than 3 per cent ( L = lo5m, Q$(L,t) as in Figure 5).
Owing to the lack of the information necessary for the analysis of error, it was assumed that
N = 4 and A t = 600 s for the next investigations.
The simulation of gas network necessitates the numerical solution of equation (2) for each
pipe. The length of pipes may change from several hundred meters to more than one
hundred kilometers. In order to compare the consistency between the Dufort-Frankel
scheme and the implicit schemes of Figures 1-4 investigations were made for:
p ( 0 , t ) =constant
= 4.92 MPa
N=4, At=600s
L = 1 0 3 m and L = 7 x 1 0 4 m
and Q:(L, t) changing according to the function shown in Figure 6.
It was assumed that Q:,o = 97.222(m3/s) for L = 7 X lo4 m and Q:,o = 694.444(m3/s) for
L = lo3m.

I I I
I
I
I
I
I .

Figure 6. Changes of flow with time (boundary condition)


GAS IN PIPELINES 133
p 1MPo

4.41

3.92

3.L3

2,9L

2,LS

I I he)
1.96 --a

2 4 6 B 10 12 14 76 1.3 20 22 time

Figure 7. Changes of pressure at x = L obtained using D-F scheme for L = lo3 m

The investigation results for pressure changes at x = L obtained using the Dufort-Frankel
scheme for L = lo3m and L = 7 X lo4 m are shown in Figures 7 and 8, respectively.
This example shows that for a short pipe the Dufort-Frankel method is not consistent. It is
possible to improve its consistency by decreasing the value of At or increasing N, but in both
cases it leads to an increase of computation time. For the implicit schemes the results are in
both cases practically the same (the differences are smaller than 2 per cent).
The comparison of computation times given by implicit schemes has shown that the
scheme presented in Figure 2 is the fastest (0.039 s) with respect to 0.04 s for the scheme
shown in Figure 1 and 0.042s for the scheme in Figure 4 (CDC-7600 computer).

6. CONCLUSIONS
The investigations have shown that the pipeline dynamics should be solved numerically by
means of the implicit schemes. The Dufort-Frankel method is accurate only for c<<
l(c =At/Ax). This means that in the case of simulating a network of a complex structure
when the number of discretization intervals is the same for every pipeline, the value of At
should be selected in such a way as to ensure the correct solution for shortest pipelines. This
significantly increases the overall simulation time. One may partially counteract the effect
134 A. OSIADACZ

1,96 (h6J

Figure 8. Changes of pressure at x = L obtained using D-F scheme for L = 7 X lo4 m

through the decomposition of the set of arcs (pipes) of the graph network into subsets of arcs
of approximate lengths, attributing various numbers of discretization intervals to individual
subsets, This, however, results in a marked increase of complexity of the numerical
algorithm.
The implicit schemes Figures 1, 2 and 4 are characterized by high accuracy within a large
interval At. This allows for a significant reduction of computation time as compared with the
explicit scheme in spite of the fact that the new variables Pi" are not explicitly defined;
however, it is necessary to solve a matrix equation in each time step.
The differences in computation times between the schemes gives in Figures 1, 2 and 4 and
the scheme in Figure 3 will increase in step with the dimension of the simulated networks
including arcs of highly varied lengths.

REFERENCES
1. A. Osiadacz, 'Simulation of transient gas flows in networks', Submitted to Int. J. Num. Meth. Eng.
2. A. V. Aleksandrov and D. B. Bayasanov, Primenenie elektronno-uychisliteEnykh mashin dla rascheta i upruulenija
u sistemakh dalnego transporta gaza, (Application of Computers in the Calculation and Control of Remote Gas
Transport Systems), Nedra, 1970.
GAS IN PIPELINES 135

3 . M. H. Goldwater, K. Rogers and D. K. Turnbull, The Pan Network Analysis Program. Its Development and Use,
Communication 1009 42nd Autumn Meeting, London, November 1976.
4 . €3. Ward, Hopscotch Reference Manual, London Research Station, T. 123, 1972.
5. J. A. Charnyi, Neustanouiusheesya duizhenie realnoi zhidkosti u trubakh, (Unsteady State Flow of Real Fluids in
Pipelines), Nedra, 1976.
6. R. D. Richtmyer and K. W. Morton, Difference Methods for Initial-Value Problems Wiley, 1967.
7. W. F. Ames, Numerical Methods for Partial Differential Equations, Nelson, 1969.

You might also like