]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Let KINSOL throw an exception if it fails.
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 6 May 2025 20:35:49 +0000 (14:35 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 6 May 2025 20:35:49 +0000 (14:35 -0600)
source/sundials/kinsol.cc

index e5fee93e0ecbb6e02a284789fcf9a2859be483c8..b41cfb10a4d0e2fcbcfab2bd942e649df1c46fb8 100644 (file)
@@ -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);

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.