[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.
This commit is contained in:
parent
feca44aa2d
commit
3b522dcfb0
1 changed files with 6 additions and 4 deletions
|
|
@ -839,7 +839,8 @@ cdef class Sim1D:
|
||||||
self.energy_enabled = True
|
self.energy_enabled = True
|
||||||
self.sim.solve(loglevel, <cbool>False)
|
self.sim.solve(loglevel, <cbool>False)
|
||||||
solved = True
|
solved = True
|
||||||
except Exception:
|
except Exception as e:
|
||||||
|
log(str(e))
|
||||||
solved = False
|
solved = False
|
||||||
|
|
||||||
if not solved:
|
if not solved:
|
||||||
|
|
@ -854,8 +855,8 @@ cdef class Sim1D:
|
||||||
self.energy_enabled = True
|
self.energy_enabled = True
|
||||||
self.sim.solve(loglevel, <cbool>False)
|
self.sim.solve(loglevel, <cbool>False)
|
||||||
solved = True
|
solved = True
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
log(str(e))
|
||||||
|
|
||||||
if solved and not self.extinct():
|
if solved and not self.extinct():
|
||||||
# Found a non-extinct solution on the fixed grid
|
# Found a non-extinct solution on the fixed grid
|
||||||
|
|
@ -863,7 +864,8 @@ cdef class Sim1D:
|
||||||
try:
|
try:
|
||||||
self.sim.solve(loglevel, <cbool>True)
|
self.sim.solve(loglevel, <cbool>True)
|
||||||
solved = True
|
solved = True
|
||||||
except Exception:
|
except Exception as e:
|
||||||
|
log(str(e))
|
||||||
solved = False
|
solved = False
|
||||||
|
|
||||||
if solved and not self.extinct():
|
if solved and not self.extinct():
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue