diff --git a/src/LinearSolvers/Krylov/FGMRESSolvers.jl b/src/LinearSolvers/Krylov/FGMRESSolvers.jl index c5de93a1..22cb5da9 100644 --- a/src/LinearSolvers/Krylov/FGMRESSolvers.jl +++ b/src/LinearSolvers/Krylov/FGMRESSolvers.jl @@ -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) diff --git a/src/NonlinearSolvers/NewtonRaphsonSolver.jl b/src/NonlinearSolvers/NewtonRaphsonSolver.jl index a2c17471..9cac1524 100644 --- a/src/NonlinearSolvers/NewtonRaphsonSolver.jl +++ b/src/NonlinearSolvers/NewtonRaphsonSolver.jl @@ -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 @@ -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