Computational Fluid Dynamics Introduction
Computational Fluid Dynamics Introduction
CFD01-1
26.03.2004
Slide 1 Hchstleistungsrechenzentrum Stuttgart
C.-D. Munz
1
, S. Roller
2
, M. Dumbser
1
University of Stuttgart
1
Institute for Aerodynamics and Gas Dynamics (IAG)
www.iag.uni-stuttgart.de
2
High-Performance Computing-Center Stuttgart (HLRS)
www.hlrs.de
Introduction to Computational Fluid Dynamics
1
The Underlying Equations
2
Contents
1. Equations
2. Finite Volume Schemes
3. Linear Advection Equation
4. Systems of Advection Equations
5. Scalar Conservation Law
6. One-dimensional Euler Equations
7. Godunov-Type Schemes
8. Flux-Vector Splitting Schemes
9. Second Order Accuracy MUSCL Schemes
10. Boundary Conditions
11. Finite-Volume Schemes in Multi-Dimensions
12. ENO-/ WENO Schemes
13. Discontinuous Galerkin Finite Element Methods
The Underlying Equations
CFD01-2
3
1. Equations
Conservation equation
e.g.: Mass conservation
: normal
mass in V :
continuum assumption, density
n
r
n
r
dV
V
4
1. Equations
Conservation equation
e.g.: Mass conservation
: normal
mass in V :
continuum assumption, density
n
r
n
r
dV
V
dS n f dV
dt
d
V
m
V
=
r
m
f ,
( )
= +
V
m t
0 dV f
( ) 0 = + v
t
6
The Compressible Navier-Stokes Equations
Equation of state:
( ) 0 v
t
= +
( ) ( ) ( ) p v v v
t
= + + o
( ) ( ) q v) ( p e v e
t
+ = + +
( ) ( )( )
2
2
1
v e 1 1 p = =
pressure
viscous stress tensor
heat flux vector
p
q
density
speed
total energy
v
e
The Underlying Equations
CFD01-4
7
Euler Equations
Equation of state:
( ) 0 v
t
= +
( ) ( ) ( ) 0 p v v v
t
= + + o
( ) ( ) 0 p e v e
t
= + +
( ) ( )( )
2
2
1
v e 1 1 p = =
pressure p density
speed
total energy per unit
volume
v
e
8
Equations of Fluid Dynamics
Compressible Navier-Stokes equations
Conservation equations for mass, momentum and energy
with viscosity and heat conduction
hyperbolic parabolic
Incompressible Navier-Stokes
equations
parabolic elliptic
0
v
=
c
M
Euler equations
gas dynamics
hyperbolic
Re
The Underlying Equations
CFD01-5
9
2. Finite Volume Schemes
( ) [ ] T , 0 D in 0 u f u
t
= +
smooth piecewise boundary
fr ,
j
k j j
j
C
k j C C C D
= =
U
i
C
Discretization of space
Grid
10
( ) ( ) dt dS n t x u f u C u C
n
n j
t
t C
n
j j
n
j j
+
+
=
1
,
1
r
[ ]
1 n n j
t , t C over n Integratio
+
+ +
= +
1 n
n
1/2 i
1/2 i
1 n
n
1/2 i
1/2 i
t
t
x
x
x
t
t
x
x
t
0 dxdt t)) f(u(x, t)dx (x, u
[ ] [ ]
1 n n 1/2 i 1/2 - i
t , t x , x over n Integratio
+ +
12
))dt t , f(u(x
t
1
es approximat g
)dx t u(x,
x
1
es approximat u
1 n
n
1/2 i
1/2 i
t
t
1/2 i 1/2 i
x
x
n
n
i
+
+
+ +
) g - (g
x
t
u u
n
1/2 - i
n
1/2 i
n
i
1 n
i +
+
=
with
Finite Volume Scheme Scheme in Conservation Form
The Underlying Equations
CFD01-7
13
3. Linear Advection Equation
= + a u a u
x t
, 0
stics characteri
( )
( )
a
dt
t dx
t x x = = with : C
: Solution
( ) ( ) satisfies t t x u u function A , =
( ) ( )
x t
u a u t t x u
dt
d
+ = ,
C along constant Solution = u u
14
Solution of Initial Value Problem
( ) ( ) = x x q x u all for 0 ,
x
t
P
0 0
t a x
0
x
( )
a
dt
t dx
=
( ) ( ) t x t a x q t x u , all for , =
The Underlying Equations
CFD01-8
15
Upwind Scheme
x
t
1 i
x
i
x
1 + i
x
1 + n
t
n
t
Grid
1 for stable
0
: 0
1
1
<
>
+
a
x
t
x
u u
a
t
u u
a
n
i
n
i
n
i
n
i
(CFL-Condition)
16
CIR Method
( )
( )
n
i
n
i
n
i
n
i
n
i
n
i
n
i
n
i
n
i
n
i
n
i n
i
n
i
u u u
x
t a
u u
x
t
a u u
a u u
a u u
x
t
a u u
1 1
1 1
1
1
1 1
2
2
2
ion Reformulat
0 for
0 for
(1946) Rees Isaacson, Courant,
+
+
+
+
+
+
<
>
=
dissipation
central difference
The Underlying Equations
CFD01-9
17
Reformulation of the CIR-Method I, Godunovs Idea
x
u
x
i-1/2
x
i+1/2
x
i+3/2
n
i
u
[ ]
1/2 i 1/2 - i
n
i
n
i
x , x for x u (x) u
+
=
Godunovs Idea
constant piecewise u
n
18
1. Solve the initial value problem
[ ]
1/2 i 1/2 - i
n
i
n
n
x t
x , x for x u (x) u
with
R fr x (x) u u(x,0) , 0 au u
+
=
= = +
x
u
x
i-1/2
x
i+1/2
x
i+3/2
The Underlying Equations
CFD01-10
19
1 a
x
t
: condition CFL , t)dx u(x,
x
1
: u
1/2 i
1/2 i
x
x
n
i
=
Result: CIR-method
x
u
x
i-1/2
x
i+1/2
x
i+3/2
2. Average the exact solution
20
Reformulation of the CIR-Method II
x
t
1 i
x
i
x
1 + i
x
1 + n
t
n
t
[ ] [ ]
+ +
+ +
= +
+ +
1 n
n
1/2 i
1/2 i
1 n
n
1/2 i
1/2 i
t
t
x
x
t
t
x
x
1 n n 1/2 i 1/2 - i
0 t)dxdt au(x, t)dx u(x,
t , t x , x over n Integratio
The Underlying Equations
CFD01-11
21
n
1/2 - i
n
1/2 i
n
i
1 n
i
g t - g t u x u x
+
+
=
with
) u , g(u g : flux Numerical
)dt t , au(x
t
1
es approximat g
)dx t u(x,
x
1
es approximat u
1 i i 1/2 i
t
t
1/2 i 1/2 i
x
x
n
n
i
1 n
n
1/2 i
1/2 i
+ +
+ +
=
+
+
22
Upwind-type Flux Calculation
) u (u a
x
t
) u (u a
x
t
- u u
form on conservati in Scheme
u a u a
0 a for au
0 a for au
) u , g(u g
n
i
n
1 i
n
1 i
n
i
n
i
1 n
i
1 i
-
i
1 i
i
1 i i 1/2 i
=
+ =
<
>
= =
+
+ +
+
+
+
+ +
Result: CIR-method
The Underlying Equations
CFD01-12
23
Reformation of the CIR-Method III
Riemann Problem
>
<
= = +
0 x for u
0 x for u
u(x,0) 0; au u
r
l
x t
x
t
1 i
x
1 + i
x
1 + n
t
n
t
a
dt
dx
u
dt
dx
= =
24
1
x
t
: condition CFL
) u , u (0; au ) u , g(u g
with
) g (g
x
t
u u
1 i i RP 1 i i 1/2 i
1/2 i 1/2 i
n
i
1 n
i
<
= =
=
+ + +
+
+
a
Result: CIR-scheme
The Underlying Equations
CFD01-13
25
A matrix m m
4. Systems of Advection Equations
0 = +
x t
Au u
eigenvectors
|
.
|
\
|
=
m
r r r R ...
2 1
Diagonalisation
( )
m
a a diag AR R ,..., :
1
1
= =
m
a a a < < < ...
2 1
m distinct eigenvalues
26
How to use the diagonalisation of A?
0 = +
x t
Au u
1
R
0
1 1
= +
x t
Au R u R
( ) ( ) 0
1 1
= +
x t
u R u R
Characteristic form
0 = +
x t
w w
u R w
1
=
characteristic variables
The Underlying Equations
CFD01-14
27
with
( ) ( )
n
i
n
i
n
i
n
i
n
i
n
i
w w
x
t
w w
x
t
w w
=
+
+
+
1 1
1
Backtransformation Rw u =
( ) ( )
n
i
n
i
n
i
n
i
n
i
n
i
u u R R
x
t
u u R R
x
t
Rw Rw
=
+
+ +
1
1
1
1 1
( )
( )
+ + + +
=
=
m
m
a a a diag
a a a diag
..., , , :
..., , , :
2 1
2 1
Application of the CIRmethod to the characteristic form
28
CIR Method for Systems, Flux-Splitting Form
( ) ( )
n
i
n
i
n
i
n
i
n
i
n
i
u u A
x
t
u u A
x
t
u u
=
+
+ +
1 1
1
1 + +
= R R A
1
= R R A ,
with
Reformulation as FV - scheme
( )
n
i
n
i i i
i
u A u A u u g g
1 1
,
2
1
+
+
+
+
+ = =
numerical flux
The Underlying Equations
CFD01-15
29
CIR Method for Systems, Godunov-Type Form
( ) ) , ; 0 ( ,
1 1
2
1 + +
+
= =
i i RP i i
i
u u Au u u g g
Numerical flux
x
t
1
a
t
x
=
2
a
t
x
=
3
a
t
x
=
2
x
2
x
Solution of the Riemann problem
RP
u
30
5. Scalar Conservation Laws
( ) 0 = +
x t
u f u
Quasilinear form
( ) 0 = +
x t
u u a u
Example: Burgers equation, ( )
2
2
1
u u f =
0 = +
x t
u u u
Charakteristics:
( ) t x x C = : with
( )
( ) u a
du
u df
=
u = constant along C
The Underlying Equations
CFD01-16
31
Riemann problem
Example 1:
( )
>
< +
= = +
0 for 1
0 for 1
0 , , 0
x
x
x u u u u
x t
x
t
1 =
r
u 1 =
l
u
1 =
t
x
1 =
t
x
Intersection of characteristics => shock wave
32
Riemann problem
Example 2:
( )
> +
<
= = +
0 for 1
0 for 1
0 , , 0
x
x
x u u u u
x t
x
t
1 =
r
u 1 =
l
u
Divergence of characteristics => rarefaction wave
1 =
t
x
1 =
t
x
The Underlying Equations
CFD01-17
33
Solution of the Riemann problem
wave shock :
r l
u u >
( )
( ) ( )
l r
l r
r
l
u u
u f u f
s
s
t
x
u
s
t
x
u
t x u
>
<
=
with
for
for
,
34
( )
( )
( )
>
|
.
|
\
|
<
=
<
r r
l l
r l
u a
t
x
u
t
x
a
u a
t
x
u
t x u
u u
for
else
for
,
wave n rarefactio :
1
inverse function of a(u) ) (
1
u a
) (
1
Solution of the Riemann problem
The Underlying Equations
CFD01-18
35
Godunovs Method for Burgers equation
( )
n
i
n
i
n
i
n
i
g g
x
u u
2 / 1 2 / 1
1
t
+
+
=
( )
( )
( ) ( )
( ) ( )
( )
< <
> <
< >
> >
=
else 0
0 , for
0 , for
0 , for
0 , for
) , (
flux numerical with the
1
a
u a u u u f
u a u u u f
s u u u f
s u u u f
u u g
r r l r
l r l l
r l r
r l l
r l
1
: , :
+
= =
i r i l
u u u u with