I have the following question. I have a code function that computes right-biased and left-biased approximations of the derivative of a function using WENO5 for Hamilton--Jacobi equations as described in

  Title                    = {Weighted {ENO} Schemes for {Hamilton--Jacobi} Equations},
  Author                   = {Jiang, Guang-Shan and Peng, Danping},
  Journal                  = SIAM Journal of Scientific Computing,
  Year                     = {2000},
  Month                    = jan,
  Number                   = {6},
  Pages                    = {2126--2143},
  Volume                   = {21},
  DOI                      = {10.1137/S106482759732455X},

I refer to this WENO as WENO5JP below.

I unit-test my implementation of WENO5JP by checking the order of convergence while approximating derivatives of simple smooth functions. I obtain right- and left-biased approximations of the derivative, average them, and compare this result to the analytic derivative. Then I measure error in $L_{\infty}$-norm, and then I compute the observed order of accuracy.

However, I get strange behavior when for one function I get between 5 and 6.5 order of accuracy, while for another function I get between 4 and 6 order of accuracy.

Computation of the observed order of accuracy. I use the following standard formula to estimate the order of accuracy:

$$ p_k = \frac{\ln \left( \|E_{k-1}\| / \|E_k\| \right)} {\ln \left(N_k / N_{k-1} \right)}, $$ where $p_k$ is the observed order for the grid size $N_k$, and here I use $N_k / N_{k-1} = 2$.

Details. Below are the details of convergence behavior that I get.

  1. I apply WENO5JP to a function $y = \sin x$ on domain $[0; 2\pi]$ and obtain the order of accuracy as shown in the table below

    | Resolution | Order |
    |         11 |   nan |
    |         41 |  6.68 |
    |         81 |  6.24 |
    |        161 |  6.12 |
    |        321 |  6.15 |
    |        641 |  5.12 |
    |       1281 |  0.60 |
    |       2561 | -1.36 |

Linear least squares applied to the function $E = p \ln N + \ln C$ gives estimate of the order $p$ as $p = 6.06$. And this is the plot in a log-log scale "Error vs grid size":

Error vs grid size for sine function

  1. I apply WENO5JP to the function $ \exp x \, \sin(5x)$ from Trefethen's book on spectral methods (p. 56) and obtain the following behavior

    | Resolution | Order |
    |         11 |   nan |
    |         21 |  4.16 |
    |         41 |  5.64 |
    |         81 |  4.90 |
    |        161 |  4.47 |
    |        321 |  4.11 |
    |        641 |  4.21 |
    |       1281 |  4.45 |
    |       2561 |  5.92 |
    |       5121 | -0.84 |

Linear least squares applied to the function $E = p \ln N + \ln C$ gives estimate of the order $p$ as $p =4.58$. And this is the plot in a log-log scale "Error vs grid size":

Error vs grid size for Trefethen's smooth function

As you can see, WENO5JP exhibits some strange behavior, where for one example it gives more than the 5th order of accuracy, while in another example the order of accuracy drops to 4. Last rows of each table show that the rounding error dominates over the truncation error of the method at these grid step sizes.

My question is: is it normal for WENO5JP to have that volatile order of accuracy?

As far as I can say from the literature on WENO for conservation laws, people usually don't get strictly 5th order even for simple linear problems.

However, it is still not clear to me whether I can say that my implementation is correct or not due to this strange convergence behavior.

UPDATE: you can find the code here: https://github.com/dmitry-kabanov/weno5jp-issue

  • $\begingroup$ There is no equation. I totally forgot to give the link to the code. I'll fix it now. $\endgroup$ – Dmitry Kabanov Sep 30 '16 at 18:13
  • $\begingroup$ I have no idea if it's normal for WENO to have a volatile order of accuracy, but when I've implemented other differencing schemes, I typically measure order of accuracy via regression of error with respect to time step or mesh size. Order of accuracy is typically a statement made in the asymptotic limit, but there's usually not a concrete calculation to tell you what mesh size or time step is small enough to be in the asymptotic regime. Consequently, the results you show don't look atrocious, although I'd be a little wary of the results from your second example. $\endgroup$ – Geoff Oxberry Oct 1 '16 at 0:35
  • $\begingroup$ Can you plot the error as a function of $x$ to see if there's anything strange about the points where the error is maximum? $\endgroup$ – Kirill Oct 1 '16 at 1:28
  • $\begingroup$ @GeoffOxberry, I've added to the tables results for such grid sizes that the rounding error starts to dominate over the truncation error. I believe that before that happens, we are in the asymptotic regime. $\endgroup$ – Dmitry Kabanov Oct 1 '16 at 15:21
  • $\begingroup$ @Kirill, I've added the plots in a log-log scale of "Error vs grid size". $\endgroup$ – Dmitry Kabanov Oct 1 '16 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.