13.6 Practice Problems
Problem 13.6.1. Show that \(\bigl (u(x + h) - 2u(x) + u(x - h)\bigr )/h^2 = u''(x) + \frac {h^2}{12}u''''(x) + O(h^4)\).
Show solution
Solution. \(u(x \pm h) = u \pm hu' + \frac {h^2}2u'' \pm \frac {h^3}6u''' + \frac {h^4}{24}u'''' + O(h^5)\). Adding, the odd terms cancel: \(u(x + h) + u(x - h) - 2u = h^2u'' + \frac {h^4}{12}u'''' + O(h^6)\); divide by \(h^2\).
Problem 13.6.2. Derive the amplification factor of backward Euler for the heat equation and show that it is unconditionally stable.
Show solution
Solution. Substituting \(u_j^n = G^ne^{ij\theta }\) into \(u_j^{n + 1} - u_j^n = r(u_{j + 1}^{n + 1} - 2u_j^{n + 1} + u_{j - 1}^{n + 1})\) gives \(G - 1 = rG(2\cos \theta - 2) = -4rG\sin ^2\frac \theta 2\), so \(G = 1/(1 + 4r\sin ^2\frac \theta 2) \in (0, 1]\) for every \(r > 0\).
Problem 13.6.3. For the leapfrog scheme for \(u_{tt} = c^2u_{xx}\), show that the amplification factors satisfy \(G^2 - 2(1 - 2\rho ^2\sin ^2\frac \theta 2)G + 1 = 0\) with \(\rho = c\Delta t/\Delta x\), and that \(|G| = 1\) for all \(\theta \) exactly when \(\rho \leq 1\).
Show solution
Solution. Substituting into \(u_j^{n + 1} - 2u_j^n + u_j^{n - 1} = \rho ^2\delta ^2u_j^n\) and dividing by \(G^{n - 1}e^{ij\theta }\): \(G^2 - 2G + 1 = -4\rho ^2\sin ^2\frac \theta 2\,G\). The roots have product \(1\); they are complex conjugates of modulus \(1\) when the discriminant \(4(b^2 - 1) \leq 0\), \(b = 1 - 2\rho ^2\sin ^2\frac \theta 2\), that is when \(|b| \leq 1\), which holds for all \(\theta \) iff \(\rho \leq 1\). If \(\rho > 1\), at \(\theta = \pi \), \(b < -1\) and one real root has modulus greater than \(1\).
Problem 13.6.4. Find the numerical diffusion coefficient of the upwind scheme with \(a = 1\), \(\Delta x = 0.005\) and \(\nu = 0.8\), and estimate how far a front is smeared after unit time.
Show solution
Solution. \(D = \frac {a\Delta x}2(1 - \nu ) = \frac {0.005}2\times 0.2 = 5 \times 10^{-4}\). A front diffuses over a width of order \(\sqrt {4Dt} = 0.045\) after \(t = 1\), about nine cells, consistent with the smeared edges in Software 13.5.3. At \(\nu = 1\) the scheme is exact (\(u_j^{n + 1} = u_{j - 1}^n\)) and \(D = 0\).
Problem 13.6.5. How many steps do FTCS and Crank–Nicolson need to solve \(u_t = u_{xx}\) on \((0, 1)\) to \(t = 1\) with \(\Delta x = 0.01\), if Crank–Nicolson uses \(\Delta t = 0.01\)? Compare the work.
Show solution
Solution. FTCS needs \(\Delta t \leq \frac 12\Delta x^2 = 5 \times 10^{-5}\), so \(20\,000\) steps of \(O(N)\) work each. Crank–Nicolson with \(\Delta t = 0.01\) (\(r = 100\)) takes \(100\) steps, each a tridiagonal solve, also \(O(N)\), so about \(200\) times less work for an error of order \(\Delta t^2 + \Delta x^2 \approx 2 \times 10^{-4}\) in the smooth part of the solution.
Problem 13.6.6. Show that the FTCS scheme satisfies a discrete maximum principle when \(r \leq \frac 12\), and that it fails when \(r > \frac 12\).
Show solution
Solution. For \(r \leq \frac 12\), \(u_j^{n + 1} = ru_{j - 1}^n + (1 - 2r)u_j^n + ru_{j + 1}^n\) is a convex combination, so \(\min _ku_k^n \leq u_j^{n + 1} \leq \max _ku_k^n\). For \(r > \frac 12\) take \(u^n = (\ldots , 0, 1, 0, \ldots )\): then \(u_j^{n + 1} = 1 - 2r < 0\), a new minimum below the old one.
Questions on this section
Stuck on something here? Ask below and it stays attached to this topic.