Skip to content

Commit

Permalink
Merge pull request #44 from gridap/solve_ambiguity_when_no_precon_is_…
Browse files Browse the repository at this point in the history
…used

Addressing ambiguity in krylov_mul! whenever no preconditioner is used at all (neither left or right)
  • Loading branch information
JordiManyer authored Nov 3, 2023
2 parents 9a47661 + e91e9a2 commit 1f1c6d3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/LinearSolvers/Krylov/KrylovUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ function krylov_mul!(y,A,x,Pr::Nothing,Pl,wr,wl)
mul!(wl,A,x)
solve!(y,Pl,wl)
end
function krylov_mul!(y,A,x,Pr::Nothing,Pl::Nothing,wr,wl)
mul!(y,A,x)
end

"""
Computes the Krylov residual r = Pl⁻¹(A⋅x - b).
Expand Down
5 changes: 5 additions & 0 deletions test/LinearSolvers/KrylovSolversTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,14 @@ function main(distribute,np)
P = JacobiLinearSolver()
verbose = i_am_main(parts)

# GMRES with left and right preconditioner
gmres = LinearSolvers.GMRESSolver(40;Pr=P,Pl=P,rtol=1.e-8,verbose=verbose)
test_solver(gmres,op,Uh,dΩ)

# GMRES without preconditioner
gmres = LinearSolvers.GMRESSolver(40;rtol=1.e-8,verbose=verbose)
test_solver(gmres,op,Uh,dΩ)

fgmres = LinearSolvers.FGMRESSolver(40,P;rtol=1.e-8,verbose=verbose)
test_solver(fgmres,op,Uh,dΩ)

Expand Down

0 comments on commit 1f1c6d3

Please sign in to comment.