Nonlinear Solvers
One of our goals is to make adding new and hacking existing nonlinear solvers easy!
Input File Syntax Example
Below is an example input file block for a trust region solver that leverages a direct solver with an LDLT factorization. The nonlinear solver is also utilizing warm start to improve the first few iterations of each load step.
linear solvers:
direct:
type: DirectLinearSolver
factorization method: ldl
nonlinear solvers:
trs:
type: TrustRegionSolver
linear solver: direct
warm start: on
General methods and abstract types
Cthonios.AbstractNonlinearSolver
— Typeabstract type AbstractNonlinearSolver{L, O, U, W, T} <: Cthonios.AbstractSolver
a nonlinear solver needs to define the following methods
- check_convergence - returns a bool
- logger - @info information
- step! - step for the solver
it needs the following types
- a linear solver
- an objective
- an unknown vector
- an int called max_iter
Cthonios.solve!
— Methodsolve!(solver::Cthonios.AbstractNonlinearSolver, Uu, p)
Generic method to fall back on if step! is defined
Newton Solver
Cthonios.NewtonSolver
— Typestruct NewtonSolver{L, O, U, W, T} <: Cthonios.AbstractNonlinearSolver{L, O, U, W, T}
linear_solver::Any
objective::Any
ΔUu::Any
warm_start::Any
timer::Any
max_iter::Int64
abs_tol::Float64
rel_tol::Float64
use_warm_start::Bool
Cthonios.NewtonSolver
— MethodNewtonSolver(
inputs::Dict{Symbol, Any},
objective::Objective,
p,
timer
) -> NewtonSolver{_A, O, _B, W} where {_A, O<:Objective, _B, W<:Cthonios.WarmStart}
Cthonios.NewtonSolver
— MethodNewtonSolver(
objective::Objective,
p,
timer;
linear_solver_type,
use_warm_start
) -> NewtonSolver{L, O, _A, W} where {L<:(DirectSolver{A, L} where {A<:(FiniteElementContainers.StaticAssembler{Float64, Int64, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, Vector{Int64}, Vector{Int64}, Vector{Float64}} where {_A<:AbstractVector{Int64}, _B<:AbstractVector{Int64}, _C<:AbstractVector{Int64}, _D<:AbstractVector{Int64}, _E<:AbstractVector{Int64}, _F<:NodalField, _G<:AbstractVector{Float64}, _H, _I, _J, _K}), L<:(LinearSolve.LinearCache{Symmetric{Float64, SparseArrays.SparseMatrixCSC{Float64, Int64}}, _A, _B, SciMLBase.NullParameters, LinearSolve.DefaultLinearSolver, LinearSolve.DefaultLinearSolverInit{LU{Float64, SparseArrays.SparseMatrixCSC{Float64, Int64}, Vector{Int64}}, QR{Float64, SparseArrays.SparseMatrixCSC{Float64, Int64}, Vector{Float64}}, Nothing, Nothing, Sparspak.SpkSparseSolver.SparseSolver{Int64, Float64}, Nothing, Nothing, _A1, LU{Float64, SparseArrays.SparseMatrixCSC{Float64, Int64}, Vector{Int64}}, Tuple{LU{Float64, SparseArrays.SparseMatrixCSC{Float64, Int64}, Vector{Int64}}, Vector{Int64}}, Nothing, Nothing, SparseArrays.CHOLMOD.Factor{Float64, Int64}, Nothing, SparseArrays.CHOLMOD.Factor{Float64, Int64}, SparseArrays.CHOLMOD.Factor{Float64, Int64}, Tuple{LU{Float64, Matrix{Float64}, Vector{Int32}}, Base.RefValue{Int32}}, Tuple{LU{Float64, Matrix{Float64}, Vector{Int64}}, Base.RefValue{Int64}}, QRPivoted{Float64, SparseArrays.SparseMatrixCSC{Float64, Int64}, Vector{Float64}, Vector{Int64}}, _B1, _C}, SciMLOperators.IdentityOperator, SciMLOperators.IdentityOperator, _C1, Bool, LinearSolve.LinearSolveAdjoint{Missing}} where {_A, _B, _A1, _B1, _C, _C1})}), O<:Objective, _A, W<:Cthonios.WarmStart}
Cthonios.check_convergence
— Methodcheck_convergence(
solver::NewtonSolver,
Uu,
p,
R0_norm
) -> Bool
Cthonios.logger
— Methodlogger(solver::NewtonSolver, Uu, p, n::Int64, norm_R0)
Cthonios.step!
— Methodstep!(solver::NewtonSolver, Uu, p)
Trust Region Solver
Cthonios.TrustRegionSolver
— Typestruct TrustRegionSolver{L, O, U<:(AbstractVector), W, T<:TimerOutput, F<:NodalField, S<:Cthonios.TrustRegionSolverSettings} <: Cthonios.AbstractNonlinearSolver{L, O, U<:(AbstractVector), W, T<:TimerOutput}
preconditioner::Any
objective::Any
ΔUu::AbstractVector
warm_start::Any
timer::TimerOutput
o::AbstractVector
g::NodalField
Hv::NodalField
cauchy_point::AbstractVector
q_newton_point::AbstractVector
d::AbstractVector
y_scratch_1::AbstractVector
y_scratch_2::AbstractVector
y_scratch_3::AbstractVector
y_scratch_4::AbstractVector
use_warm_start::Bool
settings::Cthonios.TrustRegionSolverSettings
Cthonios.TrustRegionSolver
— MethodTrustRegionSolver(
objective::Objective,
p,
timer;
preconditioner,
use_warm_start,
settings
) -> TrustRegionSolver{L, O, Vector{Float64}, W, TimerOutput, F, Cthonios.TrustRegionSolverSettings} where {L<:(CholeskyPreconditioner{A, SparseArrays.CHOLMOD.Factor{Float64, Int64}} where A<:(FiniteElementContainers.StaticAssembler{Float64, Int64, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, Vector{Int64}, Vector{Int64}, Vector{Float64}} where {_A<:AbstractVector{Int64}, _B<:AbstractVector{Int64}, _C<:AbstractVector{Int64}, _D<:AbstractVector{Int64}, _E<:AbstractVector{Int64}, _F<:NodalField, _G<:AbstractVector{Float64}, _H, _I, _J, _K})), O<:Objective, W<:Cthonios.WarmStart, F<:NodalField}
TODO figure out which scratch arrays can be nixed
Cthonios.TrustRegionSolverSettings
— Typet_1::Float64
t_2::Float64
η_1::Float64
η_2::Float64
η_3::Float64
max_trust_iters::Int64
tol::Float64
max_cg_iters::Int64
max_cumulative_cg_iters::Int64
cg_tol::Float64
cg_inexact_solve_ratio::Float64
tr_size::Float64
min_tr_size::Float64
check_stability::Bool
use_preconditioned_inner_product_for_cg::Bool
use_incremental_objective::Bool
debug_info::Bool
over_iter::Int64