Report#

Question 1: Accuracy#

This exercise concerns the accuracy analysis of the \(\theta\)-method. For this, we will use Taylor series expansions to derive the truncation error of the method. To do this in a proper way, we consider the following linear test equation

\[ \frac{dy}{dt} = \lambda\ y \]

with \(\lambda < 0\) an arbitrary constant.

Verify that the truncation error of the \(\theta\)-scheme is of first order if \(\theta \neq 0.5\) and second order if \(\theta = 0.5\).

Hint: Make full use of the test equation and its derivatives.

First, we replace the numerical solution \(y^n\) by the exact one, that is, \(y(t_n)\). Hence, we consider the following equation for the error analysis

\[ \frac{y(t_{n+1})-y(t_n)}{\Delta t} = \lambda \left ( (1-\theta) y(t_n) + \theta y(t_{n+1}) \right ) + \tau_{\Delta t} \]

with \(\tau_{\Delta t}\) the truncation error.

Next, we expand the function \(y(t_{n+1})\) using Taylor series till order 3, as follows

\[ y(t_{n+1}) = y(t_n) + \Delta t\,y_t(t_n) + \frac 12 \Delta t^2\,y_{tt}(t_n) + \frac 16 \Delta t^3\,y_{ttt}(t_n) \]

with \(y_t\), \(y_{tt}\) and \(y_{ttt}\) the first, second and third derivatives of \(y\) to \(t\), respectively. Note that we have truncated the Taylor series after third order since we expect second order accuracy approximation for the first derivative (2+1=3).

By substitution we obtain the following expression of the truncation error

\[\begin{split} \begin{align*} \tau_{\Delta t} &= \frac{y(t_{n+1})-y(t_n)}{\Delta t} - \lambda \left ( (1-\theta) y(t_n) + \theta y(t_{n+1}) \right ) \\ \\ &= y_t + \frac 12 \Delta t\,y_{tt} + \frac 16 \Delta t^2\,y_{ttt} - \lambda \left ( y + \theta \Delta t\,y_t + \frac 12 \theta \Delta t^2\,y_{tt} + \frac{1}{6} \theta \Delta t^3\,y_{ttt} \right ) + \mathcal{O}(\Delta t^4) \\ \\ &= \left ( {\color{red} y_t - \lambda y} \right ) + \Delta t \left ( {\color{green} \frac 12 y_{tt} - \lambda \theta y_t} \right ) + \Delta t^2 \left ( \frac 16 y_{ttt} - \frac 12 \lambda \theta y_{tt} \right ) + \mathcal{O}(\Delta t^3) \\ \\ &= \Delta t \left ( {\color{green} \frac 12 y_{tt} - \lambda \theta y_t} \right ) + \Delta t^2 \left ( \frac 16 y_{ttt} - \frac 12 \lambda \theta y_{tt} \right ) + \mathcal{O}(\Delta t^3) \\ \\ &= \mathcal{O}(\Delta t) \quad \text{if} \, \, \theta \neq \frac12 \\ &= \mathcal{O}(\Delta t^2) \quad \text{if} \, \, \theta = \frac12 \end{align*} \end{split}\]

Note that we have used the following expressions here:

\[ {\color{red} y_t = \lambda y} \quad \Rightarrow \quad {\color{green} y_{tt} = \lambda y_t} \]

Question 2: Stability#

In the notebook, you solved the advection-diffusion equation

\[ \frac{\partial c}{\partial t} + u \frac{\partial c}{\partial x} - K\frac{\partial^2 c}{\partial x^2} = 0\, , \quad x \in [0,L] \]

a) What did you observe about the stability of the following schemes:

  • the FTCS scheme

  • the FTBS scheme

  • the trapezoidal rule combined with central differences

b) Derive the stability limit for the FTCS scheme (for comparing with the numerically found limit, recall that we used \(u = 0.5\) m/s, \(K = 125\) \(m^{2}/s\) and \(\Delta x = 400\) m)

a)

  • the trapezoidal rule is unconditionally stable

  • FTBS and FTCS are conditionally stable, with a smaller critical time step for FTBS

b)

  • The FTCS scheme is stable if and only if

    \[ \frac{K\Delta t}{\Delta x^2} \leq \frac12 \quad \text{and} \quad |P_{\Delta}| \leq 2 \]

With the following numbers from the notebook \(u = 0.5\) m/s, \(K = 125\) \(m^{2}/s\) and \(\Delta x = 400\) m, we have the following stability limits:

  • FTCS: \(\Delta t \leq 640\) s (and \(P_\Delta = 1.6\) );

  • FTBS: \(\Delta t \leq 355.5555\) s (and \(P_\Delta = 0.88888\) );

Question 3: Numerical diffusion#

Given the BTBS scheme derive a formula for its numerical diffusion. Compute this amount and compare your result with the one from Task 3.2.

Hint: first write down this scheme (backward in time, backward in space) and next find the Taylor expansions of, amongst others, \(c^{n+1}_{m-1}\), and substitute into the scheme.

The BTBS scheme is given by (\(\theta = 1\))

\[ \frac{c_m^{n+1}-c_m^n}{\Delta t} + u \frac{c_m^{n+1} - c_{m-1}^{n+1}}{\Delta x} = 0 \]

with \(u > 0\).

The goal is to find the amount of numerical diffusion that is produced by the BTBS scheme. The idea is to make this scheme to be consistent with an advection-diffusion equation (the so-called modified equation) so that we can see immediately how much numerical diffusion is involved. So, in order to get the advection-diffusion form, we replace the numerical solution by the exact one and expand this solution around point \((x_m,t_n)\). For convenience, \(c_m^n\) denotes the exact solution of \(c(x_m,t_n)\).

The following coefficients need to be expanded around point \((m,n)\) in the \((x,t)\)-space: \(c_m^{n+1}\) and \(c_{m-1}^{n+1}\). You may noticed that the last one needs to be expanded both in \(x\) and in \(t\). This is always the case as soon as you have an implicit scheme, like the BTBS scheme.

Let us first expand \(c_m^{n+1}\), as follows

\[ c_m^{n+1} = c_m^n + \Delta t c_t|_{m,n} + \frac12 \Delta t^2 c_{tt}|_{m,n} \]

where the subscript \(t\) denotes differentiation to \(t\). Note that the expansion goes up to and including the second order, as we are only interesting in the diffusion part, that is, the terms containing the second derivative \(\partial^2 c/\partial x^2\). Also note that

\[ \frac{\partial^2 c}{\partial t^2} = u^2 \frac{\partial^2 c}{\partial x^2} \]

Next, we expand \(c_{m-1}^{n+1}\), as follows

\[ c_{m-1}^{n+1} = c_m^n + \Delta t c_t|_{m,n} - \Delta x c_x|_{m,n} + \frac12 \Delta t^2 c_{tt}|_{m,n} - \Delta t \Delta x c_{tx}|_{m,n} + \frac12 \Delta x^2 c_{xx}|_{m,n} \]

Note the mixed derivative \(c_{tx}\) which can be expressed in \(c_{xx}\), as follows

\[ c_{tx} = -u c_{xx} \]

Now, we have completed the expansions in the sense that they contain all the second derivatives \(c_{tt}\), \(c_{tx}\) and \(c_{xx}\). The final step is to substitute all these terms into the BTBS scheme, and then group all terms that contain the second derivative.

Summing up, we get

\[ K_a = \left [ - \frac12 \Delta t u^2 +u^2 \Delta t + \frac12 u \Delta x \right ] \]

or

\[ K_a = \frac12 u \left ( u \Delta t + \Delta x \right ) \]

Substitute the numbers \(u = 0.5\) m/s, \(\Delta t = 600\) s and \(\Delta x = 400\) m, we obtain \(K_a = 175\) m2/s. In terms of order of magnitude, this is comparable to the value of 147 m2/s that we found earlier.

General feedback

Will follow

How did things go? (Optional)#

Use this space to let us know if you ran into any challenges while working on this GA, and if you have any feedback to report.

By Marcel Zijlema, Delft University of Technology. CC BY 4.0, more info on the Credits page of Workbook.