move checkRatioEconLimits to WellTest

This commit is contained in:
Arne Morten Kvarving
2022-10-24 11:55:57 +02:00
parent 1a0774ceab
commit 71d404336e
4 changed files with 63 additions and 69 deletions
@@ -504,62 +504,6 @@ checkConstraints(WellState& well_state,
}
}
template<typename FluidSystem>
void
WellInterfaceFluidSystem<FluidSystem>::
checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
const SingleWellState& ws,
RatioLimitCheckReport& report,
DeferredLogger& deferred_logger) const
{
// TODO: not sure how to define the worst-offending completion when more than one
// ratio related limit is violated.
// The defintion used here is that we define the violation extent based on the
// ratio between the value and the corresponding limit.
// For each violated limit, we decide the worst-offending completion separately.
// Among the worst-offending completions, we use the one has the biggest violation
// extent.
if (econ_production_limits.onMaxWaterCut()) {
assert(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx));
assert(FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx));
WellTest(*this).checkMaxWaterCutLimit(econ_production_limits, ws, report);
}
if (econ_production_limits.onMaxGasOilRatio()) {
assert(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx));
assert(FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx));
WellTest(*this).checkMaxGORLimit(econ_production_limits, ws, report);
}
if (econ_production_limits.onMaxWaterGasRatio()) {
assert(FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx));
assert(FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx));
WellTest(*this).checkMaxWGRLimit(econ_production_limits, ws, report);
}
if (econ_production_limits.onMaxGasLiquidRatio()) {
deferred_logger.warning("NOT_SUPPORTING_MAX_GLR", "the support for max Gas-Liquid ratio is not implemented yet!");
}
if (report.ratio_limit_violated) {
// No worst offending completion is found because all the completions are either injecting or
// have trivial rates.
if(report.worst_offending_completion == INVALIDCOMPLETION) {
std::string message = "The well ratio limit is violated but all the completion rates are trivial! " + this->name() + " is kept open";
deferred_logger.warning("WECON_INVALIDCOMPLETION", message);
report.ratio_limit_violated = false;
}
// Due to numerical instability there may exist corner cases where the well breaks
// the ratio limit but no completion does.
else if(report.violation_extent <= 1.) {
std::string message = "The well ratio limit is violated but no completion ratio limit is violated! " + this->name() + " is kept open";
deferred_logger.warning("WECON_INCONSISTANT_COMPLETION_WELL", message);
report.ratio_limit_violated = false;
}
}
}
template<typename FluidSystem>
void
WellInterfaceFluidSystem<FluidSystem>::
@@ -643,9 +587,8 @@ updateWellTestStateEconomic(const SingleWellState& ws,
}
// checking for ratio related limits, mostly all kinds of ratio.
RatioLimitCheckReport ratio_report;
checkRatioEconLimits(econ_production_limits, ws, ratio_report, deferred_logger);
RatioLimitCheckReport ratio_report =
WellTest(*this).checkRatioEconLimits(econ_production_limits, ws, deferred_logger);
if (ratio_report.ratio_limit_violated) {
const auto workover = econ_production_limits.workover();