Numerical Methods For Parabolic Equations-I
Numerical Methods For Parabolic Equations-I
, 0 ;
2
2
Boundary Condition
(Neumann)
or
and
Computational Fluid Dynamics I
Parabolic equations can be viewed as the limit of a
hyperbolic equation with two characteristics as the
signal speed goes to innity
Increasing
signal speed
x
t
Computational Fluid Dynamics I
2
f
x
2
j
n
=
f
j +1
n
2 f
j
n
+ f
j1
n
h
2
f
t
j
n
=
f
j
n+1
f
j
n
t
f
t
j
n
=
2
f
x
2
j
n
j-1 j j+1
n
n+1
Approximate the derivatives:
Computational Fluid Dynamics I
2
1 1
1
2
h
f f f
t
f f
n
j
n
j
n
j
n
j
n
j +
+
+
=
Explicit: FTCS
( )
n
j
n
j
n
j
n
j
n
j
f f f
h
t
f f
1 1 2
1
2
+
+
+
+ =
j-1 j j+1
n
n+1
Explicit Method: FTCS - 1
Computational Fluid Dynamics I
Modied Equation
xxxxxx xxxx
f h t h t O f r
h
x
f
t
f
) , , ( ) 6 1 (
12
4 2 2
2
2
2
+ =
2
h
t
r
=
where
- Accuracy ) , (
2
h t O
- If then ) , (
2 2
h t O , 6 / 1 = r
- No odd derivatives; dissipative
Explicit Method: FTCS - 2
Computational Fluid Dynamics I
Stability: von Neumann Analysis
1 4 1 1
2
<
<
h
t
2
1
0
2
<
h
t
Fourier Condition
n+1
n
=1 4
Dt
h
2
sin
2
k
h
2
G =1 4rsin
2
( /2)
[ ]
Explicit Method: FTCS - 3
Computational Fluid Dynamics I
Domain of Dependence for Explicit Scheme
BC
BC
x
t
Initial Data
h
P
t
Boundary effect is not
felt at P for many time
steps
This may result in
unphysical solution
behavior
Explicit Method: FTCS - 4
Computational Fluid Dynamics I
2
1
1
1 1
1
1
2
h
f f f
t
f f
n
j
n
j
n
j
n
j
n
j
+
+ +
+
+
+
=
Implicit Method - 2
Amplication Factor (von Neumann analysis)
[ ]
1
) cos 1 ( 2 1
+ = r G
Unconditionally stable
Computational Fluid Dynamics I
+
+
+
=
+
+
+ +
+
+
2
1 1
2
1
1
1 1
1
1
2 2
2 h
f f f
h
f f f
t
f f
n
j
n
j
n
j
n
j
n
j
n
j
n
j
n
j
Crank-Nicolson Method (1947)
j-1 j j+1
n
n+1
Tri-diagonal matrix system
( ) ( )
n
j
n
j
n
j
n
j
n
j
n
j
rf f r rf rf f r rf
1 1
1
1
1 1
1
1 2 1 2
+
+
+ +
+
+ = + +
Crank-Nicolson - 1
Computational Fluid Dynamics I
- Second-order accuracy
Modied Equation
xxxxxx xxxx
f h t f
h
x
f
t
f
+ + =
4 2 3
2
2
2
360
1
12
1
12
Crank-Nicolson - 2
Amplication Factor (von Neumann analysis)
( )
( )
cos 1 1
cos 1 1
+
=
r
r
G
Unconditionally stable
) , (
2 2
h t O
Computational Fluid Dynamics I
+
+
+
=
+
+
+ +
+
+
2
1 1
2
1
1
1 1
1
1
2
) 1 (
2
h
f f f
h
f f f
t
f f
n
j
n
j
n
j
n
j
n
j
n
j
n
j
n
j
Generalization
j-1 j j+1
n
n+1
=
Nicolson Crank 1/2
Implicit 1
(FTCS) Explicit 0
( ) 1
Combined Method A - 1
Computational Fluid Dynamics I
Special Cases
) , (
12
1
2
1
4 2
h t O
r
=
r 12
1
2
1
= ) , ( 20 / 1
6 2
h t O r =
Modied Equation
xxxx xx t
f
h
t f f
|
|
|
|
|
|
+ j
)
|
\
[
=
12 2
1
2
2
xxxxxx
f h t h t
|
|
|
|
|
|
+ j
)
|
\
[
+ j
)
|
\
[
+ +
4 2 2 2 3 2
360
1
2
1
6
1
3
1
Combined Method A - 2
Computational Fluid Dynamics I
unconditionally stable
Combined Method A - 3
1
2
1
Stability Property
2
1
0 < stable only if
4 2
1
0
r
Computational Fluid Dynamics I
( )
2
1
1
1 1
1
1 1
2
1
h
f f f
t
f f
t
f f
n
j
n
j
n
j
n
j
n
j
n
j
n
j
+
+ +
+
+
+
=
+
Generalized Three-Time-Level Implicit Scheme:
Richtmyer and Morton (1967)
j-1 j j+1
n
n+1
=
implicit fully level - Three 1/2
Implicit 0
( ) + 1
n-1
Combined Method B - 1
Computational Fluid Dynamics I
Modied Equation:
Combined Method B - 2
+ +
|
|
|
|
|
|
+ j
)
|
\
[
= ) (
12 2
1
2
2
2
t O f
h
t f f
xxxx xx t
Special Cases:
) , (
2
1
2 2
h t O =
r 12
1
2
1
+ = ) , (
4 2
h t O
Computational Fluid Dynamics I
2
1 1
1 1
2
2 h
f f f
t
f f
n
j
n
j
n
j
n
j
n
j +
+
+
=
+
+
+ + = +
Computational Fluid Dynamics I
xxxx xx t
f
h
t
h f f
=
2
2
3 2
12
1
Modied Equation
DuFort-Frankel - 2
xxxxxx
f
h
t
t h
+ +
4
4
5 2 3 4
2
3
1
360
1
Amplication factor
r
r r
G
2 1
sin 4 1 cos 2
2 2
+
=
Unconditionally
stable
Conditionally consistent
Computational Fluid Dynamics I
FTCS
Stable for
BTCS
Unconditionally
Stable
Crank-Nicolson
Unconditionally
Stable
Richardson
Unconditionally
Unstable
xx t
f f =
2
1 1
1
2
h
f f f
t
f f
n
j
n
j
n
j
n
j
n
j +
+
+
=
( )
xxxx
f r
h
6 1
12
2
+ +
+
+
+
=
( )
xxxx
f r
h
6 1
12
2
+
( ) [
( )]
n
j
n
j
n
j
n
j
n
j
n
j
n
j
n
j
f f f
f f f
h t
f f
1 1
1
1
1 1
1 2
1
2
2
2
+
+
+ +
+
+
+ +
+ =
xxxxxx xxxx
f
t
f
h
12 12
2 3 2
+
2
1 1
1 1
2
2 h
f f f
t
f f
n
j
n
j
n
j
n
j
n
j +
+
+
=
) , (
2 2
h t O
Computational Fluid Dynamics I
DuFort-Frankel Unconditionally
Stable,
Conditionally
Consistent
3-Level Implicit
Unconditionally
Stable
xx t
f f =
( )
xxxx
f r
h 2
2
12 1
12
+ +
+
+
+
=
xxxx
f
h
12
2
2
1
1 1
1
1 1
2 h
f f f f
t
f f
n
j
n
j
n
j
n
j
n
j
n
j
+
+
+
+
=
And others!
Computational Fluid Dynamics I
Numerical Methods for
Parabolic Equations-II
Grtar Tryggvason
Worcester Polytechnic Institute,
Spring 2009
http://users.wpi.edu/~gretar/me612.html
Computational Fluid Dynamics I
One-Dimensional Problems
Explicit, implicit, Crank-Nicolson
Accuracy, stability
Various schemes
Multi-Dimensional Problems
Alternating Direction Implicit (ADI)
Approximate Factorization of Crank-Nicolson
Splitting
Stability in terms of uxed
Outline
Solution Methods for Parabolic Equations
Computational Fluid Dynamics I
Numerical Methods for
Multi-Dimensional Heat
Equations
Computational Fluid Dynamics I
Two-dimensional grid
j
j-1
j+1
i i+1 i-1
2
2
2
2
y
f
x
f
t
f
2
2
2
2
y
f
x
f
t
f
+
+
+
=
+ +
+
2
1 , , 1 ,
2
, 1 , , 1 ,
1
,
2 2
y
f f f
x
f f f
t
f f
n
j i
n
j i
n
j i
n
j i
n
j i
n
j i
n
j i
n
j i
+ +
+
Explicit Method - 1
Computational Fluid Dynamics I
In matrix form
+
+
+
+
+
+
+
n
J I
n
J I
n
n
n
J
n
n
n
J I
n
J I
n
n
n
J
n
n
n
J I
n
J I
n
n
n
J
n
n
f
f
f
f
f
f
f
h
t
f
f
f
f
f
f
f
f
f
f
f
f
f
f
,
1 ,
2 , 2
1 , 2
, 1
2 , 1
1 , 1
2
,
1 ,
2 , 2
1 , 2
, 1
2 , 1
1 , 1
1
,
1
1 ,
1
2 , 2
1
1 , 2
1
, 1
1
2 , 1
1
1 , 1
4 1 0
1 0 0
1 0
0 1
1 0 1 4 1 0
1 0 0 1 4 1
0 1 0 0 1 4
Explicit Method - 2
Computational Fluid Dynamics I
Explicit Method - 3
Von Neumann Analysis
imy ikx n n
j
e e =
n+1
=
n
+
t
h
2
e
ikh
+ e
ikh
+ e
imh
+ e
imh
4
( )
n+1
n
=1+
t
h
2
2coskh + 2cosmh 4 ( )
=
2
sin
2
sin
4
1
2 2
2
mh kh
h
t
Worst case
1
8
1 1
2
h
t
4
1
2
h
t
Computational Fluid Dynamics I
t
h
2
=
1
2
t
h
2
=
1
4
t
h
2
=
1
6
One-dimensional ow
Two-dimensional ow
Three-dimensional ow
Stability limits depend on the dimension of the problems
Different numerical algorithms usually have
different stability limits
Stability
Computational Fluid Dynamics I
Implicit time integration
Computational Fluid Dynamics I
f
i , j
n+1
= f
i , j
n
+
t
h
2
f
i+1, j
n
+ f
i1, j
n
+ f
i, j1
n
+ f
i, j +1
n
4 f
i, j
n
( )
Implicit Methods
f
i , j
n+1
= f
i , j
n
+
t
h
2
f
i+1, j
n+1
+ f
i1, j
n+1
+ f
i, j1
n+1
+ f
i, j +1
n+1
4 f
i, j
n+1
( )
Evaluate the spatial derivatives at the new
time (n+1), instead of at n
(1+ 4A) f
i , j
n+1
A f
i+1, j
n+1
+ f
i1, j
n+1
+ f
i, j1
n+1
+ f
i, j +1
n+1
( )
= f
i , j
n
This gives a set of linear equations for the
new temperatures:
Known source term
Recall forward in time method
Computational Fluid Dynamics I
f
i , j
n+1
=
1
1+ 4A
A f
i+1, j
n+1
+ f
i1, j
n+1
+ f
i, j1
n+1
+ f
i, j +1
n+1
( )
+ f
i , j
n
( )
Isolate the new f
i,j
and solve by iteration
The implicit method is unconditionally stable, but it is
necessary to solve a system of linear equations at
each time step. Often, the time step must be taken to
be small due to accuracy requirements and an explicit
method is competitive.
Implicit Methods
Computational Fluid Dynamics I
Second order accuracy in time can be obtained by
using the Crank-Nicolson method
n
n+1
i
i+1
i-1
j+1
j-1
j
Implicit Methods
Computational Fluid Dynamics I
The matrix equation is expensive to solve
Crank-Nicolson
Crank-Nicolson Method for 2-D Heat Equation
+ + +
2
2
2
2
2
1 2
2
1 2 1
2 y
f
x
f
y
f
x
f
t
f f
n n n n n n
( )
1
,
1
1 ,
1
1 ,
1
, 1
1
, 1 2 ,
1
,
4
2
+ +
+
+
+
+
+
+
+ + +
+ =
n
j i
n
j i
n
j i
n
j i
n
j i
n
j i
n
j i
f f f f f
h
t
f f
h y x = = If
( )
n
j i
n
j i
n
j i
n
j i
n
j i
f f f f f
h
t
, 1 , 1 , , 1 , 1 2
4
2
+ + +
+
+ +
|
|
\
[
=
+ +
+
2
2
2
1 2
2
2 / 1 2
1
2
1
2 y
f
y
f
x
f t
f f
n n n
n n
Combining the two becomes equivalent to:
Midpoint Trapisodial
Computational Fluid Dynamics I
Computational Molecules for the ADI Method
n
n+1/2
n+1
i
i+1
i-1
j+1
j-1
j
Computational Fluid Dynamics I
Instead of solving one set of linear equations for the
two-dimensional system, solve 1D equations for
each grid line.
The directions can be alternated to prevent any bias
Computational Fluid Dynamics I
In matrix form, for each row
f
i,1
n+1/ 2
f
i,2
n+1/ 2
f
i,N
n+1/ 2
=
f
i,1
n
f
i,2
n
f
i,N
n
+
t
h
2
2 1 0
1 2
1
0 1 2
f
i,1
n+1/ 2
f
i,2
n+1/ 2
f
i,N
n+1/ 2
+ source
This equation is easily solved by forward elimination
and back-substitution
Computational Fluid Dynamics I
Stability Analysis:
ADI Method is accurate
Similarly,
( )
2 2
, h t O
imy ikx n n
j
e e =
( ) ( ) [ ]
imh imh n ikh ikh n n n
e e e e
h
t
+ +
+ + +
+ = 2 2
2 / 1
2
2 / 1
2
sin 2 1
2
sin 2 1
2
2
2
2
2 / 1
mh
h
t
kh
h
t
n
n
=
+
2
sin 2 1
2
sin 2 1
2
2
2
2
2 / 1
1
kh
h
t
mh
h
t
n
n
=
+
+
=
+
kh
h
t
mh
h
t
mh
h
t
kh
h
t
n
n
xx
( ) =
1
x
2
( )
i1, j
2( )
i, j
+ ( )
i+1, j
[ ]
yy
( ) =
1
y
2
( )
i, j1
2( )
i, j
+ ( )
i, j +1
[ ]
( ) ( ) ) , , (
2 2
2 2 2 1 1
1
y x t O f f f f
t
f f
n n
yy
n n
xx
n n
+ + + + =
+ +
+
) , , (
2 2
1
2 2
1
2 2 2
1
y x t tO
f
t t
f
t t
n
yy xx
n
yy xx
+
+ =
+ + 1
2 2
1
4 2
1
2
1
n
yy xx
n
yy xx
f
t
f
t t
or
n
yy xx
n
yy xx
f
t
f
t t
4 2
1
2
1
2 2
+
n
yy xx
n
yy xx
f
t t
f
t t
+ =
2
1
2
1
2
1
2
1
1
( ) ) , , (
4
2 2 2 1
2 2
y x t tO f f
t
n n
yy xx
+
+
+
Crank-Nicolson
Computational Fluid Dynamics I
Approximate Factorization - 3
The ADI method can be written as
n
yy
n
xx
f
t
f
t
+ =
2
1
2
1
2 / 1
1
t
2
yy
f
n+1
= 1+
t
2
xx
f
n+1/ 2
Eliminating f
n+1/2
1
t
2
yy
1
t
2
xx
f
n+1
= 1+
t
2
yy
1+
t
2
xx
f
n+1
Computational Fluid Dynamics I
t
2
2
yy
xx
f
n+1
f
n
( )
2
2
t
3
xx
yy
f
t
= O(t
3
)
Up to a factor:
ADI is an approximate factorization of the
Crank-Nicolson method
Approximate Factorization - 4
Computational Fluid Dynamics I
The Peaceman-Rachford methods does not have
the same stability properties in 3D as in 2D. A
method with similar properties is:
1
t
2
xx
f
n+1*
= 1+
t
2
xx
+ 2
yy
+ 2
zz
( )
f
n
1
t
2
yy
f
n+1**
= f
n+1*
t
2
yy
f
n
1
t
2
zz
f
n+1
= f
n+1**
t
2
zz
f
n
Several other splitting methods have been proposed
in the literature.
Approximate Factorization - 5
Computational Fluid Dynamics I
Similar ideas can be used for time splitting:
f
i, j
n+1/ 2
= 1+t
xx
( ) f
i, j
n
f
i, j
n+1
= 1+t
yy ( )
f
i, j
n+1/ 2
f
i, j
n+1
= 1+t
yy ( )
1+t
xx
( ) f
i, j
n
Eliminate the half step:
Which is equivalent to the standard FTC method,
except for the
2
t
2
yy
xx
f
i, j
n
term, which is higher order.
Approximate Factorization - 6
Computational Fluid Dynamics I
Why splitting?
1. Stability limits of 1-D case apply.
2. Different t can be used in x and y directions.
Computational Fluid Dynamics I
Implicit time
marching by fast
elliptic solvers
Computational Fluid Dynamics I
f
i, j
n+1
f
i, j
n
t
=
h
2
f
i, j
n+1
h
2
f
i, j
n+1
f
i, j
n+1
t
=
f
i, j
n
t
h
2
f
i, j
n+1
f
i, j
n+1
= S
Backward Euler
Rearrange
or
Can be solved by elliptic solvers
Computational Fluid Dynamics I
Stability from a ux
point of view
Computational Fluid Dynamics I
Initial conditions
T
j
n+1
= T
j
n
+
t
h
2
T
j +1
n
2T
j
n
+ T
j 1
n
( )
T
j 1
1
T
j
T
j +1
Stability
Computational Fluid Dynamics I
T
j 1
1
T
j
T
j +1
T
j +1
n+1
= T
j+1
n
+
t
h
2
T
j + 2
n
2T
j +1
n
+ T
j
n
( )
T
j
n+1
= T
j
n
+
t
h
2
T
j +1
n
2T
j
n
+ T
j 1
n
( )
= 1 +
t
h
2
0 2 +1 ( ) = 1
t
h
2
= 0 +
t
h
2
0 0 +1 ( ) =
t
h
2
All other
temperatures
are unchanged
Stability
Computational Fluid Dynamics I
T
j 1
1
t
h
2
<
1
2
T
j
T
j +1
T
j +1
n+1
=
t
h
2
T
j
n+1
=1
t
h
2
All other temperatures are unchanged
Stability
Computational Fluid Dynamics I
T
j 1
1
t
h
2
>
1
2
T
j
T
j +1
If
t
h
2
>
1
2
heat must ow uphill, violating the second law.
This generally leads to unphysical oscillations and growth of
the solution
T
j +1
n+1
=
t
h
2
T
j
n+1
=1
t
h
2
All other temperatures are unchanged
Stability
Computational Fluid Dynamics I
% one-dimensional unsteady diffusion by the FTCS scheme
%-------------------------------------------------------
n=40; nstep=300; length=2.0;h=length/(n-1);diff=0.05;
time=0;T=zeros(n,1);T(1)=1.0;dt=0.65*h^2/diff;
for m=1:nstep,m,time
hold off;plot(T,'linewidt',2); axis([1 n -1.0, 1.0]);
set(gca,'FontSize',24);set(gca,'LineWidth',2);pause;
To=T;
for i=2:n-1,
T(i)=To(i)+diff*(dt/h^2)*(To(i+1)-2*To(i)+To(i-1));
end
time=time+dt;
end;
Stability
Computational Fluid Dynamics I
10 20 30 40
-1
-0.5
0
0.5
1
10 20 30 40
-1
-0.5
0
0.5
1
10 20 30 40
-1
-0.5
0
0.5
1
10 20 30 40
-1
-0.5
0
0.5
1
10 20 30 40
-1
-0.5
0
0.5
1
10 20 30 40
-1
-0.5
0
0.5
1
10 20 30 40
-1
-0.5
0
0.5
1
10 20 30 40
-1
-0.5
0
0.5
1
10 20 30 40
-1
-0.5
0
0.5
1
10 20 30 40
-1
-0.5
0
0.5
1
10 20 30 40
-1
-0.5
0
0.5
1
Stability
Computational Fluid Dynamics I
One-Dimensional Problems
Explicit, implicit, Crank-Nicolson
Accuracy, stability
Various schemes
Multi-Dimensional Problems
Alternating Direction Implicit (ADI)
Approximate Factorization of Crank-Nicolson
Splitting
Stability in terms of uxed
Overview
Solution Methods for Parabolic Equations