1 Implementing the SIMPLE Algorithm to the Lid Driven Cavity and Square Elbow Flow Problems Rob Morien, Ali Bakhshinejad UWM Department of Mechanical Engineering ME723 – CFD December 18, 2015 Final Project Abstract The lid driven cavity flow problem is commonly used as an assessment tool for verification of solution accuracy during testing of two dimensional flow problems within the various CFD codes. This report analyzes the lid driven cavity flow problem using the SIMPLE algorithm for multigrid development and Matlab code to generate the results. Once the Matlab code for the multigrid has been constructed, it is then used to solve a square elbow flow problem. The Matlab results for the square elbow flow problem are then confirmed with Fluent CFD analysis. Introduction The geometry of the domain for the lid driven flow problem is a square box in the x-y plane with all sides having equal dimensions as shown in figure 1. The two sides and bottom are rigidly attached to ground with no-slip conditions and the top lid moves tangentially with unit velocity. Figure 1, Lid Driven Cavity Flow Problem Geometry
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
1
Implementing the SIMPLE Algorithm to the Lid Driven Cavity and
Square Elbow Flow Problems
Rob Morien, Ali Bakhshinejad
UWM Department of Mechanical Engineering
ME723 – CFD
December 18, 2015
Final Project
Abstract
The lid driven cavity flow problem is commonly used as an assessment tool for verification of
solution accuracy during testing of two dimensional flow problems within the various CFD
codes. This report analyzes the lid driven cavity flow problem using the SIMPLE algorithm for
multigrid development and Matlab code to generate the results. Once the Matlab code for the
multigrid has been constructed, it is then used to solve a square elbow flow problem. The
Matlab results for the square elbow flow problem are then confirmed with Fluent CFD analysis.
Introduction
The geometry of the domain for the lid driven flow problem is a square box in the x-y plane with
all sides having equal dimensions as shown in figure 1. The two sides and bottom are rigidly
attached to ground with no-slip conditions and the top lid moves tangentially with unit velocity.
Figure 1, Lid Driven Cavity Flow Problem Geometry
2
The geometry of the domain for the square elbow flow problem is a square box in the x-y plane
with all sides having equal dimensions as shown in figure 1. The two corner pieces are rigidly
attached to ground with no-slip conditions and the inlet and outlet openings have length L/2.
Figure 2, Square Elbow Flow Problem
Assuming an incompressible fluid and an initial guess of zero pressure at the bottom left corner
of the cavity, we seek to determine the steady state velocity and pressure distribution inside of
the cavities.
Methodology
Using the assumptions and boundary conditions described in the introduction, we derive the
multigrid domain from the two-dimensional steady incompressible Navier-Stokes equations.
The u and v momentum equations for the x and y directions are respectively:
uu u p +S V i
vv v p +S V j
(1)
Considering the u momentum equation first, we integrate with respect to the control volume to
get a finite volume formulation:
uV
u u p +S dV V i
Next, we apply the divergence theorem:
uA A A
u d u d pd +S dV V A A A i
Let
u u J V
3
Substituting, we get:
uA A
d pd +S dV J A A i
(2)
In order to prevent checker boarding of the velocity field during simulation, we will use a
staggered grid approach during the discretization of eq. (2) as shown in figure 1.
Figure 3, Staggered Grid for the u Momentum Equation
Considering the LHS of eq. (2) first,
ˆ ˆ ˆ ˆf f E E n n P P s sA
d J A J A J A J A J A J A
Where the area terms in the staggered grid are:
E y A i
n x A j
P y A i
s x A j
Looking at the EJ term:
E E E Eu u J V
4
And so,
1
0
x
E E
yE E
uuy u y
uv
J i
Which expands to:
2
E E x Ey u u y J i
Since the velocities are only on the staggered grid i.e. eu , eeu , etc., we interpolate to nodes using
central differencing:
2
ee eE
u uu
ee ex E
u uu
x
Therefore:
2
2
ee e ee eE
u u u uy y
x
J i
(3)
Next, considering the nJ term:
ˆ
ˆ ˆ
0
1
x
n n
yn n
uux u x
uv
J j
ˆ ˆ ˆ ˆn n n y nx v u u x J j
Again, using central differencing for the velocities:
ˆ2
nne en
u uu
ˆ2
n nen
v vv
ˆ
nne ey n
u uu
y
Therefore:
ˆ2 2
nne e n ne nne en
u u v v u ux x
y
J j
(4)
Next, considering the PJ term:
1
0
x
P P
yP P
uuy u y
uv
J i
Which expands to:
5
2
P P x Py u u y J i
Using the central differencing for the velocities:
2
e wP
u uu
e wx P
u uu
x
Therefore:
2
2
e w e wP
u u u uy y
x
J i
(5)
Finally, considering the sJ term:
ˆ ˆ
ˆ ˆ
0
1
x
s s
ys s
uux u x
uv
J j
Which expands to:
ˆ ˆ ˆ ˆs s s y sx v u u x J j
Using the central differencing for the velocities:
ˆ2
sse es
u uu
ˆ2
s ses
v vv
ˆ
e ssey s
u uu
y
Therefore:
ˆ2 2
sse e s se e sses
u u v v u ux x
y
J j
(6)
Next, we consider the pressure term:
ˆ ˆ ˆ ˆf f E E n n P P s sA
pd p p p + p + p A i A i A A A A i
E PA
pd p p y A i
(7)
Finally, we write the discretized u momentum equation as:
0f f f f u e e nb nb u
nb
p S V a u a u b J A A i
6
2
2
2
2 2
2
2 2
ee e ee e
nne e n ne nne e
e w e w
sse e s se e sse
u u u uy
x
u u v v u ux
y
u u u uy
x
u u v v u ux
y
0
uf f
f
E P u
S Vp
p p y S x y
A i
J A
2e
x ya
y x
ee w
ya a
x
nne sse
xa a
y
2
24
ee e nne e n ne
u P E u
e w sse e s se
u u y u u v v xb p p y S x y
u u y u u v v x
Next, considering the v momentum equation, we integrate with respect to the control volume to
get a finite volume formulation:
vV
v v P +S dV V j
Next, we apply the divergence theorem:
vA A A
v d v d Pd +S dV V A A A j
Let
v v J V
Substituting, we get:
vA A
d Pd +S dV J A A j
(8)
Figure 2 shows the staggered grid used for the v momentum equation.
7
Figure 4, Staggered Grid for the v Momentum Equation
Considering the LHS of eq. (8) first,
ˆ ˆ ˆ ˆf f N N w w P P e eA
d J A J A J A J A J A J A
Where the area terms in the staggered grid are:
N x A j
w y A i
P x A j
e y A i
Looking at the NJ term:
N N N Nv v J V
And so,
0
1
x
N N
yN N
vux v x
vv
J j
Which expands to:
2
N N y Nx v v x J j
Using central differencing to determine the velocities:
8
2
nn nN
v vv
nn ny N
v vv
y
Therefore
2
2
nn n nn nN
v v v vx x
y
J j
(9)
Next, considering the wJ term:
ˆ ˆ
ˆ ˆ
1
0
x
w w
yw w
vuy v y
vv
J i
ˆ ˆ ˆ ˆw w w x wy u v v y J i
Again, using central differencing for the velocities:
ˆ2
nnw ww
u uu
ˆ2
n nww
v vv
ˆ
n nwx w
v vv
x
Therefore:
ˆ2 2
nnw w n nw n nww
u u v v v vy y
x
J i
(10)
Next, considering the PJ term:
0
1
x
P P
yP P
vux v x
vv
J j
Which expands to:
2
P P y Px v v x J j
Using the central differencing for the velocities:
2
n sP
v vv
n sy P
v vv
y
Therefore:
9
2
2
n s n sP
v v v vx x
y
J j
(11)
Finally, considering the eJ term:
ˆ ˆ
ˆ ˆ
1
0
x
e e
ye e
vuy v y
vv
J i
Which expands to:
ˆ ˆ ˆ ˆe e e x ey u v v y J i
Using the central differencing for the velocities:
ˆ2
nne ee
u uu
ˆ2
ne ne
v vv
ˆ
ne nx e
v vv
x
Therefore:
ˆ2 2
nne e ne n ne ne
u u v v v vy y
x
J i
(12)
Next, we consider the pressure term:
ˆ ˆ ˆ ˆf f N N w w P P e eA
pd p p p + p + p A j A j A A A A j
N PA
pd p p x A j
(13)
Finally, we write the discretized v momentum equation as:
0f f f f v n n nb nb v
nb
p S V a u a u b J A A j
2
2
2
2 2
2
2 2
nn n nn n
nnw w n nw n nw
n s n s
nne e ne n ne n
v v v vx
y
u u v v v vy
x
v v v vx
y
u u v v v vy
x
0
vf f
f
N P v
S Vp
p p x S x y
A j
J A
10
2n
x ya
y x
ne nw
ya a
x
nn s
xa a
y
2
24
nn n nnw w n nw
v P N v
n s nne e ne n
v v x u u v v yb p p x S x y
v v x u u v v y
We now consider the continuity equation which is given by:
=0 V
Integrating with respect to volume:
VdV = 0 V
And applying the divergence theorem we get:
f fA V A = V A
This form of the continuity equation may get discretized using the main cell (colored in green in
figure 1). Doing so gives:
f f e w n se w n s V A V A V A V A V A
Which results in:
0e w n su u x v v y
(14)
11
The SIMPLE Algorithm
The SIMPLE algorithm, short for semi-implicit method for pressure linked equations, is an
algorithm that links the u and v momentum equations and the continuity equation together.
The u momentum equation with corresponding velocity term that is desired to be solved for is
given by:
e e nb nb e P Ea u a u b A p p
(15)
e
nb nb e nb nbe P E e P E
e e e
d
a u b A a u bu p p d p p
a a a
This formulation will provide the velocity at e provided that we know the pressure at the faces
of the cell. However, since the pressure is not commonly known for the general case, we must
make a guess for the pressure which we will call * **, ,P Ep p p , etc. Based on the choice for *p , we
then solve for **,u v , etc. from the momentum equations. Therefore with a guessed pressure, eq.
(15) becomes:
* * * *
e e nb nb e P Ea u a u b A p p
(16)
Subtracting eq. (16) from eq. (15), we get:
' ' ' '
* * * *
e nb P E
e e e nb nb nb e P P e E E
u u p p
a u u a u u A p p A p p
(17)
Where '
u and 'p are called the velocity and pressure correction respectively. In other words, the
dashed terms are the values necessary to bring the guessed term (starred terms) to the correct
value, or ' *
e eu u u .
Upon inspection of eq. (17) we see that the velocity correction at point e is a combined effect of
the correction of velocity and pressure at the neighboring points. In the Simple algorithm, the
summation term in eq. (17) is generally omitted from the calculation since not doing so would
result in an implicit framework, hence the semi-implicit in the title of the algorithm. Therefore,
omitting the summation term, eq. (17) becomes:
12
' ' '
e e e P Ea u A p p
' ' '
e e P Eu d p p
Therefore, the updated velocity terms become:
* '
,e new e eu u u
* ' '
,e new e e P Eu u d p p
(18)
In a similar manner,
* ' '
,n new n n P Nv v d p p
(19)
Where, equations 18 and 19 are called the velocity correction equations. Although we don’t yet
know what the pressure correction is, it should converge in the momentum equations in such a
way that the velocity field satisfies the continuity equation. Therefore, it is the continuity
equation which acts as the governing equation for the correction of pressure.
We then substitute the velocity correction equations into the discretized continuity equation
derived in eq. (14).
* ' ' * ' '
* ' ' * ' ' 0
e e P E w w w P
n n P N s s s P
u d p p u d p p y
v d p p v d p p x
(20)
Therefore, the pressure correction equation is:
' ' ' ' '
P P E E W W N N S Sa p a p a p a p a p b
(21)
Where,
E ea d y
W Wa d y
N Na d x
S Sa d x
* * * *
W E S Nb u u y v v x
13
The following shows the steps taken in order to calculate the velocity and pressure:
Summary of the SIMPLE algorithm
1) Guess a *p
2) Solve for momentum equations * *,u v
3) Solve for the pressure correction equation ( 'p )
4) Using step 3, update velocity u, v
5) Correct * 'p p p
Results
Figures 5 through 10 below show the velocity distributions for the lid driven cavity and square
elbow flow problems. Figure 11 shows the Fluent CFD results of the square elbow.
Figure 5, Velocity Vector Plot, U and V Velocities, Lid Driven Cavity
14
Figure 6, Velocity Surface Plot of U Velocity, Lid Driven Cavity
Figure 7, Velocity Surface Plot of V Velocity, Lid Driven Cavity
15
Figure 8, Velocity Vector Plot, U and V Velocities, Square Elbow
Figure 9, Velocity Surface Plot of U Velocity, Square Elbow
16
Figure 10, Velocity Surface Plot of V Velocity, Square Elbow