Skip to content

Commit

Permalink
Bugfix. Block GMRES working
Browse files Browse the repository at this point in the history
  • Loading branch information
JordiManyer committed Sep 13, 2023
1 parent e2d8461 commit 214a901
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -738,9 +738,9 @@ version = "4.1.5+0"

[[deps.OpenSSL_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "bbb5c2115d63c2f1451cb70e5ef75e8fe4707019"
git-tree-sha1 = "a12e56c72edee3ce6b96667745e6cbbe5498f200"
uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95"
version = "1.1.22+0"
version = "1.1.23+0"

[[deps.OpenSpecFun_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "Pkg"]
Expand Down
14 changes: 14 additions & 0 deletions src/Li2019/solver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ function Li2019Solver(op,params)
U_u, U_p, U_j, U_φ = U
V_u, V_p, V_j, V_φ = V

if isa(params[],Nothing)
params[] = 0.0
end

# Preconditioner
k = params[:k]
γ = params[:fluid][]
Expand All @@ -27,6 +31,16 @@ function Li2019Solver(op,params)
return nlsolver
end

function Gridap.Algebra.solve!(x::AbstractVector,nls::NewtonRaphsonSolver,op::NonlinearOperator,cache::Nothing)
b = residual(op, x)
A = jacobian(op, x)
dx = allocate_col_vector(A)
ns = numerical_setup(symbolic_setup(nls.ls, A), A)

Gridap.Algebra._solve_nr!(x,A,b,dx,ns,nls,op)
return Gridap.Algebra.NewtonRaphsonCache(A,b,dx,ns)
end

# TODO: This is copied from main... should be in a common place
function _interior(model,domain::Union{Gridap.DiscreteModel,GridapDistributed.DistributedDiscreteModel})
return Interior(domain)
Expand Down
2 changes: 1 addition & 1 deletion test/seq/cavity_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ cavity(np=2,backend=:sequential,solver=:block_gmres_li2019)

# Sequential, GMRES + block preconditioners
solver = Dict(
:solver => :block_gmres_li2019
:solver => :block_gmres_li2019,
:matrix_type => SparseMatrixCSR{0,PetscScalar,PetscInt},
:vector_type => Vector{PetscScalar},
:block_solvers => [:amg,:gmres_swartz,:amg,:cg_jacobi,:cg_jacobi],
Expand Down

0 comments on commit 214a901

Please sign in to comment.