# 2.4 Analysis of Finite Difference Methods

## 2.4.3 Truncation Error for a PDE

Measurable Outcome 2.8

In the discussion of ODE integration, we used the ideas of consistency and stability to prove convergence through the Dahlquist Equivalence Theorem. Similar concepts also exist for PDE discretizations, however, we cannot cover these here. We will briefly look at the truncation error for a partial differential equation. We have already discussed the local truncation error for finite difference approximation of derivatives.

Similar to the ODE case, the truncation error is defined as the remainder after an exact solution to the governing equation is substituted into the finite difference approximation. For example, suppose we are using the FTCS algorithm in Equation (2.57) to approximate the one-dimensional convection-diffusion equation. Then the local truncation error for the PDE approximation is defined as,

 $\tau \equiv \frac{U_ i^{n+1}-U_ i^ n}{{\Delta t}} + u_{i}^ n\delta _{2x} U^ n_{i} - \mu \delta ^2_ x U^ n_{i}, \label{equ:lte_ ftcs}$ (2.65)

where $$U(x,t)$$ is an exact solution to Equation (2.55).

Note that the truncation error defined here for PDE's is not quite a direct analogy with the standard definition of local truncation error used in ODE integration, specifically in Equation (1.49). In particular, in the ODE case, the truncation error is defined as the difference between the numerical solution and the exact solution after one step of the method (starting from exact values). However, in the PDE case, we have defined the truncation error as the remainder after an exact solution is substituted into the numerical method when the numerical method is written in a form that approximates the governing PDE.

Except for this difference in the definition, the calculation of the local truncation follows the same procedure as in the ODE case in which Taylor series substitutions are used to expand the error in powers of $${\Delta t}$$. Continuing on with our example, we use Taylor series of $$U$$ about $$t=t^ n$$ and $$x=x_ i$$. However, we can use our previous results from the analysis of the truncation error of spatial derivatives. Specifically, we showed in during in-class discussions that,

 $$\displaystyle \delta _{2x} U_ i$$ $$\displaystyle =$$ $$\displaystyle {U_ x}_ i + \frac{1}{6} {\scriptstyle \Delta } x^2 {U_{xxx}}_ i + O({\scriptstyle \Delta } x^4)$$ (2.66) $$\displaystyle \delta _{x}^{2} U_ i$$ $$\displaystyle =$$ $$\displaystyle {U_{xx}}_ i + \frac{1}{12}{\scriptstyle \Delta } x^2 {U_{xxxx}}_ i + O({\scriptstyle \Delta } x^4)$$ (2.67)

Using these results,

 $\tau = \frac{U_ i^{n+1}-U_ i^ n}{{\Delta t}} + u_{i}^ n\left[{U_ x}_ i^ n + \frac{1}{6}{\scriptstyle \Delta } x^2 {U_{xxx}}_ i^ n + O({\scriptstyle \Delta } x^4) \right] - \mu \left[{U_{xx}}_ i^ n + \frac{1}{12}{\scriptstyle \Delta } x^2 {U_{xxxx}}_ i^ n + O({\scriptstyle \Delta } x^4) \right]$ (2.68)

Then, performing a similar Taylor series of the time derivative approximation gives,

 $\frac{U^{n+1} - U^ n}{{\Delta t}} = {U_ t}^ n + \frac{1}{2}{\Delta t}{U_{tt}}^ n + O({\Delta t}^2).$ (2.69)

Substituting this into $$\tau$$ and collecting terms in powers of $${\Delta t}$$ and $${\scriptstyle \Delta } x$$ gives,

 $$\displaystyle \tau$$ $$\displaystyle =$$ $$\displaystyle {U_ t}^ n_ i + u_{i}^ n {U_ x}_ i^ n - \mu {U_{xx}}_ i^ n +$$ (2.70) $$\displaystyle \frac{1}{2}{\Delta t}{U_{tt}}^ n_ i + O({\Delta t}^2) +$$ (2.71) $$\displaystyle \frac{1}{6}{\scriptstyle \Delta } x^2 u_{i}^ n {U_{xxx}}_ i^ n - \frac{1}{12}{\scriptstyle \Delta } x^2 \mu {U_{xxxx}}_ i^ n + O({\scriptstyle \Delta } x^4)$$ (2.72)

The first line of this equation is actually just the PDE, evaluated at $$t=t^ n$$ and $$x=x_ i$$. Since $$U$$ is an exact solution to the PDE, this is zero. The second line shows that the time discretization introduces an $$O({\Delta t})$$. The third line shows that the spatial discretization introduces an $$O({\scriptstyle \Delta } x^2)$$ error. Thus, this numerical method is first-order accurate in time and second-order accurate in space.

Summary The truncation error is defined as the remainder after an exact solution to the governing equation is substituted into the finite difference approximation, and is computed using Taylor series expansions to expand the error in terms of $${\Delta t}.$$

## Exercise

Consider the following convection-diffusionsteady-state PDE: $$vU_ x = \mu U_{xx}$$ and the following discretization: $$v_ i\delta _ x^{-}U_ i = \mu \delta _ x^2U_ i$$. What is the order of accuracy for this finite difference approximation?

Exercise 1

Answer: Since the backwards difference is first-order accurate, the accuracy of the entire approximation is first-order.