From 3b522dcfb0ef94d48c47f20656d73c1dcc3e893f Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Mon, 25 Jul 2016 15:33:07 -0400 Subject: [PATCH] [Python/1D] Print exception messages after failed auto-solve attempts This helps with debugging cases where the solver fails, especially, if the failures are not convergence-related and cannot be resolved by successive attempts at solving the problem. --- interfaces/cython/cantera/onedim.pyx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/interfaces/cython/cantera/onedim.pyx b/interfaces/cython/cantera/onedim.pyx index d62781a8c..564fac442 100644 --- a/interfaces/cython/cantera/onedim.pyx +++ b/interfaces/cython/cantera/onedim.pyx @@ -839,7 +839,8 @@ cdef class Sim1D: self.energy_enabled = True self.sim.solve(loglevel, False) solved = True - except Exception: + except Exception as e: + log(str(e)) solved = False if not solved: @@ -854,8 +855,8 @@ cdef class Sim1D: self.energy_enabled = True self.sim.solve(loglevel, False) solved = True - except Exception: - pass + except Exception as e: + log(str(e)) if solved and not self.extinct(): # Found a non-extinct solution on the fixed grid @@ -863,7 +864,8 @@ cdef class Sim1D: try: self.sim.solve(loglevel, True) solved = True - except Exception: + except Exception as e: + log(str(e)) solved = False if solved and not self.extinct():