You are on page 1of 49

# Course 1: Fluid Mechanics and Energy Conversion

Discretization Methods
in Fluid Dynamics

Supervisor:
Mayank Behl
Dr. G.Biswas
B-tech. 3rd Year
Department of Chemical Engineering Indian Institute of Technology
Indian Institute of Technology Delhi Kanpur

## 3/8/2007 Indo-German Winter Academy 1

OUTLINE
1. Basics of PDE
2. Mathematical Overview of fluid flow
3. Need For Computational Methods
4. Basic Discretization Methods in use
5. Finite Difference Method
6. Fluid Flow Modeling

## 3/8/2007 Indo-German Winter Academy 2

Partial differential equations (PDEs) are used to
formulate and solve problems related to any phenomena
that is distributed in space and time :
 Heat flow ∂ φ ∂ φ
2
∂ φ 2
∂φ ∂φ 2
A +B +C +D +E + Fφ = G ( x, y )
 Fluid flow ∂x ∂x∂y 2
∂y ∂x ∂y 2

 propagation of sound
 electrodynamics,
 Elasticity…….

## Most of the fluid and related transport phenomena

can be modeled using PDEs

## 3/8/2007 Indo-German Winter Academy 3

Classification of PDEs
∂ 2φ ∂ 2φ ∂ 2φ ∂φ ∂φ
A 2 +B +C 2 + D +E + Fφ = G ( x , y )
∂x ∂x∂y ∂y ∂x ∂y

## If A,B,C,D… all constants or f(x,y) Linear PDE

If any of A,B,C,D… contains Φ, Φ’ etc Non-linear PDE

+ = 0
B.V.P. ∂x 2 ∂y 2

## B2 – 4AC=0 Parabolic equation ∂φ ∂ 2φ Unsteady viscous

I.B.V.P; ∂t ∂x 2 flows

= β 2

∂t 2 ∂x 2

## 3/8/2007 Indo-German Winter Academy 4

Boundary conditions
 Dirchlet Boundary φ = φ1 (r )
condition: Given boundary temperature

 Neumann Boundary ∂φ
= φ 2 (r )
condition: ∂n
Given boundary heat flux

 Mixed Boundary ∂φ
aφ + b = φ3 (r )
condition: ∂n
Boundary heat flux dependent on boundary temperature

## 3/8/2007 Indo-German Winter Academy 5

Mathematical description of flows;
Governing Equations of Fluid Dynamics

## ∂ρu ∂ρv ∂ρw ∂ρ

+ + =−
∂x ∂y ∂z ∂t
Δz

∂ρ
In vector notation: ∇ ⋅ [ρ u] = − Δy (x,y,z)

∂t Δx

## 3/8/2007 Indo-German Winter Academy 6

Governing Equations of Fluid Dynamics (2)

Equation of motion: ρu + ∇ ⋅ ρuu = −∇p − ∇ ⋅ τ + ρg
∂t

## for incompressible, Newtonian Fluids , under laminar flow:

⎛∂ ⎞
ρ ⎜ u + u ⋅ ∇u ⎟ = −∇p + μ ∇ 2 u + ρg
⎝ ∂t ⎠

Navier-Stokes Equation

## 3/8/2007 Indo-German Winter Academy 7

The Navier-Stokes equations
∂u ∂u ∂u ∂u 1 ∂p μ ⎛ ∂2u ∂2u ∂2u ⎞
+u +v + w = − + ⎜⎜ 2 + 2 + 2 ⎟⎟ + gx
∂t ∂x ∂y ∂z ρ ∂x ρ ⎝ ∂x ∂y ∂z ⎠

## ∂v ∂v ∂v ∂v 1 ∂p μ ⎛ ∂2v ∂2v ∂2v ⎞ (Non linear

+u +v + w = − + ⎜⎜ 2 + 2 + 2 ⎟⎟ + g y
∂t ∂x ∂y ∂z ρ ∂y ρ ⎝ ∂x ∂y ∂z ⎠ PDEs)

∂w ∂w ∂w ∂w 1 ∂p μ ⎛ ∂2 w ∂2 w ∂2 w⎞ Solution???
+u +v + w = − + ⎜⎜ 2 + 2 + 2 ⎟⎟ + gz
∂t ∂x ∂y ∂z ρ ∂z ρ ⎝ ∂x ∂y ∂z ⎠

## 3/8/2007 Indo-German Winter Academy 8

Approaches to Fluid Dynamical Problems
1. Simplifications of the governing equations
Æ AFD: Analytical Fluid Dynamic
2. Experiments on scale models
Æ EFD: Experimental Fluid Dynamics

## 3. Discretize governing equations and solve by computers

Æ CFD Computational Fluid Dynamics

## CFD is the simulation of fluids engineering system using

modeling and numerical methods

## 3/8/2007 Indo-German Winter Academy 9

Need for Discretization methods
¾ In general, no analytical solution exist for non-linear models
One of the way out is to approximate the solutions using
Numerical methods

computer resources

## ¾ Basis for CFD, which can provide unlimited details of results

¾Substantially more cost effective and more rapid than EFD
¾ability to study systems under hazardous conditions

## 3/8/2007 Indo-German Winter Academy 10

Various Discretization Techniques

## ¾ Finite Difference Method (focused in this lecture)

¾ Finite Volume Method
¾ Finite Element Method

## 3/8/2007 Indo-German Winter Academy 11

Discretization Methods
Finite Difference Method (focused in this lecture)
1.Governing equations in differential formÆ domain with gridÆ
replacing the partial derivatives by approximations in terms of node
values of the functionsÆ one algebraic equation per grid nodeÆ linear
algebraic equation system.
2. Applied to structured grids
Finite Volume Method
1. Governing equations in integral formÆ solution domain is subdivided
into a finite number of contiguous control volumesÆ conservation
equation applied to each CV.
2. Computational node locates at the centroid of each CV.
3. Applied to any type of grids, especially complex geometries
Finite Element Method
1. Solution domain is subdivided into a finite number OF ELEMENTS,
the governing equation is solved for each element and then overall
solution is obtained by “assembly”.
2. Equations are multiplied by a weight function before integrated over
the entire domain.
Basics aspects of Discretization methods
► Consistency
A discretization method is said to be consistent if it can be
shown that the difference between PDEs and its finite
difference (FDE) vanishes as the mesh is refined.
Truncation error (TE): Difference between the discretized
equation and the exact one
O(∆x); O(∆t)
LimmeshÆ0 (TE) 0
O(∆t/∆x)

## ►Convergence: solution of the discretized equations

tends to the exact solution of the differential equation as the
grid spacing tends to zero.

## 3/8/2007 Indo-German Winter Academy 13

Basics aspects of Discretization methods
Stability : Differencing Method should not magnify the
errors that appear in the course off numerical solution
process ε n+1
i
n
≤1
ε i

Conservation:
1. The numerical scheme should on both local and
global basis respect the conservation laws.
2. Automatically satisfied for control volume method,
either individual control volume or the whole domain.
3. Errors due to non-conservation are in most cases
appreciable only on relatively coarse grids, but hard to
estimate quantitatively

## 3/8/2007 Indo-German Winter Academy 14

Finite Difference Method
Replacing the derivatives of governing
PDE with finite, algebraic differences
quotients. It involves following steps:

##  Grid generation defining φi-1,j

φi-1,j φφi,ji,j φi+1,j
φi+1,j

geometric domain
 Discretization of governing Δy

## equation using Taylor

series approximation. Δx

 Solution of simultaneous
algebraic equations.
Discrete grid points

## 3/8/2007 Indo-German Winter Academy 15

Finite Difference Method:grids
Grids
 Structured grid
all nodes have the same number
of elements around it
only for simple domains
 Unstructured grid
for all geometries
irregular data structure

## 3/8/2007 Indo-German Winter Academy 16

Finite Difference,
approximation of the first derivative
►Taylor Series Expansion: Any continuous differentiable
function, in the vicinity of xi , can be expressed as a Taylor
series:
⎛ ∂Φ ⎞ ( x − xi ) ⎛ ∂ 2 Φ ⎞ ( x − xi ) ( x − xi )
2 3 n
⎛ ∂ 3Φ ⎞ ⎛ ∂ nΦ ⎞
Φ ( x ) = Φ ( xi ) + ( x − xi )⎜ ⎟ + ⎜⎜ 2 ⎟⎟ + ⎜⎜ 3 ⎟⎟ + ... + ⎜⎜ n ⎟⎟ + H
⎝ ∂x ⎠ i 2! ⎝ ∂x ⎠ i 3! ⎝ ∂x ⎠ i n! ⎝ ∂x ⎠ i

⎛ ∂ 2Φ ⎞ ( xi +1 − xi )
2
⎛ ∂Φ ⎞ Φi +1 − Φi xi +1 − xi ⎛ ∂ 3Φ ⎞
⎜ ⎟ = − ⎜⎜ 2 ⎟⎟ − ⎜⎜ 3 ⎟⎟ + H
⎝ ∂x ⎠i x i +1 − x i 2 ⎝ ∂x ⎠ i 6 ⎝ ∂x ⎠ i

►Higher order derivatives are unknown and can be dropped when the
distance between grid points is small Xi+1- Xi is small

## 3/8/2007 Indo-German Winter Academy 17

►By writing Taylor series at different nodes, x i-1, x i+1, or both
x i-1 and x i+1, we can have:
order of accuracy
⎛ ∂Φ ⎞ Φ i +1 − Φ i
⎜ ⎟ ≈ Forward Difference Scheme-FDS O(∆x)
⎝ ∂x ⎠i xi +1 − xi

⎛ ∂Φ ⎞ Φ i − Φ i −1
⎜ ⎟ ≈ Backward Difference Scheme-BDS O(∆x)
⎝ ∂x ⎠i xi − xi −1

⎛ ∂Φ ⎞ Φ i +1 − Φ i −1
⎜ ⎟ ≈ O(∆x)²
⎝ ∂x ⎠ i xi +1 − xi −1 Central Difference Scheme-CDS

## 3/8/2007 Indo-German Winter Academy 18

Finite Difference,
approximation of the second derivative
Geometrically, the second derivative is the slope of the line
tangent to the curve representing the first derivative.
⎛ ∂Φ ⎞ ⎛ ∂Φ ⎞
⎜ ⎟ − ⎜ ⎟
⎛ ∂ 2Φ ⎞ ⎝ ∂x ⎠i +1 ⎝ ∂x ⎠i
⎜⎜ 2 ⎟⎟ ≈
⎝ ∂x ⎠i xi +1 − xi
Estimate the outer derivative by FDS, and estimate the inner
derivatives using BDS, we get
⎛ ∂ 2 Φ ⎞ Φ i +1 ( xi − xi −1 ) + Φ i −1 ( xi +1 − xi ) − Φ i ( xi +1 − xi −1 )
⎜⎜ 2 ⎟⎟ ≈
⎝ ∂x ⎠i (xi +1 − xi )2 (xi − xi −1 )
For equidistant spacing of the points:
⎛ ∂ 2Φ ⎞ Φ − 2Φ i + Φ i −1
⎜⎜ 2 ⎟⎟ ≈ i +1
⎝ ∂x ⎠ i (Δx )2
Higher-order approximations for the second derivative can be
derived by including more data points, such as xi-2, and xi+2, even
xi-3, and xi+3
Discretization using Explicit Method
∂Φ ∂ 2Φ

∂t ∂x 2
Φ in +1 − Φ in Φ n i +1 − 2Φ n i + Φ n i −1

Δt (Δx )2
The Only unkown
:Φin+1
Explicit method , values at time n+1 computed from values at time n
Advantages: solution algorithm is simple i.e.
- direct computation without solving system of algebraic equation
- few number of operations per time step
Requires many time
strong to carry
conditions on out
time the
step calculations
for stability over
a given time interval
Implicit Method
Crank-Nicholson Method
∂u ∂ 2u
=α 2
∂t ∂x

## uin+1 − uin u n i+1 + uin++11 − 2u n i − 2uin+1 + u n i−1 + uin−+11

Δt 2(Δx)
2

 values at time n+1 computed using the unknown values at time n+1
 Second order accurate in time and space O(∆t)2,O(∆x)2
to be solved simultaneously at all the grid points as a system of
algebraic equations
 Unconditionally stable
rearranging the above equation as follows….
Ax = C

## This generates a Tridiagonal Matrix system which can be solved

using Thomas algorithm.

## However, for higher dimensional flows, matrix system obtained are

much more complex and require substantially more computer time

## 3/8/2007 Indo-German Winter Academy 23

Alternating Direction Implicit Method
∂u ⎛ ∂ 2u ∂ 2u ⎞
= α ⎜⎜ 2 + 2 ⎟⎟
∂t ⎝ ∂x ∂y ⎠
Each time increment is executed into two steps:
First step

## uin,+j1/ 2 − uin, j ⎛ uin+1, j − 2uin, j + uin−1, j uin,+j1+1/ 2 − 2uin,+j1/ 2 + uin,+j1−1/ 2 ⎞

= α⎜ + ⎟
Δt / 2 ⎜ (Δx) 2
Δy 2 ⎟
⎝ ⎠
Second step

uin, +j 1 − uin, +j 1/ 2 ⎛ uin++11, j − 2uin, +j 1 + uin−+11, j uin, +j +11/ 2 − 2uin, +j 1/ 2 + uin, +j −11/ 2 ⎞
= α⎜ + ⎟
Δt / 2 ⎜ (Δx ) 2
Δy 2 ⎟
⎝ ⎠

## 3/8/2007 Indo-German Winter Academy 24

First direction Y Second direction X

## ADI method results in Tridiagonal Equations (for 2-d flow systems)

if it is applied along the dimension that is implicit. Thus on first step it is
applied along Y axis and on second step along on X axis

## 3/8/2007 Indo-German Winter Academy 25

Implicit method
Stability can be maintained over larger time
steps
 More computation time per time step, every time
step requires solving a system of equations.
 Truncation error is often large , since larger
time steps are employed.
 Overall, a more involved procedure

## 3/8/2007 Indo-German Winter Academy 26

Error and Stability analysis
 Numerical solution is influenced by following:
Discretization errors or Truncation errors:
Analytical Solution (A) – exact Finite Difference Solution (D)
=A–D
Computational Round-Off Error (e)
ε=Numerical Solution (N) – exact Finite Difference Solution (D)
N=D+ε
By definition, N,D follow the Discretized Equation
Thus, ε should also follow the equation:

ε in +1 − ε in ε n i +1 − 2ε n i + ε n i −1

Δt (Δx )2

## 3/8/2007 Indo-German Winter Academy 27

Errors and Stability Analysis
(Cont.)
 Substituting the value
of εm(x,t) in the F.D.E.,

## 3/8/2007 Indo-German Winter Academy 28

Stability: Differencing Method should not magnify the errors that
appear in the course off numerical solution process

ε in +1
For stability: n
≤1
εi

## Von Neumann Stability Analysis :

assuming error distribution follows Fourier series in space domain and
exponential in time
ε ( x, t ) = ε at ∑ ε
ik m x

criteria

α (Δt ) 1

(Δx) 2
2

## 3/8/2007 Indo-German Winter Academy 29

Fluid Flow Modeling Using
Finite Difference Method
 Nonlinear Fluid Flow equations involve:
time dependent multiple variables
Convective terms
Diffusive terms
 Sample fluid flow equation : Burger’s Equation
∂u ∂ζ ⎛ ∂ 2ζ ⎞
+u = ν ⎜⎜ 2 ⎟⎟
∂t ∂x ⎝ ∂x ⎠

+u =0
∂t ∂x

## 3/8/2007 Indo-German Winter Academy 30

Properties of Fluid Flow Equations
Effect of Finite Difference method on properties of
fluid flow equations

##  Conservative Property: To maintain the integral conservation

relation of continuum in finite difference representation.
It depends on the form of continuum equation being
discretized.
∂ζ ∂
Conservative form: = − (uζ )
∂t ∂x

∂ζ ∂ζ
Non-conservative form: = −u
∂t ∂x
Integrating the
CONSERVATIVE FORM
ζ in +1 − ζ in (uζ ) n i +1 − (uζ ) n i −1
∫ Δt
Δx = α ∫
2Δx
Δx

I2 I2 I2

∑ζ
i = I1
i
n +1
Δx − ∑ ζ Δx
i = I1
i
n
∑ i +1 i +1 i −1 i −1 )
(u n
ζ
i = I1
n
− u n
ζ n

=
Δt 2

= (uζ ) I1 −1 / 2 − (uζ ) I 2 +1 / 2

I1 I2
Week Conservative Form in Fluid Flow

##  Conservative form of advective part is of prime importance for

fluid flow modeling. Navier Stokes in week conservative form:

## ∂u ∂u2 ∂uv ∂uw 1 ∂p μ ⎛ ∂2u ∂2u ∂2u ⎞

+ + + =− + ⎜⎜ 2 + 2 + 2 ⎟⎟ + gx
∂t ∂x ∂y ∂z ρ ∂x ρ ⎝ ∂x ∂y ∂z ⎠

## ∂v ∂uv ∂v2 ∂vw 1 ∂p μ ⎛ ∂2v ∂2v ∂2v ⎞

+ + + =− + ⎜⎜ 2 + 2 + 2 ⎟⎟ + g y
∂t ∂x ∂y ∂z ρ ∂y ρ ⎝ ∂x ∂y ∂z ⎠

## ∂w ∂uw ∂vw ∂w2 1 ∂p μ ⎛ ∂2 w ∂2w ∂2 w⎞

+ + + =− + ⎜⎜ 2 + 2 + 2 ⎟⎟ + gz
∂t ∂x ∂y ∂z ρ ∂z ρ ⎝ ∂x ∂y ∂z ⎠

## 3/8/2007 Indo-German Winter Academy 33

Discretizing Fluid Flow equations using
Upwind Scheme
 Upwind Scheme of discretization is necessary for convection
dominated flows ∂ζ ∂ζ
= −u
∂t ∂x
Backward Differencing Scheme for u>0

ζ in +1 − ζ in uζ n i − uζ n i −1
=−
Δt Δx

## Forward Differencing Scheme for u<0

ζ in +1 − ζ in uζ n i +1 − uζ n i
=−
Δt Δx

## 3/8/2007 Indo-German Winter Academy 34

Why use Upwind scheme
 Upwind Scheme of discretization is necessary for convection
dominated flows for obtaining numerically stable results

## Central Difference Scheme applied to highly convective flows

give unconditionally Unstable Results

Violates
ζ in +1 − ζ in uζ n i +1 − uζ n i −1
CDS: + =0 Von Neumann
Δtn 2Δxn Stability
ζ i − ζ i uζ i +1 − uζ i
n +1 n
FDS: + = 0, u > 0 Criteria
Δt Δx

## 3/8/2007 Indo-German Winter Academy 35

Why use Upwind scheme

ζ n +1
−ζ uζ − uζ
n n n
ζ − 2ζ + ζ
n n n

i +1 i −1
i
+
i i +1 i i −1

Δt 2Δx Δx 2

CDS:
∂ζ ⎛ ⎛ u Δt ⎞ ⎞
2

+ uζ = ⎜ν − ⎜ ⎟ ⎟ζ
∂t ⎝ 2 ⎠⎠
x xx

⎛ ⎛ u Δt ⎞ ⎞
2

⎜ν − ⎜ ⎟⎟ ≥ 0
⎝ ⎝ 2 ⎠⎠

⎛ 1 u Δt ⎞ uΔx ⎞
ν ⎜1 − ⎛⎜ ⎟ ⎟≥0 ⎛ uΔx ⎞
⎝ 2 ⎝ Δx ⎠ ν ⎠ Re = ⎜ ⎟
⎝ ν ⎠
Δx

ν ⎛⎜1 − C * Re ⎞⎟ ≥ 0
1
⎝ 2 ⎠ CELL Reynold’s No.

2
Re ≤
C
Upwind Scheme and Transportive Property
∂ζ ∂
= − (u ζ )
∂t ∂x
ζ in+1 − ζ in uζ n i − uζ n i −1
using upwind scheme (u > 0) ⇒ =−
Δt Δx
let a perturbati on δ in ζ occurs at m th location
• Then for at a downstream location (m + 1)
ζ mn ++11 − ζ mn +1
0 − uδ uδ
=−
=+ At (m+1) location
Δt Δx Δx
which follows the rationale for the transport ive proprerty
• At (m) location
ζ mn +1 − ζ mnuδ − 0 uδ At (m) location
=−
=−
Δt Δx Δx
perturbati on being transport ed out of the region
• At (m - 1) location
ζ mn +−11 − ζ mn −1
0−0 At (m-1) location
=−
=0
Δt Δx
no perturbation carried upstream

## 3/8/2007 Indo-German Winter Academy 37

Problems of Using Forward Time Central Space method (FTCS)

At (m - 1) location
ζ mn −+11 − ζ mn −1 uδ − 0 uδ
=− =− ≠0
Δt 2Δx 2Δx

of information.

## 3/8/2007 Indo-German Winter Academy 38

Upwind Method and Artificial Viscosity(1/2)
∂u ∂ζ ⎛ ∂ 2ζ ⎞
+u = ν ⎜⎜ 2 ⎟⎟
∂t ∂x ⎝ ∂x ⎠

ζ in +1 − ζ in uζ n i − uζ n i −1
=−
Δt Δx
ζ in +1 − ζ in uζ n i +1 − uζ n i
=−
Δt Δx

## 3/8/2007 Indo-German Winter Academy 39

Upwind Method and Artificial Viscosity (2/2)

<1

## 3/8/2007 Indo-German Winter Academy 40

Upwind Differencing Method

equations

##  Although space centered differences (CDS) are more accurate than

upwind scheme (as indicated by Taylor Series expansion), the whole
system is more realistically modeled using Upwind Differencing Scheme.

inaccuracy. v >0
e

## 3/8/2007 Indo-German Winter Academy 41

Second Upwind Differencing Scheme
Let us consider

where

## 3/8/2007 Indo-German Winter Academy 42

Considering momentum equation ζ ≡u

## Here a factor η is introduced which expresses a

weighted average of central and upwind differencing

## 3/8/2007 Indo-German Winter Academy 43

Here 0<η<1
For η=0, above equation becomes centered in space
For η=1, above equation follows full upwind
Hence, η brings about an upwind bias in the difference quotient
Accuracy of the differencing scheme can be adjusted using η value

## Second upwind formulation possesses both

the conservative and transportive property

## 3/8/2007 Indo-German Winter Academy 44

Summary
 Finite Difference methods discretizes the differential form of governing
equation using Taylor Series expansion.
 The partial derivatives of governing PDE are replaced with finite,
algebraic differences quotients at the corresponding nodes.
 Leads to linear algebraic equation system, with one algebraic equation
per grid node.
 Best Suited for Structured Grids only.
 Flow equation properties can be maintained using simple schemes
like upwind differencing.

## Discretization methods provide more cost effective and more rapid

approach for solving Fluid Flow problems as compared to
experimental methods

## 3/8/2007 Indo-German Winter Academy 45

Summary
Finite Difference Approach
FD Approaches Can Be Divided Into Various
Categories Depending Upon Type of PDE Being
Solved:
1.Elliptic PDE: Algebraic System, Gauss Siedel
2.One-dimensional Parabolic PDE
A) Explicit
B) Implicit
3. Two-dimensional Parabolic PDE
Acknowledgement
 This lecture has been inspired by the
study material provided by Prof. G.Biswas

## 3/8/2007 Indo-German Winter Academy 47

References
 Chapra and Canale, “Numerical Methods for
Engineers”,4th Ed., Tata McGraw-Hill.

##  Som and Biswas, “Introduction to Fluid Mechanics and

Fluid Machines”, Tata McGraw-Hill

Thank you !