31
535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1 *Endalew Getnet Tsega and 2 V.K. Katiyar Department of Mathematics Indian Institute of Technology Roorkee Uttarakhand, India 1 [email protected], 2 [email protected] *Corresponding Author Received: July 5, 2017; Accepted: May 28, 2018 Abstract The NavierStokes equations are fundamental in fluid mechanics. The finite element method has become a popular method for the solution of the Navier-Stokes equations. In this paper, the Galerkin finite element method was used to solve the Navier-Stokes equations for two- dimensional steady flow of Newtonian and incompressible fluid with no body forces using MATLAB. The method was applied to the lid-driven cavity problem. The eight-noded rectangular element was used for the formulation of element equations. The velocity components were located at all of 8 nodes and the pressure variable is located at 4 corner of the element. From location of velocity components and pressure, it is obvious that this element consists of 16 unknowns for velocities and 4 unknowns for pressure. As a result, the unknown variables for velocities and pressure are 20 per each element. The quadratic interpolation functions represent velocity components while bilinear interpolation function represents pressure. Finite element codes were developed for implementation. The numerical results were compared with benchmark results from the literature. Keywords: NavierStokes equations; finite element method; steady-state solution; eight node rectangular element; MATLAB MSC 2010 No.: 35Q30, 35Q35, 76D05, 76M10 Available at http://pvamu.edu/aam Appl. Appl. Math. ISSN: 1932-9466 Vol. 13, Issue 1 (June 2018), pp. 535 - 565 Applications and Applied Mathematics: An International Journal (AAM)

Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

535

Finite Element Solution of the Two-dimensional Incompressible

Navier-Stokes Equations Using MATLAB

1*Endalew Getnet Tsega and 2V.K. Katiyar

Department of Mathematics

Indian Institute of Technology Roorkee

Uttarakhand, India [email protected], [email protected]

*Corresponding Author

Received: July 5, 2017; Accepted: May 28, 2018

Abstract

The Navier–Stokes equations are fundamental in fluid mechanics. The finite element method

has become a popular method for the solution of the Navier-Stokes equations. In this paper,

the Galerkin finite element method was used to solve the Navier-Stokes equations for two-

dimensional steady flow of Newtonian and incompressible fluid with no body forces using

MATLAB. The method was applied to the lid-driven cavity problem. The eight-noded

rectangular element was used for the formulation of element equations. The velocity

components were located at all of 8 nodes and the pressure variable is located at 4 corner of

the element. From location of velocity components and pressure, it is obvious that this

element consists of 16 unknowns for velocities and 4 unknowns for pressure. As a result, the

unknown variables for velocities and pressure are 20 per each element. The quadratic

interpolation functions represent velocity components while bilinear interpolation function

represents pressure. Finite element codes were developed for implementation. The numerical

results were compared with benchmark results from the literature.

Keywords: Navier–Stokes equations; finite element method; steady-state solution; eight

node rectangular element; MATLAB

MSC 2010 No.: 35Q30, 35Q35, 76D05, 76M10

Available at

http://pvamu.edu/aam

Appl. Appl. Math.

ISSN: 1932-9466

Vol. 13, Issue 1 (June 2018), pp. 535 - 565

Applications and Applied

Mathematics:

An International Journal

(AAM)

Page 2: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

536 Endalew Getnet Tsega et al.

1. Introduction

The Navier-Stokes equation is a set of nonlinear partial differential equations that describe

the flow of fluids, which represent conservation of linear momentum. It is the cornerstone of

fluid mechanics as noted by Cengel et al. (2010). It is solved jointly with continuity equation.

These equations cannot be solved exactly. So, approximations and simplifying assumptions

are commonly made to allow the equations to be solved approximately. Recently, high speed

computers have been used to solve such equations by replacing with a set of algebraic

equations using a variety of numerical techniques like finite difference, finite volume, and

finite element methods.

Finite element method is the most powerful numerical technique for computational fluid

dynamics which is readily applicable to domains of complex geometrical shape and provides

a great freedom in the choice of numerical approximations. It reduces a partial differential

equation system to a system of algebraic equations that can be solved using traditional linear

algebra techniques. In finite element method, the domain of interest is subdivided into small

subdomains called finite elements. Over each finite element, the unknown variable is

approximated by a linear combination of approximation functions called shape functions

which are associated with the node of the element characterize the element. The piecewise

approximations for elements are assembled together to obtain a global system to the whole

domain. One of the major advantages of the finite element method is that a general purpose

computer program can be developed easily to analyze various kinds of problems as noted by

Kwon et al. (1997). In particular, any complex shape of problem domain with prescribed

boundary conditions can be handled with ease using the finite element method.

Jiajan (2010) discussed the Galerkin finite element formulation of two dimensional unsteady

incompressible Navier-Stokes equations using the quadratic triangular element (6-nodes).

The pressure variable was located at the corner nodes and the velocity components were

located at all of the six nodes. Ghia et al. (1982) studied high Reynolds number solutions for

incompressible flow using the Navier-Stokes equation and the multigrid method. Persson

(2002) implemented a finite element based solver of the incompressible Navier-Stokes

equations on unstructured two dimensional triangular meshes. He solved the lid-driven cavity

flow problem for four different Reynold’s numbers: 100, 500, 1000 and 2000.

Glaisner et al. (1987) discussed finite-element procedures for the Navier-Stokes equations in

the primitive variable formulation and the vorticity stream-function formulations. Steady-

state solution of lid-driven cavity flow was obtained by the velocity-pressure formulation

using the nine-node rectangular element in their work. Taylor et al. (1981) and Smith et al.

(2014) used eight-noded rectangular element mesh to solve two-dimensional incompressible

Navier-Stokes Equations with FORTRAN programming language. Rhaman et al. (2014)

presented Galerkin finite element method to simulate the motion of fluid particles which satisfies the

unsteady Navier-Stokes equations through a programming code developed in FreeFem++.

Simpson (2017) used nine noded rectangular elements with two degree of freedom on each

node for finite element simulation of a coupled reaction-diffusion problem using MATLAB.

Khennane (2013) developed MATLAB codes for 4-nodded and 8-noded quadrilateral

elements for the linear elastic static analysis of a two dimensional problem using finite

element method.

Page 3: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

AAM: Intern. J., Vol. 13, Issue 1 (June 2018) 537

2. Governing Equations

For steady Newtonian incompressible fluid with no body forces, the governing equations for

two-dimensional flow are:

Continuity equation:

.0

y

v

x

u (1)

Navier-Stokes equation:

x-component

,2

2

2

2

y

u

x

u

x

p

y

uv

x

uu (2)

y-component

.2

2

2

2

y

v

x

v

y

p

y

vv

x

vu (3)

where u and v are the x, y components of the velocity vector, p is static pressure, is density

and dynamic viscosity of the flowing fluid.

Using L and V as a characteristics (reference) length and velocity respectively, we define the

dimensionless variables

.*and,*,*,*,*2V

pp

V

vv

V

uu

L

yy

L

xx

The governing equations, Equation(1), Equation (2),and Equation (3) can be written in their

dimensionless form (ignoring the astrix ‘*’) as:

0

y

v

x

u, (4)

,Re

12

2

2

2

y

u

x

u

x

p

y

uv

x

uu (5)

,Re

12

2

2

2

y

v

x

v

y

p

y

vv

x

vu (6)

where

VLRe

is the Reynolds number.

Page 4: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

538 Endalew Getnet Tsega et al.

u,v u,v,p

u,v

u,v

u,v

u,v,p

u,v,p u,v,p

3. Formulation of Element Equations

To describe the structure of finite element programming of a steady-state solution of the

Navier–Stokes equations, let us consider a flow confined to a rectangular cavity driven by a

uniform horizontal velocity at the top. The velocities at the other three boundaries are set to

zero. Eight-noded rectangular elements are used to model the flow. We use all the 8 nodes of

each element to model velocities components u and v and the 4 corner nodes to model the

pressure p. Meshes are numbered in x-direction. Freedoms numbered are in the order u−p−v

as used by Smith et al. (2014) and Taylor et al. (1981).

Figure 1. Lid-driven cavity

Let us denote an element by . Shape functions for the rectangular elements are expressed in

terms of local coordinates and where

=2(x-xc)/lx, =2(y-yc)/ly

Here, (xc, yc) is the centroid of the

lx, ly represent its element, and

length in x and y-direction.

Page 5: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

AAM: Intern. J., Vol. 13, Issue 1 (June 2018) 539

Figure 2. Eight-noded rectangular element

Figure 3. Eight-noded rectangular elements mesh

Suppose the nodes 1, 2, 3, 4, 5, 6, 7, 8 have coordinates (-1, -1), (0, -1), (1, -1), (1, 0), (1, 1),

(0, 1), (-1, 1), (-1, 0) in the local coordinate system. Then, the general form of shape functions

for 4-noded bilinear rectangular element (considering corner nodes) using local coordinates is

. dcbaM (7)

The general form of shape functions for 8-noded quadratic rectangular element (considering

all nodes) using local coordinates is

.2222 hgfedcbaN (8)

Using Kronecker-delta property of shape functions, from Equation (7) and Equation (8) shape

functions for 4-noded and 8-noded rectangular elements are

Page 6: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

540 Endalew Getnet Tsega et al.

).1(4

1

),1(4

1

),1(4

1

),1(4

1

4

3

2

1

M

M

M

M

(9)

).1)(1(

),1)(1)(1(

),1)(1(

),1)(1)(1(

),1)(1(

),1)(1)(1(

),1)(1(

),1)(1)(1(

2

21

8

41

7

2

21

6

41

5

2

21

4

41

3

2

21

2

41

1

N

N

N

N

N

N

N

N

(10)

Thus, the quadratic interpolation functions are used for velocity components while bilinear

interpolation functions for pressure. As a result, the unknown variables for velocities and

pressure are 20 per each element. Thus, the dependent variable u, v, and p are expressed as

.

,

,

4

1

8

1

8

1

i

ii

i

ii

i

ii

pMp

vNv

uNu

(11)

where iii pvu and, are velocity and pressure values at the nodes.

Now, expressing Equation (4), Equation (5), and Equation (6) using these shape functions we

get

08

1

8

1

j

j

j

j

j

jv

y

Nu

x

N, (12)

,Re

1 8

12

28

12

2

4

1

8

1

8

1

8

1

8

1

j

j

j

j

j

j

l

l

l

j

j

j

k

kk

j

j

j

k

kk

uy

Nu

x

N

px

Mu

y

NvNu

x

NuN

(13)

Page 7: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

AAM: Intern. J., Vol. 13, Issue 1 (June 2018) 541

.Re

1 8

12

28

12

2

4

1

8

1

8

1

8

1

8

1

j

j

j

j

j

j

l

l

l

j

j

j

k

kk

j

j

j

k

kk

vy

Nv

y

N

py

Mv

y

NvNv

x

NuN

(14)

Employing Galerkin weighted residual approach on Equation (13), we get

0Re

1 8

12

28

12

2

4

1

8

1

8

1

8

1

8

1

dAuy

Nu

x

N

px

Mu

y

NvNu

x

NuNN

j

j

j

j

j

j

l

l

l

j

j

j

k

kk

j

j

j

k

kki

(15)

Using Gauss-Divergence Theorem, we have

8

1

8

1

8

1

8

12

28

12

2

Re

1

Re

1

Re

1

j

j

j

i

j

j

ji

j

j

ji

j

j

j

i

j

j

j

i

dSun

NN

dAuy

N

y

NdAu

x

N

x

NdAu

y

NNu

x

NN

where is the boundary of the element , yx nnn , is the unit outward normal vector to

the element and y

j

x

jjn

y

Nn

x

N

n

N

is the directional derivative of

jN in the direction

normal to the boundary . Hence, we have

8

1

8

1

8

1

4

1

8

1

8

1

8

1

8

1

.0Re

1

Re

1

j

j

j

i

j j

j

ji

j

ji

l

l

l

i

j

j

j

k

kki

j

j

j

k

kki

dSun

NNdAdAu

y

N

y

Nu

x

N

x

N

px

MNu

x

NvNNu

x

NuNN

i, j=1,2, ..., 8.

For Dirichilet boundary condition, we have

.0Re

1 8

1

8

1

4

1

8

1

8

1

8

1

8

1

dAdAuy

N

y

Nu

x

N

x

N

px

MNu

x

NvNNu

x

NuNN

j j

j

ji

j

ji

l

l

l

i

j

j

j

k

kki

j

j

j

k

kki

(16)

i, j=1,2, ..., 8.

Page 8: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

542 Endalew Getnet Tsega et al.

Applying similar procedure for Equation (14), we get

.0Re

1 8

1

8

1

4

1

8

1

8

1

8

1

8

1

dAdAvy

N

y

Nv

x

N

x

N

py

MNv

x

NvNNv

x

NuNN

j j

j

ji

j

ji

l

l

l

i

j

j

j

k

kki

j

j

j

k

kki

(17)

i, j=1,2, ..., 8.

Employing Galerkin weighted residual approach on Equation (12) using the weight functions

Ml , we get

,08

1

8

1

dAvy

Nu

x

NM

j

j

j

j

j

j

l

or

.08

1

8

1

dAvy

NMu

x

NM

j

j

j

l

j

j

j

l (18)

l = 1, 2, 3, 4 .

Due to the nonlinearity, the set of algebraic equations that will be obtained here cannot be

solved in a single shot, but an iterative solution is necessary. In such an iterative solution

nonlinear terms can be linearized in a number of different ways. The simplest possibility,

which will be used in this paper, is known as Picard linearization, in which the nonlinear

terms are replaced by

,y

uv

x

uu

y

uv

x

uu

.y

vv

x

vu

y

vv

x

vu

where u and v are approximate values for the velocity components.

We assume starting values 080201080201 .,..,,.,..,, vvvanduuu for the element and

.

,

8

1

0

8

1

0

k

kk

k

kk

vNv

uNu

The iteration process continues by replacing k

u0 and k

v0 , k =1, 2, ..., 8, by the average of

velocity component values from the previous two iterations until tolerance is satisfied.

From Equation (16), Equation (17) and Equation (18), we get a system of equations in matrix

form as

Page 9: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

AAM: Intern. J., Vol. 13, Issue 1 (June 2018) 543

,bAh (19)

where

)9(

88

)9(

87

)9(

86

)9(

85

)9(

84

)9(

83

)9(

82

)9(

81

)8(

84

)8(

83

)8(

82

)8(

81

)9(

78

)9(

77

)9(

76

)9(

75

)9(

74

)9(

73

)9(

72

)9(

71

)8(

74

)8(

73

)8(

72

)8(

71

)9(

68

)9(

67

)9(

66

)9(

65

)9(

64

)9(

63

)9(

62

)9(

61

)8(

64

)8(

63

)8(

62

)8(

61

)9(

58

)9(

57

)9(

56

)9(

55

)9(

54

)9(

53

)9(

52

)9(

51

)8(

54

)8(

53

)8(

52

)8(

51

)9(

48

)9(

47

)9(

46

)9(

45

)9(

44

)9(

43

)9(

42

)9(

41

)8(

44

)8(

43

)8(

42

)8(

41

)9(

38

)9(

37

)9(

36

)9(

35

)9(

34

)9(

33

)9(

32

)9(

31

)8(

34

)8(

33

)8(

32

)8(

31

)9(

28

)9(

27

)9(

26

)9(

25

)9(

24

)9(

23

)9(

22

)9(

21

)8(

24

)8(

23

)8(

22

)8(

21

)9(

18

)9(

17

)9(

16

)9(

15

)9(

14

)9(

13

)9(

12

)9(

11

)8(

14

)8(

13

)8(

12

)8(

11

)6(

48

)6(

47

)6(

36

)6(

45

)6(

44

)6(

43

)6(

42

)6(

41

)4(

48

)4(

47

)4(

46

)4(

45

)4(

44

)4(

43

)4(

42

)4(

41

)6(

38

)6(

37

)6(

36

)6(

35

)6(

34

)6(

33

)6(

32

)6(

31

)4(

38

)4(

37

)4(

36

)4(

35

)4(

34

)4(

33

)4(

32

)4(

31

)6(

28

)6(

27

)6(

26

)6(

25

)6(

24

)6(

23

)6(

22

)6(

21

)4(

28

)4(

27

)4(

26

)4(

25

)4(

24

)4(

23

)4(

22

)4(

21

)6(

18

)6(

17

)6(

16

)6(

15

6(

14

)6(

13

)6(

12

)6(

11

)4(

18

)4(

17

)4(

16

)4(

15

)4(

14

)4(

12

)4(

12

)4(

11

)2(

84

)2(

83

)2(

82

)2(

81

)1(

88

)1(

87

)1(

86

)1(

85

)1(

84

)1(

83

)1(

82

)1(

81

)2(

74

)2(

73

)2(

72

)2(

71

)1(

78

)1(

77

)1(

76

)1(

75

)1(

74

)1(

73

)1(

72

)1(

71

)2(

64

)2(

63

)2(

62

)2(

61

)1(

68

)1(

67

)1(

66

)1(

65

)1(

64

)1(

63

)1(

62

)1(

61

)2(

54

)2(

53

)2(

52

)2(

51

)1(

58

)1(

57

)1(

56

)1(

55

)1(

54

)1(

53

)1(

52

)1(

51

)2(

44

)2(

43

)2(

42

)2(

41

)1(

48

)1(

47

)1(

46

)1(

45

)1(

44

)1(

43

)1(

42

)1(

41

)2(

34

)2(

33

)2(

32

)2(

31

)1(

38

)1(

37

)1(

36

)1(

35

)1(

34

)1(

33

)1(

32

)1(

31

)2(

24

)2(

23

)2(

22

)2(

21

)1(

28

)1(

27

)1(

26

)1(

25

)1(

24

)1(

22

)1(

22

)1(

21

)2(

14

)2(

13

)2(

12

)2(

11

)1(

18

)1(

17

)1(

16

)1(

15

)1(

14

)1(

13

)1(

12

)1(

11

00000000

00000000

00000000

00000000

00000000

00000000

00000000

00000000

0000

0000

0000

0000

00000000

00000000

00000000

00000000

00000000

00000000

00000000

00000000

aaaaaaaaaaaa

aaaaaaaaaaaa

aaaaaaaaaaaa

aaaaaaaaaaaa

aaaaaaaaaaaa

aaaaaaaaaaaa

aaaaaaaaaaaa

aaaaaaaaaaaa

aaaaaaaaaaaaaaaa

aaaaaaaaaaaaaaaa

aaaaaaaaaaaaaaaa

aaaaaaaaaaaaaaaa

aaaaaaaaaaaa

aaaaaaaaaaaa

aaaaaaaaaaaa

aaaaaaaaaaaa

aaaaaaaaaaaa

aaaaaaaaaaaa

aaaaaaaaaaaa

aaaaaaaaaaaa

A

,

8

7

6

5

4

3

2

1

4

3

2

1

8

7

6

5

4

3

2

1

v

v

v

v

v

v

v

v

p

p

p

p

u

u

u

u

u

u

u

u

v

p

u

h

b = 0 (20X1 zero vector)

Page 10: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

544 Endalew Getnet Tsega et al.

Here,

,8,...,2,1,

,Re

1)1(

ji

dAy

N

y

N

x

N

x

N

y

NvN

x

NuNa

jijij

i

j

iij

,)1()9(

ijij aa

4,3,2,18,...,2,1

,)2(

ji

dAx

MNa

j

iij

4,3,2,18,...,2,1

,)8(

ji

dAy

MNa

j

iij

,8,...,2,1,4,3,2,1

,)4(

ji

dAx

NMa

j

iij

,8,...,2,14,3,2,1

.)6(

ji

dAy

NMa

j

iij

4. Derivatives and Integrals Using Local Coordinates

Let N(,) be a shape function in terms of local coordinates. If x and y are the global

coordinates, then

.

,

y

y

Nx

x

NN

y

y

Nx

x

NN

.

y

Nx

N

yx

yx

N

N

,

y

Nx

N

JN

N

where

.

yx

yx

J

Page 11: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

AAM: Intern. J., Vol. 13, Issue 1 (June 2018) 545

is the Jacobian matrix of the transformation of the global coordinate system to local

coordinate system.

Then, we have

.1

N

N

J

y

Nx

N

(20)

5. Computing the Jacobian Matrix

Let N1(,), N2(,), . . . , Nn(,), be the shape functions for an element in local

coordinates. If (x1, y1), (x2, y2),. . . , (xn, yn) are the global coordinates of the nodes of the

element and (x , y) is the global coordinate of a point on the element, then

x = N1(,)x1+N2(,)x2+. . . + Nn(,)xn ,

y = N1(,)x1+N2(,)x2+. . . + Nn(,)xn .

Then,

....

,...

,...

,...

21

21

21

21

21

21

21

21

n

NNNy

n

NNNx

n

NNNy

n

NNNx

yyy

xxx

yyy

xxx

n

n

n

n

Hence, the Jacobian matrix of the transformation J is

n

i

iNi

n

i

i

N

n

i

i

Nn

i

i

N

nn

NNN

NNN

yx

yx

yx

yx

yx

yx

yx

Ji

ii

n

n

11

1122

11

21

21

(21)

Formation of discrete finite element system requires evaluation of integrals over elements.

Except for simplest of element geometries, this integral cannot be evaluated analytically.

Hence, numerical integrations is the only alternatives. Gaussian quadrature is mostly

employed. For example, using calculus for coordinate transformation, a typical integral for a

two dimensional rectangular element can be evaluated as

Page 12: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

546 Endalew Getnet Tsega et al.

.)det(),(),,(),(,),(

)det(),(),,(

)det(),(),,(),(

1 1

1

1

1

1

'

Jyxfffww

ddJyxf

ddJyxfdxdyyxf

m

i

n

j

jiji

where J is the Jacobian matrix of the transformation, i and j are Gaussian quadrature

abscissa, and wi and wj are corresponding weights.

6. Global System of Equations

After developing governing equations for each element, assembly of the element equations

was performed in order to establish global system of equations for the whole domain. In

addition to the element equations, Global coordinates to nodes, elements connectivity, and

global degree of freedom for nodes are also used develop the global system equations.

Applying the boundary conditions, the modified global system of equations is obtained. The

MATLAB codes used for solution process are indicated in the appendix.

7. Results and Discussion

To illustrate the finite element method algorithm discussed in this paper, we considered a

square lid-driven cavity flow of length 1 unit. The boundary conditions are such that the flow

is driven by a unit horizontal velocity at the top boundary. The velocities at the other three

boundaries are set to zero. Eight-node elements are used to model the vector field of

velocities, and 4-node elements are used to model the scalar field of pressures. The flow is

simulated with Reynolds numbers 1, 10, 50, 100, 200, 500 and 1000 using the same mesh of

100 elements (803 nodes). The numerical results are presented here in terms of velocity

quiver plot and pressure contour at the Reynolds numbers. The results in this work were

generated by the series of finite element codes we developed. The computations had been

carried out with the convergence check of 610 (tolerance).

Table 1. Computational performance of five simulations performed for the cavity flow

Re 1 10 50 100 200 500 1000

Number of

iterations 21 22 26 29 35 47 147

Time Spent for

Iterations (sec.) 4.04 4.14 4.72 5.26 6.21 7.62 21.06

Page 13: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

AAM: Intern. J., Vol. 13, Issue 1 (June 2018) 547

0 0.2 0.4 0.6 0.8 10

0.2

0.4

0.6

0.8

1

x

Re = 1, Velocity

y

Re = 1

x

y

0 0.2 0.4 0.6 0.8 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

pre

ssure

-10

-8

-6

-4

-2

0

2

4

6

8

10

As seen from Table1, high Reynolds numbers require more iteration and elapsed time to

converge.

(a)

Page 14: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

548 Endalew Getnet Tsega et al.

0 0.2 0.4 0.6 0.8 10

0.2

0.4

0.6

0.8

1

x

Re = 10, Velocity

y

Re = 10

x

y

0 0.2 0.4 0.6 0.8 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

pre

ssure

-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

(b)

Page 15: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

AAM: Intern. J., Vol. 13, Issue 1 (June 2018) 549

0 0.2 0.4 0.6 0.8 10

0.2

0.4

0.6

0.8

1

x

Re = 50, Velocity

y

Re = 50

x

y

0 0.2 0.4 0.6 0.8 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

pre

ssure

-0.2

-0.15

-0.1

-0.05

0

0.05

0.1

0.15

(c)

Page 16: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

550 Endalew Getnet Tsega et al.

Re = 100

x

y

0 0.2 0.4 0.6 0.8 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

pre

ssure

-0.1

-0.05

0

0.05

0 0.2 0.4 0.6 0.8 10

0.2

0.4

0.6

0.8

1

x

Re = 100, Velocity

y

(d)

Page 17: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

AAM: Intern. J., Vol. 13, Issue 1 (June 2018) 551

Re = 200

x

y

0 0.2 0.4 0.6 0.8 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

pre

ssure

-0.05

-0.04

-0.03

-0.02

-0.01

0

0.01

0 0.2 0.4 0.6 0.8 10

0.2

0.4

0.6

0.8

1

x

Re = 200, Velocity

y

(e)

Page 18: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

552 Endalew Getnet Tsega et al.

0 0.2 0.4 0.6 0.8 10

0.2

0.4

0.6

0.8

1

x

Re = 500, Velocity

y

Re = 500

x

y

0 0.2 0.4 0.6 0.8 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

pre

ssure

-0.02

-0.015

-0.01

-0.005

0

0.005

0.01

(f)

Page 19: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

AAM: Intern. J., Vol. 13, Issue 1 (June 2018) 553

0 0.2 0.4 0.6 0.8 10

0.2

0.4

0.6

0.8

1

x

Re = 1000, Velocity

y

Re = 1000

x

y

0 0.2 0.4 0.6 0.8 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

pre

ssure

-0.015

-0.01

-0.005

0

0.005

0.01

(g)

Figure 4. (a) - (g) Velocity quiver and pressure contour plots at different

Reynolds numbers

Page 20: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

554 Endalew Getnet Tsega et al.

8. Conclusion

In this paper, we discussed finite element solution of the two-dimensional incompressible

Navier-Stokes equations by the benchmark of square lid-driven cavity. Dirichlet boundary

conditions were imposed on every boundary of the domain. The finite element programming

codes were constructed to solve these equations. These programming codes are written using

MATLAB 7.10.0 (R2010a). The finite element programs consist of one main program and

nine sub programs. These programs with modification can be used to solve related fluid flow

problems. The codes for the geometry and the boundary conditions are original and very efficient.

The numerical results from finite element programming agreed with the numerical results

obtained from finite element analysis done by Ghia et al. (1982).

Acknowledgement

The authors would like thank the reviewers for their valuable comments to improve our

paper. We also want to express our sincere thanks and appreciation to the chief editor for his

prompt reply, careful work and clear instructions.

REFERENCES

Cengel, Yunus A. and Cimbala, John M. (2014). Fluid Mechanics: Fundamentals and

Applications, Third edition, McGraw-Hill.

Chung, T. J. (2010), Computational Fluid Dynamics, Second edition, Cambridge University

press.

Ghia U., Ghia, K. N., and Shin, C. T. (1982). High Reynolds number solutions for

Incompressible Flow Using the Navier-Stokes Equation and

the Multigrid Method, Computational Physics, vol. 48, pp. 387–411.

Glaisner, F. and Tezduyar, T.E. (1987). Finite Element Techniques for the Navier-Stokes

Equations in the Primitive Variable Formulation and the Vorticity Stream-

function Formulation, Department of Mechanical Engineering, University of

Houston.

Jiajan, Wanchai (2010). Solution to incompressible Navier- Stokes equations by using finite

element method, MSc thesis, University of Texas at Arlington.

Khennane, Amar (2013). Introduction to Finite Element Analysis Using MATLAB and

Abaqus, Taylor & Francis Group, LLC.

Papadopoulos, Panayiotis (2010). Introduction to the Finite Element Method.

Per-Olof Persson (2002). Implementation of Finite Element-Based Navier-Stokes Solver,

2.094 – Project, MIT.

Reddy, J.N. (2006). An Introduction to the Finite Element Method, Third edition, Texas

A&M University, Texas USA .

Rhaman, M. M. and Helal, K. M. (2014).Numerical Simulations of Unsteady Navier-Stokes

Equations for Incompressible Newtonian Fluids using FreeFem++ based on Finite

Element Method, Annals of Pure and Applied Mathematic Vol. 6, No. 1, 70-84.

Page 21: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

AAM: Intern. J., Vol. 13, Issue 1 (June 2018) 555

Sert, Cüneyt (2012). Finite Element Analysis in Thermofluids, Middle East

Technical University, Department of Mechanical Engineering.

Simpson, Guy (2017). Practical Finite Element Modelling in Earth Science using Matlab.

Smith, I.M., Griffiths, D. V. and Margets, L. (2014). Programming the Finite Element

Method, John Wiley & Sons Ltd

Taylor, C. and Hughes, T.G. (1981). Finite Element Programming of Navier-Stokes

Equations, Swansea, U.K., Pineridge Press Ltd.

Zienkiewicz, O. C., Taylor and R. L., Nithiarasu, P. (2014). The Finite Element Method for

Fluid Dynamics, Seventh edition, Elsevier Ltd.

Page 22: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

556 Endalew Getnet Tsega et al.

APPENDIX

The Finite Element Programming Codes

1. The Main program

Page 23: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

AAM: Intern. J., Vol. 13, Issue 1 (June 2018) 557

Page 24: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

558 Endalew Getnet Tsega et al.

2. Mesh Generating Code

Page 25: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

AAM: Intern. J., Vol. 13, Issue 1 (June 2018) 559

3. Global coordinates to nodes

4. Global node numbers Code

Page 26: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

560 Endalew Getnet Tsega et al.

5. Create global degree of freedom

Page 27: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

AAM: Intern. J., Vol. 13, Issue 1 (June 2018) 561

6. Calculate local matrix for each element

Page 28: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

562 Endalew Getnet Tsega et al.

Page 29: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

AAM: Intern. J., Vol. 13, Issue 1 (June 2018) 563

7. Calculate local vector for each element

8. Assemble local matrices into the global

Page 30: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

564 Endalew Getnet Tsega et al.

9. Assemble local vectors into the global

Page 31: Finite Element Solution of the Two-dimensional ......535 Finite Element Solution of the Two-dimensional Incompressible Navier-Stokes Equations Using MATLAB 1*Endalew Getnet Tsega and

AAM: Intern. J., Vol. 13, Issue 1 (June 2018) 565

10. Identify boundary nodes