Subsections

Numerical errors

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:

$\displaystyle \mbf{A}(t_{n+1}) = [1 + \Delta t \mbf{D}] \mbf{A}(t_n) + \Delta t \mbf{U}[\mbf{A}(t_n)] + O(\Delta t^2) + O(\Delta t \Delta x^2).$ (A.18)

Remember that this step must be repeated $ N$ times to get the final answer. Clearly $ N$ itself depends on $ \Delta t$, if the total integration time is fixed, and it is the global error (after many steps) that is of most interest to the physicist!

Time-discretisation error

We have assumed (to a first approximation) that the time derivative of the field $ \mbf{A}$ doesn't vary in the small time interval from $ t_n$ to $ t_{n+1}$. This is obviously a better approximation when $ \Delta t$ 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 $ O(\Delta t^2)$. However, one must take $ N$ steps of size $ \Delta t$ to reach a given time $ t_N$ , where $ N = (t_N -
t_0)/\Delta t$ . Hence, the accumulated error in reaching a given time $ t_{N}$ is approximately proportional to $ \Delta t = \Delta t^2 /
\Delta t$ 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.

Space-discretisation error

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 $ \Delta x^2\Delta t$, which means that the accumulated errors should be approximately proportional to $ \Delta x^2 = \Delta x^2\Delta t/\Delta t$. Again, this can be reduced by halving the step-size in space, until the changes that occur are less than the error tolerance.

Windowing error

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.

Instability errors

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.

Round-off errors

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