Computing the order of accuracy of a numerical method

1k Views Asked by At

I am solving an advection-diffusion equation \begin{equation} u_{t}=au_{x}+Du_{xx} \end{equation} by some numerical method in matlab, the numerical solution matrix is denoted by Ynum, while the exact solution matrix is denoted by Ytru, and both of them have the same dimension, how can I calculate the order of accuracy of this numerical method ?.

Thank you in advance.

1

There are 1 best solutions below

0
On

When you have a numerical method with error $E(h) = C h^{\alpha}$ where $C$ does not depend on $h$, a way of estimating the order of convergence $\alpha$ is to estimate the error for different values of $h$.

$$ \frac{E(h_2)}{E(h_1)}=\frac{C h_2^{\alpha}}{C h_1^{\alpha}} = (h_2/h_1)^{\alpha} \Rightarrow \alpha \approx \frac{\log(E(h_2)/E(h_1))}{\log(h_2/h_1)} $$

In this case you can estimate separately the order of convergence in space and time by using the above formula when i. varying $\delta x$ for fixed $\delta t$ and ii. varying $\delta t$ for fixed $\delta x$.