AALTO UNIVERSITY
School of Chemical Technology
CHEM-E7160 Fluid Flow in Process Units
2D NAVIER-STOKES EQUATION: MATLAB IMPLEMENTATION
USING FV APPROACH AND SOLUTION OF A SIMPLE PROBLEM
Charlotta Weber 298744
Artur Dahlberg 293037
Fanny Henriksson 220563
Report submitted: 6.5.2016
Abstract
The purpose of the study was to implement a MATLAB solution for a simple fluid flow
problem using the Navier-Stokes equations and finite volume method. First, the analytical
model was formed by assuming no velocity in the r-direction and a steady state system. The
analytical solution could then be simulated in MATLAB to gain a plot describing the velocity
of the flow as a function of radius. Next, a numerical model was solved by discretizing the
two-dimensional Navier-Stokes equations for x- and y-momentum and continuity using the
finite volume method. The volume is defined by choosing the size of the control volume..
Thus, a difference between the analytical and numerical solution was that the radius velocity
was not considered zero for the numerical model.
Table of contents
1.
Introduction ......................................................... Virhe. Kirjanmerkki ei ole mritetty.
2.
Materials and Methods ....................................... Virhe. Kirjanmerkki ei ole mritetty.
3.
Results.................................................................. Virhe. Kirjanmerkki ei ole mritetty.
4.
Discussion ............................................................ Virhe. Kirjanmerkki ei ole mritetty.
5.
Answers to questions........................................... Virhe. Kirjanmerkki ei ole mritetty.
6.
Comments............................................................ Virhe. Kirjanmerkki ei ole mritetty.
7.
References ........................................................... Virhe. Kirjanmerkki ei ole mritetty.
List of appendices
Appendix 1 MATLAB code for the analytical solution
1. Introduction
The purpose of the assignment was to study a simple fluid flow problem and model the
problem with the Navier-Stokes equations. The Navier-Stokes equations consist of
differential momentum balances and material balances (Alopaeus, 2016). In principles, the
Navier-Stokes equations could be implemented on all fluid flow problems. In addition, the
finite volume method was used for the numerical solution of the problem. The finite volume
method can be used for solving and evaluating partial differential equations in the form of
algebraic equations. As the name suggests, the finite volume method refers to a small
volume in the system, from which the problem was undertaken (LeVeque, 2002).
In this study, a numerical and analytical solution was prepared. In the analytical solution, a
flow in a pipe was studied. Some assumptions, such as no velocity in the r-direction (the
direction of the radius) and steady state, were applied. Boundary conditions like no slip
(velocity at the walls of the pipe is zero) and the assumption that the velocity at the center
of the pipe is finite. With all these assumptions the Navier-Stokes equations were
integrated. In the numerical solution, a flow between two plates was studied. The NavierStokes equations were discretized with the finite volume method, by choosing a control
volume. The flow was assumed in steady state but no further assumptions were made.
(Ugaz, 2014)
2. Model
This section is divided into two parts. First, an analytical model of the fluid flow problem in a
pipe is presented. Next, the numerical model of the fluid flow problem is shown.
2.1 Analytical model
A flow in a circular pipe was studied. Water was chosen as the liquid, since a lot of data is
available for water. The flow was assumed to be laminar. A schematic figure of the flow is
seen in Figure 1. (Ugaz, 2014)
Figure 1. A schematic figure of the flow ().
The following assumptions were made:
Laminar flow
Steady-state
No velocity in r direction
Velocity is zero at the walls of the pipe
Pressure driven flow
Boundary conditions
No slip: when r(x) = r V(r) = 0
When r(x) = 0 V(r) = max, finite
The conservation of mass equation is presented below. The Navier-Stokes equations for the
flow look as follows (Versteeg 1995).
( +
+ ( ( ( )) +
+ ( (
( +
2
)
2
2
))
2
(1)
(2)
Since the only difference in velocity is happening in the r direction with respect to z, all other
terms are cancelled. The remaining equation looks like follows. (Versteeg, 2015; Ugaz, 2014)
( )
(3)
The following assumption was made.
Rearranging we get the following.
(4)
Integrating the following equation is obtained.
= 2
+ 1
(5)
Rearranging and integrating again the following equation could be determined.
2
2 = 4
+ 1 ln() + 2
(6)
Next, the boundary conditions are applied. When r is at its maximum we have no slip, which
means that when r(x) = r V(r) = 0.
2
2 = 0 = 4
2 =
+ 1 ln() + 2
(7)
1 ln( )
(8)
When r = 0 the equation looks as follows.
0
2 = 4
1 ln(0)
(9)
We find that 1 =0. Putting equation (4) into equation (2) we get the following.
() =
2
(1
2 )
4
(10)
2.2 Numerical model
The numerical solution was prepared based on the Navier-Stokes equations for twodimensional flow using a finite volume approach. The Navier-Stokes equations for steady
state, two-dimensional incompressible flows are presented in equations 11-13 (Anon, 2016).
Equation 11 refers to the x-momentum in the fluid, equation 12 to the y-momentum and
equation 13 to the continuity.
2
2
2
)
2
(11)
2
2
2
)
2
(12)
+(
+(
+ = 0
(13)
where u describes the velocity in the y-direction, v the velocity in y-direction, the density
of the fluid and P the pressure.
A discretization of the two-dimensional equation was performed using the principles
explained by Versteeg et al. (1995). By applying a solution grid for the problem (Figure 2) the
numerical solution is solved by defining one section in the grid by time. As an example, in
the following equations, the gray area on the grid represents a finite volume in the pipe used
for solving the differential equations 11-13 by setting the sections according to the grid.
Figure 2. Solution grid used for determining the finite volume of the problem. The grey square is the
volume used for solving the differential equations.
Thus, equations 11-13 need to be discretized. Equation 11, describing the x-momentum,
thus becomes;
+ = + ( 2 + 2 )
+ = + ( ( ) + ())
(, 1, )
(,+1 , ) (, ,1 )
+(
)
( )
(,+1 ,1 )
)
( )
)
1 (
, 1, +
+1, ,
, 1,
)(
)
By using the same method for the other two equations (12-13), the discretized equations
becomes for y-momentum;
, 1,
,+1 ,
)+(
)=
1
( , 1,) +
+1, , , 1,
,+1 , , ,1
And finally for continuity;
, 1,
,+1 ,
=0
The following step for creating a model for the fluid flow problem would be to implement a
MATLAB code based on the discretized equations described above. Due to the complexity of
the simulation and discussions with the instructor, no such MATLAB simulation was
completed.
3. Results and discussion
3.1 Analytical solution
An analytical solution was obtained for the problem and the function was plotted on
MATLAB. The flow profile inside the 2d-pipe obtained is presented in Figure 3.
Figure 3. Plot describing the velocity in the pipe as a function of the distance from the middle of the
pipe.
As seen from the velocity profile the results looks like we assumed it to look like in the
beginning. The velocity profile has a maximum in the middle of the pipe and the velocity at
the wall is 0. The MATLAB code used for the solution is presented in appendix 1.
3.2 Numerical solution
No numerical MATLAB implementation was completed, since the problem was
misunderstood in the beginning and by the time the problem became clearer there was not
sufficient time to implement the MATLAB simulation. However, based on discussions with
the instructors, an example of a how the MATLAB code could have been implemented is
presented below.
The problem could have been solved on MATLAB with help of a SIMPLE algorithm. A flow
diagram of how to solve the algorithm is presented in Figure 4.
Figure 4. Flow chart for SIMPLER algorithm. (Matyka 2004)
Where the (U) and (V) are velocity gradients in x and y direction that can be solved from
n
the discretized Navier-Stokes equations.
To solve the model first boundary conditions has to be set up. Then you guess the (U*) and
n
(V*) to solve the (U*)
n
n+1
and (V*) . After that the pressure can be calculated from Poisson's
n+1
equation. After that the new (U*) n+1 ,and (V*) n+1 are calculated. With help of these the P
can be solved so that the (U)
n+1
and (V) can be solved. This is done until the values have
n+1
converged. The exact equations for each step can be found in Matykas article (2004).
4. Conclusion
In this work, an analytical and a numerical solution for a simple fluid flow problem has been
presented using the Navier-Stokes equations. By assumptions and simplifications the
equations are easily simplified and by setting boundary conditions and integrating, a solution
can be simulated by MATLAB. However, assumptions are needed for the Navier-Stokes
equations. In other cases the equations would be very complex and solving them would be
time consuming.
By discretizing the Navier-Stokes equations using the finite volume method, solvable
equations are obtained. The grid must be chosen. This is done by choosing the size of the
control volume. A MATLAB code can be written where the conditions in each control volume
are calculated. By this method, a numerical solution is obtained. This solution can be plotted
to gain visual data of the flow.
5. References
Alopaeus, V., Course material (Fluid flow in Process Units), Lecture 3 (2016). Available at:
[Link] Retrieved 4.5.2016.
Anonymous, Basic Fluid Mechanics. Available at:
[Link] Retrieved: 29.4.16.
Anonymous, Derivation of the Navier-Stokes Equations and Solutions. Available at:
[Link] Retrieved:
5.5.2015.
LeVeque, Randall, Finite Volume Methods for Hyperbolic Problems, Cambridge University
Press, 2002.
Matyka, M., Solution to two-dimensional Incrompressible Navier-Stokes Equations with
SIMPLE, SIMPLER and Vorticity-Stream Function Approaches. Driven-Lid Cavity Problem:
Solution and Visualization. 2014.
Ugaz, V., Applying the Navier-Stokes Equations, part 4 Lecture 4.9 Chemical Engineering
Fluid Mechanics. 12 February 2014.
Versteeg, H.K., Malalasekera, W. An introduction to Computational Fluid Dynamics,
Longman Scientific & Technical, 1995.