(Exercise 7.1) Use the explicit differencing scheme discussed in
class:
where
, to solve the diffusion
equation. The goal is to reproduce a portion of the fundamental
solution. Take the diffusion coefficient to be and work on a
uniform grid of 201 points running from to . Start with
the fundamental solution at time and integrate the system
forward in time to in steps of size . Plot your
solution at for
, and .
Differencing the diffusion equation
using the Crank-Nicholson scheme leads to the following relation
between the new () and old () values of [where
,
, and
]:
where
. By considering eigenmodes of
the form
where is an integer (and means to the -th
power!), prove that the scheme is stable, in the sense that for all .
(a) Repeat problem 1 using the implicit differencing
scheme
plotting your solution at for
, and .
(b) Use the Crank-Nicholson scheme with to solve the diffusion
equation with , starting from the fundamental solution at time
and taking
. Plot the numerical and the
analytic solutions on the same graph for at times 0.5, 1,
and 5.
Now modify your program to include a heat source in
by adding a source term to the right-hand side of the
diffusion equation, where for in the above range, and
otherwise.
Start with everywhere and take .
Recompute the difference equation from the modified
differential equation to take the additional term into account.
Set the boundary conditions to keep at the
ends of the range.
Set
.
Integrate from t = 0 to t = 10.
Plot the numerical solution at
.
Can you explain the long-term behavior of your solution?