Termination Conditions
Provides a API to specify termination conditions for NonlinearProblem
and SteadyStateProblem
. For details on the various termination modes:
Termination Conditions
The termination condition is constructed as:
cache = init(du, u, AbsSafeBestTerminationMode(); abstol = 1e-9, reltol = 1e-9)
If abstol
and reltol
are not supplied, then we choose a default based on the element types of du
and u
.
To test for termination simply call the cache
:
terminated = cache(du, u, uprev)
Absolute Tolerance
NonlinearSolveBase.AbsTerminationMode
— TypeAbsTerminationMode <: AbstractNonlinearTerminationMode
Terminates if $all \left( | \Delta u | \leq abstol \right)$. .
$\Delta u$ denotes the increment computed by the nonlinear solver and $u$ denotes the solution.
NonlinearSolveBase.AbsNormTerminationMode
— TypeAbsNormTerminationMode <: AbstractNonlinearTerminationMode
Terminates if $\| \Delta u \| \leq abstol$. .
$\Delta u$ denotes the increment computed by the inner nonlinear solver.
Constructor
AbsNormTerminationMode(internalnorm = nothing)
where internalnorm
is the norm to use for the termination condition. Special handling is done for norm(_, 2)
, norm
, norm(_, Inf)
, and maximum(abs, _)
..
NonlinearSolveBase.AbsNormSafeTerminationMode
— TypeAbsNormSafeTerminationMode <: NonlinearSolveBase.AbstractSafeNonlinearTerminationMode
Essentially AbsNormTerminationMode
+ terminate if there has been no improvement for the last patience_steps
+ terminate if the solution blows up (diverges).
Constructor
AbsNormSafeTerminationMode(
internalnorm; protective_threshold = nothing,
patience_steps = 100, patience_objective_multiplier = 3,
min_max_factor = 1.3, max_stalled_steps = nothing
)
where internalnorm
is the norm to use for the termination condition. Special handling is done for norm(_, 2)
, norm
, norm(_, Inf)
, and maximum(abs, _)
..
NonlinearSolveBase.AbsNormSafeBestTerminationMode
— TypeAbsNormSafeBestTerminationMode <: NonlinearSolveBase.AbstractSafeBestNonlinearTerminationMode
Essentially AbsNormSafeTerminationMode
, but caches the bestsolution found so far.
Constructor
AbsNormSafeBestTerminationMode(
internalnorm; protective_threshold = nothing,
patience_steps = 100, patience_objective_multiplier = 3,
min_max_factor = 1.3, max_stalled_steps = nothing
)
where internalnorm
is the norm to use for the termination condition. Special handling is done for norm(_, 2)
, norm
, norm(_, Inf)
, and maximum(abs, _)
..
Relative Tolerance
NonlinearSolveBase.RelTerminationMode
— TypeRelTerminationMode <: AbstractNonlinearTerminationMode
Terminates if $all \left(| \Delta u | \leq reltol \times | u | \right)$. .
$\Delta u$ denotes the increment computed by the nonlinear solver and $u$ denotes the solution.
NonlinearSolveBase.RelNormTerminationMode
— TypeRelNormTerminationMode <: AbstractNonlinearTerminationMode
Terminates if $\| \Delta u \| \leq reltol \times \| \Delta u + u \|$. .
$\Delta u$ denotes the increment computed by the inner nonlinear solver.
Constructor
RelNormTerminationMode(internalnorm = nothing)
where internalnorm
is the norm to use for the termination condition. Special handling is done for norm(_, 2)
, norm
, norm(_, Inf)
, and maximum(abs, _)
..
NonlinearSolveBase.RelNormSafeTerminationMode
— TypeRelNormSafeTerminationMode <: NonlinearSolveBase.AbstractSafeNonlinearTerminationMode
Essentially RelNormTerminationMode
+ terminate if there has been no improvement for the last patience_steps
+ terminate if the solution blows up (diverges).
Constructor
RelNormSafeTerminationMode(
internalnorm; protective_threshold = nothing,
patience_steps = 100, patience_objective_multiplier = 3,
min_max_factor = 1.3, max_stalled_steps = nothing
)
where internalnorm
is the norm to use for the termination condition. Special handling is done for norm(_, 2)
, norm
, norm(_, Inf)
, and maximum(abs, _)
..
NonlinearSolveBase.RelNormSafeBestTerminationMode
— TypeRelNormSafeBestTerminationMode <: NonlinearSolveBase.AbstractSafeBestNonlinearTerminationMode
Essentially RelNormSafeTerminationMode
, but caches the bestsolution found so far.
Constructor
RelNormSafeBestTerminationMode(
internalnorm; protective_threshold = nothing,
patience_steps = 100, patience_objective_multiplier = 3,
min_max_factor = 1.3, max_stalled_steps = nothing
)
where internalnorm
is the norm to use for the termination condition. Special handling is done for norm(_, 2)
, norm
, norm(_, Inf)
, and maximum(abs, _)
..
Both Tolerances
NonlinearSolveBase.NormTerminationMode
— TypeNormTerminationMode <: AbstractNonlinearTerminationMode
Terminates if $\| \Delta u \| \leq reltol \times \| \Delta u + u \|$ or $\| \Delta u \| \leq abstol$. .
$\Delta u$ denotes the increment computed by the inner nonlinear solver.
Constructor
NormTerminationMode(internalnorm = nothing)
where internalnorm
is the norm to use for the termination condition. Special handling is done for norm(_, 2)
, norm
, norm(_, Inf)
, and maximum(abs, _)
..