You are on page 1of 8

# Computational Fluid Dynamics

## Solving the Navier-

Stokes Equations-II
Grtar Tryggvason
Spring 2011
http://www.nd.edu/~gtryggva/CFD-Course/
Computational Fluid Dynamics
Other Methods for the Navier-Stokes Equations:
Articial Compressibility & SIMPLE
Higher Order Advection QUICK & ENO
Higher order in space
Compact schemes
Conservation of energy
Higher order in time for
the "-# formulation
Outline
Computational Fluid Dynamics
Other
Methods
Computational Fluid Dynamics
The Articial
Compressibility Method
(Chorin, 1967, JCP 2,
12-26)

!u
!t
= "A(u) +#\$
2
u " \$p
! p
!t
=
"1
%
\$& u
\$ is a numerical parameter, in effect an articial
velocity of sound. At steady state

! " u = 0

!u
!t
= "A(u) +#\$
2
u " \$p "
1
2
\$% u ( )u

!u
!t
= "A(u) +#\$
2
u " \$p "
1
2
\$% u ( )u "
1
&
\$ \$% u ( )
Computational Fluid Dynamics
The SIMPLE (Semi-Implicit Method for Pressure Linked
Equations) family of methods for the steady state solution

0 = !A(u) +"#
2
u ! #p
#\$ u = 0

a
p
u
p
= a
l
u
l
neighbours
!
" #p
h
#\$ u = 0
After discretization the momentum
equation can be written as:
Where the sum is over
nonlinear terms since
the coefcients depend
on the velocity
Computational Fluid Dynamics
In SIMPLE based methods we solve the discrete momentum
equation
approximately using an estimation of the pressure and then
Since the momentum equation is an approximation, this is
not the nal velocity and we therefore continue iterating until
convergence

a
p
u
p
= a
l
u
l
neighbours
!
" #p
h

p = p
*
+ p'
u = u
*
+ u'

!
2
p' = "
1
#t
!\$ u
p
*
Computational Fluid Dynamics
The SIMPLE Algorithm:
1. Guess the pressure eld p*
2. Solve the momentum equations to
get u* and v* (using u to nd a
p
)
3. Solve for p&
4. Compute new pressure
5. Compute new velocity
6. Take the corrected pressure as the
new guess p* and go to step 2, using
the new velocity for the coefcient

u
p
= u
p
*
! "p
h

p = p
*
+ p'
!
2
p' = "
1
#t
!\$ u
*

a
p
u
p
*
= a
l
u
l
*
neighbours
!
" #p
h
*
In the original
SIMPLE method
we drop this term
Computational Fluid Dynamics
There is no good reason for neglecting the
neighboring points in step 2 when updating the
velocities (except that they are not known!) and in the
SIMPLEC (SIMPLE Corrected) the neighboring
velocities are estimated using the values from the last
iteration.
In SIMPLER (SIMPLE Revisited) method pressure is
found from the new velocity.
The PISO (Pressure Implicit with Splitting of
Operators) the rst estimate for the velocities is
followed by another one where the preliminary
velocities are used to get a better estimate.
Computational Fluid Dynamics
Higher Order
Methods
Computational Fluid Dynamics
For the advection terms, the methods
described for hyperbolic equations, including
ENO, can all be applied, yielding stable and
robust methods that can be forgiving for
low resolution.
QUICK, where a third order upstream
differencing is used is also popular.
Computational Fluid Dynamics
s=1
f
1

s=2
f
2

s=3
f
3

s=4
f
4

s=5/2
At s = 5/2

!f
2
!x
"
#
\$
i
%
1
h
f
i+1/ 2
2
& f
i&1/ 2
2
{ }
=
1
64h
3 f
i+1
+ 6 f
i
& f
i&1
[ ]
2
& 3 f
i
+ 6 f
i&1
& f
i&2
[ ]
2
{ }
f
5/ 2
= 1/8 ( ) 3f
3
+ 6 f
2
! f
1
[ ]

!f
!t
+
1
2
!f
2
!x
= D
!
2
f
!x
2
Use to solve:
Computational Fluid Dynamics
Centered
Upwind
QUICK

!f
!t
+
1
2
!f
2
!x
= D
!
2
f
!x
2
Computational Fluid Dynamics
0 5 10 15 20 25 30 35 40
0
1
2
3
4
5
6
7
8
9
10
0 5 10 15 20 25 30 35 40
0
1
2
3
4
5
6
7
8
9
10
Re_cell=20
Re_cell=10

!f
!t
+
1
2
!f
2
!x
= D
!
2
f
!x
2
Centered
Upwind
QUICK
Computational Fluid Dynamics
! f
!t
+ u
! f
!x
= 0
f
j
*
= f
j
n
!
"t
h
u
j
n
f
j +1/ 2
n
! f
j !1/ 2
n
( )
f
j
n+1
= f
j
n
!
"t
h
1
2
u
j
n
f
j +1/ 2
n
! f
j !1/ 2
n
( ) + u
j
*
f
j +1/ 2
*
! f
j !1/ 2
*
( ) ( )
f
j +1/ 2
=
f
j
+
1
2
amin !f
j
+
, !f
j
"
( ), if
1
2
u
j
+ u
j +1 ( ) > 0
f
j
"
1
2
amin !f
j +1
+
, !f
j +1
"
( ), if
1
2
u
j
+ u
j +1 ( ) < 0
#
\$
%
&
%
!f
j
+
= f
j +1
" f
j
!f
j
"
= f
j
" f
j "1
amin a, b ( ) =
a, a < b
b, b ! a
"
#
\$
%
\$
Second order ENO scheme for the linear advection equation
Computational Fluid Dynamics
Second order ENO
Re_cell=20

!f
!t
+
1
2
!f
2
!x
= D
!
2
f
!x
2
0 5 10 15 20 25 30 35 40
0
1
2
3
4
5
6
7
8
9
10
Centered
Upwind
QUICK
Upwind
ENO
Computational Fluid Dynamics
! f
!t
+ u
! f
!x
= 0
Second order ENO scheme for the linear advection equation
Upwind
ENO
Computational Fluid Dynamics
Higher order
in space
Computational Fluid Dynamics
Higher order nite difference approximations
The simplest approach is to use more points:
h h
f(x-2h) f(x-h) f(x) f(x+h) f(x+2h)
Computational Fluid Dynamics

!f
!x
"
#
\$
j
=
f
j%2
%8 f
j%1
+ 8 f
j +1
% f
j +2
12h
+ O(h
4
)

!
2
f
!x
2
"
#
\$
j
=
% f
j%2
+16 f
j%1
% 30 f
j
+16 f
j +1
% f
j +2
12h
2
+ O(h
4
)
Centered
Skewed

!f
!x
"
#
\$
j
=
f
j%2
%6 f
j%1
+ 3 f
j
+ 2 f
j +1
6h
+ O(h
3
)
Computational Fluid Dynamics
Compact schemes
Computational Fluid Dynamics
The standard way to obtain higher order
approximations to derivatives is to include more
points. This can lead to very wide stencils and near
boundaries this requires a large number of ghost
points outside the boundary. This can be overcome by
compact schemes, where we derive expressions
relating the derivatives at neighboring points to each
other and the function values.
Compact Schemes
Computational Fluid Dynamics
By a Taylor series expansion the following forth order relations
between the values of f and the derivatives of f can be derived
(1)
(2)
(3)
(4)
f
i +1
= f
i
+
! f
i
!x
"x +
!
2
f
i
!x
2
"x
2
2
+
!
3
f
i
!x
3
"x
3
6
+
!
4
f
i
!x
4
"x
4
24
+ O("x
5
)
f
i #1
= f
i
#
! f
i
!x
"x +
!
2
f
i
!x
2
"x
2
2
#
!
3
f
i
!x
3
"x
3
6
+
!
4
f
i
!x
4
"x
4
24
+ O("x
5
)

!! f
i +1
+ !! f
i "1
= 2 !! f
i
+ f
i
iv
#x
2
+ f
i
vi
#x
4
12
+ O(#x
6
)

f
i +1
+ f
i !1
= 2 f
i
+ "" f
i
#x
2
+ f
i
iv
#x
4
12
+ O(#x
6
)
Taking the second derivative:
Eliminating the fourth derivative

!! f
i +1
+10 !! f
i
+ !! f
i "1
=
12
#x
2
f
i +1
" 2 f
i
+ f
i "1
( ) + O #x
4
( )
Compact Schemes
Computational Fluid Dynamics
By a Taylor series expansion the following forth order relations
between the values of f and the derivatives of f can be derived
(1)
(2)
(3)
(4)

f
i +1
= f
i
+
! f
i
!x
"x +
!
2
f
i
!x
2
"x
2
2
+
!
3
f
i
!x
3
"x
3
6
+
!
4
f
i
!x
4
"x
4
24
+ O("x
5
)
f
i #1
= f
i
#
! f
i
!x
"x +
!
2
f
i
!x
2
"x
2
2
#
!
3
f
i
!x
3
"x
3
6
+
!
4
f
i
!x
4
"x
4
24
+ O("x
5
)

! f
i +1
+ ! f
i "1
= 2 ! f
i
+ !!! f
i
#x
2
+ f
i
iv
#x
4
12
+ O(#x
6
)
Adding and taking the rst derivative:
Subtracting 2 from 1

! f
i +1
+ 4 ! f
i
+ ! f
i "1
=
3
#x
f
i +1
" f
i "1
( ) + O #x
4
( )
f
i +1
! f
i !1
= 2 " f
i
#x + """ f
i
#x
3
3
+ O(#x
5
)
Eliminating the third derivative
Compact Schemes
Computational Fluid Dynamics
To solve the nonlinear advection-diffusion equation

!f
i +1
!x
+ 4
!f
i
!x
+
!f
i "1
!x
=
3
#x
f
i +1
" f
i "1
( ) + O #x
4
( )

!
2
f
i +1
!x
2
+10
!
2
f
i
!x
2
+
!
2
f
i "1
!x
2
=
12
#x
2
f
i +1
" 2 f
i
+ f
i "1
( ) + O #x
4
( )

!f
i
!t
= " f
i
!f
i
!x
+ D
!
2
f
i
!x
2
And use the values to compute the RHS. The time integration is
then done using a high order time integration method.
we rst solve nd the rst and second derivatives using the
expressions derived above:
Compact Schemes
Computational Fluid Dynamics

!"
!t
=
!#
!x
!"
!y
\$
!#
!y
!"
!x
+%
!
2
"
!x
2
+
!
2
"
!x
2
&
'
(
)
*
+

!
2
"
!x
2
+
!
2
"
!x
2
= #\$
Use compact schemes to nd O(h
4
)
approximations for the spatial derivatives
Solution of the vorticity-streamfunction equations
Computational Fluid Dynamics

f
x
( )
i+1, j
+ 4 f
x
( )
i, j
+ f
x
( )
i!1, j
=
3
h
f
i+1, j
! f
i!1, j ( )
f
y ( )
i, j +1
+ 4 f
y ( )
i, j
+ f
y ( )
i, j!1
=
3
h
f
i, j +1
! f
i, j!1 ( )

f
xx
( )
i+1, j
+10 f
xx
( )
i, j
+ f
xx
( )
i!1, j
=
12
h
2
f
i+1, j
!2 f
i, j
+ f
i!1, j ( )
f
yy ( )
i, j +1
+10 f
yy ( )
i, j
+ f
yy ( )
i, j!1
=
12
h
2
f
i, j +1
!2 f
i, j
+ f
i, j!1 ( )
By a Taylor series expansion the following forth order
relations between the values of f and the derivatives of
f can be derived
(1)
(2)
(3)
(4)
Computational Fluid Dynamics

!"
!t
#
\$
%
&
'
(
i, j
=
!)
!x
#
\$
%
&
'
(
i, j
!"
!y
#
\$
%
&
'
(
i, j
*
!)
!y
#
\$
%
&
'
(
i, j
!"
!x
#
\$
%
&
'
(
i, j
++
!
2
"
!x
2
#
\$
%
&
'
(
i, j
+
!
2
"
!x
2
#
\$
%
&
'
(
i, j
#
\$
%
%
&
'
(
(

!
2
"
!x
2
#
\$
%
&
'
(
i, j
+
!
2
"
!y
2
#
\$
%
&
'
(
i, j
= )*
i, j
To nd the time derivative, we need
The vorticity-streamfunction equations at grid point i,j are

!
x
, !
y
, !
xx
, !
yy
, "
x
, "
y
, "
xx
, "
yy
(5)
(6)
Computational Fluid Dynamics
1. Given the vorticity, #, we solve tridiagonal
equations (1-4) for

!
x
, !
y
, !
xx
, !
yy

!
xx
, !
yy
, !
2. For " use (3) and (4) plus the elliptic equation
for the streamfunction (6) for

!
x
, !
y
3. Then use 1 and 2 for (tridiagonal systems)

!"
!t
4. Everything on the right hand side of (5) is now
known to O(h
4
) accuracy and
can be found
Computational Fluid Dynamics
The main advantage of compact schemes
is that it is somewhat easier to implement
boundary conditions than for high order
schemes that use a broad stencil
Computational Fluid Dynamics
Conservation of
kinetic energy
Computational Fluid Dynamics
Conservation of kinetic energy on a centered
regular mesh

!f
!t
+ f
!f
!x
= 0

E
kin
=
1
2
f
2
dx
!

f
!f
!t
+ f
2
!f
!x
"
#
\$
%
&
' (
dx = 0

d
dt
1
2
f
2
!
dx = "
1
3
#f
3
#x
!
dx = 0
Dene:
Multiply by f and integrate
Therefore:
The kinetic
energy is
conserved
Consider:
Computational Fluid Dynamics

!f
!t
= " f
!f
!x
# " f
i
f
i+1
" f
i"1
( ) /2h

!f
!t
= "
1
2
!f
2
!x
# "
1
2
f
i+1
2
" f
i"1
2
( )
/2h
Consider two different discretizations of the
nonlinear term
and
Both conserve f
Is f
2
conserved?
Computational Fluid Dynamics
Check conservation:

=+ f
j!1
2
f
j
! f
j!2 ( )
+ f
j
2
f
j +1
! f
j!1 ( )
+" 0

d
dt
1
2
f
2
!
dx = " f
j
h
2
#f
2
#x
\$
%
&
'
(
) *
j
= "
1
2
f
j
f
j +1
2
" f
j"1
2
( )
+
,
-
.
/
0
*

d
dt
1
2
f
2
!
dx = " f
j
h f
#f
#x
\$
%
&
'
(
) *
j
= " f
j
2
f
j +1
" f
j"1 ( ) { } *

=+
1
2
f
j!1
f
j
2
! f
j!2
2
( )
+
1
2
f
j
f
j +1
2
! f
j!1
2
( )
+" 0
Second scheme:
First scheme:
Computational Fluid Dynamics
Combine both schemes:

!f
!t
" #
1
2h
\$ f
i
f
i+1
# f
i#1
( ) #
1#\$ ( )
2
f
i+1
2
# f
i#1
2
( )
%
&
'
(
)
*

!f
2
!t
dx
"
# \$
1
2
% f
j
2
f
j +1
\$ f
j\$1 ( )
\$
1\$% ( )
2
f
j
f
j +1
2
\$ f
j\$1
2
( )
&
'
(
)
*
+
,

=+! f
j"1
2
f
j
" f
j"2 ( )
+
1"! ( )
2
f
j"1
f
j
2
" f
j"2
2
( )
+
! f
j
2
f
j +1
" f
j"1 ( )
"
1"! ( )
2
f
j
f
j +1
2
" f
j"1
2
( )
+ = 0
Write out the terms for the kinetic energy
Computational Fluid Dynamics

=+! f
j"1
2
f
j
" f
j"1
2
f
j"2 ( )
+
1"! ( )
2
f
j"1
f
j
2
" f
j"1
f
j"2
2
( )
+
! f
j
2
f
j +1
" f
j
2
f
j"1 ( )
"
1"! ( )
2
f
j
f
j +1
2
" f
j
f
j"1
2
( )
+ = 0

! "
1"! ( )
2
= 0

3! "1
2
= 0

! =
1
3

!f
!t
" #
1
6h
f
i
f
i+1
# f
i#1
( ) # f
i+1
2
# f
i#1
2
( ) { }
= #
1
2h
f
i+1
+ f
i
+ f
i#1
3
f
i+1
# f
i#1
( )
\$
%
&
'
(
)
Conserves both f and f
2

Computational Fluid Dynamics
The same idea is used in Arakawas scheme
(JCP 119, 1966)

!"
!t
+ u# \$" = 0

u! "# = \$
%&
%y
%#
%x
+
%&
%x
%#
%y
= J &,# ( )

!"
!t
+ J #," ( ) = 0
Rewrite the nonlinear terms to introduce the Jacobian
giving
Computational Fluid Dynamics

J !," ( ) =
#!
#x
#"
#y
\$
#!
#y
#"
#x
=
#
#x
!
#"
#y
%
&
'
(
)
*
\$
#
#y
!
#"
#x
%
&
'
(
)
*
=
#
#y
"
#!
#x
%
&
'
(
)
* \$
#
#x
"
#!
#y
%
&
'
(
)
*

!
!x
"
!#
!y
\$
%
&
'
(
)
=
!"
!x
!#
!y
*"
!
2
#
!x!y
since
and so on
The Jacobian can be written in several ways
Computational Fluid Dynamics

J !," ( ) = #J ",! ( )
we also have

J !," ( ) =
#!
#x
#"
#y
\$
#!
#y
#"
#x
= \$
#"
#x
#!
#y
\$
#"
#y
#!
#x
%
&
'
(
)
*
since
Discretization of the different forms of
the Jacobian give schemes with slightly
different conservation properties
Computational Fluid Dynamics

J
i, j
1
=
1
4h
2
!
i+1, j
"!
i"1, j ( )
#
i, j +1
"#
i, j"1 ( ) {
" !
i, j +1
"!
i, j"1 ( )
#
i+1, j
"#
i"1, j ( )}
Discretization

J
i, j
2
=
1
4h
2
!
i+1, j
"
i+1, j +1
#"
i+1, j#1 ( ) {
#!
i#1, j
"
i#1, j +1
#"
i#1, j#1 ( )
#!
i, j +1
"
i+1, j +1
#"
i#1, j +1 ( )
#!
i, j#1
"
i+1, j#1
#"
i#1, j#1 ( )}

J
i, j
3
=
1
4h
2
!"
i+1, j
#
i+1, j +1
!#
i+1, j!1 ( ) {
+"
i!1, j
#
i!1, j +1
!#
i!1, j!1 ( )
+"
i, j +1
#
i+1, j +1
!#
i!1, j +1 ( )
!"
i, j!1
#
i+1, j!1
!#
i!1, j!1 ( )}
Computational Fluid Dynamics
Arakawa showed that
Conserves both the vorticity and the kinetic energy

J
i, j
1
=
1
3
J
i, j
1
+ J
i, j
2
+ J
i, j
3
( )
Arakawa also presented a fourth order scheme with
the same properties
Computational Fluid Dynamics
Higher order
in time for the vorticity-
streamfunction
formulation
Computational Fluid Dynamics
Due to the relatively straightforward coupling
between the elliptic equation for the
diffusion equation, the algorithms discussed
already can be used with ease.
Computational Fluid Dynamics

!
i, j
n+1
"!
i, j
n"1
2#t
= "J
i, j
n
+\$%
h
2
!
i, j
n"1
Leapfrog

!
i, j
n+1
"!
i, j
n
#t
= "
1
2
3J
i, j
n
" J
i, j
n"1
( )
+
\$
2
%
h
2
!
i, j
n+1
+ %
h
2
!
i, j
n
( )
Predictor-corrector

!
i, j
n+1
" !
i, j
#t
= "
1
2
J
i, j
n
+

J
i, j ( )
+
\$
2
%
h
2
!
i, j
n
+ %
h
2
!
i, j ( )

!
i, j
"!
i, j
n
#t
= "J
i, j
n
+\$%
h
2
!
i, j
n
Computational Fluid Dynamics
2nd order Runge-Kutta

!
i, j
=!
i, j
n
+
"t
2
#J
i, j
n
+\$%
h
2
!
i, j
n
( )
Runge Kutta methods: take intermidiate steps

!
h
2
"
i, j
n
= #\$
i, j
n

!
h
2

"
i, j
= # \$
i, j

!
i, j
=!
i, j
n
+ "t #

J
i, j
+\$%
h
2
!
i, j ( )
Half step
Final step
Computational Fluid Dynamics
4th order Runge-Kutta method

!
i, j
n+1/ 2
=!
i, j
n
+
"t
2
#J
i, j
n
+\$%
h
2
!
i, j
n
( )

!
h
2
"
i, j
n
= #\$
i, j
n

!
h
2

"
i, j
n+1/ 2
= #

\$
i, j
n+1/ 2

!
i, j
n+1
=!
i, j
n
+ "t #

J
i, j
n+1/ 2
+\$%
h
2

!
i, j
n+1/ 2
( )
First half step
Predicted
nal value

!
h
2

"
i, j
n+1/ 2
= # \$
i, j
n+1/ 2

!
i, j
n+1/ 2
=!
i, j
n
+
"t
2
#

J
i, j
n+1/ 2
+\$%
h
2
!
i, j
n+1/ 2
( )
Second half step
Computational Fluid Dynamics
4th order Runge-Kutta method (continued)

!
i, j
n+1
=!
i, j
n
+
"t
6
#J
i, j
n
#2

J
i, j
n+1/ 2
#2

J
i, j
n+1/ 2
#

J
i, j
n+1
(
+\$%
h
2
!
i, j
n
+ 2\$%
h
2
!
i, j
n+1/ 2
+ 2\$%
h
2

!
i, j
n+1/ 2
+\$%
h
2
!
i, j
n+1
)
corrected
nal value

!
h
2

"
i, j
n+1
= # \$
i, j
n+1

t

t + !t

t + !t /2
Computational Fluid Dynamics
Generating higher order methods for the
Navier-Stokes equations in the vorticity/
streamfunction form is relatively straight
forward and any method developed for the
advection diffusion equation can be used
without much difculty
Computational Fluid Dynamics
Other Methods for the Navier-Stokes Equations:
Articial Compressibility & SIMPLE
Higher Order Advection QUICK & ENO
Higher order in space
Compact schemes
Conservation of energy
Higher order in time for
the "-# formulation
Outline