$$ \newcommand{\D}{\displaystyle} \renewcommand{\eqref}[1]{Eq.~(\ref{#1})} $$




7.6 Truncation error, consistency and convergence

7.6.1 Truncation error

Let \( U(x,t) \) be the exact solution of a PDE, written as \( L(U)=0 \), where L(U) is the differential operator, and \( u \) the numerical solution given by a generic numerical scheme, also written in operator form as \( F(u)=0 \). In this last case \( F(u) \) is the so-called numerical operator. The exact solution at \( (x_i,\ t_n) \) is given by: $$ \begin{align} U^n_i & \equiv U(x_i,t_n) \qquad \mathrm{ der } \quad x_i=i\cdot \Delta x=i\cdot h, \qquad \ i=0,1,2,\dots \tag{7.82}\\ t_n & = n\cdot \Delta t=n\cdot k,\ n=0,1,2,\dots \tag{7.83} \end{align} $$

We define the local truncation error \( T^n_i \) as: $$ \begin{equation} \tag{7.84} T^n_i=F(U^n_i)-L(U^n_i)=F(U^n_i) \end{equation} $$

Since in general the exact solution \( U(x,t) \) is not available, one finds \( T^n_i \) by expressing the exact solution at required space-time locations using Taylor expansions.

Some expansions are given to illustrate the concept: $$ \begin{equation} \tag{7.85} U^n_{i\pm1}\equiv U(x_{i\pm h},t_n)=U^n_i\pm h\cdot \frac{\partial U}{\partial x}\bigg|^n_i+\frac{h^2}{2}\cdot \frac{\partial^2U}{\partial x^2}\bigg|^n_i\pm \frac{h^3}{6}\cdot \frac{\partial^3U}{\partial x^3}\bigg|^n_i+\dots \end{equation} $$ $$ \begin{equation} \tag{7.86} U^{n\pm1}_{i}\equiv U(x_{i},t_{n\pm k})=U^n_i\pm k\cdot \frac{\partial U}{\partial t}\bigg|^n_i+\frac{k^2}{2}\cdot \frac{\partial^2U}{\partial t^2}\bigg|^n_i\pm \frac{k^3}{6}\cdot \frac{\partial^3U}{\partial t^3}\bigg|^n_i+\dots \end{equation} $$

For example, let us find the local truncation error \( T^n_i \) for the FTCS scheme applied to the diffusion equation. In this case the analytical operator is $$ \begin{equation*} L(U)=\frac{\partial U}{\partial t}-\frac{\partial^2U}{\partial x^2}=0 \end{equation*} $$ $$ \begin{equation} \tag{7.87} T^n_i=F(U^n_i)=\frac{U^{n+1}_i-U^n_i}{k}-\frac{U^n_{i-1}-2U^n_i+U^n_{i+1}}{h^2} \end{equation} $$

Replacing (7.85) in (7.87): $$ \begin{equation*} \begin{array}{c} T^n_i=\left( \dfrac{\partial U}{\partial t}-\dfrac{\partial^2U}{\partial x^2}\right)^n_i +\left(\dfrac{k}{2}\dfrac{\partial^2U}{\partial t^2}-\dfrac{h^2}{12}\dfrac{\partial^4U}{\partial x^4}\right)^n_i +\dfrac{k^2}{6}\dfrac{\partial^3U}{\partial t^3}\bigg|^n_i+O(k^3,h^4)\\ \text{Da } \dfrac{\partial U}{\partial t}-\dfrac{\partial^2U}{\partial x^2}=0 \end{array} \end{equation*} $$ $$ \begin{equation} \tag{7.88} T^n_i=\left(\dfrac{k}{2}\dfrac{\partial^2U}{\partial t^2}-\dfrac{h^2}{12}\dfrac{\partial^4U}{\partial x^4}\right)^n_i +\text{ higher order terms} \end{equation} $$

(7.88) shows that \( T^n_i=O(k)+O(h^2) \), as expected.

(7.88) can also be written as: $$ \begin{equation*} T^n_i=\frac{h^2}{12}\cdot\left(6\dfrac{k}{h^2}\dfrac{\partial^2U}{\partial t^2}-\dfrac{\partial^4U}{\partial x^4}\right)^n_i+O(k^2)+O(h^4) \end{equation*} $$

By choosing \( D=\dfrac{k}{h^2}=\dfrac{1}{6} \), we get: $$ \begin{equation} \tag{7.89} T^n_i=O(k^2)+O(h^4) \end{equation} $$

\( \Delta t \) becomes very small for \( D=1/6 \), but with today's computers this should not be a problem, except for the possible accumulation of rounding errors.

7.6.2 Consistency

We say that a the discretization of a differential equation, i.e. the numerical scheme, is consistent with the original differential if the local truncation error \( T^n_i\to 0 \) when \( \Delta x \) and \( \Delta t\to 0 \) independent of each other.

7.6.3 Example: Consistency of the FTCS-scheme

From (7.88) $$ \begin{equation*} T^n_i=\left(\dfrac{k}{2}\dfrac{\partial^2U}{\partial t^2}-\dfrac{h^2}{12}\dfrac{\partial^4U}{\partial x^4}\right)^n_i \to 0 \text{ for } h \text{ and } k\to 0 \end{equation*} $$

This means that the FTCS scheme is consistent with the diffusion equation.

7.6.4 Example: Consistency of the DuFort-Frankel scheme

Let us look at the DuFort-Frankel scheme introduced in the section 7.5.2 Dufort-Frankel scheme (1953): $$ \begin{equation*} T^n_i=\dfrac{U_i^{n+1}-U^{n-1}_i}{2k}-\dfrac{\left[U_{i-1}^n+U_{i+1}^n-(U^{n+1}_i+U_i^{n-1}) \right]}{h^2} \end{equation*} $$

Using the series expansions (7.85) and (7.86): $$ \begin{equation} \tag{7.90} T^n_i=\left[ \frac{\partial U}{\partial t}-\frac{\partial^2 U}{\partial x^2}+\left(\frac{k}{h}\right)^2\frac{\partial^2U}{\partial t^2} \right]^n_i+\left[ \frac{k^2}{6}\frac{\partial^3U}{\partial t^3}-\frac{h^2}{12}\frac{\partial^4U}{\partial x^4}\right]^n_i + O\left(\frac{k^4}{h^2},k^4,h^4\right) \end{equation} $$

Due to the factor \( \left(\dfrac{k}{h}\right)^2 \) it is important to specify how \( k \) and \( h\to0 \). The scheme is not necessarily consistent with the underlying differential equation. Such schemes are normally called conditionally consistent.

Case 1

Set \( r_0=\dfrac{k}{h}\to k=r_0\cdot h \), and let \( r_0= \) be a positive constant.

Inserting \( r_0 \) in (7.90): $$ \begin{equation*} T^n_i=\left( \frac{\partial U}{\partial t}-\frac{\partial^2U}{\partial x^2}+r_0^2\cdot \frac{\partial^2U}{\partial t^2} \right)^n_i+O(h^2) \end{equation*} $$

For \( h\to0 \), we see that the DuFort-Frankel scheme is consistent with the hyperbolic equation \( \dfrac{\partial U}{\partial t}+r_0^2 \dfrac{\partial^2U}{\partial t^2}=\dfrac{\partial^2U}{\partial x^2} \) and not with the original diffusion equation.

Case 2

Setting \( r_0=\dfrac{k}{h^2}\to k =r_0\cdot h^2 \). Inserting \( r_0 \) in (7.90): $$ \begin{equation*} \begin{array}{ll} T^n_i&=\left[\frac{\partial U}{\partial t}-\frac{\partial^2U}{\partial x^2} \right]^n_i+\left[r_0^2h^2\frac{\partial^2U}{\partial t^2}+ \frac{k^2}{6}\frac{\partial^3U}{\partial t^3}-\frac{h^2}{12}\frac{\partial^4U}{\partial x^4}\right]^n_i+O\left(\frac{k^4}{h^2},k^4,h^4\right)\\ &= \left[ r_0^2h^2 \frac{\partial^2U}{\partial t^2}+\frac{k^2}{6}\frac{\partial^3U}{\partial t^3}-\frac{h^2}{12}\frac{\partial^4U}{\partial x^4}\right]^n_i+O\left(r_0^4h^6,\ k^4,\ h^4 \right)\\ \end{array} \end{equation*} $$ $$ \begin{equation*} \text{da } \left[ \frac{\partial U}{\partial T}-\frac{\partial^2U}{\partial x^2}\right]^n_i=0 \end{equation*} $$

We see that in this case \( T^n_i\to 0 \) for \( h \) and \( t\to0 \) with \( T^n_i=O(k^2)+O(h^2) \).

The scheme is now consistent with the diffusion equation. Therefore, the DuFort-Frankel scheme can be used with \( k=r_0\cdot h^2 \). However, this poses a restriction in \( \Delta t \), arising from consistency constrains and not from stability considerations. Non-consistent schemes usually arise when we change the scheme after we have made the Taylor expansions in the usual way.

7.6.5 Convergence

It is generally difficult to prove the convergence of a difference scheme. Therefore, many attempts have been made to replace the above definition with conditions that are easier to prove individually but which together are sufficient for convergence.

A very important result in this direction is given by the following theorem

Lax's equivalence theorem: Given a well-posed linear initial value problem and a consistent numerical scheme, stability of the same scheme is a necessary and sufficient condition for convergence.

See section 4.3 in the Numeriske Beregninger for more details. When we see all the conditions that must be fulfilled in order for Lax's theorem to be used, we understand the difficulties of proving convergence in more general issues.