From 2960958a2cf7de4219b69e41b5c168acf4f1cc01 Mon Sep 17 00:00:00 2001 From: Ady0333 Date: Fri, 24 Apr 2026 08:12:04 +0530 Subject: [PATCH 1/2] Fix NewtonRaphsonSolver convergence check and max_nliters error Signed-off-by: Ady0333 --- src/Algebra/NLSolvers.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Algebra/NLSolvers.jl b/src/Algebra/NLSolvers.jl index 3990e5543..5b968da6f 100644 --- a/src/Algebra/NLSolvers.jl +++ b/src/Algebra/NLSolvers.jl @@ -64,7 +64,7 @@ function _solve_nr!(x,A,b,dx,ns,nls,op) if isconv; return; end if nliter == nls.max_nliters - @unreachable + error("NewtonRaphsonSolver failed to converge in $(nls.max_nliters) iterations. Final residual: $(maximum(abs,b))") end # Assemble jacobian (fast in-place version) @@ -78,7 +78,7 @@ end function _check_convergence(nls,b) m0 = maximum(abs,b) - return (false, m0) + return (m0 < nls.tol, m0) end function _check_convergence(nls,b,m0) From 00d04803d675d08d5a1f81544cb6b9029aeba07e Mon Sep 17 00:00:00 2001 From: Ady0333 Date: Mon, 27 Apr 2026 15:48:35 +0530 Subject: [PATCH 2/2] Update NEWS.md for NewtonRaphsonSolver convergence fix Signed-off-by: Ady0333 --- NEWS.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS.md b/NEWS.md index c3045faf8..c2d2f5fbb 100644 --- a/NEWS.md +++ b/NEWS.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- `NewtonRaphsonSolver` now correctly handles already-converged initial states and reports non-convergence properly. Previously crashed with `@unreachable` when starting residual was ~0. Now checks initial convergence and throws informative error instead of assertion failure. Since PR[#1285](https://github.com/gridap/Gridap.jl/pull/1285). (@Ady0333) + ## [0.20.4] - 2026-04-23 ### Added