mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-26 19:36:25 -06:00
move checkRatioEconLimits to WellTest
This commit is contained in:
parent
1a0774ceab
commit
71d404336e
@ -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();
|
||||
|
@ -123,11 +123,6 @@ protected:
|
||||
const SummaryState& summaryState,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
void checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
|
||||
const SingleWellState& ws,
|
||||
RatioLimitCheckReport& report,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
void updateWellTestStateEconomic(const SingleWellState& ws,
|
||||
const double simulation_time,
|
||||
const bool write_message_to_opmlog,
|
||||
|
@ -234,4 +234,55 @@ bool WellTest::checkRateEconLimits(const WellEconProductionLimits& econ_producti
|
||||
return false;
|
||||
}
|
||||
|
||||
RatioLimitCheckReport WellTest::
|
||||
checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
|
||||
const SingleWellState& ws,
|
||||
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.
|
||||
RatioLimitCheckReport report;
|
||||
|
||||
if (econ_production_limits.onMaxWaterCut()) {
|
||||
this->checkMaxWaterCutLimit(econ_production_limits, ws, report);
|
||||
}
|
||||
|
||||
if (econ_production_limits.onMaxGasOilRatio()) {
|
||||
this->checkMaxGORLimit(econ_production_limits, ws, report);
|
||||
}
|
||||
|
||||
if (econ_production_limits.onMaxWaterGasRatio()) {
|
||||
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 == RatioLimitCheckReport::INVALIDCOMPLETION) {
|
||||
std::string message = "The well ratio limit is violated but all the completion rates are trivial! " + well_.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! " + well_.name() + " is kept open";
|
||||
deferred_logger.warning("WECON_INCONSISTANT_COMPLETION_WELL", message);
|
||||
report.ratio_limit_violated = false;
|
||||
}
|
||||
}
|
||||
|
||||
return report;
|
||||
}
|
||||
|
||||
|
||||
} // namespace Opm
|
||||
|
@ -49,6 +49,16 @@ public:
|
||||
//! \brief Constructor sets reference to well.
|
||||
WellTest(const WellInterfaceGeneric& well) : well_(well) {}
|
||||
|
||||
bool checkRateEconLimits(const WellEconProductionLimits& econ_production_limits,
|
||||
const std::vector<double>& rates_or_potentials,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
RatioLimitCheckReport
|
||||
checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
|
||||
const SingleWellState& ws,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
private:
|
||||
void checkMaxGORLimit(const WellEconProductionLimits& econ_production_limits,
|
||||
const SingleWellState& ws,
|
||||
RatioLimitCheckReport& report) const;
|
||||
@ -61,11 +71,6 @@ public:
|
||||
const SingleWellState& ws,
|
||||
RatioLimitCheckReport& report) const;
|
||||
|
||||
bool checkRateEconLimits(const WellEconProductionLimits& econ_production_limits,
|
||||
const std::vector<double>& rates_or_potentials,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
private:
|
||||
template<class RatioFunc>
|
||||
bool checkMaxRatioLimitWell(const SingleWellState& ws,
|
||||
const double max_ratio_limit,
|
||||
|
Loading…
Reference in New Issue
Block a user