From: Wolfgang Bangerth Date: Tue, 6 May 2025 20:35:49 +0000 (-0600) Subject: Let KINSOL throw an exception if it fails. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e03bf73d3f3c2da85cb8d76834d8b789143295a;p=dealii.git Let KINSOL throw an exception if it fails. --- diff --git a/source/sundials/kinsol.cc b/source/sundials/kinsol.cc index e5fee93e0e..b41cfb10a4 100644 --- a/source/sundials/kinsol.cc +++ b/source/sundials/kinsol.cc @@ -564,7 +564,17 @@ namespace SUNDIALS throw; } } - AssertKINSOL(status); + // It is of course also possible that KINSOL experienced + // convergence issues even if the user-side callbacks + // succeeded. In that case, we also want to throw an exception + // that can be caught by the user -- whether that's actually + // useful to determine a different course of action (i.e., whether + // the user side can do something to recover the ability to + // converge) is a separate matter that we need not decide + // here. (One could imagine this happening in a time or load + // stepping procedure where re-starting with a smaller time step + // or load step could help.) + AssertThrow(status >= 0, ExcKINSOLError(status)); long nniters; status = KINGetNumNonlinSolvIters(kinsol_mem, &nniters);