mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
move checkMaxWaterCutLimit to WellTest
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user