I am trying to use a recurrence plot to pin pointpinpoint the location when a system re-visits a previous point in its phase portrait. The system (a thin liquid film) is governed by a non-linear differential equation and is quite easily solved using NDSolve
as shown:
{xMin, xMax} = {-(Piπ/0.0677), Piπ/0.0677};
k = 0.0677;
TMax = 1650;
m = 5;
S = 100;
Ga = -3^(-1);
Quiet[uSolpbc =
u /. NDSolve[{D[u[t, x],
t] == (-S)*D[u[t, x]^3*D[u[t, x], x, x, x], x] +
Ga*D[u[t, x]^3*D[u[t, x], x], x] -
m*D[(u[t, x]/(1 + u[t, x]))^2*
D[u[t, x], x], x],
u[0, x] == 1 - 0.01*Cos[k*x], u[t, xMin] == u[t, xMax],
Derivative[0, 1]*u[t, xMin] == Derivative[0, 1]*u[t, xMax],
Derivative[0, 2]*u[t, xMin] == Derivative[0, 2]*u[t, xMax],
Derivative[0, 3]*u[t, xMin] == Derivative[0, 3]*u[t, xMax]},
u, {t, 0, TMax}, {x, xMin, xMax}, MaxSteps -> 100000,
Method -> {"MethodOfLines", "Method" -> "LSODA", "TemporalVariable" -> t,"SpatialDiscretization" -> {"TensorProductGrid", "MinPoints" -> 800, "MaxPoints" -> 1200,
"DifferenceOrder" -> 5}}][[1]]]
Block[{stepSize = 2, end = TMax, tt, \[Tau]\[Tau]ττ, rd},
rd = ParallelTable[
UnitStep[
0.01 - Norm[uSolpbc[tt, 0] - uSolpbc[\[Tau]\[Tau]uSolpbc[ττ, 0], 2]], {tt,
0, end, stepSize}, {\[Tau]\[Tau]ττ, 0, end, stepSize}];
MatrixPlot[rd]]
The grainy nature of the plot can be improved by choosing a smaller time step; say, stepSize=1/20stepSize=1/20
or less. However, the current stepSizestepSize
of 2 itself is quite slow (Timing
Revealsreveals 0.344 seconds; AbsoluteTiming
reveals 3.33 seconds).
I have a feeling that it is the nested nature of these functions (ParallelTableParallelTable
, UnitStepUnitStep
and NormNorm
) that is taking a long time. Is there some way I can improve this? Currently, choosing a much smaller time step leads to "out of memory" error (I have ~8 gigs of memory that is exhausted!).
It is not Nest
or Map
that I am looking for and if it, I guess I am lost on its application in this case.
Is