mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
move checkMaxGORLimit to WellTest
This commit is contained in:
parent
37f51420f6
commit
fe8259bb76
@ -590,40 +590,6 @@ checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits,
|
||||
}
|
||||
}
|
||||
|
||||
template<typename FluidSystem>
|
||||
void
|
||||
WellInterfaceFluidSystem<FluidSystem>::
|
||||
checkMaxGORLimit(const WellEconProductionLimits& econ_production_limits,
|
||||
const SingleWellState& ws,
|
||||
RatioLimitCheckReport& report) const
|
||||
{
|
||||
assert(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx));
|
||||
assert(FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx));
|
||||
|
||||
// function to calculate gor based on rates
|
||||
auto gor = [](const std::vector<double>& rates,
|
||||
const PhaseUsage& pu) {
|
||||
const double oil_rate = -rates[pu.phase_pos[Oil]];
|
||||
const double gas_rate = -rates[pu.phase_pos[Gas]];
|
||||
if (gas_rate <= 0.)
|
||||
return 0.;
|
||||
else if (oil_rate <= 0.)
|
||||
return 1.e100; // big value to mark it as violated
|
||||
else
|
||||
return (gas_rate / oil_rate);
|
||||
};
|
||||
|
||||
const double max_gor_limit = econ_production_limits.maxGasOilRatio();
|
||||
assert(max_gor_limit > 0.);
|
||||
|
||||
const bool gor_limit_violated = WellTest(*this).checkMaxRatioLimitWell(ws, max_gor_limit, gor);
|
||||
|
||||
if (gor_limit_violated) {
|
||||
report.ratio_limit_violated = true;
|
||||
WellTest(*this).checkMaxRatioLimitCompletions(ws, max_gor_limit, gor, report);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename FluidSystem>
|
||||
void
|
||||
WellInterfaceFluidSystem<FluidSystem>::
|
||||
@ -680,7 +646,9 @@ checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
|
||||
}
|
||||
|
||||
if (econ_production_limits.onMaxGasOilRatio()) {
|
||||
checkMaxGORLimit(econ_production_limits, ws, report);
|
||||
assert(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx));
|
||||
assert(FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx));
|
||||
WellTest(*this).checkMaxGORLimit(econ_production_limits, ws, report);
|
||||
}
|
||||
|
||||
if (econ_production_limits.onMaxWaterGasRatio()) {
|
||||
|
@ -131,10 +131,6 @@ protected:
|
||||
const SingleWellState& ws,
|
||||
RatioLimitCheckReport& report) const;
|
||||
|
||||
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;
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <config.h>
|
||||
#include <opm/simulators/wells/WellTest.hpp>
|
||||
|
||||
#include <opm/simulators/wells/ParallelWellInfo.hpp>
|
||||
#include <opm/simulators/wells/SingleWellState.hpp>
|
||||
#include <opm/simulators/wells/WellInterfaceGeneric.hpp>
|
||||
|
||||
@ -87,4 +88,36 @@ void WellTest::checkMaxRatioLimitCompletions(const SingleWellState& ws,
|
||||
}
|
||||
}
|
||||
|
||||
void WellTest::checkMaxGORLimit(const WellEconProductionLimits& econ_production_limits,
|
||||
const SingleWellState& ws,
|
||||
RatioLimitCheckReport& report) const
|
||||
{
|
||||
static constexpr int Oil = BlackoilPhases::Liquid;
|
||||
static constexpr int Gas = BlackoilPhases::Vapour;
|
||||
|
||||
// function to calculate gor based on rates
|
||||
auto gor = [](const std::vector<double>& rates,
|
||||
const PhaseUsage& pu) {
|
||||
const double oil_rate = -rates[pu.phase_pos[Oil]];
|
||||
const double gas_rate = -rates[pu.phase_pos[Gas]];
|
||||
if (gas_rate <= 0.)
|
||||
return 0.;
|
||||
else if (oil_rate <= 0.)
|
||||
return 1.e100; // big value to mark it as violated
|
||||
else
|
||||
return (gas_rate / oil_rate);
|
||||
};
|
||||
|
||||
const double max_gor_limit = econ_production_limits.maxGasOilRatio();
|
||||
assert(max_gor_limit > 0.);
|
||||
|
||||
const bool gor_limit_violated = this->checkMaxRatioLimitWell(ws, max_gor_limit, gor);
|
||||
|
||||
if (gor_limit_violated) {
|
||||
report.ratio_limit_violated = true;
|
||||
this->checkMaxRatioLimitCompletions(ws, max_gor_limit, gor, report);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace Opm
|
||||
|
@ -33,6 +33,7 @@ namespace Opm
|
||||
|
||||
class PhaseUsage;
|
||||
class SingleWellState;
|
||||
class WellEconProductionLimits;
|
||||
class WellInterfaceGeneric;
|
||||
|
||||
struct RatioLimitCheckReport {
|
||||
@ -59,6 +60,10 @@ public:
|
||||
const double max_ratio_limit,
|
||||
const RatioFunc& ratioFunc,
|
||||
RatioLimitCheckReport& report) const;
|
||||
|
||||
void checkMaxGORLimit(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