0% found this document useful (0 votes)
65 views5 pages

Finite Difference Solution - 1 Finite Difference Solution - 2

1. The document discusses numerical solutions of partial differential equations using finite difference methods. 2. Finite difference methods involve discretizing the governing PDEs on a grid and approximating derivatives with finite differences to obtain a system of algebraic equations. 3. The document presents the finite difference discretization of a sample diffusion equation and describes solution techniques like the Forward Time Central Space (FTCS) explicit method and Backward Time Central Space (BTCS) implicit method.

Uploaded by

arun_gerrad
Copyright
© Attribution Non-Commercial (BY-NC)
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)
65 views5 pages

Finite Difference Solution - 1 Finite Difference Solution - 2

1. The document discusses numerical solutions of partial differential equations using finite difference methods. 2. Finite difference methods involve discretizing the governing PDEs on a grid and approximating derivatives with finite differences to obtain a system of algebraic equations. 3. The document presents the finite difference discretization of a sample diffusion equation and describes solution techniques like the Forward Time Central Space (FTCS) explicit method and Backward Time Central Space (BTCS) implicit method.

Uploaded by

arun_gerrad
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 5

6/6/2012

1
Finite Difference Solution - 1
Bhalchandra Puranik, MED, IIT Bombay
Numerical Solution Methodology
Governing Equations
Algebraic Equations
Numerical Solution (on discrete points)
Analysis of Solution
Discretization on a grid/mesh
Solution Algorithm
Post-processing of the solution data
E-Outreach Workshop on CFD
Finite Difference Solution - 2
Bhalchandra Puranik, MED, IIT Bombay
Consider a governing differential equation:
constant s
y
u
t
u
+
c
c
=
c
c
2
2

with BCs:
U t h u t u = = ) , ( , 0 ) , 0 (
and IC:
0 ) 0 , ( = y u
Transient flow between infinite parallel plates
Time marching problem
E-Outreach Workshop on CFD
s
y
u
t
u
+
c
c
=
c
c
2
2
Diffusion Equation
Finite Difference Solution - 3
Bhalchandra Puranik, MED, IIT Bombay
1, 2, 3, ., N: Nodes/Grid points (points where the
numerical solution will be obtained).
1, N: Boundary nodes.
: Grid spacing (uniform in the present case).
Grid:
1 2 3
N
y
y=0 y=h
y A y A
y A
E-Outreach Workshop on CFD
Finite Difference Solution - 4
Bhalchandra Puranik, MED, IIT Bombay
The Finite Difference Approach:
Taylor series expansions:
N
y=0 y=h
y A y A
i 1 + i 1 i
( )
( )
( )
( )
) (
! 2
) (
! 2
2
2
2
1
2
2
2
1
II
y
y
u
y
y
u
u u
I
y
y
u
y
y
u
u u
i i
i i
i i
i i
+
A
|
|
.
|

\
|
c
c
+ A
|
|
.
|

\
|
c
c
=
+
A
|
|
.
|

\
|
c
c
+ A
|
|
.
|

\
|
c
c
+ =

+
E-Outreach Workshop on CFD
6/6/2012
2
Finite Difference Solution - 5
Bhalchandra Puranik, MED, IIT Bombay
Adding (I) and (II):
( )
( )
. .
2
2
2
1 1
2
2
2
2
2
1 1
E T
y
u u u
y
u
y
y
u
u u u
i i i
i
i
i i i
+
A
+
=
|
|
.
|

\
|
c
c

A
|
|
.
|

\
|
c
c
+ = +
+
+
Next,
( )
( ) ( ) t
u u
t
u u
t
u
t
t
u
u u
n
i
n
i
t
i
t t
i
i
i
t
i
t t
i
A

=
A

= |
.
|

\
|
c
c

+ A |
.
|

\
|
c
c
+ =
+ A +
A +
1
( )
( ) ( ) t
u u
t
u u
t
u
t
t
u
u u
n
i
n
i
t t
i
t
i
i
i
t
i
t t
i
A

=
A

= |
.
|

\
|
c
c

+ A |
.
|

\
|
c
c
=
A
A
1
OR
E-Outreach Workshop on CFD
Truncation error
Finite Difference Solution - 6
Bhalchandra Puranik, MED, IIT Bombay
( )
2
1 1
2
2
2
y
u u u
y
u
i i i
i
A
+
=
|
|
.
|

\
|
c
c
+
( ) ( ) t
u u
t
u u
t
u
n
i
n
i
t
i
t t
i
i
A

=
A

= |
.
|

\
|
c
c
+ A + 1
( ) ( ) t
u u
t
u u
t
u
n
i
n
i
t t
i
t
i
i
A

=
A

= |
.
|

\
|
c
c
A 1
A central difference
A forward difference
A backward difference
s
y
u
t
u
+
c
c
=
c
c
2
2

Finite Difference Equation:


for each interior
node i
( ) ( )
s
y
u u u
t
u u
n
i
n
i
n
i
n
i
n
i
+
|
|
.
|

\
|
A
+
=
A

+
+
2
1 1
1
2

( ) ( )
s
y
u u u
t
u u
n
i
n
i
n
i
n
i
n
i
+
|
|
.
|

\
|
A
+
=
A

2
1 1
1
2

E-Outreach Workshop on CFD


Finite Difference Solution - 7
Bhalchandra Puranik, MED, IIT Bombay
( ) ( )
s
y
u u u
t
u u
n
i
n
i
n
i
n
i
n
i
+
|
|
.
|

\
|
A
+
=
A

+
+
2
1 1
1
2

Forward Time Central Space (FTCS) form (Explicit Method)


( )
( )
( ) ( ) t s u u u
y
t
u u
n
i
n
i
n
i
n
i
n
i
A + +
A
A
+ =
+
+
1 1 2
1
2
for each interior node i,
one by one
1 + i 1 i i
n
1 + n
The entire RHS is known
BCs: U u u
n
N
n
= =
+ + 1 1
1
, 0
Explicit method
is stable only if
( )
( ) 2
1
2
<
A
A
y
t
E-Outreach Workshop on CFD
Finite Difference Solution - 8
Bhalchandra Puranik, MED, IIT Bombay
( ) ( )
( ) ( )
s
y
u u u
t
u u
s
y
u u u
t
u u
n
i
n
i
n
i
n
i
n
i
n
i
n
i
n
i
n
i
n
i
+
|
|
.
|

\
|
A
+
=
A


+
|
|
.
|

\
|
A
+
=
A

+ +
+
+
+

2
1
1
1 1
1
1
2
1 1
1
2
2

Backward Time Central Space (BTCS) form (Implicit Method)


( )
( )
( ) ( ) t s u u u
y
t
u u
n
i
n
i
n
i
n
i
n
i
A + +
A
A
+ =
+

+ +
+
+ 1
1
1 1
1 2
1
2
1 + i 1 i i
n
1 + n
E-Outreach Workshop on CFD
6/6/2012
3
Finite Difference Solution - 9
Bhalchandra Puranik, MED, IIT Bombay
Backward Time Central Space (BTCS) form (Implicit Method)
( )
( )
( ) ( )
( ) ( ) ( )
( )
n
i
n
i
n
i
n
i
n
i
n
i
n
i
n
i
n
i
n
i
n
i
n
i
n
i
c au bu au
t s u u
y
t
u
y
t
u
y
t
t s u u u
y
t
u u
= + +

A + =
(

A
A

A
A
+ +
(

A
A

A + +
A
A
+ =
+
+
+ +

+
+
+ +

+ +
+
+
1
1
1 1
1
1
1 2
1
2
1
1 2
1
1
1 1
1 2
1
2
1
2

known
System of linear algebraic equations for the unknown interior grid point
values (i = 2 to N-1) of u at the n+1 time level
E-Outreach Workshop on CFD
Finite Difference Solution - 10
Bhalchandra Puranik, MED, IIT Bombay
| || | | |
(
(
(
(
(
(
(
(

=
(
(
(
(
(
(
(
(

(
(
(
(
(
(
(
(

= + +

+
+
+
+ +

U
c
c
c
u
u
u
u
u
a b a
a b a
a b a
c u A
c au bu au
N
N
N
n n
n
i
n
i
n
i
n
i
1
3
2
1
3
2
1
1
1
1
1 1
1
0
1 0 0 0 0 0
0
0 0
0 0
0
0 0 0 0 0 1
0
0
Coefficient matrix A is tri-
diagonal.
U u u
n
N
n
= =
+ + 1 1
1
, 0 BCs:
N i u
i
,....., 2 , 1 , 0 = =
IC: Initialize with
Dropping
superscripts
E-Outreach Workshop on CFD
Finite Difference Solution - 11
Bhalchandra Puranik, MED, IIT Bombay
Solve using the Tri-Diagonal Matrix Algorithm (TDMA)/Thomas
Algorithm (Gauss Elimination for a tri-diagonal system).
(I) Forward elimination (leads to an upper bi-diagonal matrix):
1 ,......, 2 for
1 ,....., 2 for
1
1 , 1
1 ,
, 1
1 , 1
1 ,
, ,
=
=

N i c
A
A
c c
N i A
A
A
A A
i
i i
i i
i i
i i
i i
i i
i i i i
(II) Back substitution:
2 , 3 ..... 2 , 1 for
,
1 1 ,
=

+ +
N N i
A
u A c
u
i i
i i i i
i
Implicit method is unconditionally stable (no restriction on time step).
E-Outreach Workshop on CFD
Finite Difference Solution - 12
Bhalchandra Puranik, MED, IIT Bombay E-Outreach Workshop on CFD
Solution of energy equation: 2-D steady-state conduction.
Example:
0
2
2
2
2
=
c
c
+
c
c
y
T
x
T
Laplace Equation
x
y
0 = T
0 = T 0 = T
1
T T =
) 0 , 0 ( a x =
b y =
Boundary Value Problem
(BVP)
6/6/2012
4
Finite Difference Solution - 13
Bhalchandra Puranik, MED, IIT Bombay E-Outreach Workshop on CFD
x
y
0 = T
0 = T
0 = T
1
T T =
) 1 , 1 (
a x =
b y =
) 1 , (M
) , 1 ( N
) , ( N M
) , ( j i
Finite Difference Solution - 14
Bhalchandra Puranik, MED, IIT Bombay E-Outreach Workshop on CFD
) , ( j i ) , 1 ( j i + ) , 1 ( j i
) 1 , ( + j i
) 1 , ( j i
( )
2
1 , , 1 ,
,
2
2
2
y
T T T
y
T j i j i j i
j i
A
+
=
|
|
.
|

\
|
c
c +
x A x A
y A
y A
( )
2
, 1 , , 1
,
2
2
2
x
T T T
x
T j i j i j i
j i
A
+
=
|
|
.
|

\
|
c
c +
Finite Difference Solution - 15
Bhalchandra Puranik, MED, IIT Bombay E-Outreach Workshop on CFD
( )
( ) | |
1 , 1 ,
2
, 1 , 1 2 ,
1 2
1
+ +
+ + +
+
=
j i j i j i j i j i
T T T T T

0
2
2
2
2
=
c
c
+
c
c
y
T
x
T
The system of linear algebraic equations, represented by
Eq. (I) (one equation for each grid point (i,j)), has a penta-
diagonal coefficient matrix.
Most common solution technique: iterative methods.
Start from an initial guess for the dependent variable and update
the guess using Eq. (I).
The solution is updated as the BC information is transmitted inside
the domain.
Let k and k+1 denote successive iteration levels.
(I)
y
x
A
A
=
Jacobi iteration algorithm:
Point-by-point Gauss-Seidel iteration algorithm:
Finite Difference Solution - 16
Bhalchandra Puranik, MED, IIT Bombay E-Outreach Workshop on CFD
( )
( ) | |
k
j i
k
j i
k
j i
k
j i
k
j i
T T T T T
1 , 1 ,
2
, 1 , 1 2
1
,
1 2
1
+ +
+
+ + +
+
=

( )
( ) | |
1
1 , 1 ,
2 1
, 1 , 1 2
1
,
1 2
1
+
+
+
+
+
+ + +
+
=
k
j i
k
j i
k
j i
k
j i
k
j i
T T T T T

) , ( j i ) , 1 ( j i
) 1 , ( j i
6/6/2012
5
The idea of relaxation in iterative solution process.
Consider:
Express the above as:
In words:
Finite Difference Solution - 17
Bhalchandra Puranik, MED, IIT Bombay E-Outreach Workshop on CFD
( )
k
j i
k
j i
k
j i
k
j i
T T T T
,
1
, ,
1
,
+ =
+ +
Change in the solution through the k
th
iteration
( ) ) (
,
1
, ,
1
,
I T T T T
k
j i
k
j i
k
j i
k
j i
+ =
+ +

Solution after the (k+1)


st
iteration = Solution after the k
th
iteration +
(Change in the solution during the (k+1)
st
iteration).
Using the basic iteration step
Express relation (I) as:
Rearrange in the final form:
Finite Difference Solution - 18
Bhalchandra Puranik, MED, IIT Bombay E-Outreach Workshop on CFD
( )
( ) | |
k
j i
k
j i
k
j i
k
j i
k
j i
T T T T T
1 , 1 ,
2
, 1 , 1 2
1
,
1 2
1
+ +
+
+ + +
+
=

( )
( ) | |
)
`

+ + +
+
+ =
+ +
+ k
j i
k
j i
k
j i
k
j i
k
j i
k
j i
k
j i
T T T T T T T
, 1 , 1 ,
2
, 1 , 1 2 ,
1
,
1 2
1

( )
( )
( ) | |
k
j i
k
j i
k
j i
k
j i
k
j i
k
j i
T T T T T T
1 , 1 ,
2
, 1 , 1 2 ,
1
,
1 2
1
+ +
+
+ + +
+
+ =

Relaxation form for the Jacobi iteration algorithm


Point-by-point Successive Relaxation iteration algorithm
(Note that the basic iteration algorithm here is the point-
by-point Gauss-Seidel more common in use):
The parameter : Relaxation parameter.
0 < < 1: Under-relaxation. Slows down the convergence of
iterations.
= 1: Point-by-point Gauss-Seidel algorithm.
> 1: Over-relaxation. Speeds up the convergence of iterations.
Usually 1 < < 2 for convergence.
Finite Difference Solution - 19
Bhalchandra Puranik, MED, IIT Bombay E-Outreach Workshop on CFD
( )
( )
( ) | |
1
1 , 1 ,
2 1
, 1 , 1 2 ,
1
,
1 2
1
+
+
+
+
+
+ + +
+
+ =
k
j i
k
j i
k
j i
k
j i
k
j i
k
j i
T T T T T T

Convergence criterion for iterations (for all algorithms):


Finite Difference Solution - 20
Bhalchandra Puranik, MED, IIT Bombay E-Outreach Workshop on CFD
<
|
|
.
|

\
|

+ k
j i
k
j i
T T
,
1
,
max

You might also like