Page 01
Page 02
Page 03
Department of
Chemical Engineering
NIT Agartala Page 04
Electivee-II
(Computational Fluid Dynamics)
Page 05
7 Semester
th
Year-2020-2021
Page 06
Page 07
Introduction to
Electivee-II
(Computational Fluid Dynamics)
7th Semester
Year-2020-2021
Computational
Fluid Dynamics
Instructor
Dr. Bibhab Kumar Lodh Slide
01
Fluid (gas and liquid) flows are governed by
partial differential equations which
represent conservation laws for the mass,
Electivee-II momentum, and energy.
(Computational Fluid Dynamics)
7th Semester
Year-2020-2021
Computational Fluid Dynamics (CFD) is
the art of replacing such PDE systems
by a set of algebraic equations which can
Instructor be solved using digital computers.
Dr. Bibhab Kumar Lodh
Slide
02
What is fluid flow?
Fluid flows encountered in everyday life include
• meteorological phenomena (rain, wind, hurricanes, floods, fires)
• environmental hazards (air pollution, transport of contaminants)
Electivee-II
(Computational Fluid Dynamics) • heating, ventilation and air conditioning of buildings, cars etc.
7th Semester
Year-2020-2021 • combustion in automobile engines and other propulsion systems
• interaction of various objects with the surrounding air/water
• complex flows in furnaces, heat exchangers, chemical reactors etc.
• processes in human body (blood flow, breathing, drinking . . . )
• and so on and so forth
Instructor
Dr. Bibhab Kumar Lodh
Slide
03
What is CFD?
Computational Fluid Dynamics (CFD) provides a qualitative (and sometimes
even quantitative) prediction of fluid flows by means of
• mathematical modeling (partial differential equations)
• numerical methods (discretization and solution techniques)
• software tools (solvers, pre- and postprocessing utilities)
Electivee-II
(Computational Fluid Dynamics)
CFD enables scientists and engineers to perform ‘numerical experiments’
7th Semester
(i.e. computer simulations) in a ‘virtual flow laboratory’ real experiment CFD
Year-2020-2021
simulation.
Instructor
Dr. Bibhab Kumar Lodh
Real experiment CFD simulation
Slide
04
Why use CFD?
Numerical simulations of fluid flow (will) enable
❖ architects to design comfortable and safe living environments
❖ designers of vehicles to improve the aerodynamic characteristics
❖ chemical engineers to maximize the yield from their equipment
Electivee-II
(Computational Fluid Dynamics)
❖ petroleum engineers to devise optimal oil recovery strategies
7th Semester
Year-2020-2021
❖ surgeons to cure arterial diseases (computational hemodynamics)
❖ meteorologists to forecast the weather and warn of natural disasters
❖ safety experts to reduce health risks from radiation and other hazards
❖ military organizations to develop weapons and estimate the damage
Instructor ❖ CFD practitioners to make big bucks by selling colorful pictures :-)
Dr. Bibhab Kumar Lodh
Slide
05
Examples of CFD
Electivee-II
(Computational Fluid Dynamics)
7th Semester
Year-2020-2021
Instructor
Dr. Bibhab Kumar Lodh
Slide
06
Examples of CFD
Electivee-II
(Computational Fluid Dynamics)
7th Semester
Year-2020-2021
Instructor
Dr. Bibhab Kumar Lodh
Slide
07
Experiments vs. Simulations
CFD gives an insight into flow patterns that are difficult, expensive
or impossible to study using traditional (experimental) techniques
Experiments Simulations
Quantitative description of Quantitative prediction of
Electivee-II flow phenomena using flow
(Computational Fluid Dynamics) measurements phenomena using CFD
7th Semester software
Year-2020-2021
• for one quantity at a time • for all desired quantities
• at a limited number of • with high resolution in
points and time instants space and time
• for a laboratory-scale model • for the actual flow domain
• for a limited range of • for virtually any problem
problems and operating and realistic operating
conditions conditions
Instructor
Dr. Bibhab Kumar Lodh
Error sources: measurement Error sources: modeling, Slide
errors, flow disturbances by discretization, iteration, 08
the probes implementation
Experiments vs. Simulations
As a rule, CFD does not replace the measurements completely
but the amount of experimentation and the overall cost can be
significantly reduced.
Experiment Simulations
s
Electivee-II Equipment and personnel
(Computational Fluid Dynamics) •Expensive •Cheap(er) are difficult to transport
7th Semester
•Slow •Fast(er)
Year-2020-2021
CFD software is portable,
•Sequential •parallel easy to use and modify
•Single- •Multi-Purpose
Purpose
The results of a CFD simulation are never 100% reliable because
• the input data may involve too much guessing or imprecision
Instructor
Dr. Bibhab Kumar Lodh • the mathematical model of the problem at hand may be inadequate
• the accuracy of the results is limited by the available computing power Slide
09
Fluid characteristics
Macroscopic properties Classification of fluid flows
ρ density viscous inviscid
μ viscosity compressible incompressible
Electivee-II
(Computational Fluid Dynamics) p pressure steady unsteady
7thSemester
Year-2020-2021
T temperature laminar turbulent
v velocity single-phase multiphase
The reliability of CFD simulations is greater
Instructor • for laminar/slow flows than for turbulent/fast ones
Dr. Bibhab Kumar Lodh • for single-phase flows than for multi-phase flows
• for chemically inert systems than for reactive flows Slide
10
How does CFD make predictions?
CFD uses a computer to solve the mathematical equations for the
Problem at hand. The main components of a CFD design cycle
are as follows:
Electivee-II • the human being (analyst) who states the problem to be solved
(Computational Fluid Dynamics)
7th Semester
• scientific knowledge (models, methods) expressed mathematically
Year-2020-2021
• the computer code (software) which embodies this knowledge and
provides detailed instructions (algorithms) for
• the computer hardware which performs the actual calculations
• the human being who inspects and interprets the simulation results
Instructor
CFD is a highly interdisciplinary research area which
Dr. Bibhab Kumar Lodh
lies at the interface of physics, applied mathematics,
and computer science Slide
11
CFD analysis process
1. Problem statement information about the flow
2. Mathematical model IBVP = PDE+IC+BC
Electivee-II 3. Mesh generation nodes/cells, time instants
(Computational Fluid Dynamics)
7th Semester 4. Space discretization coupled ODE/DAE systems
Year-2020-2021
5. Time discretization algebraic system Ax = b
6. Iterative solver discrete function values
7. CFD software implementation, debugging
8. Simulation run parameters, stopping criteria
Instructor 9. Postprocessing visualization, analysis of data
Dr. Bibhab Kumar Lodh
10. Verification model validation / adjustment
Slide
12
Problem statement
• What is known about the flow problem to be dealt with?
• What physical phenomena need to be taken into account?
Electivee-II • What is the geometry of the domain and operating conditions?
(Computational Fluid Dynamics)
7th Semester • Are there any internal obstacles or free surfaces/interfaces?
Year-2020-2021
• What is the type of flow (laminar/turbulent, steady/unsteady)?
• What is the objective of the CFD analysis to be performed?
– computation of integral quantities (lift, drag, yield)
– snapshots of field data for velocities, concentrations etc.
– shape optimization aimed at an improved performance
Instructor
• What is the easiest/cheapest/fastest way to achieve the goal?
Dr. Bibhab Kumar Lodh
Slide
13
Mathematical model
1. Choose a suitable flow model (viewpoint) and reference frame.
2. Identify the forces which cause and influence the fluid motion.
3. Define the computational domain in which to solve the problem.
Electivee-II
(Computational Fluid Dynamics) 4. Formulate conservation laws for the mass, momentum, and energy.
7th Semester
Year-2020-2021 5. Simplify the governing equations to reduce the computational effort:
• use available information about the prevailing flow regime
• check for symmetries and predominant flow directions (1D/2D)
• neglect the terms which have little or no influence on the results
• model the effect of small-scale fluctuations that cannot be captured
• incorporate a priori knowledge (measurement data, CFD results)
Instructor
6. Add constituitive relations and specify initial/boundary conditions.
Dr. Bibhab Kumar Lodh
Slide
14
Discretization process
The PDE system is transformed into a set of algebraic equations
1. Mesh generation (decomposition into cells/elements)
• structured or unstructured, triangular or quadrilateral?
• CAD tools + grid generators
• mesh size, adaptive refinement in ‘interesting’ flow regions
Electivee-II
(Computational Fluid Dynamics)
7th Semester
Year-2020-2021
2. Space discretization (approximation of spatial derivatives)
• finite differences/volumes/elements
Instructor • high- vs. low-order approximations
Dr. Bibhab Kumar Lodh
3. Time discretization (approximation of temporal derivatives)
Slide
• explicit vs. implicit schemes, stability constraints 15
• local time-stepping, adaptive time step control
Iterative solution strategy
The coupled nonlinear algebraic equations must be solved iteratively
• Outer iterations: the coefficients of the discrete problem are updated using
the solution values from the previous iteration so as to
Electivee-II – get rid of the nonlinearities by a Newton-like method
(Computational Fluid Dynamics) – solve the governing equations in a segregated fashion
7th Semester
Year-2020-2021 • Inner iterations: the resulting sequence of linear sub problems is
typically solved by an iterative method (conjugate
gradients, multigrid) because direct solvers
(Gaussian elimination) are prohibitively expensive
• Convergence criteria: it is necessary to check the residuals, relative
solution changes and other indicators to make sure
that the iterations converge. As a rule, the algebraic
systems to be solved are very large (millions of
Instructor unknowns) but sparse, i.e.,most of the matrix
Dr. Bibhab Kumar Lodh coefficients are equal to zero.
Slide
16
CFD simulations
The computing times for a flow simulation depend on
• the choice of numerical algorithms and data structures
• linear algebra tools, stopping criteria for iterative solvers
Electivee-II
(Computational Fluid Dynamics) • discretization parameters (mesh quality, mesh size, time step)
7th Semester
Year-2020-2021 • cost per time step and convergence rates for outer iterations
• programming language (most CFD codes are written in Fortran)
• many other things (hardware, vectorization, parallelization etc.)
The quality of simulation results depends on
• the mathematical model and underlying assumptions
Instructor • approximation type, stability of the numerical scheme
Dr. Bibhab Kumar Lodh
• mesh, time step, error indicators, stopping criteria . . .
Slide
17
Postprocessing and analysis
Postprocessing of the simulation results is performed in order to
extract the desired information from the computed flow field
• calculation of derived quantities (streamfunction, vorticity)
Electivee-II
(Computational Fluid Dynamics) • calculation of integral parameters (lift, drag, total mass)
7th Semester
Year-2020-2021
• visualization (representation of numbers as images)
– 1D data: function values connected by straight lines
– 2D data: streamlines, contour levels, color diagrams
– 3D data: cutlines, cutplanes, isosurfaces, isovolumes
– arrow plots, particle tracing, animations . . .
• Systematic data analysis by means of statistical tools
Instructor
Dr. Bibhab Kumar Lodh • Debugging, verification, and validation of the CFD model
Slide
18
Uncertainty and error
Whether or not the results of a CFD simulation can be trusted
depends on the degree of uncertainty and on the cumulative
effect of various errors
• Uncertainty is defined as a potential deficiency due to the lack
of knowledge (turbulence modeling is a classical example)
Electivee-II
(Computational Fluid Dynamics) • Error is defined as a recognizable deficiency due to other
7th Semester reasons
Year-2020-2021
– Acknowledged errors have certain mechanisms for identifying,
estimating and possibly eliminating or at least alleviating them
– Unacknowledged errors have no standard procedures for
detecting them and may remain undiscovered causing a lot of
harm
– Local errors refer to solution errors at a single grid point or cell
Instructor – Global errors refer to solution errors over the entire flow domain
Dr. Bibhab Kumar Lodh
Local errors contribute to the global error and may move
throughout the grid. Slide
19
Classification of errors
Acknowledged errors
• Physical modeling error due to uncertainty and deliberate
simplifications
Electivee-II • Discretization error approximation of PDEs by algebraic equations
(Computational Fluid Dynamics)
7th Semester
Year-2020-2021
– spatial discretization error due to a finite grid resolution
– temporal discretization error due to a finite time step size
• Iterative convergence error which depends on the stopping criteria
• Round-off errors due to the finite precision of computer arithmetic
Unacknowledged errors
Instructor • Computer programming error: “bugs” in coding and logical mistakes
Dr. Bibhab Kumar Lodh
• Usage error: wrong parameter values, models or boundary conditions
Slide
20
Verification of CFD codes
Verification amounts to looking for errors in the implementation of
the models (loosely speaking, the question is: “are we solving the
equations right”?)
• Examine the computer programming by visually checking the source
Electivee-II code, documenting it and testing the underlying subprograms
(Computational Fluid Dynamics) individually
7th Semester
Year-2020-2021 • Examine iterative convergence by monitoring the residuals, relative
changes of integral quantities and checking if the prescribed
tolerance is attained
• Examine consistency (check if relevant conservation principles are
satisfied)
• Examine grid convergence: as the mesh and/or and the time step
are refined, the spatial and temporal discretization errors,
Instructor respectively, should asymptotically approach zero (in the absence of
round-off errors)
Dr. Bibhab Kumar Lodh
• Compare the computational results with analytical and numerical
solutions for standard benchmark configurations (representative test Slide
cases) 21
Structure of the course
1. Introduction, flow models.
2. Equations of fluid mechanics.
Electivee-II 3. Finite Difference Method.
(Computational Fluid Dynamics)
7th Semester 4. Finite Volume Method.
Year-2020-2021
5. Finite Element Method.
6. Implementation of FEM.
7. Time-stepping techniques.
8. Properties of numerical methods.
9. Turbulence Modeling.
Instructor
Dr. Bibhab Kumar Lodh [Link] Correction Technique
11. Vorticity Stream Function Slide
22
Electivee-II
Getting started….
(Computational Fluid Dynamics)
7th Semester
Year-2020-2021
Instructor
Dr. Bibhab Kumar Lodh
Slide
23
CFD notation
u …, u u 2u pu
PDE of p-th order f(u, x, t, , , ,....., p ) = 0
x1 x
n t x1x2 t
scalar unknowns u = u(x, t), x ∈ Rn, t ∈ R, n = 1, 2, 3
Electivee-II
(Computational Fluid Dynamics)
7th Semester
vector unknowns v = v(x, t), v ∈ Rm, m = 1, 2, . . .
Year-2020-2021
Nabla Operator = i + j + Where, x = (x, y, z),
x y z v = (vx, vy, vz)
T
u u u u u u
Instructor
u = i + j +k = , , Gradient
x y z x y z
Dr. Bibhab Kumar Lodh
vx v y vz
v = + + Divergence Slide
x y z 24
CFD notation
vz v y
−
i j k y z
X v = det
vx vz
= −
Curl
x y z z x
v vy vz v y vx
x −
Electivee-II x y
(Computational Fluid Dynamics)
7th Semester
Year-2020-2021 2u 2u 2u
u = (u ) = u = 2 + 2 + 2
2
Laplacian
x y z
z
v
Instructor j y
Dr. Bibhab Kumar Lodh
i
x Slide
25
Tensorial quantities in fluid dynamics
Velocity gradient
vx v y vz
x x x
v v y vz
v = vx , v y , vz = x
y y y
vx v y vz
Electivee-II
z z z
(Computational Fluid Dynamics)
7th Semester Remark. The trace (sum of diagonal elements) of ∇v equals
Year-2020-2021
∇ . v.
Deformation rate tensor (symmetric part of ∇v)
vx 1 v y vx 1 vz vx
( + ) ( + )
x 2 x y 2 x z
1 1 v v y v y 1 vz v y
D (v ) = (v + vT ) = ( x + ) ( + )
2 2 y x y 2 y z
Instructor 1 v v 1 v y vz vz
( x + z ) ( + )
Dr. Bibhab Kumar Lodh 2 z x 2 z y z
Slide
Spin tensor S(v)= ∇v-D(v) (Skew symmetric part of ∇v) 26
Tensor Y d=-15 i+10 j+0.5 k
Agartala B
Temperature= 370C
Scalar: specify with 1
component -0 basis 10 km
vector/component
15 km
Electivee-II x
(Computational Fluid Dynamics) A
7thSemester
Year-2020-2021 Z
O
Displacement : ǁd ǁ= 18 km
d is in the direction of AB
Vector: 3 component
(1 basis vector/component)
Instructor
Dr. Bibhab Kumar Lodh
Stress at O? Slide
27
z
y
Electivee-II
(Computational Fluid Dynamics)
7th Semester
Year-2020-2021
Instructor
Dr. Bibhab Kumar Lodh
Slide
So to specify stress use p, which has 9 components (2 basis vector
28
for each components)-1 for cross sectional area+1 for direction of
the force
Tensors : In an m dimensional space, a tensor of rank n is
a mathematical object that has n indices, mn components
and obeys certain transformation rules.
Generally m=3
Rank of a tensor : Number of basis vector needed to fully
Electivee-II specify a component of the tensor.
(Computational Fluid Dynamics)
7th Semester
Year-2020-2021
For instance: a scalar is a tensor of rank 0.
a vector is a tensor of rank 1
p stress is a tensor of rank 2 ( stress
tensor)
Now lets verify with mn rules: let us take mn=a
Scalar: m=3, n=0 and hence , a=1, which is obviously
Instructor true
Dr. Bibhab Kumar Lodh Vector: m=3, n=1 and hence, a=3 which is again true
Tensor: m=3, n=2 and hence, a=9 which is again true Slide
29
Page 01
Page 02
CFD
7th Semester
Page 03
Date: 27.07.20
Page 04