StiffnessTest Method Option for NDSolve
Overview
The methods
DoubleStep,
Extrapolation, and
ExplicitRungeKutta have the option
StiffnessTest, which can be used to identify whether the method applied with the specified
AccuracyGoal and
PrecisionGoal tolerances to a given problem is stiff.
A convenient way of detecting stiffness is to directly estimate the dominant eigenvalue of the Jacobian
J of the problem (see [
S84] and [
R87]).
Such an estimate is often available as a by-product of the numerical integration and so it is reasonably inexpensive.
If
v denotes an approximation to the eigenvector corresponding to dominant eigenvalue of the Jacobian, with
v
sufficiently small, then by the mean value theorem a good approximation to the leading eigenvalue is:
Richardson's extrapolation provides a sequence of refinements that yield a quantity of this form as do certain explicit Runge-Kutta methods.
Let
LSB denote the linear stability boundary—the intersection of the linear stability region with the negative real axis.
The product

gives an estimate that can be compared to the linear stability boundary of a method in order to detect stiffness.
The method option
StiffnessTest itself accepts a number of options that are now illustrated.
Examples
The default values for the stiffness test implement a weak form of (
1) where the test incorporates a safety factor and is allowed to fail a specified number of times.
The reason for this is that some problems can be only mildly stiff in a certain region and an explicit integration method may still be efficient.
This loads a package with some predefined examples and selects one of the examples. |
The problem is integrated successfully with the given method and the default option settings for StiffnessTest.
| Out[3]= |  |
|
A longer integration is aborted and a message is issued when the stiffness test condition is not satisfied.
| Out[4]= |  |
|
Using a unit safety factor and specifying that only one stiffness failure is allowed effectively gives a strict test. The specification uses the nested method option syntax.
| Out[5]= |  |
|
Option summary
| | |
| MaxStiffnessTestFailures | 3 | specify the maximum number of times that the stiffness test (1) is allowed to fail |
| StiffnessTestSafetyFactor |  | specify the safety factor to use in the left-hand side of the stiffness test (1) |
Options of the method option StiffnessTest.