Central Compact Schemes for the KdV Equation

An open-source Python reproduction of the TDCCS third-derivative scheme (Salian, Samala & Ghosh, 2026)

Third-order spatial derivatives appear in every dispersive wave model, and the Korteweg-de Vries (KdV) equation is the canonical example. Salian, Samala and Ghosh (Numerical Methods for Partial Differential Equations, 2026, 42:e70060, doi:10.1002/num.70060; openly available as a PDF from the author’s website) proposed the third-derivative central compact scheme (TDCCS), which evolves node values and cell-center values as independent variables and computes derivatives at each set of points from both grids, with no interpolation at any stage.

The original work uses MATLAB and its code is not publicly available. This project is an independent, open-source Python implementation: it derives the scheme’s coefficients from the order conditions rather than transcribing the published tables, verifies them against the paper, and reproduces every figure and table of the paper’s numerical section at the paper’s own parameters.

Highlights

  • Coefficients derived symbolically. 25 of the 26 published coefficient rows satisfy every order condition they claim; the remaining row (Table 1, TDCNCS-P8) is a sign typo, $\beta = +1/166$ where $-1/166$ is printed. The derivation also shows that the printed Eqs. (3.5) to (3.7) are the order conditions of the cell-centered scheme, not of TDCCS; no numerical results are affected.
  • Truncation-error constants agree with the paper in every published digit.
  • Spectral and stability analysis (modified wavenumber, resolving efficiency, CFL bounds) agrees to within $10^{-4}$ or to three or four significant figures.
  • Linear convergence tests (Example 7.1): Table 9 is reproduced over the paper’s full range $N = 20$ to $160$ to four significant figures, with convergence rates within $0.06$ of the paper’s.
  • Two-dimensional test (Example 7.5): reproduced over the paper’s full range $N = 10$ to $40$; both schemes match the published errors in every digit at $N = 10$ and $15$ and agree to within 0.8 percent through $N = 30$, beyond which both runs are limited by round-off.
  • Nonlinear problems (soliton collisions and splitting, the zero-dispersion limit, the coupled Ito system) are run at the paper’s grids and integration windows and reproduce the structures the paper describes.

Selected results

Example 7.3: a double-soliton collision computed with TDCNCS (top) and TDCCS (bottom), with the space-time surface up to t = 4.
Example 7.5: two-dimensional linear dispersion. Solution surfaces (top) and pointwise errors (bottom); both schemes reproduce the published errors closely.
Example 7.6: the coupled Ito system with a Gaussian initial condition. Only the u equation carries a third derivative, so u stays smooth while v steepens into shock-like fronts.

Implementation

The code is self-contained Python (numpy, scipy, sympy, matplotlib) and is written to be read as a tutorial: each example script opens with an explanation of the physical problem and how it maps onto the solver. Computation and plotting are separate. The example scripts solve once and save their results, and a single plotting script redraws every figure from the saved data, because the stable time step scales like $\Delta x^3$ and the finest runs need hundreds of thousands of Runge-Kutta steps. The figures follow the paper’s MATLAB conventions, including the turbo colormap and camera angles measured from the published panels.

Code

The complete code, together with the saved data behind every figure, is on GitHub: abelokoj.github.io/_projects/tdccs_project. The folder’s README gives a suggested reading order and the script-to-figure map.

Read more

The full derivation, validation and discussion of where the reproduction is exact and where it necessarily diverges are in the blog post: Reproducing a Central Compact Finite-Difference Scheme for the Korteweg-de Vries Equation.