mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
move checkMaxWGRLimit to WellTest
This commit is contained in:
parent
fe8259bb76
commit
e7273868f5
@ -590,41 +590,6 @@ checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits,
|
||||
}
|
||||
}
|
||||
|
||||
template<typename FluidSystem>
|
||||
void
|
||||
WellInterfaceFluidSystem<FluidSystem>::
|
||||
checkMaxWGRLimit(const WellEconProductionLimits& econ_production_limits,
|
||||
const SingleWellState& ws,
|
||||
RatioLimitCheckReport& report) const
|
||||
{
|
||||
assert(FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx));
|
||||
assert(FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx));
|
||||
|
||||
// function to calculate wgr based on rates
|
||||
auto wgr = [](const std::vector<double>& rates,
|
||||
const PhaseUsage& pu) {
|
||||
|
||||
const double water_rate = -rates[pu.phase_pos[Water]];
|
||||
const double gas_rate = -rates[pu.phase_pos[Gas]];
|
||||
if (water_rate <= 0.)
|
||||
return 0.;
|
||||
else if (gas_rate <= 0.)
|
||||
return 1.e100; // big value to mark it as violated
|
||||
else
|
||||
return (water_rate / gas_rate);
|
||||
};
|
||||
|
||||
const double max_wgr_limit = econ_production_limits.maxWaterGasRatio();
|
||||
assert(max_wgr_limit > 0.);
|
||||
|
||||
const bool wgr_limit_violated = WellTest(*this).checkMaxRatioLimitWell(ws, max_wgr_limit, wgr);
|
||||
|
||||
if (wgr_limit_violated) {
|
||||
report.ratio_limit_violated = true;
|
||||
WellTest(*this).checkMaxRatioLimitCompletions(ws, max_wgr_limit, wgr, report);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename FluidSystem>
|
||||
void
|
||||
WellInterfaceFluidSystem<FluidSystem>::
|
||||
@ -652,7 +617,9 @@ checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
|
||||
}
|
||||
|
||||
if (econ_production_limits.onMaxWaterGasRatio()) {
|
||||
checkMaxWGRLimit(econ_production_limits, ws, report);
|
||||
assert(FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx));
|
||||
assert(FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx));
|
||||
WellTest(*this).checkMaxWGRLimit(econ_production_limits, ws, report);
|
||||
}
|
||||
|
||||
if (econ_production_limits.onMaxGasLiquidRatio()) {
|
||||
|
@ -131,10 +131,6 @@ protected:
|
||||
const SingleWellState& ws,
|
||||
RatioLimitCheckReport& report) const;
|
||||
|
||||
void checkMaxWGRLimit(const WellEconProductionLimits& econ_production_limits,
|
||||
const SingleWellState& ws,
|
||||
RatioLimitCheckReport& report) const;
|
||||
|
||||
void checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
|
||||
const SingleWellState& ws,
|
||||
RatioLimitCheckReport& report,
|
||||
|
@ -119,5 +119,36 @@ void WellTest::checkMaxGORLimit(const WellEconProductionLimits& econ_production_
|
||||
}
|
||||
}
|
||||
|
||||
void WellTest::checkMaxWGRLimit(const WellEconProductionLimits& econ_production_limits,
|
||||
const SingleWellState& ws,
|
||||
RatioLimitCheckReport& report) const
|
||||
{
|
||||
static constexpr int Gas = BlackoilPhases::Vapour;
|
||||
static constexpr int Water = BlackoilPhases::Aqua;
|
||||
|
||||
// function to calculate wgr based on rates
|
||||
auto wgr = [](const std::vector<double>& rates,
|
||||
const PhaseUsage& pu) {
|
||||
|
||||
const double water_rate = -rates[pu.phase_pos[Water]];
|
||||
const double gas_rate = -rates[pu.phase_pos[Gas]];
|
||||
if (water_rate <= 0.)
|
||||
return 0.;
|
||||
else if (gas_rate <= 0.)
|
||||
return 1.e100; // big value to mark it as violated
|
||||
else
|
||||
return (water_rate / gas_rate);
|
||||
};
|
||||
|
||||
const double max_wgr_limit = econ_production_limits.maxWaterGasRatio();
|
||||
assert(max_wgr_limit > 0.);
|
||||
|
||||
const bool wgr_limit_violated = this->checkMaxRatioLimitWell(ws, max_wgr_limit, wgr);
|
||||
|
||||
if (wgr_limit_violated) {
|
||||
report.ratio_limit_violated = true;
|
||||
this->checkMaxRatioLimitCompletions(ws, max_wgr_limit, wgr, report);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Opm
|
||||
|
@ -64,6 +64,11 @@ public:
|
||||
void checkMaxGORLimit(const WellEconProductionLimits& econ_production_limits,
|
||||
const SingleWellState& ws,
|
||||
RatioLimitCheckReport& report) const;
|
||||
|
||||
void checkMaxWGRLimit(const WellEconProductionLimits& econ_production_limits,
|
||||
const SingleWellState& ws,
|
||||
RatioLimitCheckReport& report) const;
|
||||
|
||||
private:
|
||||
const WellInterfaceGeneric& well_; //!< Reference to well interface
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user