Merge pull request #4483 from GitPaean/wrong_direction_flow_not_converged

not considering wells with wrong flow direction as converged
This commit is contained in:
Atgeirr Flø Rasmussen
2023-02-28 07:55:07 +01:00
committed by GitHub
3 changed files with 27 additions and 1 deletions

View File

@@ -81,7 +81,7 @@ namespace Opm
class WellFailure
{
public:
enum struct Type { Invalid, MassBalance, Pressure, ControlBHP, ControlTHP, ControlRate, Unsolvable };
enum struct Type { Invalid, MassBalance, Pressure, ControlBHP, ControlTHP, ControlRate, Unsolvable, WrongFlowDirection };
WellFailure(Type t, Severity s, int phase, const std::string& well_name)
: type_(t), severity_(s), phase_(phase), well_name_(well_name)
{

View File

@@ -164,6 +164,19 @@ getWellConvergence(const WellState& well_state,
report,
deferred_logger);
// for stopped well, we do not enforce the following checking to avoid dealing with sign of near-zero values
// for BHP or THP controlled wells, we need to make sure the flow direction is correct
if (!baseif_.wellIsStopped() && baseif_.isPressureControlled(well_state)) {
// checking the flow direction
const double sign = baseif_.isProducer() ? -1. : 1.;
const auto weight_total_flux = this->primary_variables_.getWQTotal() * sign;
constexpr int dummy_phase = -1;
if (weight_total_flux < 0.) {
report.setWellFailed(
{CR::WellFailure::Type::WrongFlowDirection, CR::Severity::Normal, dummy_phase, baseif_.name()});
}
}
return report;
}

View File

@@ -151,6 +151,19 @@ getWellConvergence(const WellState& well_state,
report,
deferred_logger);
// for stopped well, we do not enforce the following checking to avoid dealing with sign of near-zero values
// for BHP or THP controlled wells, we need to make sure the flow direction is correct
if (!baseif_.wellIsStopped() && baseif_.isPressureControlled(well_state)) {
// checking the flow direction
const double sign = baseif_.isProducer() ? -1. : 1.;
const auto weight_total_flux = this->primary_variables_.value(PrimaryVariables::WQTotal) * sign;
constexpr int dummy_phase = -1;
if (weight_total_flux < 0.) {
report.setWellFailed(
{CR::WellFailure::Type::WrongFlowDirection, CR::Severity::Normal, dummy_phase, baseif_.name()});
}
}
return report;
}