move checkMaxWaterCutLimit to WellTest

This commit is contained in:
Arne Morten Kvarving
2022-10-24 11:06:35 +02:00
parent e7273868f5
commit 2b152e67e1
4 changed files with 57 additions and 58 deletions

View File

@@ -29,6 +29,7 @@
namespace Opm
{
template<class RatioFunc>
bool WellTest::checkMaxRatioLimitWell(const SingleWellState& ws,
const double max_ratio_limit,
const RatioFunc& ratioFunc) const
@@ -44,6 +45,7 @@ bool WellTest::checkMaxRatioLimitWell(const SingleWellState& ws,
return (well_ratio > max_ratio_limit);
}
template<class RatioFunc>
void WellTest::checkMaxRatioLimitCompletions(const SingleWellState& ws,
const double max_ratio_limit,
const RatioFunc& ratioFunc,
@@ -151,4 +153,41 @@ void WellTest::checkMaxWGRLimit(const WellEconProductionLimits& econ_production_
}
}
void WellTest::checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits,
const SingleWellState& ws,
RatioLimitCheckReport& report) const
{
static constexpr int Oil = BlackoilPhases::Liquid;
static constexpr int Water = BlackoilPhases::Aqua;
// function to calculate water cut based on rates
auto waterCut = [](const std::vector<double>& rates,
const PhaseUsage& pu) {
const double oil_rate = -rates[pu.phase_pos[Oil]];
const double water_rate = -rates[pu.phase_pos[Water]];
const double liquid_rate = oil_rate + water_rate;
if (liquid_rate <= 0.)
return 0.;
else if (water_rate < 0)
return 0.;
else if (oil_rate < 0)
return 1.;
else
return (water_rate / liquid_rate);
};
const double max_water_cut_limit = econ_production_limits.maxWaterCut();
assert(max_water_cut_limit > 0.);
const bool watercut_limit_violated =
this->checkMaxRatioLimitWell(ws, max_water_cut_limit, waterCut);
if (watercut_limit_violated) {
report.ratio_limit_violated = true;
this->checkMaxRatioLimitCompletions(ws, max_water_cut_limit,
waterCut, report);
}
}
} // namespace Opm