Partial Differential Equations – Local Truncation Error of Crank-Nicolson for PDE $u_t+au_x = 0$

finite difference methodshyperbolic-equationspartial differential equationstruncation error

Exercise 4:
The Crank-Nicolson scheme for $u_t + a u_x = 0$ is given by
$$ \frac{U_{j,n+1}-U_{j,n}}{\Delta t} + \frac{a}{2}\frac{D_xU_{j,n}}{2\Delta x} + \frac{a}{2}\frac{D_xU_{j,n+1}}{2\Delta x} = 0 .$$
Show that the LTE is given by
$$ \mathcal{L}_\Delta u = au_{xxx} \left(\frac{1}{6} + \frac{p^2}{12}\right) {\Delta x}^2 + O({\Delta x}^3,{\Delta t}^3) , $$
where $p = a{\Delta t}/{\Delta x}$. Find the amplification factor and find the conditions for stability.

I am just trying to work out the LTE of the Crank-Nicolson scheme, however i do not get the same answers the book. Here is my working if anyone could have a look and tell me what i am doing wrong, thank you.

The scheme $ u_j^{n+1} = u_j^n -\frac{1}{4}(u_{j+1}^n -u_{j-1}^{n}+ u_{j+1}^{n+1}-u_{j-1}^{n+1})$ rewrites as
$$
\frac{(u(x,t+\Delta t) – u(x.t)}{\Delta t} + \frac{a}{4 \Delta x} [ u(x+\Delta x,t) – u(x-\Delta x ,t) + u(x+ \Delta x, t+ \Delta t)- u ( x-\Delta x , t+\Delta t)
$$

Expanding using Taylor series, I get
$$
u_t + \frac{1}{2} u_{tt} \Delta t + \frac{1}{6}u_{ttt} \Delta t^{2} + O(\Delta t^{3})
$$

and similarly for the $x$ and $t$. I get
$$
\frac{a}{4 \Delta x} [ u(x,t) + u_x \Delta + \frac{1}{2} u_{xx} \Delta x^2 + \frac{1}{6} u_{xxx} \Delta x^{3} + O(\Delta x ^{4})- (u(x,t)-u_{x} \Delta x……)]
$$

after some simplification i get the even terms remaining..
$$
\frac{a}{2}u_{x} + \frac{au_{xxx}\Delta x^{2}}{12} + O(\Delta x^{3})
$$

similarly for the last expansion. And $t$ and $x$ together, i get
$$
\frac{a}{2}u_{x} + \frac{a}{2} u_{xt} \Delta t + o(\Delta t^{2}) + \frac{a}{12}u_{xxx} \Delta x^{2}
$$

Putting all these terms back into the equation and using
$u_{t} – = -au_{x}$,
$u_{tt} = -au_{xt}$, I am left with $\frac{1}{6} u_{ttt} \Delta t^{2} + \frac{1}{6} a u_{xxx} \Delta x^{2} + O( \Delta t^{3} \Delta x^{3})$.
However the answer in the book is $ au_{xxx}(\frac{1}{6} + \frac{p^2}{12} )\Delta x^{2}$.

Best Answer

Let us write the Crank-Nicolson method for the linear advection equation $u_t + au_x = 0$ by averaging forward and backward Euler time-integration and by using centered spatial differences: $$ \frac{u_{j}^{n+1} - u_j^n}{\Delta t} = -\frac{a}{2}\left(\frac{u_{j+1}^n - u_{j-1}^n}{2\Delta x} + \frac{u_{j+1}^{n+1} - u_{j-1}^{n+1}}{2\Delta x}\right) , \qquad u_j^n \simeq u(j\Delta x, n\Delta t) . \tag{1} $$ Thus, the scheme reads $ u_{j}^{n+1} = u_j^n - \frac{1}{4} p\big(u_{j+1}^n - u_{j-1}^n + u_{j+1}^{n+1} - u_{j-1}^{n+1}\big) = 0 $, where $p = {a \Delta t}/{\Delta x}$ denotes the Courant number. To perform the local truncation error analysis, we need to expand the smooth function $u$ as a Taylor series in two variables in the vicinity of $(x, t)$. Doing so at the third order, we have \begin{aligned} v &= u + h u_x + k u_t + \tfrac{1}{2} \left( h^2 u_{xx} + 2 hk u_{xt} + k^2 u_{tt}\right) \\ &+ \tfrac{1}{6} \left( h^3 u_{xxx} + 3 h^2 k u_{xxt} + 3 h k^2 u_{xtt} + k^3 u_{ttt}\right) + O(h^4 + k^4) \end{aligned} with the notation $v(x,t) = u(x+h, t+k)$ for the steps $h \in \lbrace{0, \pm\Delta x}\rbrace$ and $k \in \lbrace{0,\Delta t}\rbrace$. Assuming that $u$ satisfies the PDE $u_t = -au_x$, we replace time-derivatives by spatial derivatives as follows $$ v = u + (h-ak)u_x + \tfrac{1}{2} ( h-ak)^2 u_{xx} + \tfrac{1}{6} ( h-ak)^3 u_{xxx} + O(h^4 + k^4) . $$ For a fixed value of the Courant number, we obtain the following expressions to be substituted in the numerical scheme $(1)$: \begin{aligned} v_{j}^{n+1} &= u - p\Delta x\,u_x + \tfrac{1}{2}(p\Delta x)^2 u_{xx} - \tfrac{1}{6} (p\Delta x)^3 u_{xxx} + O(\Delta x^4) \\ v_j^n &= u \\ v_{j\pm 1}^{n} &= u \pm \Delta x\,u_x + \tfrac{1}{2} \Delta x^2 u_{xx} \pm \tfrac{1}{6} \Delta x^3 u_{xxx} + O(\Delta x^4) \\ v_{j\pm 1}^{n+1} &= u + (\pm 1 -p)\Delta x\, u_x + \tfrac{1}{2} ( \pm 1-p)^2\Delta x^2 u_{xx} + \tfrac{1}{6} ( \pm 1 -p)^3\Delta x^3 u_{xxx} + O(\Delta x^4) \end{aligned} The divided finite-difference operators become \begin{aligned} \frac{v_{j}^{n+1} - v_j^n}{\Delta t} &= {-a} u_x + \tfrac{1}{2}pau_{xx} \Delta x - \tfrac{1}{6} p^2 au_{xxx} \Delta x^2 + O(\Delta x^3) \, , \\ \frac{v_{j+1}^{n} - v_{j-1}^n}{2\Delta x} &= u_x + \tfrac{1}{6} u_{xxx} \Delta x^2 + O(\Delta x^3) \, , \\ \frac{v_{j+1}^{n+1} - v_{j-1}^{n+1}}{2\Delta x} &= u_x - pu_{xx}\Delta x + \tfrac{1}{6} (1 + {3}p^2) u_{xxx} \Delta x^2 + O(\Delta x^3) \end{aligned} leading to the local truncation error $a u_{xxx} \big({\tfrac{1}{6}} + \tfrac{1}{12} p^2\big) \Delta x^2 + O(\Delta x^3)$.