mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Log the message of exceptions in the catch clause of adaptive time stepper.
This commit is contained in:
@@ -57,6 +57,17 @@ namespace Opm {
|
|||||||
return solver_.model().relativeChange( previous_, current_ );
|
return solver_.model().relativeChange( previous_, current_ );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<class E>
|
||||||
|
void logException(const E& exception, bool verbose)
|
||||||
|
{
|
||||||
|
if( verbose )
|
||||||
|
{
|
||||||
|
std::ostringstream message;
|
||||||
|
message << "Caught Exception: " << exception.what();
|
||||||
|
OpmLog::debug(message.str());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// AdaptiveTimeStepping
|
// AdaptiveTimeStepping
|
||||||
@@ -207,19 +218,19 @@ namespace Opm {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (const Opm::NumericalProblem& e) {
|
catch (const Opm::NumericalProblem& e) {
|
||||||
std::cerr << e.what() << std::endl;
|
detail::logException(e, solver_verbose_);
|
||||||
// since linearIterations is < 0 this will restart the solver
|
// since linearIterations is < 0 this will restart the solver
|
||||||
}
|
}
|
||||||
catch (const std::runtime_error& e) {
|
catch (const std::runtime_error& e) {
|
||||||
std::cerr << e.what() << std::endl;
|
detail::logException(e, solver_verbose_);
|
||||||
// also catch linear solver not converged
|
// also catch linear solver not converged
|
||||||
}
|
}
|
||||||
catch (const Dune::ISTLError& e) {
|
catch (const Dune::ISTLError& e) {
|
||||||
std::cerr << e.what() << std::endl;
|
detail::logException(e, solver_verbose_);
|
||||||
// also catch errors in ISTL AMG that occur when time step is too large
|
// also catch errors in ISTL AMG that occur when time step is too large
|
||||||
}
|
}
|
||||||
catch (const Dune::MatrixBlockError& e) {
|
catch (const Dune::MatrixBlockError& e) {
|
||||||
std::cerr << e.what() << std::endl;
|
detail::logException(e, solver_verbose_);
|
||||||
// this can be thrown by ISTL's ILU0 in block mode, yet is not an ISTLError
|
// this can be thrown by ISTL's ILU0 in block mode, yet is not an ISTLError
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user