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 <: AbstractNonlinearTerminationModeTerminates 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 <: AbstractNonlinearTerminationModeTerminates 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.AbstractSafeNonlinearTerminationModeEssentially 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.AbstractSafeBestNonlinearTerminationModeEssentially 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 <: AbstractNonlinearTerminationModeTerminates 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 <: AbstractNonlinearTerminationModeTerminates 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.AbstractSafeNonlinearTerminationModeEssentially 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.AbstractSafeBestNonlinearTerminationModeEssentially 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 <: AbstractNonlinearTerminationModeTerminates 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, _)..