-
Notifications
You must be signed in to change notification settings - Fork 6
Description
In discussion with @visr
The number of backtracking iterations is currently set at its default value of 1000:
This is likely far too many. Note that every backtracking iteration requires an evaluation of the Newton-Raphson residual --- basically the rhs!
-- which isn't that cheap. In my opinion, it makes more sense to put the maximum backtracking iterations at a value of 10 or so (the values I see "in the wild" for other nonlinear solves vary between 5-20). If you need more than 10 iterations are so, you're probably better off decreasing the time step, reformulating, and trying again.
In testing this with Martijn, the models crashes with a LineSearchException with a value of 10
. This shouldn't happen, this should be a reason to signal convergence failure and to apply the failfactor
(by default 2, i.e. cut the step size in half).
To address this, we can catch the exception and reset the residual so that it'll be rejected. See #2190
For the particular model, this doesn't give any performance benefit, but:
- It should give performance benefits for very poorly converging models (since we spend less time on a difficult problem and move to an easier problem earlier)
- It is more robust: with adaptive time stepping, there should always be an option to decrease the time step (until dtmin). The exception basically blocks this, because the exception isn't caught / shouldn't be raised in this context.
Note that LineSearch.jl doesn't raise this exception, but communicates a ReturnCode instead. The return code can be used to e.g. decrease the time step.
So this is another reason to move to LineSearch.jl (once it's past its teething problems and growing pains), see #1784.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status