From 30448d6e5272015075f2654069cb496bfe361716 Mon Sep 17 00:00:00 2001
From: Philipp Nuske <philipp.nuske@mailbox.org>
Date: Fri, 18 Jan 2013 10:04:24 +0000
Subject: [PATCH] The "standard implicit" way of determining phase compositions
 is by means of the MiscibleMultiPhaseComposition constraint solver. The
 constraints are written into a matrix and the matrix is solved. However, if
 it cannot be solved an exception is thrown. This commit catches that
 exception, and throws NumericalProblem so the simulation can try and
 continue. - Reviewed by Bernd

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@10030 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 .../misciblemultiphasecomposition.hh               | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/dumux/material/constraintsolvers/misciblemultiphasecomposition.hh b/dumux/material/constraintsolvers/misciblemultiphasecomposition.hh
index 9d8a129e6e..9a23a0f5a5 100644
--- a/dumux/material/constraintsolvers/misciblemultiphasecomposition.hh
+++ b/dumux/material/constraintsolvers/misciblemultiphasecomposition.hh
@@ -162,7 +162,19 @@ public:
         }
 
         // solve for all mole fractions
-        M.solve(x, b);
+        try
+        {
+            M.solve(x, b);
+        }
+        catch (Dune::FMatrixError & e) {
+            DUNE_THROW(NumericalProblem,
+                    "Matrix for composition of phases could not be solved. \n"
+                    "Throwing NumericalProblem for trying with smaller timestep.");
+        }
+        catch (...) {
+            std::cerr << "Unknown exception thrown!\n";
+            exit(1);
+        }
 
         // set all mole fractions and the the additional quantities in
         // the fluid state
-- 
GitLab