Professional Documents
Culture Documents
2 / 110
Overview on Computational Fluid Dynamics (CFD)
What is CFD?
3 / 110
Overview on Computational Fluid Dynamics (CFD)
Applications of CFD I
Any field where the fluid motion plays a relevant role:
Meteorology
Architecture Environment
4 / 110
Overview on Computational Fluid Dynamics (CFD)
Applications of CFD II
Moreover, the research front is particularly active:
6 / 110
Overview on Computational Fluid Dynamics (CFD)
7 / 110
Overview on Computational Fluid Dynamics (CFD)
9 / 110
Governing Equations and their Discretization
10 / 110
Governing Equations and their Discretization Governing equations
11 / 110
Governing Equations and their Discretization Governing equations
We thus naturally divide the flow field into fluid elements, or volumes, and
try to develop a mathematical description of its physics.
We define the finite control volume (fixed in space):
n ∂Ω
dS
v
Ω
12 / 110
Governing Equations and their Discretization Governing equations
13 / 110
Governing Equations and their Discretization Governing equations
14 / 110
Governing Equations and their Discretization Governing equations
Z I
d h i
u dΩ + F C − F D · n dS =
dt Ω ∂Ω Z I (2)
Q V dΩ + Q S · n dS
Ω ∂Ω
15 / 110
Governing Equations and their Discretization Governing equations
Equations (1) and (2) express the conservation law in the integral
formulation, and are characterized by two very important and desirable
properties:
1. Conservation: in absence of sources, the variation of φ and u is only
due to fluxes across the boundary ∂Ω, and no flux is created inside Ω
⇒ both local and global conservation
2. Generality: the integral form remains valid even in presence of
shocks and discontinuity
NOTE: Because of these properties, historically, the majority of the CFD
codes is based on the integral form of the governing equations (e.g. Ansys
Fluent, OpenFOAM . . . )
The integral form is essentially the finite volume formulation.
16 / 110
Governing Equations and their Discretization Governing equations
n ∂Ω
dS
v
Ω
17 / 110
Governing Equations and their Discretization Governing equations
18 / 110
Governing Equations and their Discretization Governing equations
x : ρuv
y : ρv v
z : ρwv
20 / 110
Governing Equations and their Discretization Governing equations
1. The conserved quantity is the total energy per unit mass ρE, where
E = e + |v |2 /2, with e the internal energy per unit mass
2. Now we do have a diffusive flux
F D = −γρκ∇e
F D = −k ∇T
Q V = ρf e · v + q̇h
22 / 110
Governing Equations and their Discretization Governing equations
Then, by using the conservation law for a scalar (1) on our control volume
Ω we have the integral form of the energy equation:
Z I I
∂
ρE dΩ + ρH (v · n) dS = k (∇T · n) dS +
∂t Ω ∂Ω ∂Ω
Z I (5)
(ρf e · v + q̇h ) dΩ + τ · n dS
Ω ∂Ω
23 / 110
Governing Equations and their Discretization Governing equations
24 / 110
Governing Equations and their Discretization Governing equations
25 / 110
Considerations on accuracy
Governing Equations and their Discretization Discretization techniques
Considerations on accuracy I
26 / 110
Governing Equations and their Discretization Discretization techniques
Considerations on accuracy II
If not considering analytical methods, which are only viable for few
simplified problems, we can say that almost all numerical strategies follow
the same workflow:
1. Discretization of space:
I Finite Difference (FV)
I Finite Volumes (FV)
I Finite Elements (FE)
I Spectral methods, hybrid, Boundary Element Method (BEM) . . . . . .
2. Advancement in time:
I Typically, some kind of Finite Difference method (implicit/explicit
methods . . . )
3. We get a system of equations
27 / 110
Governing Equations and their Discretization Discretization techniques
Z I
∂
ρv dΩ + ρv (v · n) dS =
∂t Ω ∂Ω I
Z (4 momentum)
ρf e dΩ + −pn + τ · n dS
Ω ∂Ω
28 / 110
Governing Equations and their Discretization Discretization techniques
∂ρ
+ ∇ · (ρv ) = 0 (6)
∂t
∂
(ρv ) + ∇ · (ρv ⊗ v ) = ρf e − ∇p + ∇ · τ (7)
∂t
29 / 110
Finite differences
Governing Equations and their Discretization Discretization techniques
30 / 110
Governing Equations and their Discretization Discretization techniques
31 / 110
Governing Equations and their Discretization Discretization techniques
Disadvantages:
32 / 110
Finite volumes
Governing Equations and their Discretization Discretization techniques
I For the volume integrals: the classical FV is developed for 1st and
2nd order accuracy, although higher order approximations are
available (using neighbouring nodes)
I Surface integrals, i.e. the fluxes crossing the individual faces of the
control volume, are then approximated using several schemes with
varying accuracy, stability, efficiency
34 / 110
Governing Equations and their Discretization Discretization techniques
35 / 110
Governing Equations and their Discretization Discretization techniques
Advantages:
I Directly apply the integral spatial discretization in the physical space (no
coordinate transformation to a computational space, unlike FD and typically
FEM)
I Flexible for complex geometries: both structured and un-structured meshes
Disadvantages:
36 / 110
Finite elements
Governing Equations and their Discretization Discretization techniques
Advantages:
I Straightforward high-order
Disadvantages:
38 / 110
Governing Equations and their Discretization Discretization techniques
NOTE: For the one-dimensional case, it can be shown that the FD, FV and
FEM are mathematically equivalent!
39 / 110
Governing Equations and their Discretization Discretization techniques
Time discretization
As mentioned, in CFD, different discretizations are employed for space
and time (“method of lines”).
We only mention some important time schemes in CFD, as are typical
choices that the user has to face:
1. Advancement in time, typically, some kind of Finite Difference method
2. Explicit methods: in general, more efficient since all the equation is
put on the Right Hand Side and no matrix need to be solved, but less
stable (Multistage methods (Runge-Kutta), local time stepping,
multigrid. . . )
3. Implicit methods: in general, higher computational cost due to
matrix inversion, but more stable and significantly larger time steps
can be used (dual time stepping, iterative solvers, preconditioning . . . )
40 / 110
What is “turbulence”?
3. What is “turbulence”?
41 / 110
What is “turbulence”? Examples of turbulent flows
43 / 110
What is “turbulence”? Examples of turbulent flows
44 / 110
What is “turbulence”? Origin
45 / 110
What is “turbulence”? Origin
46 / 110
What is “turbulence”? Origin
More on the boundary layers: the Magnus effect explains the deviation in
the trajectory of a ball (i.e. soccer, tennis . . . )
47 / 110
What is “turbulence”? Origin
48 / 110
What is “turbulence”? Some characteristics
Complexity of turbulence
49 / 110
What is “turbulence”? Some characteristics
Characteristics of turbulence
Characteristics of turbulence
(from “Tennekes and Lumley: First Course in Turbulence” ):
50 / 110
Three hypothesis on turbulence
What is “turbulence”? Some characteristics
51 / 110
What is “turbulence”? Some characteristics
Energy
Taylor scale
k-5/3
Inertial range
Dissipation
Wavenumber
“wavenumber” k ≡ 2π/L, where L the length scale of the vortex structure 52 / 110
What is “turbulence”? Some characteristics
53 / 110
What is “turbulence”? Some characteristics
54 / 110
What is “turbulence”? Some characteristics
Rigor
55 / 110
Turbulence modelling
4. Turbulence modelling
56 / 110
Turbulence modelling Overview on the approaches
57 / 110
Turbulence modelling Overview on the approaches
58 / 110
Turbulence modelling Overview on the approaches
59 / 110
Turbulence modelling Overview on the approaches
60 / 110
Turbulence modelling Overview on the approaches
61 / 110
Turbulence modelling Practical cases
DNS vs LES
The LES capture the large scales, but misses some details and also some
dynamics that the DNS is able to predict.
Turbulence structures in 3D:
DNS LES
62 / 110
Turbulence modelling Practical cases
LES vs RANS
RANS simulations are way more affordable, but need to pay attention to
their limitations.
63 / 110
Turbulence modelling Practical cases
64 / 110
Turbulence modelling Practical cases
65 / 110
Turbulence modelling Practical cases
66 / 110
Initial and Boundary Conditions
67 / 110
Some Basic Tools
Initial and Boundary Conditions Some Basic Tools
PDE Classification
68 / 110
Initial and Boundary Conditions Some Basic Tools
Impacts on IC and BC
69 / 110
Compressible Flows
Initial and Boundary Conditions Compressible Flows
Compressible Flows-Steady
Compressible Flows-Steady →
Using Continuity Equation and Velocity potential for irrotational flow
(u = Φx , v = Φy , w = Φz ) :
2 2 2 2Φ Φ
(1 − ua2 )Φxx + (1 − va2 )Φyy + (1 − wa2 )Φzz − ax2 y Φxy − ...
70 / 110
Initial and Boundary Conditions Compressible Flows
Compressible Flows-Unsteady
71 / 110
Initial and Boundary Conditions Initial Conditions
Initial Conditions
Unsteady Flows:
Steady Flows:
Boundary Conditions
I Actual flux
I Ghost cell
Inflow/Outflow
73 / 110
Initial and Boundary Conditions Initial Conditions
Boundary Conditions II
Inflow/Outflow
Using Reimann invariants result in:
I Well-posed settings
I Non-reflective BCs
I Accurate satisfactions
I Final properties are not exactly what you set.
Notes for the implementation:
I Derivation of all possibilities
I Using Reimannian flux formula with ghost cells (Roe, Osher, ...)
74 / 110
Initial and Boundary Conditions Initial Conditions
Boundary Conditions II
75 / 110
Initial and Boundary Conditions Initial Conditions
Incompressible Flows
Continuity: ∇.V = 0
1 ∂p
I Artificial compressibility: β ∂t + ∇.V = 0, Hyperbolic
I Pressure Poisson:
∇.(Momentum) with ∇.V = 0 → ∆p = ∇(f − (u .∇)u ) Elliptic
Pressure-Velocity coupling, no state equation
Subsonic flow → Input data are important in inflow and interior data for the
outflow
76 / 110
Initial and Boundary Conditions Initial Conditions
Incompressible Flows-BC
77 / 110
Initial and Boundary Conditions Initial Conditions
78 / 110
Consistency
Initial and Boundary Conditions Initial Conditions
Consistency
If the mesh size tends to zero, solution must tend to the exact.
→ Truncation error must tend to zero, if grid size tends to zero
In Finite Difference it is more clear.
Stability
80 / 110
Initial and Boundary Conditions Initial Conditions
Stability II
Suppose:
A: is the Analytical solution.
D: is the exact solution of Discrete form.
N: is the actual numerical solution using Discrete form.
81 / 110
Initial and Boundary Conditions Initial Conditions
Fourier analysis
If we suppose = N − D and substitute D + in the discrete form of a
linear case, the original discrete form would be satisfied by as well.
ea(t +∆t ) eikm x − ea(t +∆t ) eikm x = r (eat eikm (x +∆x ) − 2eat eikm x ) + eat eikm (x −∆x ) )
(11)
α∆t
where r = (∆ x )2
Simplifying (11) introduces Amplification Factor:
β n+1
ea∆t = 1 − 4rsin2 = (12)
2 n
82 / 110
Initial and Boundary Conditions Initial Conditions
Fourier analysis II
n +1
To have stability Amplification factor (G)= n must be less than 1.
It is easy to find that the stability criteria is r ≤ 12 .
2
1 (∆x )
then ∆t ≤ 2 α ⇒
1 (∆x )2
∆t = CFL (13)
2 α
CFL (Courant-Friedrichs-Lewy)
83 / 110
Initial and Boundary Conditions Initial Conditions
General Rules
84 / 110
Initial and Boundary Conditions Initial Conditions
Compressible Flows
Vol
∆t = CFL P (14)
(u f .nf + af )Af
For Navier-Stokes equations there are a lot approximate formula which are
generally added to the maximum eigenvalue.
For Implicit schemes it is common to add the artificial time term as well so
above formula again could be used but generally the CFL might be set
much higher.
85 / 110
Initial and Boundary Conditions Initial Conditions
Incompressible Flows
86 / 110
Grid Generation
6. Grid Generation
87 / 110
Grid Generation Grid types
Grid Types
I Structured Grids
I Cartesian Grids
I Curvilinear Grids
I Unstructured Grids
I Triangle/Tetrahedron Grids
I Quadrilateral Grids
I Adaptive Grids
I Unstructured AMR
I OctreeQuadtree AMR
I Snappy hex mesh
I Overset Grids
88 / 110
Grid Generation Grid types
Grid Types
89 / 110
Grid Generation Grid types
Grid Types
90 / 110
Grid Generation Structured grids
Structured Grids
Desirable features:
1. Grid lines of same family must not cross each other.
2. Smoothness of the grid point distribution.
3. Orthogonality or near orthogonality of the grid lines.
4. Options for grid point clustering.
91 / 110
Grid Generation Structured grids
Structured Grids
I Algebraic
I Conformal Mapping (Just 2D)
I NURBS, Splines
I Stretching functions
I PDE
I Elliptic
I Hyperbolic
92 / 110
Grid Generation Structured grids
Structured Grids
93 / 110
Grid Generation Structured grids
Structured Grids-Algebraic
An example:
x =ξ
(2α + β)[(β + 1)/(β − 1)](η−α)/(1−α) + 2α − β (15)
y =H
(2α + 1)(1 + [(β + 1)/(β − 1)](η−α)/(1−α) )
94 / 110
Grid Generation Structured grids
ξxx + ξyy = 0
(16)
ηxx + ηyy = 0
Since there is no discretization in physical space (actually it is our
unknown) we use inverse of system:
95 / 110
Grid Generation Structured grids
96 / 110
Grid Generation Structured grids
P and Q are used for controlling the spacing and alignments of grid lines
(boundary orthogonality):
1
axξξ − 2bxξη + cxηη = − (Pxξ + Qxη )
J2 (19)
1
ayξξ − 2byξη + cyηη = − 2 (Pyξ + Qyη )
J
where J −1 = xξ yη − xη yξ
97 / 110
Grid Generation Structured grids
Structured Grids-Hyperbolic
xξ xη + yη yξ = 0
(20)
xξ yη − xη yξ = F
Grid lines are orthogonal.
Could be interested for boundary layers and overset grids.
98 / 110
Grid Generation Unstructured grids
Unstructured Grids
99 / 110
Grid Generation Unstructured grids
100 / 110
Grid Generation Unstructured grids
Advantages:
Disadvantages:
101 / 110
Grid Generation Unstructured grids
Unstructured Grids-Delaunay
A technique of making non-overlap, unique and high quality triangles over
arbitrary point was studied by Delaunay in 1934. Properties:
I Uniqueness.
I Max-Min, Maximizing the minimum angle of all triangles.
I A circle circumscribing any Delaunay triangle does not contain any
other input points in its interior.
I ...
102 / 110
Grid Generation Unstructured grids
Unstructured Grids-Delaunay
103 / 110
Grid Generation Unstructured grids
Unstructured Grids-Delaunay
Advantages:
Disadvantages:
I Boundary preserving.
I Degenerate cases due to round-off error.
104 / 110
Grid Generation Unstructured grids
105 / 110
Grid Generation Unstructured grids
106 / 110
Grid Generation Useful open-source codes for grid generation
107 / 110
Grid Generation Useful open-source codes for grid generation
108 / 110
References
7. References
109 / 110
References
References
I J. Blazek, Computational Fluid Dynamics: Principles and Applications, 2nd edition,
Elsevier 2005 (CFD textbook)
I P. K. Kundu, I. M. Cohen and D. R. Dowling, Fluid Mechanics, 5th edition, Elsevier
2012 (Fundamental fluid mechanics textbook)
I H. Tennekes and J. L. Lumley, A First Course in Turbulence, The MIT Press 1972
(Theory of turbulence)
I V. Venkatakrishnan Implicit Schemes and Parallel Computing in Unstructured Grid,
CFD. ICASE Report No. 95–28, 1995 (Review report)
I John C. Tannehill and Richard H. Pletcher, Computational Fluid Mechanics and Heat
Transfer, 2nd ed., Taylor & Francis, 1997
I Klaus A. Hoffmann , Steve T. Chiang, Computational Fluid Dynamics (Vol. 1), 4th
Edition, Engineering Education System, 2000
I Joe F. Thompson, Bharat K. Soni, Nigel P. Weatherill, Handbook of Grid Generation,
CRC Press, 1998
I BBIPED, CFD Industrial Platform for Engineering Design, BCAM - Basque Center for
Applied Mathemathics, 2015 (Open-source CFD code used in the hands-on session)
110 / 110