mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
move checkRateEconLimits to WellTest
This commit is contained in:
@@ -504,52 +504,6 @@ checkConstraints(WellState& well_state,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename FluidSystem>
|
|
||||||
bool
|
|
||||||
WellInterfaceFluidSystem<FluidSystem>::
|
|
||||||
checkRateEconLimits(const WellEconProductionLimits& econ_production_limits,
|
|
||||||
const double* rates_or_potentials,
|
|
||||||
DeferredLogger& deferred_logger) const
|
|
||||||
{
|
|
||||||
const PhaseUsage& pu = phaseUsage();
|
|
||||||
|
|
||||||
if (econ_production_limits.onMinOilRate()) {
|
|
||||||
assert(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx));
|
|
||||||
const double oil_rate = rates_or_potentials[pu.phase_pos[ Oil ] ];
|
|
||||||
const double min_oil_rate = econ_production_limits.minOilRate();
|
|
||||||
if (std::abs(oil_rate) < min_oil_rate) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (econ_production_limits.onMinGasRate() ) {
|
|
||||||
assert(FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx));
|
|
||||||
const double gas_rate = rates_or_potentials[pu.phase_pos[ Gas ] ];
|
|
||||||
const double min_gas_rate = econ_production_limits.minGasRate();
|
|
||||||
if (std::abs(gas_rate) < min_gas_rate) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (econ_production_limits.onMinLiquidRate() ) {
|
|
||||||
assert(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx));
|
|
||||||
assert(FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx));
|
|
||||||
const double oil_rate = rates_or_potentials[pu.phase_pos[ Oil ] ];
|
|
||||||
const double water_rate = rates_or_potentials[pu.phase_pos[ Water ] ];
|
|
||||||
const double liquid_rate = oil_rate + water_rate;
|
|
||||||
const double min_liquid_rate = econ_production_limits.minLiquidRate();
|
|
||||||
if (std::abs(liquid_rate) < min_liquid_rate) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (econ_production_limits.onMinReservoirFluidRate()) {
|
|
||||||
deferred_logger.warning("NOT_SUPPORTING_MIN_RESERVOIR_FLUID_RATE", "Minimum reservoir fluid production rate limit is not supported yet");
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename FluidSystem>
|
template<typename FluidSystem>
|
||||||
void
|
void
|
||||||
WellInterfaceFluidSystem<FluidSystem>::
|
WellInterfaceFluidSystem<FluidSystem>::
|
||||||
@@ -636,16 +590,22 @@ updateWellTestStateEconomic(const SingleWellState& ws,
|
|||||||
const auto& quantity_limit = econ_production_limits.quantityLimit();
|
const auto& quantity_limit = econ_production_limits.quantityLimit();
|
||||||
if (econ_production_limits.onAnyRateLimit()) {
|
if (econ_production_limits.onAnyRateLimit()) {
|
||||||
if (quantity_limit == WellEconProductionLimits::QuantityLimit::POTN) {
|
if (quantity_limit == WellEconProductionLimits::QuantityLimit::POTN) {
|
||||||
rate_limit_violated = checkRateEconLimits(econ_production_limits, ws.well_potentials.data(), deferred_logger);
|
rate_limit_violated = WellTest(*this).checkRateEconLimits(econ_production_limits,
|
||||||
|
ws.well_potentials,
|
||||||
|
deferred_logger);
|
||||||
// Due to instability of the bhpFromThpLimit code the potentials are sometimes wrong
|
// Due to instability of the bhpFromThpLimit code the potentials are sometimes wrong
|
||||||
// this can lead to premature shutting of wells due to rate limits of the potentials.
|
// this can lead to premature shutting of wells due to rate limits of the potentials.
|
||||||
// Since rates are supposed to be less or equal to the potentials, we double-check
|
// Since rates are supposed to be less or equal to the potentials, we double-check
|
||||||
// that also the rate limit is violated before shutting the well.
|
// that also the rate limit is violated before shutting the well.
|
||||||
if (rate_limit_violated)
|
if (rate_limit_violated)
|
||||||
rate_limit_violated = checkRateEconLimits(econ_production_limits, ws.surface_rates.data(), deferred_logger);
|
rate_limit_violated = WellTest(*this).checkRateEconLimits(econ_production_limits,
|
||||||
|
ws.surface_rates,
|
||||||
|
deferred_logger);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rate_limit_violated = checkRateEconLimits(econ_production_limits, ws.surface_rates.data(), deferred_logger);
|
rate_limit_violated = WellTest(*this).checkRateEconLimits(econ_production_limits,
|
||||||
|
ws.surface_rates,
|
||||||
|
deferred_logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -123,10 +123,6 @@ protected:
|
|||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
bool checkRateEconLimits(const WellEconProductionLimits& econ_production_limits,
|
|
||||||
const double* rates_or_potentials,
|
|
||||||
Opm::DeferredLogger& deferred_logger) const;
|
|
||||||
|
|
||||||
void checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
|
void checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
|
||||||
const SingleWellState& ws,
|
const SingleWellState& ws,
|
||||||
RatioLimitCheckReport& report,
|
RatioLimitCheckReport& report,
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <opm/simulators/wells/WellTest.hpp>
|
#include <opm/simulators/wells/WellTest.hpp>
|
||||||
|
|
||||||
|
#include <opm/simulators/utils/DeferredLogger.hpp>
|
||||||
#include <opm/simulators/wells/ParallelWellInfo.hpp>
|
#include <opm/simulators/wells/ParallelWellInfo.hpp>
|
||||||
#include <opm/simulators/wells/SingleWellState.hpp>
|
#include <opm/simulators/wells/SingleWellState.hpp>
|
||||||
#include <opm/simulators/wells/WellInterfaceGeneric.hpp>
|
#include <opm/simulators/wells/WellInterfaceGeneric.hpp>
|
||||||
@@ -190,4 +191,47 @@ void WellTest::checkMaxWaterCutLimit(const WellEconProductionLimits& econ_produc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WellTest::checkRateEconLimits(const WellEconProductionLimits& econ_production_limits,
|
||||||
|
const std::vector<double>& rates_or_potentials,
|
||||||
|
DeferredLogger& deferred_logger) const
|
||||||
|
{
|
||||||
|
static constexpr int Gas = BlackoilPhases::Vapour;
|
||||||
|
static constexpr int Oil = BlackoilPhases::Liquid;
|
||||||
|
static constexpr int Water = BlackoilPhases::Aqua;
|
||||||
|
|
||||||
|
const PhaseUsage& pu = well_.phaseUsage();
|
||||||
|
|
||||||
|
if (econ_production_limits.onMinOilRate()) {
|
||||||
|
const double oil_rate = rates_or_potentials[pu.phase_pos[Oil]];
|
||||||
|
const double min_oil_rate = econ_production_limits.minOilRate();
|
||||||
|
if (std::abs(oil_rate) < min_oil_rate) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (econ_production_limits.onMinGasRate() ) {
|
||||||
|
const double gas_rate = rates_or_potentials[pu.phase_pos[Gas]];
|
||||||
|
const double min_gas_rate = econ_production_limits.minGasRate();
|
||||||
|
if (std::abs(gas_rate) < min_gas_rate) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (econ_production_limits.onMinLiquidRate() ) {
|
||||||
|
const double oil_rate = rates_or_potentials[pu.phase_pos[Oil]];
|
||||||
|
const double water_rate = rates_or_potentials[pu.phase_pos[Water]];
|
||||||
|
const double liquid_rate = oil_rate + water_rate;
|
||||||
|
const double min_liquid_rate = econ_production_limits.minLiquidRate();
|
||||||
|
if (std::abs(liquid_rate) < min_liquid_rate) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (econ_production_limits.onMinReservoirFluidRate()) {
|
||||||
|
deferred_logger.warning("NOT_SUPPORTING_MIN_RESERVOIR_FLUID_RATE", "Minimum reservoir fluid production rate limit is not supported yet");
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
|
||||||
|
class DeferredLogger;
|
||||||
class PhaseUsage;
|
class PhaseUsage;
|
||||||
class SingleWellState;
|
class SingleWellState;
|
||||||
class WellEconProductionLimits;
|
class WellEconProductionLimits;
|
||||||
@@ -60,6 +61,10 @@ public:
|
|||||||
const SingleWellState& ws,
|
const SingleWellState& ws,
|
||||||
RatioLimitCheckReport& report) const;
|
RatioLimitCheckReport& report) const;
|
||||||
|
|
||||||
|
bool checkRateEconLimits(const WellEconProductionLimits& econ_production_limits,
|
||||||
|
const std::vector<double>& rates_or_potentials,
|
||||||
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template<class RatioFunc>
|
template<class RatioFunc>
|
||||||
bool checkMaxRatioLimitWell(const SingleWellState& ws,
|
bool checkMaxRatioLimitWell(const SingleWellState& ws,
|
||||||
|
|||||||
Reference in New Issue
Block a user