Modeling and simulation the incompressible flow through pipelines 3D solution for the Navier-Stokes equations Daniela Tudorica 1 (1) Petroleum Gas University of Ploiesti, Department of Information Technology, Mathematics, Physics, no. 39 Bd. Bucuresti, 100680, Ploiesti, ROMANIA E-mail: danatudorica@gmail.com Abstract Automatic monitoring of fluids transportation through pipelines requires first of all modeling and simulation of flow process. The development of mathematical model is based on the application of Newton's second law (conservation of momentum), plus boundary conditions, the continuity equation (mass conservation), energy conservation equation or an equation of state. Since the parameters involved in these equations are variable in time, result in a system of partial differential equations known as the Navier-Stokes equations. Solving theoretical (analytical) Navier-Stokes equations is possible only for some specific simple cases, otherwise are used numerical solutions. The most common solutions use the simplified case of flow in a two-dimensional space (2D) - for example a rectangular surface. This paper presents a Matlab application for the numerical solution of the Navier-Stokes equations for incompressible flow through pipes, using the method of lines, in threedimensional space. The application treats the laminar flow, but it can also be adapted for turbulent flow. Keywords: Navier-Stokes, Modeling, Pipeline, Transportation process 1. Introduction Pipelines are the most convenient way to transport various products. Considering the example of the oil industry, pipelines carry crude oil from the field to the separation park, to the park warehouse and finally to refineries or to export. Petroleum refinery products results from the process of fractionation are transported to consumers. This means a complex network of pipes, whose safe operation can be achieved by implementing control and monitoring systems more efficient. Automatic monitoring of fluid transport by pipeline requires first of all modeling and simulation of flow process. For this, there are used different equations of fluid dynamics. Equations that best describe the motion of a fluid are the Navier-Stokes equations. These are partial differential equations, whose theoretical solution is possible only for some particular simple cases, less common in practice. The fact that few mathematical demonstrations so far failed to fully describe and explain the Navier-Stokes equations, the problem is one of the seven millennium problems proposed in 2000 by the Clay Mathematics Institute, with prizes of 1 million dollars each. (http://www.claymath.org/millennium/navier-stokes_equations/). In practice, flow modeling is done by writing the Navier-Stokes equations in a way best suited to the case considered, adding appropriate boundary conditions and by solving them numerically.
368 University of Bucharest and "Transilvania" University of Brasov 2 Classification of fluid motion Fluid motion is a complex phenomenon that can be classified according to several criteria. For a more suitable model, must identify the type of flow, according to all criteria. Are listed below the types of flow, which are described in detail in (Soare, 2002) - Stationary and nonstationary flow; - Uniform and non-uniform flow; - Three-dimensional, two-dimensional and one-dimensional flow; - Under pressure and the free surface flow; - Laminar and turbulent flow. The paper considers the non-uniform, laminar and under pressure flow of an incompressible fluid in three-dimensional space, through a circular pipe. 3 Equations of fluid incompressible laminar flow Mathematical relations that describe the movement of fluids are based on three fundamental laws of physics: - The mass conservation Law equation of continuity - Newton's Second Law dynamic equilibrium equation (conservation of momentum) - The Energy Conservation Law energy balance equation (Bernoulli equation) In these equations, the indepent variables are spatial coordinates x, y, z and time t, and the depent variables (expressed in terms of the indepent ones) are velocity v, temperature T and pressure p. The first two equations are known as the Navier-Stokes equations. In the following, we use the following notation for physical quantities: - - density of the fluid; - - dynamic viscosity of the fluid; - v velocity; - t time; - T temperature; - p pressure; - g gravitational acceleration. 3.1 The continuity equation For three-dimensional flow of an incompressible fluid (constant density), the continuity equation has the following form: v v x y vz [1] 0 x y z Or, using the symbol, the vector of partial derivatives, (,, ), the continuity x y z equation can be written in a simpler form: [2] v 0 3.2 Dynamic equilibrium equation For three-dimensional flow of an incompressible fluid, this equation is: v 2 [3] p ( v) g t
The 7 th International Conference on Virtual Learning ICVL 2012 369 2 is the Laplacian operator that in Cartesian coordinates is 2 2 2 2 [4] 2 2 2 x y z 3.3 Bernoulli equation Bernoulli equation allows calculation of energy losses through friction. For a real fluid, in isothermal flow in steady state the equation has the following form: P [5] f g where f is the coefficient of friction. The application proposed in this paper does not use Bernoulli equation. Application is limited to solving Navier-Stokes equations, written in a simplified form using the continuity equation. Equations considered have the following characteristics: - Are hyperbolic partial differential equations; - Are strongly nonlinear; - Difficult to solve by numerical methods. Solving partial differential equations require formulation of initial conditions and boundary conditions. These are restrictions imposed on domain boundaries and may be of the following types: - Dirichlet conditions (if the depent variable is specified); - Neumann conditions (if the derivative of depent variable is specified); - Cauchy type (Dirichlet and Neumann); - Robin type (linear combination between Dirichlet and Neumann conditions). Boundary conditions used here in solving the equations will be presented in next chapter. 4 Numerical solution of the Navier-Stokes equations using method of lines 4.1 Numerical methods of solving partial differential equations Simulation of flow through pipeline using computer, which is capable only of simple mathematical operations, requires that partial differential equations to be transformed into algebraic form, suitable programming. This stage is called discretization. There are different methods of discretization, described in detail in specialized books and used extensively in engineering calculations: - the finite difference method FDM - the finite element method FEM - the finite volume method FVM - the boundary element method BEM - the method of lines MOL 4.2 Method of lines The basic idea of the MOL is to replace the spatial (boundary-value) derivatives in the PDE with algebraic approximations. Once this is done, the spatial derivatives are no longer stated explicitly in terms of the spatial indepent variables. Thus, in effect, only the initial-value variable, typically time in a physical problem, remains. In other words, with only one remaining indepent variable, we have a system of ODEs that approximate the original PDE. The challenge, then, is to formulate the approximating system of ODEs. Once this is done, we can apply any integration algorithm for initial-value ODEs to compute an approximate numerical
370 University of Bucharest and "Transilvania" University of Brasov solution to the PDE. Thus, one of the salient features of the MOL is the use of existing, and generally well-established, numerical methods for ODEs. (Schiesser, 2009). In the book A compium of Partial Differential Equation Models (Schiesser W., Griffiths G., 2009) are described in detail various uses of the method of lines for solving partial differential equations. The application proposed in this paper was based on examples from the book mentioned above, but adapted to the equations for incompressible fluid transport modeling. Transformation of partial differential equations (PDEs) in ordinary differential equations (ODEs) can be done using finite differences as follows: v vi vi1 [6] x x where i is an index designating a position along a grid in x and Δx is the spacing in x along the grid. If equation [3] is reduced to one-dimensional 1D case and the pressure gradient is considered null, the result is the Burgers equation. This equation was solved analytically, finding the solution: (Schiesser, 2009) ( is the kinematic viscosity [7] 0.1e v( x, t) e a a b 0.5e e b c e e 0.005 [8] a ( x 0.5 4.95t) 0.25 b ( x 0.5 0.75t 0.5 c ( x 0.375 [9] ) [10] ) c ) Numerical solution of the Navier-Stokes equations in 3D will use as boundary conditions the relations [7] [10]. MOL method is a popular tool for solving the PDE equations. Also Matlab library contains a function called PDEPE for this. The following are sequences from application code in Matlab for numerical solution of the Navier-Stokes equations, focusing more on results. Calculation of analytical solution: function an=cond(x,t) a=(0.05/visc)*(x-0.5+4.95*t); b=(0.25/visc)*(x-0.5+0.75*t); c=(0.5/visc)*(x-0.375); ea=exp(-a); eb=exp(-b); ec=exp(-c); an=(0.1*exp(-a)+0.5*exp(-b)+exp(-c))/(exp(-a)+exp(-b)+exp(c));
The 7 th International Conference on Virtual Learning ICVL 2012 371 Initial conditions: t0=0.0; for i=1:n dx=(xu-xl)/(n-1); for j=1:n x(j)=xl+(j-1)*dx; u0(j)=cond(x(j),0.0); ODE integration: mf=1; reltol=1.0e-04; abstol=1.0e-04; options=odeset('reltol',reltol,'abstol',abstol); if(mf==1) [t,u]=ode15s(@pde_1,tout,u0,options); if(mf==2) ndss=4; [t,u]=ode15s(@pde_2,tout,u0,options); Storing analytical and numerical solutions, calculation of error: n2=(n-1)/2.0+1; for i=1:n u_num(i)=u(i,n2); u_anal(i)=cond(x(i),t(i)); err_plot(i)=u_num(i)-u_anal(i); In Figure 1, you can see the results from running the application. For time values from 0.0 to 5.0, analytical solutions of simplified Navier-Stokes equations, numerical solutions obtained with the method of lines and error are displayed. Note that as time increases, the error decreases. Figure 1. Analytical solutions, numerical solutions and error The same is seen in Figure 2, where analytical solutions are plotted, and the evolution of the error.
372 University of Bucharest and "Transilvania" University of Brasov Figure 2. Graphical representation of error 5 Conclusions This example application attempts to illustrate the basic steps of MOL/PDE analysis used to obtain a numerical solution of acceptable accuracy for the Navier-Stokes equations. It was considered the laminar under pressure flow of an incompressible fluid in threedimensional space. The application did not treat the case more complicated of compressible fluids (gas), nor the multiphase flow. Application can be adapted to the case of turbulent flow, by rewriting the Navier-Stokes equations - using models of turbulence like Reynolds mediation or semiempirical models. 6 References Benjamin Seibold (2008): A compact and fast Matlab code solving the incompressible Navier-Stokes equations on rectangular domains, www-math.mit.edu/, March 31, 2008. Gavrila L. (2000): Transfer phenomena, Vol I, momentum transfer Fenomene, Ed. Alma Mater, Bacau. Schiesser W., Griffiths G.(2009): A compium of Partial Differential Equation Models, Cambridge University Press. Shampine L.F., Gladwell I., Thompson S. (2009): Solving ODEs with Matlab, Cambridge University Press. Soare, Al. (2002): Transport and storage of fluids, Vol 1, Ed.UPG Ploiesti. Soare, Al. (2002): Transport and storage of fluids, Vol 2, Ed.UPG Ploiesti. http://en.wikipedia.org/wiki/computational_fluid_dynamics http://www.claymath.org/millennium/ http://www.scholarpedia.org/article/method_of_lines