7 Cost -v- benefit
At a first reading of this Section, it might be tempting to think that the extra effort involved in using Crank-Nicolson (we have to store a set of simultaneous equations, we have to solve them and we have to do this at every time-step) is enough to make the explicit method the winner in a cost-benefit analysis. But this would be wrong.
In practical problems involving numerical approximations to parabolic problems the explicit method is rarely good enough. The stability constraint ( ) imposes such tiny time-steps that it takes a great deal of time for a computer to produce approximations corresponding to even fairly modest values of . If efficiency is what matters, then Crank-Nicolson beats the explicit approach, and it is worth the extra initial effort formulating a solver (such as those we saw in HELM booklet 30) for the system of equations.
Exercises
-
Consider the function
defined by
Using increments of and , and working to 8 decimal places, approximate
- with a one-sided forward difference
- with a central difference
- with a one-sided forward difference
- with a central difference.
State the approximate derivatives to 3 decimal places.
-
The temperature of a metal bar of length at a distance from one end and at time is modelled by the partial differential equation
It is given that the metal has diffusivity , that the two ends of the bar are kept at temperature and that the initial temperature distribution is
Use the explicit difference scheme with and to approximate at and .
-
The temperature
of a metal bar of length
at a distance
from one end and at time
is modelled by the partial differential equation
It is given that the metal has diffusivity , that the two ends of the bar are kept at temperature and that the initial temperature distribution is
Use the Crank-Nicolson difference scheme with and to approximate at and at .
-
The evaluations of
we will need are
,
,
,
,
It follows that
to 3 decimal places. (Workings shown to 8 decimal places.)
-
In this case
so that the numerical scheme can be written
The first stage is to use the given data to find
The first timestep will find . We note that the boundary condition implies that .
The second timestep will find . First we note that the boundary condition implies that .
where some quantities have been rounded to 6 decimal places.
-
In this case
so that the numerical scheme can be written
Moving the unknowns to the left of the equation we obtain
The first stage is to use the given data to find
The first time-step will find . First we note that the boundary condition implies that . Two uses of the stencil give
The implicit nature of this method means that we have to do some extra work to complete the time-step. We must now solve the simultaneous equations
In this case there are only two unknowns and it is a simple matter to solve the pair of equations to give and .
The second time-step will find . First we note that the boundary condition implies that . Two uses of the stencil giveThe implicit nature of this method means that we have to do some extra work to complete the time-step. We must now solve the simultaneous equations
In this case there are only two unknowns and it is a simple matter to solve the pair of equations to give and .