Using any numerical technique to solve differential equations always introduces various numerical errors. It is important to be aware of these errors, and to know how to estimate them, in order to reduce them below the minimum error requirement, or error tolerance, for the numerical problem being solved. Obviously, the error tolerances depend on the physical application.
Errors can usually be reduced by reducing step-sizes, but the rate at which this happens--called the order of the algorithm--depends on the algorithm design. There is generally a trade-off between complexity of code and rate of convergence. Using a rapidly convergent code is not always desirable, if it makes the code so complex that programming errors (`bugs') are introduced! For this reason, we focus on relatively simple methods in this laboratory.
In order to understand error propagation, consider the single-step FTCS description, with the Taylor series (local) errors included:
We have assumed (to a first approximation) that the time derivative of
the field
doesn't vary in the small time interval from
to
. This is obviously a better approximation when
is small. However, it is useful to think about this more
quantitatively. From the Taylor expansion, the error for making each
step in time is
. However, one must take
steps of
size
to reach a given time
, where
. Hence, the accumulated error in reaching a given time
is approximately proportional to
in the FTCS methods, provided the error simply adds, and
does not grow exponentially. This error can therefore be reduced by
halving the time-step, until the changes that occur are less than the
error tolerance.
Spatial discretisation introduces further errors. From the Taylor
expansion in space, the local error for one step in time due to
spatial discretisation is proportional to
, which
means that the accumulated errors should be approximately proportional
to
. Again, this can be
reduced by halving the step-size in space, until the changes that
occur are less than the error tolerance.
Boundary conditions have to be included by careful treatment of the discretised differential operator near the boundaries. This introduces no error if the spatial windows are finite. If the real spatial window is infinite, then the approximation of using a finite spatial window introduces further errors. This can be checked through doubling the window-size, while keeping the step-sizes constant. Note that using mapping techniques also reduces windowing errors. However, mapping does not really eliminate them totally. Instead, it transforms windowing errors into new spatial-discretisation errors--caused by the rapidly increasing spatial variation of the equation terms, as the transformed boundaries in the mapping space are approached. Even so, this method illustrates how mapping techniques can be combined with a numerical method.
It is possible that the global errors behave rather differently to the above estimates. For example, the local errors may cancel each other (relatively unusual, owing to Murphy's law), or they may themselves become amplified by the algorithm. If this happens, then there is an exponential growth in the errors, which can become enormously large very quickly. Under these conditions, the numerical solution is essentially meaningless.
The final error source is the round-off error, due to the fact that real numbers are represented by binary number approximations in a computer. This effect is complementary to the other error sources, since it accumulates with the total number of floating-point operations, and therefore gets larger when the step-sizes are reduced--or as the spatial window is increased. This effect is often ignored, under the assumption that commonly used double-precision floating-point IEEE operations (64bit, 16-17 decimals) have negligible round-off errors. However, for very accurate calculations with large lattices, this effect can become important. With some computer languages, it is possible to repeat the calculation with quadruple-precision (128bit, 32-34 decimal). If the calculations give results that differ by more than the error tolerance at two different precisions, then round-off is clearly a problem.
Paul Cochrane 2002-04-18