Home > three_d.js > Examples

KdV solitons

The Korteweg-de Vries equation is the non-linear PDE ut + uxxx + 6uux = 0. It allows soliton solutions – solitary waves that do not lose their shape, the non-linearity of the equation somehow perfectly offsetting the dispersion – which are appropriately-scaled sech2 functions.

The JavaScript on this page numerically solves the KdV equation with the split-step FFT method, following the very handy page on Wikiwaves, written by Michael Meylan. For the Fourier transforms I have used Nick Jones' jsfft.

The calculation is a pretty heavy one, and on my phone the controls become quite unresponsive (it takes a few seconds to register when I tap 'Pause', but it does eventually halt the calculation). Choices below the plot for the initial values of u are a single soliton (default); two solitons, which collide and show a phase shift; and a couple of non-soliton waves – one a sech2 function of the wrong height-to-width ratio, and a sine wave that roughly approximates the single soliton choice, but which immediately breaks apart. I find the top-down view the most rewarding.

The calculation will start when you click the appropriate phrase below the plot.

Mouse controls: Left-click and drag to rotate; alt (Mac)- or ctrl (Windows)-click-drag or middle-click-drag to pan; scroll or shift-click-drag to zoom. Touch screen controls: one finger to rotate; two-finger scroll to pan; pinch to zoom. Click/tap on the cube icons to snap to a side-on view.

Initial state: Start calculation.


You can see how the plot is constructed in the HTML source:

Posted 2016-12-22.

Home > three_d.js > Examples