Crank-Nicolson method for solving parabolic problem in 1D

computational mathematicsfinite differencesheat equationnumerical methods

Condiser the following initial-boundary value problem for $u = u(x,t),$
$$u_t – au_{xx} = f(x,t) \text { for } 0 < x< L \text { and } 0 < t < T,$$

along with boundary and initial conditions. This is a model of heat conduction in $1$D.

We know that the implicit Euler method is first-order accurate in time because the first-order backward difference approximates $u_t(x_p, t_n)$ only to first order in $\Delta t$, that is,

$$\dfrac {u(x_p,t_n) – u(x_p,t_{n-1})}{\Delta t} = u_t(x_p,t_n) + O(\Delta t).$$

However, viewed as an approximation to $u_t(x_p,t_{n-1/2})$, the backward difference becomes a central difference (with step-size $\frac{1}{2}\Delta t$), and is therefore second-order accurate by:
$$\dfrac {u(x_p,t_n) – u(x_p,t_{n-1})}{\Delta t} = u_t(x_p,t_{n-1/2}) + O(\Delta t^2).$$

Suppose $U_p^{n} \approx u(x_p,t_n).$ Then $u_t(x_p,t_n) \approx \dfrac{U_p^{n} – U_p^{n-1}}{\Delta t}.$

Furthermore, $u_{xx}(x_p,t_n) \approx \dfrac{U_{p+1}^{n-1/2} – 2U_p^{n-1/2} + U_{p-1}^{n-1/2}}{\Delta x ^2} $ where $U_p^{n-1/2} = \dfrac{U_p^n + U_p^{n-1}}{2} \approx u(x_p, t_{n-1/2}) $

When viewed as an approximation to $u_t(x_p,t_{n+1/2})$, the forward difference (as employed in the explicit Euler) becomes a central difference (with step-size $\frac{1}{2}\Delta t$), and is therefore second-order accurate by:
$$\dfrac {u(x_p,t_{n+1}) – u(x_p,t_n)}{\Delta t} = u_t(x_p,t_{n+1/2}) + O(\Delta t^2).$$

My question is the following:

Can we, in the Crank-Nicolson method, approximate $u_t(x_p,t_n)$ by $\dfrac{U_p^{n+1} – U_p^{n}}{\Delta t}$ and $u_{xx}(x_p,t_n) \text { by }$ $$\dfrac{U_{p+1}^{n + 1/2} – 2U_p^{n + 1/2 } + U_{p-1}^{n + 1/2}}{\Delta x^2} \text { where } U_p^{n + 1/2} = \frac{1}{2}(U_p^n + U_p^{n+1}).$$

Will this make any difference except that the index $n$ will be from $1 \text { to } N$ in the first case and $0 \text { to } N – 1$ in the latter ?

Best Answer

You seem to be discussing the implicit midpoint method, $$ U^{j+1}=U^j+ΔtF\left(\tfrac12(U^{j+1}+U^j)\right). $$ Which could also be implemented as a backwards Euler step of half the step size $$ U^*=U^j+\frac{Δt}2F(U^*) $$ followed by a forward Euler step $$ U^{j+1}=U^*+\frac{Δt}2F(U^*). $$ Yes, that is a second order method (in time), the same as the implicit trapezoidal method $$ U^{j+1}=U^j+\frac{Δt}2(F(U^{j+1})+F(U^j)) $$ that is usually associated as the time evolution in C-N.

Related Question