TRANSIENT MODELING AND SIMULATIONS WITH ANSYS FLOTRAN OF NATURAL GAS IN PIPELINES

Transient analysis of gas flow in pipeline was studied. Finite Element Method based on ANSYS FLOTRAN was used to account for changes in pressure, temperature and flow rate. Compressibility factor function of temperature and pressure was considered. For nonisothermal transient results, the pressure and the flowrate gave wave propagation as a result of slow transients created by demand condition at the outlet end of custody transfer. Results obtained were in agreement with the demand restrictions at the outlet end of custody transfer indicating that the predictions are accurate and reliable. The results demonstrated that the Finite Element Method gave accurate prediction of pressure, temperature and flowrate in transient gas studies. For steady state non-isothermal model, results showed that the magnitude of the average pressure drop was higher when pressure was predicted with constant compressibility factor, but the same average pressure drop was reduced when the pressure was predicted with variable compressibility factor, z. Since compressibility factor is a function of temperature and pressure, the above findings signifies that in the case when gas temperature does not stabilize, the prediction of pressure with isothermal model and constant compressibility factor will lead to significant errors.


Introduction
Modelling and simulation of gas flow in pipelines has been handled by many investigators.Some have analysed the gas flow as  Assist to make pre-definition of turbo compressors that best fits a system  Assist in performing failure analysis on the pipeline to foresee how the system would cope, define screening capacity and define much better maintenance procedure.
 The modeling of a physical gas transmission system leads to partial differential equations as will be seen latter in the mathematical development.
 In the subject of transient modeling and simulation of gas flow through pipelines, the problem has to do with seeking an efficient numerical scheme that enhances the solution of the partial differential equations obtained from the conservation of mass, conservation of momentum and conservation of energy in order to produce effective, reliable and accurate results [28].
 Runge-Kutta method, method of lines, finite difference and finite volume have all been used  These methods have shown to produce adequate engineering results for the unsteady flow equation especially with the observation of pressure, temperature and flow rate oscillations .
 It is not the objective of this study to apply the conventional route for the analysis of transient flow in pipe distributing systems but to apply Finite Element to simulate the same problem.
The main objectives of this study shall be:  To model a non-isothermal pipeline thermal model that considers steady heat transfer and compressibility factor as a function of pressure and temperature.
 To treat the partial differential equations of gas flow model by finite element method and solve the problem numerically by means of the finite element software package Ansys Flotran.
 Relate the results to those of Osiadacz et al. [10] Methodology of Study A two-data set on physical gas distribution system was used for the present study to analyze the transient behavior in the flow of the gas through the pipeline.One of the data set is the West Africa Gas Pipeline (WAGP) system.The WAGP system is a 570 Km offshore single pipeline system from Nigeria to Ghana through Benin and Togo.The system operates with a diameter of 0.508 m, fixed inlet pressure of 15.3 M Pa and an initial flow rate of 5.30 MMm 3 /D.The WAGP system parameters are provided in S1.
The second data is the test by Osiadacz et al [5] carried out to analyze isothermal and nonisothermal model on the pipeline hydraulics.These tests were carried out for gas transmission system described by Osiadacz [5] and Chaczykowski [12].Calculations were done for the Yamal -Europe pipelines mainly for the 122 Km pipe section between Kondratki and Wloclawek compressor stations on polish territory.This is a typical onshore gas transmission system with a maximum operating pressure of 8.4MPa.The distance between the compressor stations is 122 Km and the pipe diameter is 1383.6 mm.The average roughness of the pipe, ε = 0.03 mm.The Osiadacz system parameters provided in S2, S3 and S4 Source: osiadacz system [5] Transient Gas Flow Model in Pipeline The basic equations governing the flow of natural gas in pipelines are the continuity equation, the momentum equation, the energy equation and the equation of state.In practice, the form of the mathematical model varies with assumptions made with regards to the condition of operation of the network.
Figure1: Shows a gas flow through a control volume of a pipe.From the consideration of mass, momentum and energy, modelling of gas flow lead to the following partial differential equations.

The Models
Transient non-isothermal flow of gas in a pipeline is described in this study by system of equations: The developments underlying the above equation are provided on supplementary S5, S6, S7 and S8.

NUMERICAL SOLUTION OF TRANSIENT EQUATION BY FINITE ELEMENT METHOD
Type of PDE to be solve are:  Hyperbolic  Non-linear  Primary challenge is to create an equation that approximate the equation to be solved, but is numerically stable. The finite element (FE) method is a good choice for solving the PDE  Several FE based compressible and incompressible fluid dynamics algorithms have been developed under the category of stabilized methods. One of such finite element method is the Characteristic Based Split (CBS) Scheme which is the method chosen for this study.

Treatment of Model Equations in CBS Format
The detailed CBS treatment is shown in S9.
The summary of CBS procedure used in this work is shown below.The choice of CBS Scheme is based on having a procedure for dealing with the pressure instability in the compressible flow problem.Other advantages include: Having ability to reduce oscillations in convection dominated flow problems Ability to paralyze codes and its small memory requirement during program implementation.

Applications: Solution Implementation
The construction of solution to engineering problems using finite element analysis (FEA) requires either the development of a computer program based on FEA formulation or the use of a commercially available-general purpose FEA program.In this work, a computational fluid dynamics (CFD) model based on a commercial code ANSYS FLOTRAN was used for the numerical simulation of the steady and transient flow of gas through pipeline.
An ANSYS Parametric Design Language (APDL) code was written to establish the numerical simulation generating a two-dimensional mesh of 1500 nodes.The ANSYS Parametric Design language conducts the simulation by using the generated nodes and elements to generate solution to the gas flow problem.The pressure, velocity and the temperature are solved iteratively to convergence.The ANSYS Parametric Design Language code can be referred in the appendix.
During FLOTRAN solution process, ANSYS obtained an approximate solution to the momentum equation and used them as forcing functions to solve the pressure equation based on the conservation of mass.The resulting pressures were then used to update the velocities so that the velocity field conserves mass.To solve the energy equation, ANSYS FLOTRAN solved for the temperature equation and used it to update the temperature dependent properties.As FLOTRAN simulation proceeds, ANSYS calculated convergence monitors for each degree of freedom for every global iteration.Convergence monitors were computed for velocity (VX, VY), pressure (PRES) and temperature (TEMP).
Convergence monitors are a normalized measure of the solutions rate of change from iteration to iteration.It represents the sum of changes of the variable calculated from the results between the k th iteration and the previous (k-1) th iteration divided by the sum of the current values.The problem statement and data that were used in the ANSYS simulation are given herein below.

Application of Model Solutions : Transient Conditions
The example considered is an onshore single horizontal pipe of 122Km, 1.3836 m diameter with an initial pressure of 8.4MPa and inlet temperature of 315.65 K.The system has a variable flow demand at the outlet end given by a function f (t).Details of the system are shown in Table 1

Application of Model Solutions: West African Gas Pipeline Project
The example considered is an offshore single horizontal pipe of 570Km, 0.508 m diameter with an initial pressure and flow rate of 15.3 M Pa and 5.30 MMCM/D respectively.The system has a variable flow demand at the outlet given by a function fig 3.3.Details of the system are given Table 1as

Results and Discussion
Numerical simulation was carried out using ANSYS FLOTRAN for the values of the system given in Table 1.1 and 1.3.A function V (L, t) = f (t) was imposed at the outlet boundary and V (L, t) shown in fig 3 .2 is defined by f (t)= 4.74 + 2.4 sin .The same problem was simulated by Osiadacz [5] except that the outlet boundary function f(t) was changed in the present work.ANSYS FLOTRAN gave erroneous results for table functions such as the outlet boundary function used by Osiadacz [5] therefore a function f(t) that works well with FLOTRAN was used.For the West Africa Gas Pipeline system, an outlet boundary function f (t) = 2.1 + 2 sin was used to satisfy the system's operating restriction of 4.5 m/s optimum velocity (fig 3 .3).With regards to the boundary conditions of the problem, the inlet gas pressure, inlet temperature, inlet flow rate (converted to velocity) and density was kept fixed by reason of uniform flow whiles the flow rate at the outlet was varied with a 72-hour cycle to reflect the changes in consumer demand within three days (fig 3 .2).In the simulation, density and viscosity were varied.
The numerical simulation was performed with a 2-D axisymmetric mesh made up of 1500 nodes and 1616 elements with a FLOTRAN fluid element, fluid-141.Four different transient simulations were performed for system details outlined in Table 1.The first case (case 1) was the simulation with an initial gas temperature of 315.65 K, the second (case 2) was the simulation with an inlet gas temperature of 303.15 K, the third (case 3) was the one with an initial gas temperature of 285.15K and the final case (case 4) was the simulation of the West African Gas Pipeline system with an initial temperature of 303.From the graph and contour plots, it is seen that the temperature records a sharp decrease in value from the initial 315.65 K to about 291 K for case 1 in fig.4.13 at a distance of about 10 km.From there it becomes stable and constant between the distance of about 11 km to 100 km.Between 100 km and 122 km there is a discontinuity in the trend.The observed discontinuity may be explained by two phenomena: Joule Thompson effect and heat transfer between the gas and the surroundings.By Joule Thompson effect, the temperature predictions of all simulations gradually drop below the ambient temperature when the heat transfer coefficient is kept constant [22].The heat transfer coefficient in this simulation was isotropic and constant.Temperature profile along the pipeline should therefore approach the ambient temperature asymptotically or decrease below the ambient temperature as observed in fig.4.14, 4.16, 4.18 and 4.20.However, when the size of the mesh is increased it is believed that the predictions would be more accurate than previous.In a long pipeline flow simulation the temperature would eventually stabilize and assume an asymptotic behavior close with the ambient or ground temperature.It is anticipated that when the pipeline length is extended the temperature would again stabilize and assume an asymptotic behavior.Nevertheless, the temperature prediction in gas flow in pipelines cannot always stabilize [59].In comparing the numerical results to the analytical steady state results (fig 4.60 -4.65), it is found that the numerical results agree with the analytical results.In all these behavior of the temperature and pressure, the velocity contours and profiles from inlet to outlet as shown in fig 4.25 -4.32 are not constant but varying according to the varying flow conditions at the outlet.The turbulence plots indicate that turbulence was high at the initial stages of the simulation.This turbulence in the initial stages of the flow is possibly responsible for the initial high oscillations in pressures.

Steady State Analytical Results:
In order to validate the numerical results, steady state analytical results are presented here below.For non-isothermal steady state, it was found that there was steady drop in gas pressure as the natural gas travelled from upstream to downstream; the higher the initial gas temperature, the higher the average pressure drop and vice versa.It was also found that the magnitude of the average pressure drop was higher when pressure was predicted with constant compressibility factor, z, but the same average pressure drop was reduced when the pressure was predicted with variable compressibility factor, z, for the non-isothermal results.Since compressibility factor is a function of temperature and pressure, the above findings signifies that in the case when gas temperature does not stabilize, the prediction of pressure with isothermal model and constant compressibility factor will lead to significant errors.
Results for density prediction along the pipeline from upstream to downstream were found to follow similar profile pattern as the pressure signifying that the gas density varies directly proportional to the pressure according to the equation of state.Therefore we form an opinion that, along the pipeline, the fluid density decreases as the pressure drops.
For temperature prediction, it was seen that the temperature of the gas cools as it travels from upstream to downstream until it becomes asymtotic or near to the ambient temperature signifying that the gas temperature in a flowing pipeline is not constant but varies along the pipeline.This shows that using isothermal models for predictions of pressure may give significant errors but nonisothermal predictions will give accurate results.
In viscosity results, it was found that increased temperature results in increased dynamic viscosity.
For non-isothermal transient results, the pressure and the flowrate (velocity) gave wave propagation as a result of slow transients created by demand condition at the outlet end of custody transfer.Results obtained were in agreement with the demand restrictions at the outlet end of custody transfer indicating that the predictions are accurate and reliable.All the results demonstrated that the Finite Element Method gives accurate prediction of pressure, temperature and flowrate in transient gas studies.
It is concluded that the transient non-isothermal model leads to accurate prediction of state variables and the inclusion of a variable compressibility factor in non-isothermal predictions results in accurate predictions and has significant effect on the pressure.Hence Finite Element Method is suitable for the prediction of pressure, temperature and flowrate in gas flow studies.
the gas flow in pipelines is analysed as transient non-isothermal Analyzing the gas flow as transient means to predict the changes in the flow parameters with respect to time.It has several advantages:  To satisfy contractual agreement between the operators  Predict the flow scenario at the delivery point In the diagram above, P = the pressure flowing into the control volume measured in Pascal, q = volumetric flowrate into the control volume measured in mmcd, P+ΔP = pressure flowing out of the control volume, τ = pipe wall stress, θ = angle of inclination of pipe, dx = length of control volume.


Convert the flow equations into conservative forms using set of codes  Convert the conservative equations into non-dimensional forms  Apply Characteristic-Galerkin method to the equations to stabilize the pressures and convection quantity in the equations  Find an intermediate momentum in Split A Drop the pressure term and calculate the intermediate velocity  Calculate the pressure and correct the intermediate velocity  Calculate the temperature  Apply spatial approximations and Standard Galerkin type FE to solve the equations  Transform all equations into Matrix  Codes in Ansys Flotran were written to obtain flow prediction.Transforming all the four equations into matrix we obtain: []{ } = {} Where  = − ∆ ∆ + ( + ∆ ) −   ∆  =  + ∆    ∆∆ −   ∆  ∆ −  ∆ +   = − ∆ ∆ −  WAGP data and Osiadacz data on single pipeline was used for the simulation.

Fig 1 :Fig. 2 :
Fig 1: Boundary condition function at x=L for Osiadacz data 15 K.The results of the simulations are presented in fig 3 to fig 4.59.Figures 4.1 -4.8 show the contour plot and profile of the gas pressure along the pipe length.

Preprints (www.preprints.org) | NOT PEER-REVIEWED | Posted: 9 July 2018 doi:10.20944/preprints201807.0150.v1
Fig 58: Comparison of steady state pressures with pipe length.Fig 59: Comparison of Velocity profiles with Pipe LengthConclusionsTransient studies with non-isothermal pipeline model that considers steady heat transfer and compressibility factor as function of pressure and temperature was studied.Three partial differential equation obtained from conservation of mass, conservation of momentum equation and conservation of energy gave predictions for gas flow pressure, temperature and flowrate when Ansys based Finite Element method was used to simulate.