[go: up one dir, main page]

0% found this document useful (0 votes)
64 views14 pages

MECH3780 Fluid Mechanics 2 and CFD

The document discusses finite difference methods for computational fluid dynamics (CFD). There are three main paradigms for CFD - finite difference method (FDM), finite volume method (FVM), and finite element method (FEM). FDM uses differential forms of conservation laws and is easily applied to uniform grids but requires transformations for non-uniform grids. FVM uses integral forms and is intuitive for any grid type. The document then provides examples of finite difference approximations for first and second order spatial derivatives, which are used in FDM discretizations of partial differential equations in CFD.

Uploaded by

ninibear
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views14 pages

MECH3780 Fluid Mechanics 2 and CFD

The document discusses finite difference methods for computational fluid dynamics (CFD). There are three main paradigms for CFD - finite difference method (FDM), finite volume method (FVM), and finite element method (FEM). FDM uses differential forms of conservation laws and is easily applied to uniform grids but requires transformations for non-uniform grids. FVM uses integral forms and is intuitive for any grid type. The document then provides examples of finite difference approximations for first and second order spatial derivatives, which are used in FDM discretizations of partial differential equations in CFD.

Uploaded by

ninibear
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

MECH3780

Fluid Mechanics 2 and CFD

Computation Fluid
Dynamics (CFD)
Lecture 4 - Finite Difference
Reference: CFD Lecture Notes by Assoc Prof Dr Kamarul Arifin Ahmad
Objectives

• To introduce the finite difference in CFD


• To give overview about the finite difference
method in CFD
Three Paradigms
 Finite Difference Method (FDM)
 Related to the differential form of the conservation laws
 Easily implemented on uniform, Cartesian meshes
 Requires transformations when implemented on conformal meshes
 Finite Volume Method (FVM)
 Related to the integral form of the conservation laws
 Most intuitive method
 Easily applied on conformal meshes
 Finite Element Method (FEM)
 Mathematically rigorous method
 Implementation more difficult
Three Paradigms
 Finite Difference Method (FDM)
 Related to the differential form of the conservation laws
 Easily implemented on uniform, Cartesian meshes
 Requires transformations when implemented on conformal meshes
 Finite Volume Method (FVM)
 Related to the integral form of the conservation laws
 Most intuitive method
 Easily applied on conformal meshes
 Finite Element Method (FEM)
 Mathematically rigorous method
 Implementation more difficult
Three Paradigms
 Finite Difference Method (FDM)
 Related to the differential form of the conservation laws
 Easily implemented on uniform, Cartesian meshes
 Requires transformations when implemented on conformal meshes
 Finite Volume Method (FVM)
 Related to the integral form of the conservation laws
 Most intuitive method
 Easily applied on conformal meshes
 Finite Element Method (FEM)
 Mathematically rigorous method
 Implementation more difficult
Finite Difference Approximations
for First Order Derivatives

u du ui − ui −1
Backward diff. ≈
dx ∆x

du ui +1 − ui
Forward diff. ≈
dx ∆x

du ui +1 − ui −1
i−1 i i+1 x Central diff. ≈
dx 2∆x

du ∆u
= Lim
dx ∆x → 0 ∆x
Finite Difference Approximations
for First Order Derivatives

Consider a Taylor’s series expansion for xi+1

du ∆x 2 d 2u ∆x 3 d 3u ∆x n d n u
u i +1 = u i + ∆x + 2
+ 3
++ n
+
dx i 2! dx i 3! dx i n! dx i


du u i +1 − u i ∆x d 2u ∆x 2 d 3u
= − − −
dx i ∆x 2
2! dx i 3! dx i3

du u − ui
⇒ = i +1 + err (∆x )
dx i ∆x
Finite Difference Approximations
for First Order Derivatives

If we say that du u − ui
≈ i +1
dx i ∆x

there will be a truncation error in the approximation, where:

∆x d 2u ∆x 2 d 3u
err (∆x ) = − 2
− 3
−
2! dx i 3! dx i

The truncation error is said to be order ∆x, written O(∆x), because


the leading term in the error function ∝ ∆x.
Hence we may write,
du u i +1 − u i
= + O (∆x )
dx i ∆x
This is known as a first order forward difference.
Finite Difference Approximations
for First Order Derivatives

First order approximation of the temporal derivative

u in +1 − u in
n
du
= + O (∆t )
dx i ∆t

n+1

n
i−1 i i+1
Finite Difference Approximations
for First Order Derivatives

A backward difference can be obtained by expanding for xi−1

u i −1 = u i − ∆x
du
+
∆x 2 d 2u

∆x 3 d 3u
++
(− ∆x ) d n u
n
+
dx i 2! dx 2 i 3! dx 3 i n! dx n i


du u i − u i −1 ∆x d 2u ∆x 2 d 3u
= + − −
dx i ∆x 2
2! dx i 3! dx i3

du u − u i −1
⇒ = i + O (∆x )
dx i ∆x
Finite Difference Approximations
for First Order Derivatives
A central difference approximation may be obtained by a
(weighted) average of the forward and backward differences:

Backward
du u − u ∆x d 2
u ∆x 2
d 3
u
= i i −1
+ − −
dx i ∆x 2! dx i2
3! dx i 3

Forward du u i +1 − u i ∆x d 2u ∆x 2 d 3u
= − − −
dx i ∆x 2
2! dx i 3! dx i3

Central du u i +1 − u i −1 ∆x 2 d 3u ∆x 4 d 5u
= − − −
dx i 2∆x 3! dx i3
5! dx i5

u − u i −1
+ O (∆x 2 )
du
⇒ = i +1
dx i 2∆x
Finite Difference Approximations
for Second Order Derivatives
An approximation to d 2u dx 2 may be obtained from a
(weighted) difference between the forward and backward Taylor’s
series:
du ∆x 2 d 2u ∆x 3 d 3u ∆x n d n u
Eqn.1 u i +1 = u i + ∆x + 2
+ 3
++ n
+
dx i 2! dx i 3! dx i n! dx i

Eqn.2 u i −1 = u i − ∆x
du
+
∆x 2 d 2u

∆x 3 d 3u
++
(− ∆x ) d n u
n
+
2 3 n
dx i 2! dx i 3! dx i n! dx i

Eqn.1 + Eqn.2
d 2u ∆x 2n d 2n u
u i + 1 + u i −1 = 2u i + ∆x
2
++ +
2
dx i (2n )! 2n
dx i

d 2u u i +1 − 2u i + u i −1 2∆x 2 d 4u 2∆x 2(n −1) d 2n u


⇒ = − −− −
2
dx i ∆x 2
4! dx i 4
(2n )! dx i 2n
Finite Difference Approximations
for Second Order Derivatives

d 2u u i +1 − 2u i + u i −1 2∆x 2 d 4u 2∆x 2(n −1) d 2n u


= − −− −
2
dx i ∆x 2
4! dx i 4
(2n )! dx i 2n

u i +1 − 2u i + u i −1
+ O (∆x 2 )
d 2u
⇒ =
2
dx i ∆x 2

You might also like