Vous êtes sur la page 1sur 57

Part IV

20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Part IV
20401
Tony Shardlow
1 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Outline
1
Model parabolic problem
2
Uniqueness
3
Method of lines
4
Euler method
5
Finite dierences for heat equation
2 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Outline
1
Model parabolic problem
2
Uniqueness
3
Method of lines
4
Euler method
5
Finite dierences for heat equation
3 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Model parabolic PDE
Consider the heat equation for t > 0 and x [0, 1],
u
t
=u
xx
u(0, t) =u(1, t) = 0,
with initial condition u(x, 0) = u
0
(x).
We study
1
Uniqueness of soln
2
Finite dierence method
3
Stability of time discretisation.
4 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Outline
1
Model parabolic problem
2
Uniqueness
3
Method of lines
4
Euler method
5
Finite dierences for heat equation
5 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Uniqueness of soln
u
t
u
xx
= 0
u(0, t) = u(1, t) = 0
u(x, 0) = u
0
(x)
_
_
_
(H)
Multiply the PDE by u and integrate over x [0, 1],
Dene the energy : E(t) =
_
1
0
u
2
(x, t) dx
and dierentiate
E

(t) =
d
dt
_
1
0
u
2
dx =
_
1
0

t
(u
2
) dx = 2
_
1
0
uu
t
dx
=2
_
1
0
uu
xx
dx.
6 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
E(t) =
_
1
0
u
2
dx; E

(t) = 2
_
1
0
uu
xx
dx.
Integrate by parts
E

(t) = 2
_
uu
x
_
1
0
2
_
1
0
(u
x
)
2
dx
= 2
_
1
0
(u
x
)
2
dx 0 ,
where we apply the boundary conditions u(0, t) = u(1, t) = 0.
We deduce that E(t) E(0) for all t > 0. That is,
_
1
0
u
2
(x, t) dx = E(t) E(0) =
_
1
0
u
2
0
(x) dx.
7 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
E(t) =
_
1
0
u
2
dx; E

(t) = 2
_
1
0
uu
xx
dx.
Integrate by parts
E

(t) = 2
_
uu
x
_
1
0
2
_
1
0
(u
x
)
2
dx
= 2
_
1
0
(u
x
)
2
dx 0 ,
where we apply the boundary conditions u(0, t) = u(1, t) = 0.
We deduce that E(t) E(0) for all t > 0. That is,
_
1
0
u
2
(x, t) dx = E(t) E(0) =
_
1
0
u
2
0
(x) dx.
8 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Uniqueness of soln
Theorem
The solution to (H) is unique.
Proof.
Let v, u be two solutions. By linearity, w = u v satises
w
t
=w
xx
, w(0, t) = w(1, t) = 0,
w(x, 0) =0.
E(t) =
_
1
0
w(x, t)
2
dx
is a decreasing function.
But E(0) = 0, so E(t) = 0 for all t. Hence w = 0 for all t and
u = v and the solution is unique.
9 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
A model parabolic PDE problem
HOMEWORK
You can now try Problem 1
Evolution of the temperature proles for specic initial
conditions ..
0 0.5 1
0
0.2
0.4
0.6
0.8
1
x
t
e
m
p
e
r
a
t
u
r
e
Problem 2.1
0 0.5 1
0
0.2
0.4
0.6
0.8
1
x
t
e
m
p
e
r
a
t
u
r
e
Problem 2.2
10 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
A model parabolic PDE problem
HOMEWORK
You can now try Problem 1
Evolution of the temperature proles for specic initial
conditions ..
0 0.5 1
0
0.2
0.4
0.6
0.8
1
x
t
e
m
p
e
r
a
t
u
r
e
Problem 2.1
0 0.5 1
0
0.2
0.4
0.6
0.8
1
x
t
e
m
p
e
r
a
t
u
r
e
Problem 2.2
11 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Outline
1
Model parabolic problem
2
Uniqueness
3
Method of lines
4
Euler method
5
Finite dierences for heat equation
12 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Heat equation
Consider the Fourier series
u(x, t) =

j =1
u
j
(t) sin(j x)
Notice that u(0, t) = u(1, t) and boundary conditions are
satised.
Substitute into the heat equation u
t
= u
xx
. Then
u
t
(x, t) =

j =1
u

j
(t) sin(j x)
u
xx
(x, t) =

j =1
u
j
(t) (j
2

2
) sin(j x).
13 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Heat equation
Consider the Fourier series
u(x, t) =

j =1
u
j
(t) sin(j x)
Notice that u(0, t) = u(1, t) and boundary conditions are
satised.
Substitute into the heat equation u
t
= u
xx
. Then
u
t
(x, t) =

j =1
u

j
(t) sin(j x)
u
xx
(x, t) =

j =1
u
j
(t) (j
2

2
) sin(j x).
14 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Decoupling the heat equation
After substitution into the heat equation,

j =1
u
j
(t)j
2

2
sin(j x) =

j =1
u

j
(t) sin(j x).
and equating coecients of sin(j x),
ODEs for Fourier coecients u
j
(t)
u

j
= j
2

2
u
j
, j = 1, 2, . . . .
The system is decoupled, as the solution u
j
can be found inde-
pendently of u
k
for j ,= k.
From u(0, x) =

j =1
u
j
(0) sin(j x) = u
0
(x), the initial data
u
j
(0) = 2
_

0
u
0
(x) sin j x dx.
15 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Method of lines
Replace innite system of ODEs
u

j
= j
2

2
u
j
, j = 1, 2, . . . ,
with nite system of ODEs
u

j
= j
2

2
u
j
, j = 1, 2, . . . , J
where J is size of system and solve to determine u
j
(t),
j = 1, . . . , J.
Method of lines approximation is
v(x, t) =
J

j =1
u
j
(t) sin(j x).
For large J, u(x, t) v(x, t).
Finite dierence methods are often used to solve the ODEs for
u
j
(t). We study nite dierence methods for ODEs.
16 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Outline
1
Model parabolic problem
2
Uniqueness
3
Method of lines
4
Euler method
5
Finite dierences for heat equation
17 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Finite dierence method for
ODE
Consider the following initial value problem for the ODE:
dX
dt
= f (X), X(0) = X
0
For k > 0 (the time step), we can approximate
dX
dt
=
X(t + k) X(t)
k
+O(k)
Example: X(t) = e
t
dX
dt
=
de
t
dt
= e
t
=
e
t+k
e
t
k
+O(k)
As a numerical example, put t = 1 and k = 0.1, then X

(t) =
e
t
= e = 2.7183 and
e
t+k
e
t
k
=
e
1.1
e
1
0.1
= 2.8588
18 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Finite dierence method for
ODE
Consider the following initial value problem for the ODE:
dX
dt
= f (X), X(0) = X
0
For k > 0 (the time step), we can approximate
dX
dt
=
X(t + k) X(t)
k
+O(k)
Example: X(t) = e
t
dX
dt
=
de
t
dt
= e
t
=
e
t+k
e
t
k
+O(k)
As a numerical example, put t = 1 and k = 0.1, then X

(t) =
e
t
= e = 2.7183 and
e
t+k
e
t
k
=
e
1.1
e
1
0.1
= 2.8588
19 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Finite dierence method for
ODE
Consider the following initial value problem for the ODE:
dX
dt
= f (X), X(0) = X
0
For k > 0 (the time step), we can approximate
dX
dt
=
X(t + k) X(t)
k
+O(k)
Example: X(t) = e
t
dX
dt
=
de
t
dt
= e
t
=
e
t+k
e
t
k
+O(k)
As a numerical example, put t = 1 and k = 0.1, then X

(t) =
e
t
= e = 2.7183 and
e
t+k
e
t
k
=
e
1.1
e
1
0.1
= 2.8588
20 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Explicit Euler method
Put t = nk and substitute
X(t + k) X(t)
k
= f (X(t)) +O(k)
into ODE.
X((n + 1)k) X(nk)
k
= f (X(nk)) +O(k)
Drop the error term and approximate X(nk) by X
n
, gives the
Explicit Euler method
Given X
0
and time step k, compute X
n
X(nk) by
X
n+1
= X
n
+ kf (X
n
)
It is possible to show that [X(nk) X
n
[ = O(k) for nk = T,
under assumptions on f . The method is rst order accurate.
We do not prove this.
21 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Example: explicit Euler method
Consider the ODE
dX
dt
= X, X(0) = X
0
with X
0
= 2 and = 3. In this case, exact solution is
X(t) = e
3t
2 .
We nd explicit Euler approximation for time step k = 0.1,
X
n+1
= X
n
+ kf (X
n
), X
0
= 2.
X
1
= 2 + 0.1(3 2) = 1.4 ,
X
2
= 1.4 + 0.1(3 1.4) = 0.98
The exact solution X
1
X(0.1) = 2e
0.3
= 1.4816,
X
2
1.0976 = X(0.2).
Can get more accurate approximation by taking k smaller
22 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Example: explicit Euler method
Consider the ODE
dX
dt
= X, X(0) = X
0
with X
0
= 2 and = 3. In this case, exact solution is
X(t) = e
3t
2 .
We nd explicit Euler approximation for time step k = 0.1,
X
n+1
= X
n
+ kf (X
n
), X
0
= 2.
X
1
= 2 + 0.1(3 2) = 1.4 ,
X
2
= 1.4 + 0.1(3 1.4) = 0.98
The exact solution X
1
X(0.1) = 2e
0.3
= 1.4816,
X
2
1.0976 = X(0.2).
Can get more accurate approximation by taking k smaller
23 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Implicit Euler method
Approximating dX/dt by (X(t) X(t k))/k and repeating
gives
X(nk) X((n 1)k)
k
= f (X(nk)) +O(k)
Drop the error term and approximate X(nk) by X
n
, gives the
Implicit Euler method
Given X
0
and time step k, compute X
n
X(nk) by
X
n
= X
n1
+ kf (X
n
)
A nonlinear system of equations must be solved to determine
X
n
. Hence the method is implicit.
Again possible to show that [X(nk) X
n
[ = O(k) for nk = T,
under assumptions on f . The method is rst order accurate.
Not proved.
24 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Linear test ODE
Linear test equation
dX
dt
= X

= X, X(0) = X
0
.
The solution is easily found to be
X(t) = e
t
X
0
.
Note that X(t) 0 as t if 1 < 0 (1 means real part).
What about numerical methods?
For what values of , do the numerical approximations X
n
0
as n
Hope that the set of such is also R: 1 < 0.
25 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Stability condition for Explicit
Euler
1
For the case f (X) = X, the explicit Euler method is
X
n+1
= X
n
+ kX
n
2
Rearrange,
X
n+1
= (1 + k)X
n
.
and the solution X
n
= (1 + k)
n
X
0
.
3
Hence as n
X
n
0 [1 + k[ < 1
if and only if k belongs to
circle of radius 1 in complex plane with centre at 1.
4
The set of k C such that X
n
0 as n is known
as the region of absolute stability.
26 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Stability condition for Explicit
Euler
1
For the case f (X) = X, the explicit Euler method is
X
n+1
= X
n
+ kX
n
2
Rearrange,
X
n+1
= (1 + k)X
n
.
and the solution X
n
= (1 + k)
n
X
0
.
3
Hence as n
X
n
0 [1 + k[ < 1
if and only if k belongs to
circle of radius 1 in complex plane with centre at 1.
4
The set of k C such that X
n
0 as n is known
as the region of absolute stability.
27 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Time step restriction for explicit
Euler
1
Recall for the ODE, then
X(t) 0 as t
if 1 < 0.
2
The numerical method decays for all initial data if and
only if [1 + k[ < 1 if and only if
timestep k < 2/[[ .
That is, there is a restriction on the time step.
3
For the method of lines method, = j
2

2
where
j = 1, 2, . . . , J.
4
Hence, the time step restriction is
timestep k < 2/J
2

2
.
For large J, the time step condition is very restrictive!
Leads to inecient method.
28 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Time step restriction for explicit
Euler
1
Recall for the ODE, then
X(t) 0 as t
if 1 < 0.
2
The numerical method decays for all initial data if and
only if [1 + k[ < 1 if and only if
timestep k < 2/[[ .
That is, there is a restriction on the time step.
3
For the method of lines method, = j
2

2
where
j = 1, 2, . . . , J.
4
Hence, the time step restriction is
timestep k < 2/J
2

2
.
For large J, the time step condition is very restrictive!
Leads to inecient method.
29 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Time step restriction for explicit
Euler
1
Recall for the ODE, then
X(t) 0 as t
if 1 < 0.
2
The numerical method decays for all initial data if and
only if [1 + k[ < 1 if and only if
timestep k < 2/[[ .
That is, there is a restriction on the time step.
3
For the method of lines method, = j
2

2
where
j = 1, 2, . . . , J.
4
Hence, the time step restriction is
timestep k < 2/J
2

2
.
For large J, the time step condition is very restrictive!
Leads to inecient method.
30 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Implicit Euler
Put f (X) = X into the implicit Euler method.
Implicit Euler method
X
n
X
n1
k
= X
n
It becomes
X
n
=
1
(1 k)
X
n1
.
and the soln X
n
= (1 k)
n
X
0
.
Hence
X
n
0 [1 k[ > 1
if and only if k is
outside the circle of radius 1 in complex plane with centre at 1
.
31 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Implicit Euler
Put f (X) = X into the implicit Euler method.
Implicit Euler method
X
n
X
n1
k
= X
n
It becomes
X
n
=
1
(1 k)
X
n1
.
and the soln X
n
= (1 k)
n
X
0
.
Hence
X
n
0 [1 k[ > 1
if and only if k is
outside the circle of radius 1 in complex plane with centre at 1
.
32 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
No stability restriction for
implicit Euler
1
For implicit Euler, the region of absolute stability is
[1 k[ > 1 and this holds for all with 1 < 0.
2
When the ODE is stable (1 < 0), the implicit Euler is
stable too and [X
n
[ 0 as n .
3
There is no timestep restriction for the implicit Euler
method.
This is important for the heat equation, where is large.
4
The implicit Euler is a better method for the time
discretisation of the heat equation.
33 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
No stability restriction for
implicit Euler
1
For implicit Euler, the region of absolute stability is
[1 k[ > 1 and this holds for all with 1 < 0.
2
When the ODE is stable (1 < 0), the implicit Euler is
stable too and [X
n
[ 0 as n .
3
There is no timestep restriction for the implicit Euler
method.
This is important for the heat equation, where is large.
4
The implicit Euler is a better method for the time
discretisation of the heat equation.
34 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Explicit vs Implicit
To understand the names implicit and explicit, apply the
methods to
dX
dt
= f (X), X(0) = X
0
for f (x) a nonlinear function. The explicit Euler method is
X
n+1
= X
n
+ kf (X
n
)
so that X
n+1
is determined explicitly from X
n
and evaluation of
f .
The implicit Euler method is
X
n
= X
n1
+ kf (X
n
)
so that X
n
is determined implicitly by a solution of a nonlinear
equation involving f .
HOMEWORK
You can now try Problem 24
35 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Explicit vs Implicit
To understand the names implicit and explicit, apply the
methods to
dX
dt
= f (X), X(0) = X
0
for f (x) a nonlinear function. The explicit Euler method is
X
n+1
= X
n
+ kf (X
n
)
so that X
n+1
is determined explicitly from X
n
and evaluation of
f .
The implicit Euler method is
X
n
= X
n1
+ kf (X
n
)
so that X
n
is determined implicitly by a solution of a nonlinear
equation involving f .
HOMEWORK
You can now try Problem 24
36 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Examination
The material from here on is not covered on the exam.
37 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Outline
1
Model parabolic problem
2
Uniqueness
3
Method of lines
4
Euler method
5
Finite dierences for heat equation
38 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Discretisation of (x, t) space :
u
m
j
u(x
j
, t
m
)
Grid spacing in x direction is h.
Grid spacing in t direction is k.
6 6





s s s s s s
c
c
c
c
c
c
c
c
c
c
0 = x
0
x
j x
n
= 1
j 1 j j +1
h
h =
1
n
-
k
m
t
m
m+1
6
?
u
m
j
39 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Explicit approximation
u
t
(x
j
, t
m
) = u
xx
(x
j
, t
m
)
Approximate
u
xx
(x
j
, t
m
)
1
h
2

2
x
u(x
j
, t
m
)
=
1
h
2
_
u(x
j
h, t
m
) 2u(x
j
, t
m
) + u(x
j
+ h, t
m
)
_
u
t
(x
j
, t
m
)
1
k

+t
u(x
j
, t
m
)
=
1
k
_
u(x
j
, t
m
+ k) u(x
j
, t
m
)
_
.
40 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Finite dierence methodexplicit
u
t
(x
j
, t
m
) = u
xx
(x
j
, t
m
)
j = 1, 2, . . . , n 1
m = 0, 1, 2, . . .
.
Substitute dierence approximations to derive the nite
dierence method
1
k

+t
u
m
j
=
1
h
2

2
x
u
m
j
or
1
k
_
u
m+1
j
u
m
j
_
=
1
h
2
_
u
m
j 1
2u
m
j
+ u
m
j +1
_

s s s
j 1 j j + 1
m
m + 1
Given u
m
j 1
, u
m
j
, u
m
j +1
, u
m+1
j
is given explicitly by
u
m+1
j
= u
m
j 1
+ (1 2)u
m
j
+ u
m
j +1
, where = k/h
2
.
41 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Linear system of equations

t t t
j 1 j j + 1
m
m + 1
For = k/h
2
u
m+1
j
= u
m
j 1
+ (1 2)u
m
j
+ u
m
j +1
,
j = 1, 2, . . . , n 1
m = 0, 1, 2, . . .
This is a matrix-vector multiply at each time level:
_

_
u
m+1
1
.
.
.
u
m+1
j
.
.
.
u
m+1
n1
_

_
=
_

_
1 2 0
.
.
.
.
.
.
1 2
.
.
.
.
.
.
0 1 2
_

_
_

_
u
m
1
.
.
.
u
m
j
.
.
.
u
m
n1
_

_
.
42 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Consistency I
Is the explicit approximation consistent?
Theorem (consistency)
The local error at the grid point (x
j
, t
m
),
T
m
j
=
1
k

+t
u(x
j
, t
m
)
1
h
2

2
x
u(x
j
, t
m
) j = 1, 2, . . . , n,
is bounded from above:

T
m
j

= O(k) +O(h
2
)
HOMEWORK
You can now try Problem 5
43 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Consistency I
Is the explicit approximation consistent?
Theorem (consistency)
The local error at the grid point (x
j
, t
m
),
T
m
j
=
1
k

+t
u(x
j
, t
m
)
1
h
2

2
x
u(x
j
, t
m
) j = 1, 2, . . . , n,
is bounded from above:

T
m
j

= O(k) +O(h
2
)
HOMEWORK
You can now try Problem 5
44 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Explicit Approximation II
1
Is the explicit approximation stable?
It all depends on = r
0 0.5 1
0
0.2
0.4
0.6
0.8
1
Explicit FD Scheme: r is 0.48
x
t
e
m
p
e
r
a
t
u
r
e
0 0.5 1
0
0.2
0.4
0.6
0.8
1
Explicit FD Scheme: r is 0.52
x
t
e
m
p
e
r
a
t
u
r
e
45 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Theorem
If 1 2 0 1/2 then the explicit approximation
u
m+1
j
= u
m
j 1
+ (1 2)u
m
j
+ u
m
j +1
,
is non-increasing:
max
j

u
m+1
j

max
j

u
m
j

. ()
HOMEWORK
You can now try Problem 6
46 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Theorem
If 1 2 0 1/2 then the explicit approximation
u
m+1
j
= u
m
j 1
+ (1 2)u
m
j
+ u
m
j +1
,
is non-increasing:
max
j

u
m+1
j

max
j

u
m
j

. ()
HOMEWORK
You can now try Problem 6
47 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Proof.
Let u
m

= max
j
[u
m
j
[.
[u
m+1
j
[ = [u
m
j 1
+ (1 2)u
m
j
+ u
m
j +1
[
[u
m
j 1
[ +[(1 2)u
m
j
[ +[u
m
j +1
[

..
>0
u
m

+ (1 2)
. .
0
u
m

+ ()
..
>0
u
m

= u
m

+ (1 2)u
m

+ u
m

= u
m

.
This establishes () since [u
m+1
j
[ u
m

for all j .
48 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Implicit Approximation
u
t
(x
j
, t
m
) = u
xx
(x
j
, t
m
)
Approximate
u
xx
(x
j
, t
m
)
1
h
2

2
x
u(x
j
, t
m
)
=
1
h
2
_
u(x
j
h, t
m
) 2u(x
j
, t
m
) + u(x
j
+ h, t
m
)
_
u
t
(x
j
, t
m
)
1
k

t
u(x
j
, t
m
)
=
1
k
_
u(x
j
, t
m
) u(x
j
, t
m
k)
_
.
where

2
x
u(x
j
, t
m
) = u(x
j
h, t
m
) 2u(x
j
, t
m
) + u(x
j
+ h, t
m
)

t
u(x
j
, t
m
) = u(x
j
, t
m
) u(x
j
, t
m
k).
49 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Implicit Approximation II
u
t
(x
j
, t
m
) = u
xx
(x
j
, t
m
)
j = 1, 2, . . . , n 1
m = 0, 1, 2, . . .
.
1
k

t
u
m
j
=
1
h
2

2
x
u
m
j
1
k
_
u
m
j
u
m1
j
_
=
1
h
2
_
u
m
j 1
2u
m
j
+ u
m
j +1
_

t
j 1 j j + 1
m 1
m
Thus
u
m
j 1
+ (1 + 2)u
m
j
u
m
j +1
= u
m1
j
,
where = k/h
2
.
50 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Linear system of eqns

t
j 1 j j + 1
m 1
m
For = k/h
2
u
m
j 1
+ (1 + 2)u
m
j
u
m
j +1
= u
m1
j
j = 1, 2, . . . , n 1
m = 0, 1, 2, . . .
This is a tridiagonal matrix solve at each time level:
_

_
1 + 2 0
.
.
.
.
.
.
1 + 2
.
.
.
.
.
.
0 1 + 2
_

_
_

_
u
m
1
.
.
.
u
m
j
.
.
.
u
m
n1
_

_
=
_

_
u
m1
1
.
.
.
u
m1
j
.
.
.
u
m1
n1
_

_
51 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Consistency
Theorem
The local error at the grid point (x
j
, t
m
),
T
m
j
=
1
k

t
u(x
j
, t
m
)
1
h
2

2
x
u(x
j
, t
m
) j = 1, 2, . . . , n,
is bounded from above:

T
m
j

= O(k) +O(h
2
).
HOMEWORK
You can now try Problem 78
52 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Consistency
Theorem
The local error at the grid point (x
j
, t
m
),
T
m
j
=
1
k

t
u(x
j
, t
m
)
1
h
2

2
x
u(x
j
, t
m
) j = 1, 2, . . . , n,
is bounded from above:

T
m
j

= O(k) +O(h
2
).
HOMEWORK
You can now try Problem 78
53 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Implicit Approximation II
1
Is the implicit approximation stable?
Yes for any = r
0 0.5 1
0
0.2
0.4
0.6
0.8
1
Implicit FD Scheme: r is 0.48
x
t
e
m
p
e
r
a
t
u
r
e
0 0.5 1
0
0.2
0.4
0.6
0.8
1
Implicit FD Scheme: r is 0.52
x
t
e
m
p
e
r
a
t
u
r
e
54 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Theorem
The implicit approximation
u
m
j 1
+ (1 + 2)u
m
j
u
m
j +1
= u
m1
j
is non-increasing: max
j

u
m+1
j

max
j

u
m
j

. ()
55 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Proof.
Proof. Let u
m

= max
j
[u
m
j
[.
[ (1 + 2)
. .
>0
u
m
j
[ = [u
m
j 1
+ u
m1
j
+ u
m
j +1
[.
(1 + 2) [u
m
j
[ = [u
m
j 1
+ u
m1
j
+ u
m
j +1
[
[u
m
j 1
[ +[u
m1
j
[ +[u
m
j +1
[
u
m

+[u
m1
j
[ + u
m

= 2u
m

+[u
m1
j
[.
(1 + 2) u
m

2u
m

+[u
m1
k
[
This establishes () since u
m

[u
m1
k
[ max
j
[u
m1
j
[.
56 / 57
Part IV
20401
Model
parabolic
problem
Uniqueness
Method of
lines
Euler method
Finite
dierences for
heat equation
Summary
1
We have looked at two nite dierence approximations for
the heat equation. An explicit and an implicit method.
2
The explicit method is easier to implement as it does NOT
involve solving a linear system of equations.
3
Both implicit and explicit methods are consistent with the
same order of accuracy ([T
m
j
[ = O(k) +O(h
2
)). Second
order accurate in space; rst order accurate in time.
4
Stability depends on a step size condition for the explicit
method ( = k/h
2
1/2). The implicit method is always
stable.
5
Stable+consistency gives convergence for both methods.
The implicit method is preferred in practice due to better
stability.
57 / 57

Vous aimerez peut-être aussi