So I wish to stop integrating my PDE when the spatial gradient is larger than some value, let's say 10. That is to say, my WhenEvent condition wants to be stop when the the maximum gradient over all x at a given t exceeds a threshold.
However, when I try implement the code I get "The function value is not True or False errors".
Here's my attempt:
NDSolve[{Derivative[0, 1][h][x, t] + 2000 h[x, t]*Derivative[1, 0][h][x, t] ==
1/4 D[(1 - 4 h[x, t]^2)^3 Derivative[1, 0][h][x, t], x],
h[-1/2, t] == 0, h[1/2, t] == 0, h[x, 0] == 0.1 Sin[8 π (x - 1/2)],
WhenEvent[NMaximize[Derivative[1, 0][h][x, t]] > 10, tEnd = t;
"StopIntegration"]}, h[x, t], {x, -1/2, 1/2}, {t, 0, 10},
Method -> {"MethodOfLines", "DiscretizedMonitorVariables" -> True,
"SpatialDiscretization" -> {"TensorProductGrid", "MinPoints" -> 100000}}];
Any ideas what I'm doing wrong?
Max[ ]
.. ? $\endgroup$