Skip to content

Korteweg–de Vries

Shallow water has a rule: taller waves move faster. A hump therefore steepens at its front, like a wave about to break on a beach. But shallow water also has dispersion, which spreads a hump out. The Korteweg–de Vries equation is the simplest model that contains both effects, and it has an exact hump shape where they cancel perfectly.

Live in your browser, computed by the engine.Open in the playground with sliders and graphs ↗

Notice the shape never changes and the speed is constant. Taller solitons are narrower and faster. That is not a coincidence. Height, width and speed are locked together by one parameter.

Now watch two of them meet.

Live in your browser, computed by the engine.Open in the playground with sliders and graphs ↗

The fast one catches the slow one, they merge into a single hump for a moment, and then both reappear exactly as before. The only trace of the collision is that the fast soliton is a little ahead of where it would have been, and the slow one is a little behind.

What if you start with a shape that is not a soliton?

Live in your browser, computed by the engine.Open in the playground with sliders and graphs ↗

The bump sorts itself into a line of solitons, tallest first, leaving behind a small ripple that spreads away. The number and heights of the solitons that come out are determined by the initial shape alone. That is the inverse scattering transform at work.

The equation, in the normalisation this engine uses, is

ut+6 u ux+uxxx=0.u_t + 6\,u\,u_x + u_{xxx} = 0 .

The term 6uux6 u u_x is the nonlinear steepening and uxxxu_{xxx} is the dispersion. Look for a travelling wave u(x,t)=f(x−ct)u(x,t) = f(x - ct) and you find the single-soliton solution

u(x,t)=c2 sech⁡2 ⁣(c2 (x−ct−x0)).u(x,t) = \frac{c}{2}\,\operatorname{sech}^2\!\left(\frac{\sqrt{c}}{2}\,(x - ct - x_0)\right).

One parameter, the speed cc, fixes the amplitude c/2c/2 and the width 2/c2/\sqrt{c}.

The equation has infinitely many conserved quantities. The engine tracks the first three:

NameExpression
Mass∫u dx\int u \, dx
Momentum∫u2 dx\int u^2 \, dx
Energy∫(u3−12ux2)dx\int \left( u^3 - \tfrac{1}{2} u_x^2 \right) dx

The energy is the Hamiltonian that generates the flow, ut=−∂x δH/δuu_t = -\partial_x\, \delta H / \delta u.

On a periodic domain the engine writes the equation as ut=Lu+N(u)u_t = L u + N(u) with

L(k)=ik3,N(u)=−3 (u2)x.L(k) = i k^3, \qquad N(u) = -3\,(u^2)_x .

In Fourier space LL is just a number for each wavenumber, so the linear part is handled exactly. The nonlinear part is computed in physical space and transformed back. This is the pseudo-spectral method. Time stepping uses ETDRK4, which treats the stiff dispersive term exactly and the nonlinear term to fourth order.

TestSetupResult
Single solitonc=4c = 4, N=512N = 512, L=60L = 60, Δt=10−3\Delta t = 10^{-3}, t=5t = 5max error 5×10−85 \times 10^{-8}
Two solitonsc=4c = 4 and c=1c = 1, 8000 stepsinvariant drift below 10−810^{-8}
Collisionc=6c = 6 and c=1.5c = 1.5fast soliton amplitude restored to 3.03.0 within 0.020.02

Source: crates/soliton-core/src/equations/kdv.rs and its tests.