[Fix]: Check convergence in NLSolver before returning solution#1283
Conversation
Signed-off-by: Ady0333 <adityashinde1525@gmail.com>
|
Hello @JordiManyer and @oriolcg!!! Please review this pr and let me know if any changes are needed... |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1283 +/- ##
==========================================
- Coverage 88.83% 88.82% -0.01%
==========================================
Files 227 227
Lines 29749 29753 +4
==========================================
+ Hits 26427 26429 +2
- Misses 3322 3324 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Thanks @Ady0333 for the contribution, I don't see any issue with the PR. Could you please update NEWS.md with the changes? Cheers! |
Signed-off-by: Ady0333 <adityashinde1525@gmail.com>
Thanks for the review...I have updated the NEWS.md file. |
Summary
Fixes #1282
When
nlsolve()fails to converge, NLSolver now checks the convergence status before returning the solution. Previously, it silently copied the unconverged last iterate.Changes
src/Algebra/NLSolvers.jl: Addconverged()check afternlsolve()callsrc/ODEs/StageOperators.jl: Same fix for ODE/transient contextBehavior
Before: Unconverged Newton iterates silently returned as valid solutions
After: Throws error with iteration count and residual norm
Testing
Tested with a nonlinear problem that fails to converge:
All existing Gridap tests pass.