I try to find a general approach to plot the time evolution of horizontal distances from maximum to maximum in a solution of PDE. The solution u[x,t]
normally have multiple maximum and minimum in space x
, which move in space x
and evolve in time t
.
Here is a simple example, in which the maxima and minima are periodic. But in my real problem they are not periodic and the distances between different pairs of adjacent max are different at a given t
, also the distances between two adjacent max can change with t
.
sol = NDSolve[{D[u[x, t], t] + u[x, t] D[u[x, t], x] + D[u[x, t], x, x] + 0.4*D[u[x, t], {x, 3}] + D[u[x, t], {x, 4}] == 0, u[-4 \[Pi], t] == u[4 \[Pi], t], u[x, 0] == 0.1*Sin[x]}, u, {t, 0, 20}, {x, -4 \[Pi], 4 \[Pi]}] Plot3D[Evaluate[u[x, t] /. First[sol]], {t, 0, 10}, {x, -4 Pi, 4 Pi}, PlotRange -> All, PlotPoints -> 100]
I have tried to use Table[FindMaximum[Evaluate[u[x, t] /. First[sol]], {x, x0}][[2, 1, 2]], {t,0,tend,0.01}]
with an initial position x0
to find a local maximum. But I don’t know how to find two adjacent maxima simultaneously in order to plot the time evolution of their distance.