move checkConvergencePolyMW into WellConvergence

This commit is contained in:
Arne Morten Kvarving
2022-10-27 10:43:44 +02:00
parent 0f8ca0c529
commit 5d4c7f49a2
5 changed files with 48 additions and 46 deletions

View File

@@ -115,4 +115,44 @@ checkConvergenceControlEq(const WellState& well_state,
}
}
void
WellConvergence::
checkConvergencePolyMW(const std::vector<double>& res,
const int Bhp,
const double maxResidualAllowed,
ConvergenceReport& report) const
{
if (well_.isInjector()) {
// checking the convergence of the perforation rates
const double wat_vel_tol = 1.e-8;
const int dummy_component = -1;
using CR = ConvergenceReport;
const auto wat_vel_failure_type = CR::WellFailure::Type::MassBalance;
for (int perf = 0; perf < well_.numPerfs(); ++perf) {
const double wat_vel_residual = res[Bhp + 1 + perf];
if (std::isnan(wat_vel_residual)) {
report.setWellFailed({wat_vel_failure_type, CR::Severity::NotANumber, dummy_component, well_.name()});
} else if (wat_vel_residual > maxResidualAllowed * 10.) {
report.setWellFailed({wat_vel_failure_type, CR::Severity::TooLarge, dummy_component, well_.name()});
} else if (wat_vel_residual > wat_vel_tol) {
report.setWellFailed({wat_vel_failure_type, CR::Severity::Normal, dummy_component, well_.name()});
}
}
// checking the convergence of the skin pressure
const double pskin_tol = 1000.; // 1000 pascal
const auto pskin_failure_type = CR::WellFailure::Type::Pressure;
for (int perf = 0; perf < well_.numPerfs(); ++perf) {
const double pskin_residual = res[Bhp + 1 + perf + well_.numPerfs()];
if (std::isnan(pskin_residual)) {
report.setWellFailed({pskin_failure_type, CR::Severity::NotANumber, dummy_component, well_.name()});
} else if (pskin_residual > maxResidualAllowed * 10.) {
report.setWellFailed({pskin_failure_type, CR::Severity::TooLarge, dummy_component, well_.name()});
} else if (pskin_residual > pskin_tol) {
report.setWellFailed({pskin_failure_type, CR::Severity::Normal, dummy_component, well_.name()});
}
}
}
}
}