An illustrated guide to limiters

numerical-analysis
hyperbolic-PDEs
Published

November 22, 2026

Many interesting wave phenomena – like fluid dynamics, lasers, and water waves – are described by nonlinear hyperbolic partial differential equations. The solutions of these problems often contain discontinuities. So-called limiters (sometimes referred to as slope limiters or flux limiters) are one of the key ingredients in approximating these discontinuous solutions. This page explains how to interpolate non-smooth data without creating wiggles.

It is an HTML version of a Jupyter notebook from my HyperPython course. The notebook includes a Python implementation of everything shown here, which you can run and modify; some of that code is reproduced below in collapsible boxes. On this page, the computations run in your browser, except for the advection solutions at the end, which were computed with PyClaw.

Interpolation and wiggles

Suppose you’re given a set of data samples:

Now what you really want to know is, what is the state of the system at the points halfway between your samples? And to figure that out, you need to guess at what’s going on at the points in between those samples. The simplest approximation would be to assume that the system just jumps from one value to the next somewhere in between:

For this set of data, you don’t really believe that’s what’s happening, do you? But our goal is to deal with systems that exhibit non-smooth (possibly discontinuous) behavior, so we need to at least admit the possibility of sudden jumps. That’s why we won’t simply “connect the dots” to get a continuous approximation.

Instead, we can try to approximate the slope around each of our sample points. The simplest way to do so is using finite differences. If we let \(\sigma_i\) denote our approximation of the slope at \(x_i\), then three common approximations are:

  • Forward difference: \(\sigma_i = \dfrac{y_{i+1}-y_i}{x_{i+1}-x_i}\)
  • Backward difference: \(\sigma_i = \dfrac{y_i - y_{i-1}}{x_i - x_{i-1}}\)
  • Centered difference: \(\sigma_i = \dfrac{y_{i+1}-y_{i-1}}{x_{i+1}-x_{i-1}}\)

Here’s what each of these approximations looks like for our data:

I’ve used \(\sigma=0\) for the points at the edges where we don’t have enough data to compute the appropriate slope.

The problem: overshoots!

Looking closely, you can see that each of these approximations adds little jumps (called “overshoots”) in some region where the data itself was monotone. Worse still, each of them generates negative values, whereas the original values were non-negative! If our data represent concentrations or probabilities, then we have no way to make sense of negative values.

Things look even worse if we take data samples from a function that is in fact discontinuous:

Now all three approaches have large, obvious overshoots. This becomes even more problematic when actually solving a hyperbolic PDE; see Lesson 3 of my HyperPython course for details.

Is there a better way?

The simplest limiter: minmod

We’d like to avoid those overshoots and ensure that monotone regions of the data give monotone interpolations. For equally spaced points, we can do that by choosing the slope \(\sigma_i\) small enough that the interpolant near \(x_i\) stays bounded between the neighboring averages \((y_{i-1}+y_i)/2\) and \((y_i+y_{i+1})/2\). There’s an easy way to do that: just compute the forward and backward differences (like we did above), and then use whichever is smaller in absolute value. If \(y_i\) is an extremum, then to avoid increasing the overall range of the data we always choose \(\sigma_i=0\).

Here’s what that looks like:

Let’s apply minmod to a monotone sequence of values, to illustrate the average-boundedness property:

Each grey box extends from the average of \(y_i\) and its left neighbor, \((y_{i-1}+y_i)/2\), to the average of \(y_i\) and its right neighbor, \((y_i+y_{i+1})/2\). The minmod interpolant around \(x_i\) is guaranteed to stay within these bounds, so the right edge of one interpolated piece never “overshoots” the left edge of the next.

Total variation

In fact, the minmod limiter guarantees an important mathematical property: the piecewise-linear function it produces has no more total variation (TV) than the data. For discrete data, TV is defined as

\[ TV(y) = \sum_i |y_i - y_{i-1}|.\]

For a piecewise-linear function with jumps, the TV is the sum of the absolute changes along each linear piece plus the absolute size of each jump. Essentially, TV is a measure of how much a function wiggles! This total variation diminishing (TVD) property is important because the true solutions of scalar hyperbolic PDEs have the same property: their total variation never increases.

In the 1970s and 80s, researchers developed many other limiters. Most of them do not guarantee that the interpolant has no more TV than the data. Instead, they guarantee that the full numerical method for a scalar hyperbolic PDE is TVD, as long as the time step is small enough. These are known as TVD limiters.

TVD limiters

Just for fun, let’s look at 3 more such limiters. Let \(F_i\) and \(B_i\) denote the forward- and backward-difference slope approximations at point \(i\), and let \(\theta_i = F_i/B_i\) be their ratio. Each of these limiters can be described in terms of a function \(\phi(\theta)\); the slope to be used is

\[\sigma_i = \phi(\theta_i) B_i.\]

(If \(B_i = 0\), we take \(\sigma_i = 0\).) For instance, minmod corresponds to \(\phi(\theta) = \max(0,\min(1,\theta))\). The other limiter names and functions are:

  • Monotonized centered difference (MC): \(\phi(\theta) = \max\left(0,\min\left(\frac{1+\theta}{2},2,2\theta\right)\right)\)
  • van Leer: \(\phi(\theta) = \dfrac{\theta + |\theta|}{1+ |\theta|}\)
  • Superbee: \(\phi(\theta) = \max(0,\min(1,2\theta),\min(2,\theta))\)
Python code from the notebook
def phi(theta,limiter):
    if limiter == 'minmod':
        phi = np.maximum(0,np.minimum(1,theta))
    elif limiter == 'vanleer':
        phi = (theta + np.abs(theta))/(1+np.abs(theta))
    elif limiter == 'MC':
        phi = np.maximum(0,np.minimum( (1.+theta)/2., np.minimum(2.,2*theta)))
    elif limiter == 'superbee':
        phi = np.maximum(0,np.maximum(np.minimum(1.,2*theta),np.minimum(2.,theta)))
    else:
        raise ValueError('Unrecognized limiter: '+limiter)
    return phi

def limited_slopes(x,y,limiter='minmod'):
    "Slopes sigma_i = phi(theta_i) B_i, with sigma = 0 at the endpoints and wherever B_i = 0."
    forward  = np.zeros_like(y)
    backward = np.zeros_like(y)
    theta    = np.zeros_like(y)

    forward[:-1] = (y[1:]-y[:-1])/(x[1:]-x[:-1])
    backward[1:] = (y[1:]-y[:-1])/(x[1:]-x[:-1])
    interior = np.zeros(len(y),dtype=bool); interior[1:-1] = True
    nonzero = interior & (backward != 0)
    theta[nonzero] = forward[nonzero]/backward[nonzero]

    sigma = phi(theta,limiter) * backward
    sigma[~nonzero] = 0.
    return sigma

Here’s what each of them looks like for our data. You can also switch to the smooth data we started with.

Compare these with the finite difference approximations above.

You’ll notice that – except for minmod – all the limiters do produce some overshoot near the discontinuity; the total variation of each of their interpolants (shown in each panel) is larger than that of the data, which is the same as that of the minmod interpolant. Superbee even increases the total variation for the smooth data we used at the start.

What gives? Well, these limiters are used within a larger algorithm for solving hyperbolic PDEs. It turns out that if the overshoots are small enough, they are removed in a full step of the algorithm: for the advection equation, the methods based on these limiters are TVD as long as the CFL number is at most 1, even though the interpolants themselves are not. So no oscillations appear in the PDE solution.

Interactive comparison

In each region, these limiters take three data points and give back a linear interpolant. It’s illuminating to compare their behavior on a single set of 3 points: \((-1, y_{i-1})\), \((0, 0)\), and \((1, y_{i+1})\).

The shaded region in the plot above shows the slopes that lie between the backward difference and the forward difference. For smooth data, both of these differences approximate the derivative to first order, so any slope in this region gives an interpolant that is second-order accurate. All four limiters always choose a slope in this region. Play with the sliders and answer the following questions:

  • Which limiter usually chooses the flattest approximation? Does it always?
  • Which limiter usually chooses the steepest approximation? Does it always?
  • In which situations do all the limiters give the same slope? Why?

Try your own data

Here you can apply any of the methods above to any of the data sets, or to random data.

Higher-order interpolation: WENO

If we want to get higher-order accuracy (in smooth regions), then we have to give up the TVD property – at least, in the sense defined above. The most common approach for higher order non-oscillatory piecewise interpolation is known as weighted essentially non-oscillatory (WENO) interpolation.

WENO is a very effective technique for interpolating or reconstructing functions that contain discontinuities without introducing oscillations. We’ll focus on 5th-order WENO interpolation, which is the most commonly used. As for the limiters above, we work with point values of a function. (In finite volume methods, WENO is usually applied instead to cell averages; the idea is the same, but the coefficients are different.)

We take 5 values \(y_{i-2}, \dots, y_{i+2}\) at the points \(x = -2, -1, 0, 1, 2\) (so \(x_i = 0\) and \(\Delta x = 1\)). You can change them with the sliders below, or choose one of the preset data sets. The plots that follow use these values, until the final plot of this section, which has its own controls.

Ordinary polynomial interpolation yields an oscillatory polynomial that, for the example data, also exceeds the bounds of the data:

For application to hyperbolic conservation laws, our main interest is in getting values of the function at the half-integer points (interfaces). Let’s suppose we’re trying to interpolate around \(x=0\), at \(x=\pm 1/2\). Instead of using all 5 points, we could just use three points, which might give us a less oscillatory interpolant, at least in that interval. Using the 5 points we’re given, there are three natural choices of interpolation stencil: the leftmost three, the middle three, or the rightmost three. Let’s see what each of these quadratic interpolants looks like.

Here are all three quadratic interpolants together with the quartic interpolant for comparison:

The quadratic interpolants look less oscillatory, but they’re also less accurate. The WENO idea is to use the high-order interpolant (with all 5 points) if the data is smooth, but to use one of the lower-order interpolants (or a combination of them) if the data is not smooth. This is achieved by computing point values of the interpolant as weighted averages of the point values of the candidate polynomials. Let \(p_1 = p_\text{left}\), \(p_2 = p_\text{center}\), and \(p_3 = p_\text{right}\). Writing \(\tilde{y}_{i-1/2}\) for the interpolated value at \(x_{i-1/2}\),

\[\tilde{y}_{i-1/2} = \sum_{j=1}^{3} w_{j,-1/2}\, p_j(x_{i-1/2}).\]

Of course, there is some particular set of weights that gives the value of the quartic interpolant:

\[p_\text{quartic}(x_{i-1/2}) = \sum_{j=1}^{3} \gamma_{j,-1/2}\, p_j(x_{i-1/2}).\]

These optimal weights \(\gamma\) do not depend on the data, but they do depend on the point where we evaluate. Requiring this equation to hold for any data gives

\[ \gamma_{j,-1/2} = \left(\tfrac{5}{16}, \tfrac{5}{8}, \tfrac{1}{16}\right), \qquad \gamma_{j,+1/2} = \left(\tfrac{1}{16}, \tfrac{5}{8}, \tfrac{5}{16}\right) \]

for \(j = 1, 2, 3\).

We will want to have \(w_{j,\pm 1/2} \approx \gamma_{j,\pm 1/2}\) for smooth data.

How does one determine if a polynomial is non-oscillatory? There are several ways proposed in the literature, but the original and most widely used is the weighted Sobolev norm introduced by Jiang and Shu:

\[\beta = \sum_{l=1}^{k-1} \Delta x^{2l-1} \int_{x_{i-1/2}}^{x_{i+1/2}} \left(\frac{d^l}{dx^l}p(x)\right)^2 dx.\]

Here \(k = 3\) is the number of points in each candidate stencil. Put simply, \(\beta\) is a scaled sum of the squared \(L^2\) norms of all the derivatives of the polynomial over the interval where it will be used. The scaling is chosen to make the “smoothness indicator” \(\beta\) independent of the choice of \(\Delta x\).

As each of the interpolants above is a linear function of the values \(y_j\), the smoothness indicators are quadratic functions of the \(y_j\). If we number the stencils \(r = 0, 1, 2\) from left to right, so that stencil \(r\) uses \(y_{i-2+r}, y_{i-1+r}, y_{i+r}\), they can be written in the form

\[\beta_r = \sum_{m=0}^{2} \sum_{n=0}^{m} C_{r,m,n}\, y_{i-2+r+m}\, y_{i-2+r+n}.\]

The coefficients \(C_{r,m,n}\) are different for each of the candidate polynomials \(p_\text{left},p_\text{center},p_\text{right}\). Here we simply compute \(\beta\) directly from each polynomial.

Next we use these smoothness indicators to determine a weighting for the candidate polynomials. Observe that a large smoothness indicator means a polynomial has large derivatives, so we will want to give it less weight (perhaps they should be called non-smoothness indicators).

\[\tilde{w}_j = \frac{\gamma_j}{(\epsilon + \beta_j)^2}\]

Here \(\epsilon\) is a small number used to avoid division by zero; we use \(\epsilon = 10^{-6}\). We also normalize the weights so that they sum to unity:

\[w_j = \frac{\tilde{w}_j}{\sum_j\tilde{w}_j}\]

Python code from the notebook
def stencil_coefficients(xs,xe):
    """Coefficients c such that the polynomial interpolating (xs[j], f_j)
       has the value sum_j c[j]*f_j at the point xe."""
    n = len(xs)
    V = np.vander(xs,n,increasing=True)
    return np.linalg.solve(V.T, xe**np.arange(n))

def compute_opt_weights(x,k,xi):
    """
    Optimal (linear) weights gamma for the k candidate stencils (ordered left, center, right)
    at the points x_i + xi/2, where x_i is the middle point of x.  These are the weights
    for which the combination of the degree-(k-1) interpolants equals the degree-(2k-2)
    interpolant through all 2k-1 points.
    """
    gamma = {}
    for xi_val in xi:
        xe = x[k-1] + xi_val/2.
        c_opt = stencil_coefficients(x,xe)
        M = np.zeros((2*k-1,k))
        for r in range(k):
            M[r:r+k,r] = stencil_coefficients(x[r:r+k],xe)
        g = np.linalg.lstsq(M,c_opt,rcond=None)[0]
        assert np.allclose(M.dot(g),c_opt), 'no exact optimal weights at xi = %s' % xi_val
        gamma[xi_val] = g
    return gamma

def compute_smoothness_indicators(polys,dx=1.):
    "Jiang-Shu smoothness indicator of each polynomial on the interval [-dx/2, dx/2]."
    beta = np.zeros(len(polys))
    for r, poly in enumerate(polys):
        degree = poly.order
        for l in range(1,degree+1):
            antiderivative = np.polyint(np.polyder(poly,l)**2)
            beta[r] += dx**(2*l-1) * (antiderivative(dx/2.) - antiderivative(-dx/2.))
    return beta

def compute_weights(gamma, beta, epsilon=1.e-6):
    k = len(beta)
    w = np.empty(k)
    for j in range(k):
        w[j] = gamma[j]/(epsilon+beta[j])**2

    wsum = np.sum(w)
    return w/wsum

Here are the final interpolated values given by WENO (indicated by the large grey circles), and the weights given to each of the quadratic interpolants when computing the left and right values. This plot has its own data controls. Try different data. What happens if you use a step function for \(y\)?

If you choose “Step”, you’ll see that for a perfect step function, WENO picks the flat interpolant, just like any TVD limiter would!

Comparison of several limiters for advection

In practice, all of these limiters are used as components of numerical solvers for hyperbolic PDEs. The simplest hyperbolic PDE is the advection equation:

\[ q_t + a q_x = 0.\]

The solution \(q\) simply translates at velocity \(a\); if you’re not familiar with this, take a look at my HyperPython lesson on advection and then the lesson on high-resolution methods.

The plots below show solutions of the advection equation with \(a = 1\) on the interval \([0, 1]\) with periodic boundary conditions, using 100 grid cells and several of the methods we’ve discussed. The TVD limiters are used in Clawpack’s second-order finite volume method; “Lax-Wendroff” is the same method with no limiter, and “first-order” is the upwind method. The WENO solutions use the method of lines with WENO reconstruction of order 5, 7, or 9. These solutions were computed with PyClaw, using the code in the notebook; the solution advects across the full domain once in each unit of time. The grey curve is the initial condition, which is also the exact solution after each full cycle.

By stepping through the animation, you can see how each limiter modifies the shape of the solution over time. The Lax-Wendroff method is based on a centered-difference approximation with no limiting; notice that it creates oscillations and is also less accurate than the limiter-based methods. For the advection equation, oscillations and overshoots are not a serious problem, but in the context of fluid dynamics or water wave simulations, they can be catastrophic.