Cut timestep if penlaty exceeds limit

This commit is contained in:
jakobtorben
2024-09-09 19:55:16 +02:00
parent d476a328de
commit 5f17c9de6a
3 changed files with 13 additions and 1 deletions

View File

@@ -1172,6 +1172,15 @@ namespace Opm {
}
// check card penalty, and add to report
checkCardPenalty(report, iteration);
int cut_off_limit = 30;
if (total_penaltyCard_.total() > cut_off_limit) {
report.setReservoirFailed({ConvergenceReport::ReservoirFailure::Type::ConvergenceMonitorFailure,
ConvergenceReport::Severity::TooLarge,
-1}); // -1 indicates it's not specific to any component
throw ConvergenceMonitorFailure("Total penalty count exceeded cut-off-limit of " + std::to_string(cut_off_limit) + ". Cutting timestep.");
}
return report;
}

View File

@@ -247,6 +247,9 @@ void registerAdaptiveParameters();
logException_(e, solverVerbose_);
// since linearIterations is < 0 this will restart the solver
}
catch (const ConvergenceMonitorFailure& e) {
causeOfFailure = "Convergence monitor failure";
}
catch (const LinearSolverProblem& e) {
substepReport = solver.failureReport();
causeOfFailure = "Linear solver convergence failure";

View File

@@ -92,7 +92,7 @@ namespace Opm
class ReservoirFailure
{
public:
enum struct Type { Invalid, MassBalance, Cnv };
enum struct Type { Invalid, MassBalance, Cnv, ConvergenceMonitorFailure };
// Default constructor needed for object serialisation. Don't
// use this for anything else.