I am following the approach of Hundsdorfer from Numerical solution of time-dependent advection-diffusion-reaction equations in which they introduce adaptive upwinding. The method can adapt from pure upwind ($\kappa=1$) to pure central ($\kappa=0$) discretisation for the advection term (N.B. the diffusion term is always based on a central difference), $$ u_j^{\prime} = \frac{1}{2h}a \left( u_{j-1} - u_{j+1} \right) + \left( \frac{d}{h^2} + \kappa\frac{a}{2h} \right) \left( u_{j-1} - 2u_{j} + u_{j+1} \right) $$

$u_j^{\prime}$ is shorthand for the time derivative, $a$ is the velocity ($a>0$), $d$ is the diffusion coefficient and $h$ is the step size between uniform mesh points.

I wish to extend this to the case of a non-uniform mesh, however I run into a problem because I get a factor of $4$ appearing when I do so, which seems inconsistent. For example, modify the above equation to include non-uniform steps,

$$ u_j^{\prime} = \frac{1}{2h_j^{+}}a \left( u_{j-1} - u_{j+1} \right) + \left( \frac{d}{(h_j^{+} + h_j^{-})^2} + \kappa\frac{a}{2h_j^{+}} \right) \left( u_{j-1} - 2u_{j} + u_{j+1} \right) $$

where $h_j^{+}=x_{j+1} - x_j$ and $h_j^{-}=x_{j} - x_{j-1}$. We can check the consistence by putting this equation back on to a uniform mesh. Substituting $h_j^{+}\rightarrow h$ and $h_j^{-}\rightarrow h$,

$$ u_j^{\prime} = \frac{1}{2h}a \left( u_{j-1} - u_{j+1} \right) + \left( \frac{d}{4h^2} + \kappa\frac{a}{2h} \right) \left( u_{j-1} - 2u_{j} + u_{j+1} \right) $$

This is identical appart form the factor of $4$ appearing in the denominator!

I haven't much experience with these adaptive upwinds, can you see an issue with using a modified version of the original equation,

$$ u_j^{\prime} = \frac{1}{2h}a \left( u_{j-1} - u_{j+1} \right) + \left( \frac{4d}{(2h)^2} + \kappa\frac{a}{2h} \right) \left( u_{j-1} - 2u_{j} + u_{j+1} \right) $$

The additional constants cancel on both a uniform and non-uniform grid, giving the correct central difference diffusion term in all cases,

$$ d\frac{\left( u_{j-1} - 2u_{j} + u_{j+1} \right) }{h^2} $$


Using a Taylor series to calculate the second derivative (the diffusion term) with non-uniform step gives,

$$ 2d \frac{h^{+} \left(- u_{j} + u_{{j-1}}\right) + h^{-} \left(- u_{j} + u_{{j+1}}\right)}{h^{+} h^{-} \left(h^{+} + h^{-}\right)} $$

This reduces to the correct expression when the grid is uniform.

However, this makes the equation hard to write in a compact form because the $h^{-}$ and $h^{+}$ terms appear in the numerator. Does anybody you have any comments on whether this can be simplified further, i.e. so the $h$ terms don't appear in the numerator? This will allow the write the equation in the original form.


1 Answer 1


You need to rederive the term $$ \frac{d}{(h_j^+ + h_j^-)^2} $$ because this appears to be wrong. It must lead to factor of 4 when switching to a uniform grid because you've taken the sum of two things that are $O(h)$ and squared it.

Perhaps if you spell out the derivation, we can help you find the error.

  • $\begingroup$ This is simply just a central finite difference applied to a second order derivative but with non-uniform step. I can do this with a Taylor expansion around, $f(x-h^{-})$ and $f(x+h^{+})$. Thanks for the advice, I'll do that. $\endgroup$
    – boyfarrell
    Jun 9, 2013 at 3:40
  • $\begingroup$ OK there is an update above. But the derived equation is hard to write in a compact form! Can it be simplified further? I'm not sure. $\endgroup$
    – boyfarrell
    Jun 9, 2013 at 5:40
  • 1
    $\begingroup$ I believe your only option is to separate it into two terms with different denominators. That will allow you to cancel the $h^-$ in one case and the $h^+$ in the other, but now you'll have two terms where you had one before. $\endgroup$
    – Bill Barth
    Jun 10, 2013 at 3:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.