Computational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
Numerical Methods for
the Navier-Stokes
Equations
Instructor: Hong G. Im University of MichiganComputational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
• Summary of solution methods
- Incompressible Navier-Stokes equations - Compressible Navier-Stokes equations • High accuracy methods
- Spatial accuracy improvement - Time integration methods
Outline What will be covered
What will not be covered
• Non-finite difference approaches such as - Finite element methods (unstructured grid) - Spectral methods
Computational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
Incompressible
Navier-Stokes Equations
Computational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
Incompressible Navier-Stokes Equations
w
v
u
=
u
0
=
⋅
∇
u
ρ
α
p
t
∇
−
∇
+
∇
⋅
−
=
∂
∂
u
u
u
u
2The (hydrodynamic) pressure is decoupled from the
rest of the solution variables. Physically, it is the pressure that drives the flow, but in practice pressure is solved such that the incompressibility condition is satisfied.
The system of ordinary differential equations (ODE’s)
are changed to a system of differential-algebraic equations (DAE’s), where algebraic equations acts like a constraint.
Computational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
Vorticity-stream function formulation Advantages:
- Pressure does not appear explicitly (can be obtained later) - Incompressibility is automatically satisfied
(by definition of stream function) Drawbacks:
- Limited to 2-D applications
Computational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
Solution Methods for Incompressible N-S Equations in Primitive Formulation:
• Artificial compressibility (Chorin, 1967) – mostly steady • Pressure correction approach – time-accurate
- MAC (Harlow and Welch, 1965)
- Projection method (Chorin and Temam, 1968) - Fractional step method (Kim and Moin, 1975) - SIMPLE, SIMPLER (Patankar, 1981)
Computational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
Back to a system of ODE by
• With properly-chosen , solve until
• Originally developed for steady problems
• The term “artificial compressibility” is coined from equation of state
• Possible numerical difficulties for large
Artificial Compressibility - 1
0
2∇
⋅
=
+
∂
∂
u
c
t
p
ρ
α
p
t
∇
−
∇
+
∇
⋅
−
=
∂
∂
u
u
u
u
2 2c
: arbitrary constant 2c
0
(
p
p
(
x
)
)
t
p
=
→
∂
∂
ρ
2c
p
=
2c
Computational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
The concept can be applied to a time-accurate method by using “pseudo-time stepping” at every sub-steps.
Artificial Compressibility - 2
0
2∇
⋅
=
+
∂
∂
u
c
p
τ
ρ
α
τ
β
p
t
∇
−
∇
+
∇
⋅
−
=
∂
∂
+
∂
∂
u
u
u
u
u
2At every “real” time step, take “pseudo-time stepping” using explicit time integration until
0
,
0
→
∂
∂
→
∂
∂
τ
τ
p
u
Since the pseudo time scale is not physical, we can accelerate the integration however we want.
Computational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
Marker-and-Cell (MAC) Method – Harlow and Welch (1965) • Originally derived for free surface flows with staggered grid
Pressure Correction Method - 1
0
=
⋅
∇
u
ρ
α
p
t
∇
−
∇
+
∇
⋅
−
=
∂
∂
u
u
u
u
2)
(
)
(
2 2 1 n h h h n h n h n h n hp
t
u
u
u
u
u
⋅
∇
∇
+
∇
−
=
∇
⋅
⋅
∇
+
∆
⋅
∇
−
⋅
∇
+α
ρ
)
(
2 n h n h hp
=
−
∇
⋅
u
⋅
∇
u
∇
ρ
Taking divergence of momentum equation,
Poisson equation
ρ
α
p
t
h n h n h n n n∇
−
∇
+
∇
⋅
−
=
∆
−
+u
u
u
u
u
1 2 and Explicit integrationComputational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
Projection Method – Chorin (1968), Temam (1969) • Originally derived on a colocated grid
• Identical to MAC except for the Poisson equation Pressure Correction Method - 2
p t p t h t n h t n ∇ ∆ − = ⇒ ∇ − = ∆ − + +
ρ
ρ
u u u u 1 1 1 0 1 = ⋅ ∇ n+ h u p t h h t h n h ∇ ⋅∇ ∆ − ⋅ ∇ = ⋅ ∇ +ρ
u u 1 t h ht
p
∇
⋅
u
∆
=
∇
2ρ
0Computational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
MAC vs. Projection1. Integration without pressure
Pressure Correction Method - 3
p
t
h t n+=
−
∆
∇
ρ
u
u
1(
n n)
n tt
A
D
u
u
=
+
∆
−
+
t h ht
p
∇
⋅
u
∆
=
∇
2ρ
2. Poisson equation3. Projection into incompressible field
)
(
2 n h n h hp
=
−
∇
⋅
u
⋅
∇
u
∇
ρ
n nu
u
=
(
)
t
p
t
n n h n n+=
+
∆
−
+
−
∆
∇
ρ
D
A
u
u
1Computational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
SIMPLE Algorithm – Patankar (1981)
(Semi-Implicit Method for Pressure Linked Equations) - Iterative procedure with pressure correction
Pressure Correction Method - 4
p p
p = 0 + ′
1. Guess the pressure field
2. Solve the momentum equation (implicitly)
3. Solve the pressure correction equation
0 p
ρ
α
0 0 2 0 0 0p
t
n∇
−
∇
+
∇
⋅
−
=
∆
−
u
u
u
u
u
(
0)
2u
⋅
∇
∆
=
′
∇
t
p
ρ
Computational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
Pressure Correction Method - 54. Correct the pressure and velocity
5. Go to 2. Repeat the process until the solution converges.
p p p = 0 + ′
p
t
′
∇
∆
−
=
ρ
0u
u
Notes:- Originally developed for the staggered grid system.
- The corrected velocity field satisfies the continuity equation
even if the pressure correction is only approximate. - Sometimes tends to be overestimatedp′
) 8 . 0 ( 0 + ′ ≈ = p
ω
pω
p underrelaxationComputational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
SIMPLER (SIMPLE Revised)
- Incorporating the projection method (fractional step) Pressure Correction Method - 6
1. Guess the velocity field
2. Solve momentum equation (implicitly) without pressure
3. Solve the pressure Poisson equation
0 u
u
u
u
u
u
ˆ
ˆ
ˆ
ˆ
0 2∇
+
∇
⋅
−
=
∆
−
α
t
(
u
ˆ
)
* 2∇
⋅
∆
=
∇
t
p
ρ
Computational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
Pressure Correction Method - 75. Solve the momentum equation with
6. Pressure correction equation
7. Correct the velocity, but not the pressure
8. Go to 2. Repeat the process until solution is converged. * * 2 * * 0 *
1
p
t
=
−
⋅
∇
+
∇
−
∇
∆
−
ρ
α
u
u
u
u
u
( )
* 2u
⋅
∇
∆
=
′
∇
t
p
ρ
*p
p
t
′
∇
∆
−
=
ρ
*u
u
Computational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
Stability ConsiderationExplicit time integration in 2-D requires the stability condition:
(
)
α
α
4 and 4 2 2 h t v u t ∆ < + < ∆ t ∆ α 4 2 h t = ∆(
)
α / 1 4 u v 2 t = + ∆ Re ~ / 1α
0 → ∆t at both limits! High-Re flow: advection-controlledLow-Re flow: diffusion-controlled Use implicit schemes for
Computational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
Accuracy Improvement – Spatial 1Spatial Accuracy
• Explicit differencing - use larger stencils ) ( 2 2 1 1 h O h f f f j′ = j+ − j− + ) ( 12 8 8 1 1 2 4 2 h O h f f f f f j′ = j− − j− + j+ − j+ +
• Tridiagonal - Padé (compact) schemes
(
)
( ) 3 4 1 1 1 4 1 f f O h h f f f j′− + j′ + j′+ = j+ − j− + • Pentadiagonal L + + + + + = ′ + ′ + ′ + ′ + ′−2 j−1 j j+1 j+2 j−2 j−1 j j+1 j+2 j f f f f af bf cf df ef fβ
γ
δ
ε
α
Computational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
Accuracy Improvement – Spatial 2Ref: Kennedy, C. A. and Carpenter, M. H.,
Applied Numerical Mathematics, 14, pp. 397-433 (1994) .
k∆ k' ∆ 0 1 2 3 0 1 2 3 Exact 2E 4E 6E 6T 8E 8T
Computational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
Accuracy Improvement – Temporal 1Temporal Accuracy • Implicit – Crank-Nicolson
(
)
[
1 2 2 1]
1/2 1 ) ( ) ( ) ( 2 + + + + − n = ∆ − n + n + ∇ n + ∇ n − ∆ ∇ n n p t tρ
α
u u u A u A u up
t
=
−
+
−
∇
∂
∂
ρ
1
)
(
)
(
u
D
u
A
u
Computational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
Accuracy Improvement – Temporal 2Linearization of Advection Terms • For example, a 2-D equation
can be linearized as 0 = ∂ ∂ + ∂ ∂ + ∂ ∂ y x t F E U = v u ρ ρ ρ U − − + = xy xx uv p u u τ ρ τ ρ ρ 2 E − + − = yy xy p v uv v τ ρ τ ρ ρ 2 F
[ ]
[ ]
= 0 ∂ ∂ + ∂ ∂ + ∂ ∂ y B x A t U U U[ ]
[ ]
U F U E ∂ ∂ = ∂ ∂ = B A ,Computational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
Accuracy Improvement – Temporal 3Fractional Step Method – Kim & Moin (1985)
• Projection method extended to higher accuracy
[
]
( ) Re 2 1 ) ( ) ( 3 2 1 n n 1 2 t n n t t A u A u u u u u + ∇ + − − = ∆ − −Adams-Bashforth (AB2) Crank-Nicolson
t n t n t t u u u u ⋅ ∇ ∆ = ∇ = ⋅ ∇ −∇ = ∆ − + + 1 0 2 1 1
φ
φ
Note that is different from the original pressure
φ
φ
φ
2 Re 2 ∇ ∆ − = t pComputational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
Accuracy Improvement – Temporal 4Treatment of implicit viscous terms
[
]
( ) Re 2 1 ) ( ) ( 3 2 1 n n 1 2 t n n t t A u A u u u u u + ∇ + − − = ∆ − − Factorizing,(
−)
= − ∆ − ∆ − ∆ ⇒ t n zz yy xx t t t u uδ
δ
δ
Re 2 Re 2 Re 2 1[
]
(
)
n zz yy xx n n t t u u A u A − + ∆δ
+δ
+δ
∆ − − Re ) ( ) ( 3 2 1(
−)
= − ∆ − ∆ − ∆ t n zz yy xx t t t u uδ
δ
δ
Re 2 1 Re 2 1 Re 2 1[
]
(
)
n zz yy xx n n t t u u A u A − + ∆δ
+δ
+δ
∆ − − Re ) ( ) ( 3 2 1Computational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
Accuracy Improvement – Temporal 5Notes on Fractional Step Method
• Originally implemented into a staggered grid system • Later improved with 3rd-order Runge-Kutta method
Ref: Le & Moin, J. Comp. Phys., 92:369 (1991)
• The method can be applied to a variable-density problem (e.g. subsonic combustion, two-phase flow) where
Poisson equation becomes
Ref: Rutland, Ph. D. Thesis, Stanford University (1989) Bell, Collela and Glaz, JCP, 85:257 (1989)
( )
∂ ∂ + ⋅ ∇ ∆ = ∇ t t t t tρ
ρ
φ
1 u 2ρ
T =1 Eq. of StateComputational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
Boundary ConditionsBoundary Conditions for Incompressible Flows
• In general, boundary condition treatment is easier than for the compressible flow formulation due to the absence of acoustics
• Typical boundary conditions:
- Periodic: etc. - Inflow conditions:
- Outflow conditions: convective outflow condition
2 1 1, f f f fN = N+ = ) , , ( ) 0 (x F y z t f = = L x x U t = = ∂ ∂ + u 0 at u =
∫
udA A U 1Computational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
Compressible
Navier-Stokes Equations
Computational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
0
=
∂
∂
+
∂
∂
+
∂
∂
+
∂
∂
z
y
x
t
G
F
E
U
= E w v u ρ ρ ρ ρ ρ U + + − − − + = x xz xy xx u p E uw uv p u u ψ ρ τ ρ τ ρ τ ρ ρ ) ( 2 E + + − − + − = y yz yy xy v p E vw p v uv v ψ ρ τ ρ τ ρ τ ρ ρ ) ( 2 F + + − + − − = z zz yz xz w p E p vw vw uw w ψ ρ τ ρ τ ρ τ ρ ρ ) ( 2 G T c h T c e RT p = ρ , = v , = p R e T e p R cv , ( 1) , ( 1) 1 − = − = − = γ ρ γ γ or Constitutive relations z zz yz xz z y yz yy xy y x xz xy xx x q w v u q w v u q w v u + − − − = + − − − = + − − − = τ τ τ ψ τ τ τ ψ τ τ τ ψ whereComputational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
Solution methods for compressible N-S equations
follows the same techniques used for hyperbolic equations
z
y
x
t
∂
∂
+
∂
∂
+
∂
∂
=
∂
∂
U
E
F
G
For smooth solutions with viscous terms, central differencing usually works.
⇒ No need to worry about upwind method, flux-splitting, TVD, FCT (flux-corrected transport), etc.
In general, upwind-like methods introduces numerical dissipation, hence provides stability, but accuracy
Computational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
- MacCormack method- Leap frog/DuFort-Frankel method - Lax-Wendroff method - Runge-Kutta method Explicit Methods Implicit Methods - Beam-Warming scheme - Runge-Kutta method
Most methods are 2nd order.
The Runge-Kutta method can be easily tailored to higher order method (both explicit and implicit).
Computational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
Most of the time, an implicit integration method involves nonlinear advection terms
which are linearized as
z
y
x
t
∂
∂
+
∂
∂
+
∂
∂
=
∂
∂
U
E
F
G
[ ]
[ ]
[ ]
z C y B x A t n n n n n ∂ ∂ + ∂ ∂ + ∂ ∂ = ∆ − + + + +1 1 1 1 U U U U U[ ]
A n[ ]
B n[ ]
C n ∂ ∂ = ∂ ∂ = ∂ ∂ = U G U F U E , ,Computational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
Ultimately, compressible Navier-Stokes equations can be written as a system of ODE’s
z
y
x
t
∂
∂
+
∂
∂
+
∂
∂
=
∂
∂
U
E
F
G
(
)
0 0)
(
)
(
,
U
U
U
U
=
=
=
⇒
t
t
t
t
F
dt
d
Initial condition Solution techniques for a system of ODE applies.- Explicit vs. Implicit (Nonstiff vs. Stiff) - Multi-stage vs. Multi-step
Computational Fluid Dynamics I
P
P
P
PIIII
W
W
W
W
Boundary ConditionsBoundary Conditions for Compressible Flows
• In general, boundary condition for the compressible flow is trickier because all the acoustic waves must be
properly taken care of at the boundaries. • Typical boundary conditions:
- Periodic: still easy to implement
- Both inflow and outflow conditions require treatment of characteristic waves