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.AbsTerminationModeType
AbsTerminationMode <: 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.

source
NonlinearSolveBase.AbsNormTerminationModeType
AbsNormTerminationMode <: 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, _)..

source
NonlinearSolveBase.AbsNormSafeTerminationModeType
AbsNormSafeTerminationMode <: 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, _)..

source
NonlinearSolveBase.AbsNormSafeBestTerminationModeType
AbsNormSafeBestTerminationMode <: 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, _)..

source

Relative Tolerance

NonlinearSolveBase.RelTerminationModeType
RelTerminationMode <: 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.

source
NonlinearSolveBase.RelNormTerminationModeType
RelNormTerminationMode <: 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, _)..

source
NonlinearSolveBase.RelNormSafeTerminationModeType
RelNormSafeTerminationMode <: 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, _)..

source
NonlinearSolveBase.RelNormSafeBestTerminationModeType
RelNormSafeBestTerminationMode <: 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, _)..

source

Both Tolerances

NonlinearSolveBase.NormTerminationModeType
NormTerminationMode <: 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, _)..

source