Finite Difference Method

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

1

Discretization
What?
Analytical Solution : Continuous
Numerical Solution : Discrete
Types of Discretization Technique
FDM (Finite Difference Method): Most popular
during the early days of CFD
FVM (Finite Volume Method): Gives greater
flexibility in handling complex geometry
FEM (Finite Element Method): More commonly
used in Solid Mechanics rather than Fluid
Mechanics
2
FDM: Discrete Grid Points
(i,j)
P
P
(i,j) (i+1,j) (i-1,j)
(i,j+1) (i+1,j+1) (i-1,j+1)
(i,j-1) (i+1,j-1) (i-1,j-1)
i
j
3
FDM: Finite Difference Quotient
Taylor Series Expansion
Example :
2 2
2
2 1
3
4
( ) sin 2
0.2, 0.02 ( ) 0.9511
( ) ( )
( ) ( )
2
0.9823 3.176%
0.9899 %
0.9824 %
f x x
x x f x x
f x f x x
f x x f x x
x x
f f
f
f
=
= = + =

+ = + + +

= =
=
=

( Error)
(0.775 Error)
(0.01 Error)

I Guess Add to
Capture Slope
Add to account
for Curvature
1 2
3
4
x
f(x)
4
FDM: Finite Difference Quotient
Taylor Series Expansion
I Order Forward Difference
2 2 3 3
1 , ,
2 3
,
, ,
2 2 3 3
1 , ,
2 3
,
, ,
2 3
1 , ,
2 3
,
,
2 3
2 3
2
i j i j
i j
i j i j
i j i j
i j
i j i j
i j i j
i j
i j
x x
x
x x x
x x
x
x x x
x
x x x x






+

+
| | | |
| |
= + + + +
| | |

\ .
\ . \ .
| | | |
| |
= + +
| | |

\ .
\ . \ .

| | |
| |
= +
`
| |

\ .
) \ . \

( )
2
,
1 , ,
,
3
i j
i j i j
i j
x
x
x x

+
(
|
+ (
|
( .


| |
= +
`
|

\ .
)
O

Finite Difference Quotient


T.E (Truncation Error)
I Order Accurate
(i+1,j)
(i,j)
(+)
(-)
x
5
FDM: Finite Difference Quotient
I Order Backward Difference
II Order Central Difference
( )
2 3 2
, 1,
2 3
,
, ,
, 1,
,
3 2 5 4
1, 1,
3 5
,
, ,
2 3
2 3 5
i j i j
i j
i j i j
i j i j
i j
i j i j
i j
i j i j
x x
x x x x
x
x x
x x
x x x x


+
(

| | | |
| |
= + + (
`
| | |

\ .
( ) \ . \ .


| |
= +
`
|

\ .
)

| | | |
| |
= +
`
| | |

\ .
) \ . \ .

( )
1, 1,
2
,
2
i j i j
i j
x
x x

+
(
(
(


| |
= +
`
|

\ .
)
O II Order Accurate
(i-1,j)
(i,j)
(+)
(-)
x
(i-1,j)
(+)
(-)
x
x
(i+1,j)
6
FDM: Finite Difference Quotient
II Order Central Second Difference
IV Order Second Difference
( )
2 4 2 6 4
1, , 1,
2 2 4 6
, , ,
2
1, , 1,
2
2 2
,
2
2, 1, , 1, 1,
2
,
2
2
4 6
2
16 30 16
1
i j i j i j
i j i j i j
i j i j i j
i j
i j i j i j i j i j
i j
x x
x x x x
x
x x
x


+
+
+ +
(
+
| | | | | |

= + +
(
`
| | |

( ) \ . \ . \ .

+
| |

= +
`
|

) \ .
+ +
| |

=
|

\ .
O

( )
( )
4
2
2
x
x


+
`


)
O
II Order Accurate
(+)
(+)
x
x (-2)
(i-1,j) (i,j) (i+1,j)
7
FDM: Finite Difference Quotient
Higher Order Accurate Difference
Quotients
Disadvantage : By requiring more
neighboring grid points, results in more
computational time for each grid point
computation
Advantage : Smaller number of total grid
points in a flow solution to obtain
comparable overall accuracy
II Order accuracy has been accepted in
the vast majority of CFD applications
8
FDM: Finite Difference Equation
and Solution Methodology
1-D Steady State Conduction
G.E:
B,Cs:
F.D.Eq. :
Tridiagonal Matrix:
Solver
Jacobi
Gauss-Seidel
2
2
1 2
1 1 1 1
2
2 1
3
4
5
6 2
0
At 0, ; ,
2
0
2
2 1 0 0 0
0 1 2 1 0 0
0 0 1 2 1 0
0 0 0 1 2 1
0 0 0 1 2
b b
i i i i i
i
b
b
T
x
x T T x L T T
T T T T T
T
x
T T
T
T
T
T T
+ +

= = = =
+ +
= =

( ( (
( ( (

( ( (
( ( ( =
( ( (

( ( (
( ( (


L
T
b1 T
b2
i=1 2 3 4 5 6 7
9
FDM: Finite Difference Equation
and Solution Methodology
1-D Unsteady State Conduction
G.E:
I.C & B.Cs:
F.D.Eq. :
Reliability of num. results (within T.E.) Vs analytical
results
If the difference equation is consistent
If the numerical algorithm is stable
If the B.Cs are handled properly
{ }
2
2
0
1
2
1 1
2

At t 0;
2
T.E=O( t, x )
As t 0 & x 0 T.E 0 F.D.Eq. is Consistent


n n n n n
i i i i i
T T
t x
T T
T T T T T
t x

+
+

=

= =
+
=


T
b1 T
b2
i=1 2 3 4 5 6 7
T
b1 T
b2
T
b1 T
b2
n+1
n
n-1
10
FDM: Finite Difference Equation
and Solution Methodology
1-D Steady State Convection-Diffusion
( )
( )
2
2
0
/
0 0
1 1
B. C : at 0, at
1
E x act S o lu t i o n :
1
W h ere /
Alg eb rai c E q u at i o n : 0
L
xP e L
L
P e
i i i
E i P i W i
u
x x
x x L
e
e
P e u L
A A A




=

= = = =

= +

=
+ + =
F i n i te D i f f eren ce Q u o ti en t
2
1 1
2 2
2
2
:
/ ; ( )
i i i
i
d i d i d i d i d i
E W P E W
x x
A x A A A A

+
| |
+

|

\ .
= = = +
:
D i f f u s i o n
x
L
0

Pe=0
Pe>0
Pe<0
11
FDM: Finite Difference Equation
and Solution Methodology
1-D Steady State Convection-Diffusion
( )
( )
1
1
1 1
, 0
, 0
min( , 0) / ; max( , 0) / ; ( )
2
/ 2
i i
i i
i
ci ci ci ci ci
E W P E W
i i
i
ci ci
E W
u u
u
x
x
u u
x
A u x A u x A A A
u
u
x x
A u x A

+
+


>




<


= = = +
(


(


= =
if
Convection: UDS
if
CDS
0
; ( ) 0
1.0, 1.0, 1.0, 0.02,
0 1.0; 11 11 51 51
ci ci ci
P E W
L
A A A
L u

= + =
= = = =
= = =
Example Prob. :
and Gridsize and
12
FDM: Finite Difference Equation
and Solution Methodology
1-D Unsteady State Convection-Diffusion
( )
2
2
1
1 1 1 1
2
1
1 1 1 1
2
2
2
2
2
min( , 0) / ; max( , 0) / ; (
n n n n n n n
i i i i i i i
n n ci n ci n ci n n n n
i i E i P i W i i i i
ci ci ci ci
E W P E W
u
t x x
u
t x x
A A A
u
t x x
A u x A u x A A A



+
+ +
+
+ +


+ =

+
+ =

+ + +
+ =

= = = +
F.D.Eq.:
CDS
UDS
)
ci

You might also like