Loading [MathJax]/extensions/TeX/boldsymbol.js
\newcommand{\uex}{{u_{\small\mbox{e}}}}
\newcommand{\half}{\frac{1}{2}}
\newcommand{\tp}{\thinspace .}
\newcommand{\Oof}[1]{\mathcal{O}(#1)}
Checking convergence rates
The next function estimates convergence rates, i.e., it
- performs m simulations with halved time steps: 2^{-k}\Delta t , k=0,\ldots,m-1 ,
- computes the L_2 norm of the error,
E = \sqrt{\Delta t_i\sum_{n=0}^{N_t-1}(u^n-\uex(t_n))^2} in each case,
- estimates the rates r_i from two consecutive
experiments (\Delta t_{i-1}, E_{i-1}) and (\Delta t_{i}, E_{i}) ,
assuming E_i=C\Delta t_i^{r_i} and E_{i-1}=C\Delta t_{i-1}^{r_i} :