StiffnessSwitching Method for NDSolve
Introduction
The basic idea behind the
StiffnessSwitching method is to provide an automatic means of switching between a nonstiff and a stiff solver.
The
StiffnessTest option (described within
"StiffnessTest Method Option for NDSolve") provides a useful means of detecting when a problem appears to be stiff.
The
StiffnessSwitching method traps any failure code generated by
StiffnessTest and switches to an alternative solver.
Extrapolation provides a powerful technique for computing highly accurate solutions using dynamic order and step size selection (see
"ExplicitRungeKutta Method for NDSolve" for more details) and are therefore used as the default choice in
StiffnessSwitching.
Examples
This loads some useful packages. |
This selects a stiff problem and specifies a longer integration time interval than the default specified by NDSolveProblem. |
The default Extrapolation base method is not appropriate for stiff problems and gives up quite quickly.
| Out[7]= |  |
|
Instead of giving up, the StiffnessSwitching method continues the integration with a stiff solver.
| Out[8]= |  |
|
The
StiffnessSwitching method uses a pair of extrapolation methods as the default. The nonstiff solver uses the
ExplicitModifiedMidpoint base method, and the stiff solver uses the
LinearlyImplicitEuler base method.
For small values of the
AccuracyGoal and
PrecisionGoal tolerances, it is sometimes preferable to use an explicit Runge-Kutta method for the nonstiff solver.
The ExplicitRungeKutta method eventually gives up when the problem is considered to be stiff.
| Out[9]= |  |
|
This sets the ExplicitRungeKutta method as a submethod of StiffnessSwitching.
| Out[10]= |  |
|
A switch to the stiff solver occurs at T 1.77, and a plot of the step sizes used shows that the stiff solver takes much larger steps.
| Out[11]= |  |
|
Option Summary
Option of the method StiffnessSwitching.