Professional Documents
Culture Documents
Computational Fluid Dynamics: Martin Kronbichler Martin - Kronbichler@it - Uu.se
Computational Fluid Dynamics: Martin Kronbichler Martin - Kronbichler@it - Uu.se
Martin Kronbichler
martin.kronbichler@it.uu.se
Discretization
Overview of spatial discretizations
The Finite Volume Method
Time discretization
Spatial discretization
What is CFD?
I Fluid mechanics deals with the motion of fluids (liquids and gases),
induced by external forces.
I Fluid flow is modeled by partial differential equations (PDE),
describing the conservation of mass, momentum, and energy.
I Computational Fluid Dynamics (CFD) is the discipline of
discretizing these PDE and solving them using computers.
CFD software
CFD links
I http://www.cfd-online.com
I http://www.fluent.com
I http://www.openfoam.org
Notation
ρ density
u velocity, u = (u1 , u2 , u3 )
p pressure
T temperature
µ dynamic viscosity
ν kinematic viscosity,
ν = µ/ρ
∂ ∂ ∂
∇ nabla operator, ∇ = ∂x1 , ∂x2 , ∂x3
· inner product, a · b = a1 b1 + a2 b2 + a3 b3
Continuity equation I
Continuity equation II
Momentum equation I
Momentum equation II
Rewritten for a stationary control volume Ω:
Z Z
∂ρu
+ ρ(u ⊗ u) · n ds = K,
Ω ∂t ∂Ω
Momentum equation II
Rewritten for a stationary control volume Ω:
Z Z
∂ρu
+ ρ(u ⊗ u) · n ds = K,
Ω ∂t ∂Ω
Newtonian fluid
Model that relates the stress tensor τ to the velocity u:
We consider so-called Newtonian fluids, where the viscous stress is
linearly related to strain rate, that is,
2 2
τ = 2µε(u) − µI tr ε(u) = µ ∇u + (∇u)T − µ(∇ · u)I,
3 3
(compare with constitutive and kinematic relations in elasticity theory).
Newtonian fluid
Model that relates the stress tensor τ to the velocity u:
We consider so-called Newtonian fluids, where the viscous stress is
linearly related to strain rate, that is,
2 2
τ = 2µε(u) − µI tr ε(u) = µ ∇u + (∇u)T − µ(∇ · u)I,
3 3
(compare with constitutive and kinematic relations in elasticity theory).
For Cartesian coordinates
3
∂uj ∂ui 2 X ∂uk
τij = µ + − µ .
∂xi ∂xj 3 ∂xk
k=1
µ = µ(T , p) ≈ constant.
Energy equation I
Energy Equation II
We have
I seven variables (ρ, u1 , u2 , u3 , p, T , E )
I five equations (continuity, 3×momentum, energy)
We need two more equations to close the system, the so-called equations
of state.
Equations of state
Since the integral is zero for an arbitrary control volume Ω, we obtain the
differential form of the
Continuity equation
Momentum equation
The momentum equation,
∂ρu
+ ∇ · (ρu ⊗ u) = −∇p + ∇ · τ + ρf,
∂t
can be simplified by using ∇ · u = 0,
Momentum equation
The momentum equation,
∂ρu
+ ∇ · (ρu ⊗ u) = −∇p + ∇ · τ + ρf,
∂t
can be simplified by using ∇ · u = 0,
Momentum equation
The momentum equation,
∂ρu
+ ∇ · (ρu ⊗ u) = −∇p + ∇ · τ + ρf,
∂t
can be simplified by using ∇ · u = 0,
Since the energy equation does not enter the momentum and continuity
equation, we have a closed system of four equations:
µ
where ν = ρ is the fluid kinematic viscosity.
Equation in temperature
where
3 3
∂uj 2
X ∂uj X 1 ∂ui
τ : ∇u = τij =µ + ,
∂xi 2 ∂xj ∂xi
i,j=1 i,j=1
1
for further reading, see e.g. J. Blazek: Computational Fluid Dynamics, Elsevier,
Amsterdam
Martin Kronbichler (TDB) FVM for CFD February 11, 2010 32 / 72
The Navier–Stokes equations Incompressible Navier–Stokes equations
Additional conditions
Discretization
Overview of Methods
Discretization methods for the CFD equations:
I Finite Difference Method (FDM)
+ efficiency, + theory, − geometries
I Finite Element Method (FEM)
+ theory, + geometries, − shocks, − uses no directional information
I Spectral Methods (Collocation, Galerkin, . . .)
+ accuracy, + theory, − geometries
Overview of Methods
Discretization methods for the CFD equations:
I Finite Difference Method (FDM)
+ efficiency, + theory, − geometries
I Finite Element Method (FEM)
+ theory, + geometries, − shocks, − uses no directional information
I Spectral Methods (Collocation, Galerkin, . . .)
+ accuracy, + theory, − geometries
I Finite Volume Methods (FVM)
+ robustness, + geometries, − accuracy
I Discontinuous Galerkin Methods (DGM)
+ geometries, + shocks, − efficiency (e.g. smooth solutions)
Overview of Methods
Discretization methods for the CFD equations:
I Finite Difference Method (FDM)
+ efficiency, + theory, − geometries
I Finite Element Method (FEM)
+ theory, + geometries, − shocks, − uses no directional information
I Spectral Methods (Collocation, Galerkin, . . .)
+ accuracy, + theory, − geometries
I Finite Volume Methods (FVM)
+ robustness, + geometries, − accuracy
I Discontinuous Galerkin Methods (DGM)
+ geometries, + shocks, − efficiency (e.g. smooth solutions)
I Hybrid Methods
+ versatile, − complex (not automatable)
Introduction
The Finite Volume Method (FVM) is based on the integral form of the
governing equations.
The integral conservation is enforced in so-called control volumes
( d Ω → ∆Ω) defined by the computational mesh.
The type of FVM is specified by
I the type of control volume
I the type of evaluation of integrals and fluxes
Km
The first integral can be simplified by changing order of time derivative and
integration to get
d dum
Z Z
∂u
dΩ = u d Ω = |Km | . (3)
Km ∂t dt Km dt
dum 1
Z
=− ∇ · F(u) d Ω.
dt |Km | Km
2
e.g., E. Hairer, S.P. Nørsett, G. Wanner: Solving Ordinary Differential Equations. I:
Nonstiff Problems. Springer-Verlag, Berlin, 1993.
Martin Kronbichler (TDB) FVM for CFD February 11, 2010 43 / 72
Discretization The Finite Volume Method
dum u n+1 − um
n
= m ,
dt ∆t
n = u (t ).
where um m n
2
e.g., E. Hairer, S.P. Nørsett, G. Wanner: Solving Ordinary Differential Equations. I:
Nonstiff Problems. Springer-Verlag, Berlin, 1993.
Martin Kronbichler (TDB) FVM for CFD February 11, 2010 43 / 72
Discretization The Finite Volume Method
Inserting the forward Euler time discretization into our system gives
Z
n+1 n ∆t
um = um − ∇ · F(u) d Ω.
|Km | Km
The boundary integral describes the flux of u over the boundary ∂Km of
the control volume.
Note: Transforming the volume to a surface integral gets us back to the
form used for the derivation of the Navier–Stokes equations.
The boundary integral describes the flux of u over the boundary ∂Km of
the control volume.
Note: Transforming the volume to a surface integral gets us back to the
form used for the derivation of the Navier–Stokes equations.
Different ways of evaluating the flux integral specify the type of FVM
(together with the control volume type).
3
Contains only the inviscid terms from the compressible Navier–Stokes equations
Martin Kronbichler (TDB) FVM for CFD February 11, 2010 46 / 72
Discretization The Finite Volume Method
3
Contains only the inviscid terms from the compressible Navier–Stokes equations
Martin Kronbichler (TDB) FVM for CFD February 11, 2010 46 / 72
Discretization The Finite Volume Method
and j denotes the index of each subboundary of ∂Km with a given normal
nj .
Hence, we get
n+1 n ∆t n n
um = um − F(um+1/2 )nm+1/2 + F(um−1/2 )nm−1/2
∆x
n ∆t n n
n ∆t n n
= um − β um+1/2 − um−1/2 = um − β um − um−1 .
∆x ∆x
Martin Kronbichler (TDB) FVM for CFD February 11, 2010 50 / 72
Discretization The Finite Volume Method
n · F(uL ) + n · F(uR ) uL − uR
F ∗ (uL , uR , n) = + n · F 0 (ū)
.
2 2
Here, ū satisfies the mean value theorem,
n · F(uL ) + n · F(uR ) uL − uR
F ∗ (uL , uR , n) = + n · F 0 (ū)
.
2 2
Here, ū satisfies the mean value theorem,
n+1 n ∆t n n
um = um − F(um+1/2 )nm+1/2 + F(um−1/2 )nm−1/2
∆x
n ∆t n n
= um − β um+1/2 − um−1/2
∆x
n + un
um n
um−1 n
+ um
n ∆t m+1
= um − β −
∆x 2 2
n n
um+1 − um−1
n ∆t
= um − β .
∆x 2
n+1 n ∆t n n
um = um − β um − um−1 ,
∆x
we require
∆t
∆x β ≤ 1.
Measure whether steady state has been achieved: residual gets small.
To reach steady state, many different acceleration techniques can be used,
for example local time stepping and multigrid.
Measure whether steady state has been achieved: residual gets small.
To reach steady state, many different acceleration techniques can be used,
for example local time stepping and multigrid.
Two examples of steady state:
I computation of the drag and lift around an airfoil,
I mixing problem considered in the computer lab.
Martin Kronbichler (TDB) FVM for CFD February 11, 2010 57 / 72
Discretization The Finite Volume Method
Initial condition
u = 0.
Heat transfer
Turbulence
Turbulence
∇∗ · u∗ = 0,
∂u∗ ν
+ (u∗ · ∇∗ )u∗ = −∇∗ p ∗ + ∇2 u∗ .
∂t ∗ UL
|{z}
Re−1
UL Inertial forces
Re = = ,
ν Viscous forces
where U, L, ν are the characteristic velocity, characteristic length, and the
kinematic viscosity, respectively.
Fluids with the same Reynolds number behave the same way.
UL Inertial forces
Re = = ,
ν Viscous forces
where U, L, ν are the characteristic velocity, characteristic length, and the
kinematic viscosity, respectively.
Fluids with the same Reynolds number behave the same way.
When the Reynolds number becomes larger than a critical value, the
formerly laminar flow changes into turbulent flow, for example at
Re ≈ 2300 for pipe flows.
Characterization of turbulence
Describing the turbulence can be done in many ways, and the choice of the
method depends on the application at hand and on computational
resources.
Martin Kronbichler (TDB) FVM for CFD February 11, 2010 67 / 72
Turbulence and its modeling
Applications of DNS:
I Turbulence research.
I Reference results to verify other turbulence models.
Only the large scales are resolved, and small scales are modeled.
Active research.
LES quite popular in certain industries, but still very costly.
∇ · u = 0.
Momentum equations:
∂u 1
+ (u · ∇)u + (u0 · ∇)u0 = − ∇p + ν∇2 u + f,
∂t ρ
or, equivalently,
∂u 1 0 0
+ (u · ∇)u = ∇ · − pI + ν∇u − u ⊗ u + f,
∂t ρ
∂u 1
+ (u · ∇)u = ∇ · − pI + ν∇u − u0 ⊗ u0 + f,
∂t ρ
∇ · u = 0.
The Reynolds stress term −u0 ⊗ u0 contains fluctuations, and its effect
needs to be modeled.
Examples are Spalart-Allmaras, K − ε, K − ω, and SST.