Introduction To Computational Fluid Dynamics (CFD)
Introduction To Computational Fluid Dynamics (CFD)
Introduction To Computational Fluid Dynamics (CFD)
1. What is CFD
2. Why use CFD
3. Where is CFD used?
4. What are the advantages and limitations of CFD?
5. Physics of Fluid
6. Numerical methods
7. Discretization for equations
8. Modeling
9. Types of CFD codes
10. CFD process
11. CFD Educational Interface
12. Example of CFD analysis process
Fluid
Problem Comparison &
Fluid Mechanics Analysis
Simulation Results
Physics of Fluid
C
Mathematics Computer
F
Navier-Stokes Equations
D Computer Program
Programming
Numerical
Methods Language
Geometry
Discretized Form Grids
Simulation(CFD) Experiment
Cost Cheap Expensive
Aeronautics
Automotive aerodynamics . . .
– Sports
Shear rate distribution in twin-
screw extruder simulation
2021/03/03 CFD club@HCMUT 26
Where is CFD used?
Process engineering
HVAC
Marine (movie)
– Power Generation
– Sports
Flow of lubricating
2021/03/03 CFDmud over drill bit
club@HCMUT 35
Where is CFD used?
Where is CFD used? (Power generation)
Applications
Visualization examples
Advantages of CFD
• Relatively low cost.
– Using physical experiments and tests to get essential
engineering data for design can be expensive.
– CFD simulations are relatively inexpensive, and costs are
likely to decrease as computers become more powerful.
• Speed.
– CFD simulations can be executed in a short period of time.
– Quick turnaround means engineering data can be
introduced early in the design process.
• Ability to simulate real conditions.
– Many flow and heat transfer processes can not be (easily)
tested, e.g. hypersonic flow.
– CFD provides the ability to theoretically simulate any
physical condition.
Advantages of CFD
Advantages
Limitations of CFD
• Boundary conditions.
– As with physical models, the accuracy of the CFD solution is
only as good as the initial/boundary conditions provided to
the numerical model.
– Example: flow in a duct with sudden expansion. If flow is
supplied to domain by a pipe, you should use a fully-
developed profile for velocity rather than assume uniform
conditions.
Computational Domain Computational Domain
poor better
2021/03/03 CFD club@HCMUT 46
What are the advantages and limitations of CFD?
Limitations
Viscosity μ:
resistance to flow of a fluid
Ns
3 ( Poise)
m
Substance Air(18ºC) Water(20ºC) Honey(20ºC)
Density(kg/m3) 1.275 1000 1446
Viscosity(P) 1.82e-4 1.002e-2 190
Fluid mechanics
Inviscid Viscous
Laminar Turbulence
Internal External
Compressible Incompressible (airfoil, ship)
(pipe, valve)
(air, acoustic) (water)
m in m out
in M out
dM
m in m out
dt
m in m out
Mass
dM Momentum
0
dt Energy
ux uy uz 0
t x y z
Continuity
Equation of motion
Analytical
Experimental Numerical
• Navier-Stokes: u 1 2 1
u u P g u F
t
• Continuity:
• Cons. Energy: (vn)dA t dV 0
Q Ws W P
e (vn)dA e dV
dt dt dt t
k1 hf (x n , yn )
h k1
k2 hf (x n , yn )
2 2
h k2
k3 hf (x n , yn )
2 2
k 4 hf (x n h, yn k3 )
k1 k2 k3 k 4
yn 1 yn O(h 5 )
6 3 3 6
Discretization
Analytical Equations Discretized Equations
Discretization Methods
Finite Difference
Straightforward to apply, simple, sturctured grids
Finite Element
Any geometries
Finite Volume
Conservation, any geometries
U i q 1, U j , T
t xi xi
Local change with time Flux Source
A B
A B
m dV pV ; mu i ui dV Pu PV
Vi Vi
P dV P dS Pk S k k n, s, e, w
Ue Vi Si
k
Interpolation
U P if (U n ) e 0
Upwind Ue
U E if (U n ) e 0
Central xe x P
U e U E e U P (1 e ) e
xE xP
Discretization of
Continuity Equation
2021/03/03 CFD club@HCMUT 66
FV Discretization of Incompressible N-S Equation
Muh 0
duh
C (uh )uh Duh Mqh 0
dt
Unsteady Convection Diffusion Source
Time Discretization
n 1
f (u n Explicit
du h h)
dt f (uhn , uhn 1 ) Implicit
Discretization of
Navier-Stokes Equation
2021/03/03 CFD club@HCMUT 67
8 Modelling
• Based on the physics of the fluids phenomena, CFD can be distinguished into
different categories using different criteria
• Viscous vs. inviscid (Re)
• External flow or internal flow (wall bounded or not)
• Turbulent vs. laminar (Re)
• Incompressible vs. compressible (Ma)
• Single- vs. multi-phase (Ca)
• Thermal/density effects (Pr, g, Gr, Ec)
• Free-surface flow (Fr) and surface tension (We)
• Chemical reactions and combustion (Pe, Da)
• etc…
• Turbulent flows at high Re usually involve both large and small scale
vortical structures and very thin turbulent boundary layer (BL) near the wall
• Turbulent models:
• DNS: most accurately solve NS equations, but too expensive
for turbulent flows
• RANS: predict mean flow structures, efficient inside BL but excessive
diffusion in the separated region.
• LES: accurate in separation region and unaffordable for resolving BL
• DES: RANS inside BL, LES in separated regions.
• Free-surface models:
• Surface-tracking method: mesh moving to capture free surface,
limited to small and medium wave slopes
• Single/two phase level-set method: mesh fixed and level-set
function used to capture the gas/liquid interface, capable of
studying steep or breaking waves.
2021/03/03 CFD club@HCMUT 78
Examples of modeling (Turbulence and free surface models)
B
B2 1 3 B1
ul FD l l
y 2 v v
m vml 2 uml 2 m FD uml 1 2 m BD uml 1
x 1
BD y y y y y
y
uml l 1
um ( p / e)lm
l
x x
Bu l
1 m 1
l
Bu Bu
2 m
l
3 m 1 Bu l 1
4 m p / e m B4
x
l
l 1 p Solve it using
l B4u1
B2 B3 0 0 0 0 0 0 u1 x e 1 Thomas algorithm
B B B 0 0 0 0 0
1 2 3
0 0 0 0 0 B 1 B2 B3
0 0 0 0 0 0 B1 B2 umm l
p
l
l 1
B4umm
To be stable, Matrix has to be x e mm
Diagonally dominant.
2021/03/03 CFD club@HCMUT 84
Solvers and numerical parameters
Unstructured Grid
+ for all geometries
– irregular data structure
Transform
o x o x
Physical domain Computational domain
• Post-processing:
1. Visualize the CFD results (contour, velocity vectors, streamlines, path lines,
streak lines, and iso-surface in 3D, etc.), and
2. CFD UA: verification and validation using EFD data (more details later)
• Post-processing usually through using commercial software
Figure: Isosurface of Q=300 colored using piezometric pressure, free=surface colored using z for fully appended Athena,
Fr=0.25, Re=2.9×108. Tecplot360 is used for visualization.
CFDSHIPIOWA
2021/03/03 CFD club@HCMUT 94
CFD Educational Interface
Boundary Numerical
Conditions Scheme
Initial
Conditions
Error: S S T SM SN Uncertainty: U S2 U SM
2 2
U SN
• Verification: process for assessing simulation numerical
uncertainties USN and, when conditions permit, estimating the sign
and magnitude Delta δ*SN of the simulation numerical error itself and
the uncertainties in that error estimate USN
J
SN I G T P I j 2
U SN U I2 U G2 U T2 U P2
j 1
I: Iterative, G : Grid, T: Time step, P: Input parameters
Monotonic Convergence
k 21 Sk 2 Sk1 k 32 Sk 3 Sk 2
Rk k 21 k 32
(i). Monotonic convergence: 0<Rk<1
(ii). Oscillatory Convergence: Rk<0; | Rk|<1 Monotonic Divergence Oscillatory Convergence
n pk( i ) J
Sˆkm SC xkm g k(i ) *
jm
order of accuracy for the ith term
i 1 j 1, j k
J J
Sˆk1 SC xk1 pk(1)
g (1)
k *
j1
Sˆk 2 SC rk xk1 pk(1)
g (1)
k *
j2
j 1, j k j 1, j k
J
pk(1)
Sˆk3 SC r xk1 k
2
g (1)
k *
j3 Three equations with three unknowns
j 1, j k
pk
ln k32 k21 * *
k
21
lnrk k1 REk 1
rkpk 1
2021/03/03 CFD club@HCMUT 108
Post-processing (UA, verification, cont’d)
order and 1 for 1st order schemes U k is the uncertainties based on fine mesh
Ck is the correction factor solution,U kc is the uncertainties based on
numerical benchmark SC
2. GCI approach *
U kc Fs 1 RE
U k Fs RE k1
*
k1
FS: Factor of Safety
• Oscillatory Convergence: Uncertainties can1 be estimated, but without
signs and magnitudes of the errors. U k SU S L
• Divergence 2
• In this course, only grid uncertainties studied. So, all the variables with
subscribe symbol k will be replaced by g, such as “Uk” will be “Ug”
RG G21 G pG
ln G32
2
G 21 2
2 32 2
ln rG
Where <> and || ||2 are used to denote a profile-averaged quantity (with ratio of
solution changes based on L2 norms) and L2 norm, respectively.
NOTE: For verification using AFD for axial velocity profile in laminar pipe flow (CFD
Lab1), there is no modeling error, only grid errors. So, the difference between CFD and
AFD, E, can be plot with +Ug and –Ug, and +Ugc and –Ugc to see if solution was
verified.
(a) 1 (b)
UI ( SU S L )
2
Iteration history for series 60: (a). Solution change (b) magnified view of total
resistance over last two periods of oscillation (Oscillatory iterative convergence)
2021/03/03 CFD club@HCMUT 112
Post-processing (UA, validation)
• Validation example
Example: Grid study
and validation of
wave profile for
series 60
ONERA M6 Wing
- Table of airfoil coordinates
- Drawing of planform shape
- Develop a CAD model of wing
Solution Processing:
• Extract data (lift, drag, recovery, spillage, etc…) useful
for iterative convergence monitoring and engineering
design (CFPOST).
CFD results, like any other data, should be reported along with some idea of the
level of error that it contains and indications of how much confidence one has in
the data.
• What are engineering results and uncertainty of those results?
• How much error is there in the iterative convergence?
• How much error is there in the grid convergence?
• How sensitive are the results to model parameters (turbulence, etc…)
• How sensitive are the results to algorithm parameters (CFL, etc…)
• How do the results compare to similar experimental or theoretical data?
• Statistical analysis may be useful for reporting such information.