Does determining the truncation error of a numerical scheme depend on the problem the scheme is applied to?
For example, If Crank-Nicolson is applied to heat equation, does that impact the truncation error?
Does determining the truncation error of a numerical scheme depend on the problem the scheme is applied to?
For example, If Crank-Nicolson is applied to heat equation, does that impact the truncation error?
Yes, and no. Let's have a look at the definition of the truncation error on the example of the explicit Euler method.
Given a differential equation $u'(t)=f(t,u(t))$ the method reads $$\frac{u_n-u_{n-1}}{h_n} = f(t_{n-1},u_{n-1}).$$
The truncation error in step $n$ is given by $$τ_n:=h_n^{-1}(u(t_n)-u(t_{n-1})) - f(t_{n-1},u(t_{n-1})).$$
To remember this a bit complicated looking formula, think of the truncation error as the residual of the method applied to the exact solution. If the method was exact, the truncation error would be 0.
The method is called consistent, if the method generates the exact solution for $h→0$. Using Taylor expansion it follows: \begin{align*} τ_n&=(t_n-t_{n-1})^{-1}(u(t_n)-u(t_{n-1})) - f(t_{n-1},u(t_{n-1})) \\ &=u'(t_{n-1}) + \frac{1}{2}(t_n-t_{n-1})^{-1}u''(ξ_n) - f(t_{n-1},u(t_{n-1})) \\ &=\frac{1}{2}h_nu''(ξ_n). \end{align*} Hence: $$\|τ_n\|≤\frac{1}{2}h_n\max_{t_n∈I_n}\|u''\|.$$
And the exponent in $h$ gives us the order of consistency.
To answer the question: It was necessary, that the right hand side $f(t,u)$ was sufficiently differentiable, so that $u$ can be expanded by Taylor. In this case the solution $u$ had to be continuous differentiable twice.
In this sense the consistency depends on the equation you want to solve, but it is a general property