3.11 Example
69
Since this problem has an analytic solution, Eq. (3.62), we can calculate
the error in the numerical solution directly. The following average error is
used as a measure:
The problem was solved using both CDS and UDS and both uniform and
non-uniform grids with up to 321 nodes. The average error is plotted as a
function of average mesh spacing in Fig. 3.11. The UDS error asymptotically
approaches the slope expected of a first-order scheme. The CDS shows, from
the second grid onwards, the slope expected of a second-order scheme: the
error is reduced by two orders of magnitude when the grid spacing is reduced
one order of magnitude.
This example clearly shows that the solution on a non-uniform grid converges in the same way as the solution on a uniform grid, even though the
truncation error contains a first-order term as explained in Sect. 3.3.4. For
the CDS, the average error on a non-uniform grid is almost an order of magnitude smaller than on a uniform grid with the same number of grid nodes.
This is due to the fact that the mesh spacing is small where the error would
be large. That Fig. 3.11 indicates larger error for UDS on a non-uniform than
on a uniform grid is due to the fact that large errors at a few nodes on a uniform grid have a small effect on the average; maximum nodal error is much
larger on uniform than on non-uniform grids, as can be seen by examining
Figs. 3.8 and 3.10.
For related examples, see the last section of the next chapter.
Précédent

- 82/431

Suivant