Introduction to NUMERICAL
(COMPUTER) MODELING IN
ENGINEERING & CFD
Dr. Rached Ben- Mansour
Aug 28, 2024
ME505
Lecture 2-3
1.1 Advantages of Computational
Modeling (CM)
CM provides four major advantages
compared with experimental methods:
• (i) Lead time in design and development
is significantly reduced
• (ii) CM can simulate conditions not
reproducible in experimental model tests
• (iii)CM provides more detailed and
comprehensive information
Advantages of Computational
Modeling (CM)
In addition :
• (iv) CM is increasingly more cost-effective
than experimental testing
• (v) CM can be a tool for redesign of an
existing facility once the model matches very
well with the existing physical plant
• (vi) Tool for design optimization and recently
for studying of system dynamics and
implementing control algorithms.
1.2. Overview of CM in Fluid
Dynamics (CFD)
Once the problem is well defined, the overall
process of CFD can be summarized by the
following steps:
1. Geometry Modeling, Mesh
Generation and other
Preprocessing
Overview of CM in Fluid
Dynamics: CFD
2. For each Fluid Finite Volume , integrate
1. Conservation of Mass: Continuity Equation
2. Newton’s 2nd Law: Euler/Navier-Stokes Eq.
3. Conservation of Energy: Energy Eq.
4. Equation of State
5. Apply the Boundary conditions
The above results in a set of algebraic equations
Overview of CM in Fluid
Dynamics: CFD
3. Solve the above algebraic equation using the
appropriate solution algorithm and obtain:
➢Velocity distribution u(x,y,z,t), v(x,y,z,t), w(x,y,z,t)
➢Pressure distribution p(x,y,z,t)
➢Density distribution (x,y,z,t)
➢Temperature T(x,yz,t)
➢Mass fractions in case two or more species
Overview of CM in Fluid
Dynamics: CFD
4 Post-processing the Results to deduce the
flow behavior such as:
- Flow Separation
- Flow Rates
- Heat Transfer Rates
- Forces on Bodies (Skin friction, Drag, Lift)
- Efficiencies of System
1.3. Computational Procedure
• The computational modeling process can
also be viewed in Figures below :
Physical Computational
Model (PDE) Algorithm applied
to Partial Computational
specified by
Differential Solution
Data and
Equation describing and Interpretation
boundary
conditions the model
Computational Algorithm Steps
• We can also represent the CFD process by
the following diagram:
Governing
Discretization
PDE and
BC
System of
Algebraic Algebraic Approximate
Equations Equation Solution
Solver
Characteristics of Computational
Algorithm
The stability can be affected by
• Ability of the solver to absorb errors and
perturbations
• Limitations in the CPU such as finite
number of floating points, round-off errors
• The accuracy of the solution can be
estimated by evaluation of the truncation
error of each discretized term of the PDE
(1st Order, 2nd Order, ....)
Convergence of the Solution
Algorithm
• If the discretization process is consistent
with original PDE, and
• if the solution of the algebraic equations is
stable then
• then we will obtain a convergent solution.
so we can say:
CONSISTENCY + STABILITY = CONVERGENCE
Characteristics of Computational
Algorithm
Discretization System of Algebraic
Governing PDE
Equations
Consistency
Analytic Stability
Method
Convergence Approximate
Exact Solution
Solution
t, x, .. → 0
2. DISCRETIZATION METHODS
• 2.1. Taylor Series Approximation (Finite
difference)
• Using this method, we can approximate the
nodal variables in a finite difference mesh
(Figure 2.1) as follows
1 2 3
x x
Figure 2.1. Finite difference cluster
Taylor Series Approximation
• We obtain the following discretization
d 2 d 3 d
2 3
1 1
1 = 2 − x + ( x ) 2
− ( x ) 3
+ ......
dx 2 2 dx 3! dx 2
2
d 2 d 3 d
2 3
1 1
3 = 2 + x + ( x ) 2
+ ( x ) 3
+ ......
dx 2 2 dx 3! dx 2
2
Taylor Series Approximation
• If we truncate the series after the 3rd term
we get the following approximations for the
first and second derivative respectively
d 3 − 1 d 3 − 2 2 + 1
2
= 2
=
dx 2 2x dx ( x )
2
2
• If we substitute these approximations into
the differential equations we obtain the
Finite difference approximation.
Taylor Series Approximation
• The method assumes that the variable
varies like a polynomial in (x) so higher
derivatives are not important
• This leads to undesirable formulation if an
exponential behavior is encountered
• Relatively straightforward
• Fixed spacing is required for regular
formulation, and variable spacing require a
mapping and a special derivation.
2.2 Variational Formulations
➢ Calculus of variation is used to minimize a certain
functional
➢ If the functional is minimized w/r to grid points-
values of the dependent variable, the resulting
conditions give the discretization equations.
➢ Used in Finite Element for stress analysis (linked to
virtual-work principal)
➢ Limited because the Variational principle
(minimizing the functional) does not work for all
differential equations of interest.
2.3 Method of Weighted Residuals
a) Let L( )= 0 represent a differential equation
b) Assume an approximate solution (called a
trial function)
= a + a x + a x 2 + .........+ a xn
0 1 2 n
where the a’s are parameters
Substitute in the D.E. this will leave residual
R= L( )
2.3 Method of Weighted Residuals
• c) We wish to make R as small as
possible , therefore we propose
W ( x ). R ( x ). dx = 0
where W(x) is a weighting functional and
the integral is performed over the domain
of interest.
(i) Subdomain Method
• In this method we split domain into
subdomains (m) which may overlap and
set
• Wm= 1 in Dm and Wm=0 outside Dm
as shown in Fig. 2.3
Wm
1 2 3 4 5 6 x
Figure 2.3. Subdomain Function
Subdomain Method
• This method coincide with the Finite Volume
Method (FVM) used in many CFD software
(Fluent, Ansys-CFX, Flow3d, StarCD,
etc....)
• Examples: Conduction, Convection
d dT q F G
1 . dx k dx + S = 0 and 1 . + + dxdy
t x y
Other W.R. Methods
• (ii) Collocation Method
Wm= (x-xm) where is the delta (Dirac)
function and set R(xm)=0
• (iii) Least Square Method
R
Wm= and R d x d y d z is minimized
2
a m
• (iv) Galerkin Method
- Wm(x,y,z)= m(x,y,z) Weighting functions are
from the same family as of the trial function.
- Very similar to the Finite Element Method
(Galerkin Approximation).
(v) Finite Element Method
A. Overview
• Started as an adhoc engineering procedure
for constructing matrix solution to stress-
displacement calculations. Then was placed
on sound mathematical basis.
• Two methods:
1) Variational calculus (very limited)
2) Galerkin method is widely used and
more practical.
Galerkin F.E. method
• The Galerkin F.E. method has two (2) main
features:
(a) The approximation solution (x) is written
directly in terms of nodal unknowns (nodes)
as follows:
J
T ( x ) = ( x ) = T j j ( x ) , j (x )
j= 1
is called the trial/ interpolation / approximation
/ shape function (Nj(x) in engineering literature)
and Tj are the nodal values.
Galerkin F.E. method
• This formulation will save computational
resources and has direct physical meaning.
(b) j(x) are chosen from relatively low order,
piece-wise polynomials restricted to
contiguous elements, hence few non-zero
terms which (with proper ordering) can be
located close to the main diagonal of the
matrix (smaller bandwidth) hence more
economical.
Example: Linear Shape Function
x j +1
− x
( j)
j +1
=
x j +1
− x j
x − x j −1
( j)
j
=
xj − x j −1
xj-2 xj-1 xj xj+1 xj+2
Application Example
We take the following 1-dimensional problem:
2
d y L dy
2
+ y = F = a l s in ( l − 0 .5 ) x y ( 0 ) = 0; (1 ) = 0
dx l= 1 dx
L al
y (x ) = − s in [ ( l − 0 .5 ) x ] .
1 − [ ( l − 0 .5 ) ]
2
l= 1
Example- Cont’d
• The analytical exact solution is given by
y(x), now we try a numerical approximation
as follows
2
d Y
Y ( x ) = Y j j ( x ) and R = 2
+ Y − F
dX
Using a weighted residual method we write:
d Y
1 2
m ( x ) + Y − F dx = 0
dX
2
0
(vi) Spectral Methods
➢ Similar to Galerkin Method
➢ Applied to all the domain
➢ Complex but produces very accurate
results for basic problems (natural laminar
convection)
2.4 Implementation of Finite
(Control) Volume Method
• Consider 1-D Steady State Heat Conduction
with internal source S, From first principles we
obtain the following differential equation:
x
dT dT d dT
−k − k + k
dx dx dx dx
Control Volume Method
• T is temperature (K) and S is the internal heat
generation in (W/m3).
• We use the weighted residual method (W(x)=1)
in the subdomain)
xw xe
w e
W P E
Control Volume Method
• Step 1:
x(e)
d dT
1. k + S d x = 0
x(w ) dx dx
dT dT
e
• Step 2: k − k + Sdx = 0
dx e
dx w w
In step 2 we have applied Leibnetz rule (1-D)
In the case of 2D or 3D apply Green’s theorem.
Control Volume Method
• The fluxes at the boundaries of the FV are
automatically conserved
• The physical meaning is clear
• Now we need an approximation of the
fluxes, we use a piece-wise linear one:
( TE − TP ) ( TP − TW )
k e
− k w
+ S x = 0
( x ) e ( x ) w
xw xe
w e
W P E
Control Volume Method
• We rewrite the following equations as
follows:
aP TP = aE TE + aW TW + b
where
a E = k e / ( x ) e
a W = k w / ( x ) w
aP = aE + aW
b = S x
Comments: CVM
• TP is the central grid point aP TP= anb Tnb + b
• The neighbors will increase for 2D (4) and 3D (6)
• We have used the simplest profile for dT/dx , other
interpolations are possible (increase accuracy order)
• We do not need to use same profile for all quantities,
for S we used constant profile, also for the same
variable we can use different profiles
• Note (x)e and (x)w can vary for other control
volumes.
CVM-Time Discretization
• Similar integration over time can be carried
out. We take the transient equation
T T
cp = k
t x x
• We carry the following integration to obtain
the algebraic equation:
e t+ t
T T
t+ t w
cp d t d x = k d x d t
w t t t w x x
New Methods for CFD
Continuum Approach and
Multiscale Flows
– Mesh-less Methods (Domain and
Boundary simulations)
– Particulate methods
– Direct Monte Carlo Simulations (DSMC)
– Lattice Boltzmann Methods (LBM)
– Molecular Dynamic Simulations (MD)
– Dissipative Particle Dynamics (DPD)
– Reduced Order Modeling (Res. Method in
Heat Transfer or Fluid Flow)
Ref.: Microflows and Nanoflows: G. Kardiniadkis et al 2005
New Methods: LBM
• Lattice Boltzmann Method
– Based on Statistical thermodynamics and quantum
physics
– Still under research and development
– It can be used for continuum and non-continuum (micro
and nano- devices) flow regimes.
• Molecular Dynamic Simulations
– This is method is applicable to nano-scale flows where
molecular interaction forces are modeled. (L-J forces)
– The method is simple in principle but cumbersome in
programming and require super-computational recourses
to model
– Can be used to derive the properties of a certain fluid
mixture (nanofluids, etc…)