Solitons that pass¶
Two solitons before, during and after their meeting: the tall one overtakes the small one, and both keep their shape.
import sympy as sp
import pdemagic as pm
x, t = sp.symbols("x t", real=True)
u = sp.Function("u")(x, t)
def soliton(speed, centre):
return speed / 2 / sp.cosh(sp.sqrt(speed) / 2 * (x - centre)) ** 2
water = pm.Problem(
sp.Eq(u.diff(t) + 6 * u * u.diff(x) + u.diff(x, 3), 0),
domain=pm.Space(x, periodic={x: (-20, 20)}),
time=(t, 0, 6),
initial={u: soliton(4, -14) + soliton(1, -6)},
)
plan = pm.plan(water)
plan.method.tolerance = 1e-6
passing = pm.solve(water, plan)
passing.plot(time=[0, 2.1, 6])
film = passing.animate()
What it shows¶
The Korteweg–de Vries equation, \(u_t + 6\,u\,u_x + u_{xxx} = 0\), a model of waves in shallow water. A soliton is a single hump that moves without changing its shape, and the taller it is, the faster it moves: one of the height \(c/2\) has the speed \(c\). Here a hump of the height 2 starts behind one of the height 0.5 and catches up with it. At \(t = 2.1\) the two are one hump of the height 1.5, lower than the tall one alone. At the end both are back, with the heights they started with, although the equation is nonlinear. The tall one is ahead of where it would be without the meeting, and the small one behind.
What pdemagic decided¶
The planner chose exponential time stepping of fourth order
(exponential_runge_kutta): the third derivative is exact, and the
nonlinear term is stepped. It took the finest grid that it tries by
itself, 512 points, and its plan says that the spectrum of the two
humps has only fallen to \(4\cdot10^{-7}\) there. The plan here loosens
the tolerance of a step from \(10^{-10}\) to \(10^{-6}\), which takes 640
steps in place of forty thousand and changes the solution in its fifth
digit.