Problem with error handling using IstlSolverFactoryBackend
Bug report
I'm running into a problem using the istl sovler factory with dumux, which seems to be caused by the error handling within dumux. I face a numerical problem within the linear solver (that's ok), but instead of reducing the time step size or aborting the simulation properly the parallel simulation freezes (that's not ok).
What happened / Problem description:
- The ILU, I'm using, fails to invert a matrix block and throws a
Dune::MatrixBlockError
. That's ok. (https://gitlab.dune-project.org/core/dune-istl/-/blob/master/dune/istl/ilu.hh?ref_type=heads#L85) - The error is caught within the
IstlSolverFactoryBackend
of dumux. There is a follow up error thrown, usingthrow
and notDUNE_THROW
. (https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/blob/master/dumux/linear/istlsolverfactorybackend.hh?ref_type=heads#L460) - Thus the
NewtonSolver
, which checks, if the linear solver converged properly, does not catch the exception, as it only catchesDune::Exceptions
. That's not ok and I think that's the reason, why my parallel simulation freezes, as one process is aborted by the error and the other processes are pending as the abortion is not communicated properly. (https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/blob/master/dumux/nonlinear/newtonsolver.hh?ref_type=heads#L497)
Possible solutions:
- Use
DUNE_THROW
within theIstlSolverFactoryBackend
:
try { return Dune::getSolverFromFactory(fop, params_); }
catch(Dune::Exception& e)
{
DUNE_THROW(Dune::ISTLError, "Could not create solver with factory");
}
- Don't catch the error in
IstlSolverFactoryBackend
return Dune::getSolverFromFactory(fop, params_);
Unfortunately, none of these solutions worked for me. Maybe due to some mistake in implementation?!