math.vinhnx.ca / riemann

The Riemann problem

Start with a single jump between two constant states and let a conservation law run. What comes out is a fan of waves (shocks, rarefactions and contacts), and every other solution is built from that pattern. Drag the states and watch the waves change.

Solution at time t

x–t plane

drag to scrub time

Flux and its envelope

drag L and R

The setup

A conservation law in one dimension says that a quantity $u$ (a density, a depth, a saturation) changes only because of the flux $f(u)$ moving it around:

$$u_t + f(u)_x = 0.$$

The Riemann problem is this equation with the simplest initial data that is still interesting, a single jump:

$$u(x,0) = \begin{cases} u_L & x < 0, \\ u_R & x > 0. \end{cases}$$

Riemann posed it in 1860 for gas in a tube with a membrane that is suddenly removed. The key observation is that the equation and the data both stay the same if you stretch $x$ and $t$ by the same factor. So the solution can only depend on the ratio $\xi = x/t$:

$$u(x,t) = U(x/t).$$

This is why the x–t diagram above is a fan of straight lines through the origin, and why the profile at any time is the same picture stretched. Time only zooms.

Three kinds of waves

Smooth solutions satisfy $u_t + f'(u)\,u_x = 0$, so each value of $u$ travels at its characteristic speed $f'(u)$. What happens to the jump depends on whether the characteristics on either side collide or pull apart.

Shock. If the left state is faster ($f'(u_L) > f'(u_R)$), characteristics run into each other and the jump survives as a moving discontinuity. Conservation alone fixes its speed, through the Rankine–Hugoniot condition:

$$s = \frac{f(u_L) - f(u_R)}{u_L - u_R}.$$

On the flux plot, $s$ is the slope of the chord between L and R. The shock is physical only if characteristics run into it from both sides, $f'(u_L) > s > f'(u_R)$. This is the Lax entropy condition, and the readout checks it.

Rarefaction. If the left state is slower, characteristics fan out from the origin and the jump spreads into a smooth wave. Inside the fan each ray $x/t = \xi$ carries the value of $u$ whose speed is $\xi$:

$$f'\big(U(\xi)\big) = \xi.$$

A jump in the “rarefaction” direction could be kept as a discontinuity, since that still conserves mass. It is the entropy condition that rules it out, so the fan is the only physical solution.

Contact. If $f$ is straight between the states, both sides move at the same speed and the jump is carried along unchanged.

Try it: on , drag R above L on the flux plot and watch the chord turn into a fan.

The general rule: envelopes

For a flux that is neither convex nor concave, a single jump can need several waves. Oleinik’s construction handles every scalar case in one step. If $u_L < u_R$, take the lower convex envelope of $f$ between them; if $u_L > u_R$, the upper concave envelope. Then walk the envelope from L to R:

The highlighted curve on the flux plot is exactly that envelope, and it is how this page computes the exact solution. On the S-shaped Buckley–Leverett flux the envelope from 1 down to 0 follows the curve and then leaves along a tangent chord. The result is a rarefaction with a shock attached to its front. In oil recovery this is the water front, and the tangent point is Welge’s construction.

Try it: .

Systems: shallow water

For a system of $m$ equations, the jump splits into $m$ waves, one per characteristic family, separated by new constant states. Shallow water has depth $h$ and velocity $u$, with characteristic speeds $u \mp \sqrt{gh}$. A Riemann problem makes a 1-wave moving left, a 2-wave moving right, and a star state $(h_*, u_*)$ between them.

Each wave can be a shock or a rarefaction. To find out which, draw in the $(h, u)$ plane every state reachable from L by a 1-wave and every state reachable from R by a 2-wave:

$$u = u_L - \phi(h; h_L), \qquad u = u_R + \phi(h; h_R),$$ $$\phi(h; h_K) = \begin{cases} 2\big(\sqrt{gh} - \sqrt{gh_K}\big) & h \le h_K \ \text{(rarefaction)}, \\ (h - h_K)\sqrt{\tfrac{g}{2}\,\tfrac{h + h_K}{h\,h_K}} & h > h_K \ \text{(shock)}. \end{cases}$$

The star state is where the two curves cross. If you pull the two sides apart fast enough ($u_R - u_L \ge 2\sqrt{gh_L} + 2\sqrt{gh_R}$), the curves never meet and a dry bed opens in the middle.

Try it: , then .

Why it matters: Godunov’s method

The Riemann problem is more than a textbook example. In 1959 Godunov noticed that if you store a solution as cell averages, each cell boundary is a little Riemann problem. Solve them all, use the flux at $x/t = 0$, and update:

$$u_i^{n+1} = u_i^n - \frac{\Delta t}{\Delta x}\Big(F(u_i^n, u_{i+1}^n) - F(u_{i-1}^n, u_i^n)\Big).$$

Most shock-capturing codes for gas dynamics, weather and astrophysics are built on this idea. The dotted overlay is this scheme, with the exact Riemann flux for scalar laws and the HLL approximate solver for shallow water. The Rusanov option swaps in a simpler flux that adds more dissipation. Compare the two on a shock, then raise the cell count and watch the L¹ error fall.

Try it: with 25 cells. The exact jump stays sharp, but the first-order scheme smears it out like diffusion.