Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
JordiManyer committed Dec 29, 2023
1 parent 0fcc986 commit be16f27
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/LinearSolvers/Krylov/FGMRESSolvers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ function Gridap.Algebra.numerical_setup(ss::FGMRESSymbolicSetup, A::AbstractMatr
return FGMRESNumericalSetup(solver,A,Pr_ns,Pl_ns,caches)
end

function Gridap.Algebra.numerical_setup(ss::FGMRESSymbolicSetup, A::AbstractMatrix, x::AbstractVector)
solver = ss.solver
Pr_ns = numerical_setup(symbolic_setup(solver.Pr,A,x),A,x)
Pl_ns = isa(solver.Pl,Nothing) ? nothing : numerical_setup(symbolic_setup(solver.Pl,A,x),A,x)
caches = get_solver_caches(solver,A)
return FGMRESNumericalSetup(solver,A,Pr_ns,Pl_ns,caches)
end

function Gridap.Algebra.numerical_setup!(ns::FGMRESNumericalSetup, A::AbstractMatrix)
numerical_setup!(ns.Pr_ns,A)
if !isa(ns.Pl_ns,Nothing)
Expand Down
4 changes: 2 additions & 2 deletions src/NonlinearSolvers/NewtonRaphsonSolver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function Algebra.solve!(x::AbstractVector,nls::NewtonSolver,op::NonlinearOperato
A = jacobian(op, x)
dx = similar(b)
ss = symbolic_setup(nls.ls, A)
ns = numerical_setup(ss,A)
ns = numerical_setup(ss,A,x)
_solve_nr!(x,A,b,dx,ns,nls,op)
return NewtonCache(A,b,dx,ns)
end
Expand All @@ -32,7 +32,7 @@ function Algebra.solve!(x::AbstractVector,nls::NewtonSolver,op::NonlinearOperato
A,b,dx,ns = cache.A, cache.b, cache.dx, cache.ns
residual!(b, op, x)
jacobian!(A, op, x)
numerical_setup!(ns,A)
numerical_setup!(ns,A,x)
_solve_nr!(x,A,b,dx,ns,nls,op)
return cache
end
Expand Down

0 comments on commit be16f27

Please sign in to comment.