Very often I solve partial differential equations that are nonlinear and could be up to 4th order. In these cases, it is usual for the solution determined by NDSolve
to be stiff during a later stage. What I suspect NDSolve
does in this case is to resolve the stiffness until the error/local accuracy is very poor. That is when it quits the problem and gives you an Interpolating function polynomial.
Whilst using the BDF method to MaxOrder of 1 for instance, is there someway to tell Mathematica to quit as soon as stiffness is encountered in the solution so that I save time? I don't want to resolve the stiff portion and just stop my solution just as it gets stiff.
The below example looks like a mess in plain text but it copies fine. It gets stiff at t=4806. However, is lots of problems, NDSolve lingers at the time at which stiffness is achieved to try and resolve the features that I would like to circumvent completely.
I will obv. look into the stiffness switching stuff again.
Example
{xMin,xMax}={-4\[Pi]/0.0677,4\[Pi]/0.0677};
k=0.0677/4;
TMax=5000;
uSolpbc[t_,x_]=u[t,x]/.NDSolve[{\!\(
\*SubscriptBox[\(\[PartialD]\), \(t\)]\(u[t, x]\)\)==-100\!\(
\*SubscriptBox[\(\[PartialD]\), \(x\)]\((
\*SuperscriptBox[\(u[t, x]\), \(3\)]\
\*SubscriptBox[\(\[PartialD]\), \(x, x, x\)]u[t, x])\)\)+1/3 \!\(
\*SubscriptBox[\(\[PartialD]\), \(x\)]\((
\*SuperscriptBox[\(u[t, x]\), \(3\)]\
\*SubscriptBox[\(\[PartialD]\), \(x\)]u[t, x])\)\)-5 \!\(
\*SubscriptBox[\(\[PartialD]\), \(x\)]\((
\*SuperscriptBox[\((
\*FractionBox[\(u[t, x]\), \(1 + u[t, x]\)])\), \(2\)]\
\*SubscriptBox[\(\[PartialD]\), \(x\)]u[t, x])\)\),u[0,x]==1-0.1 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},
MaxStepFraction->1/150][[1]]