GridapSolvers.NonlinearSolvers
GridapSolvers.NonlinearSolvers.ContinuationFEOperator
— Typestruct ContinuationFEOperator <: FESpaces.FEOperator
op1 :: FEOperator
op2 :: FEOperator
switch :: ContinuationSwitch
reuse_caches :: Bool
end
FEOperator implementing the continuation method for nonlinear solvers. It switches between its two operators when the switch is triggered.
Continuation between more that two operators can be achieved by daisy-chaining two or more ContinuationFEOperators.
If reuse_caches
is true
, the Jacobian of the first operator is reused for the second operator. This is only possible if the sparsity pattern of the Jacobian does not change.
GridapSolvers.NonlinearSolvers.ContinuationFEOperator
— MethodContinuationFEOperator(op1::FEOperator, op2::FEOperator, niter::Int; reuse_caches::Bool = true)
ContinuationFEOperator that switches between op1
and op2
after niter
iterations.
GridapSolvers.NonlinearSolvers.ContinuationSwitch
— Typemutable struct ContinuationSwitch{A}
callback :: Function
caches :: A
switched :: Bool
end
ContinuationSwitch(callback::Function, caches)
Switch that implements the switching logic for a ContinuationFEOperator.
The callback function must provide the following signatures:
- Reset:
callback(u::FEFunction,::Nothing,cache) -> (switch::Bool, new_cache)
- Update:
callback(u::FEFunction,b::AbstractVector,cache) -> (switch::Bool, new_cache)
where u
is the current solution (as a FEFunction) and b
is the current residual. The first signature is called by allocate_residual
and is typically used to reset the switch for a new nonlinear solve. The second signature is called by residual!
and is used to update the switch based on the current residual.
The cache is (potentially) mutated between each call, and can hold any extra information needed for the continuation logic.
GridapSolvers.NonlinearSolvers.ContinuationSwitch
— MethodContinuationSwitch(niter::Int)
Switch that will change operators after niter
iterations.
GridapSolvers.NonlinearSolvers.NLsolveNonlinearSolver
— TypeNLsolveNonlinearSolver <: NonlinearSolver
NLsolveNonlinearSolver(ls::LinearSolver;kwargs...)
NLsolveNonlinearSolver(;kwargs...)
Wrapper for NLsolve.jl
nonlinear solvers. It is equivalent to the wrappers in Gridap, but with support for nonlinear preconditioners. Same kwargs
as in nlsolve
. Due to NLSolve.jl
not using LinearAlgebra's API, these solvers are not compatible with PartitionedArrays.jl
. For parallel computations, use NewtonSolver
instead.
GridapSolvers.NonlinearSolvers.NewtonSolver
— Typestruct NewtonSolver <: Algebra.NonlinearSolver
Newton-Raphson solver. Same as NewtonRaphsonSolver
in Gridap, but with a couple addons:
- Better logging and verbosity control.
- Better convergence criteria.
- Works with geometric LinearSolvers/Preconditioners.