mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Treat rate control with zero target same as stopped well.
This commit is contained in:
@@ -35,6 +35,7 @@
|
|||||||
#include <opm/simulators/wells/WellAssemble.hpp>
|
#include <opm/simulators/wells/WellAssemble.hpp>
|
||||||
#include <opm/simulators/wells/WellBhpThpCalculator.hpp>
|
#include <opm/simulators/wells/WellBhpThpCalculator.hpp>
|
||||||
#include <opm/simulators/wells/WellInterfaceIndices.hpp>
|
#include <opm/simulators/wells/WellInterfaceIndices.hpp>
|
||||||
|
#include <opm/simulators/wells/WellState.hpp>
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
@@ -162,6 +163,9 @@ assembleControlEq(const WellState& well_state,
|
|||||||
bhp_from_thp,
|
bhp_from_thp,
|
||||||
control_eq,
|
control_eq,
|
||||||
deferred_logger);
|
deferred_logger);
|
||||||
|
} else if (rateControlWithZeroTarget(well_state.well(well_.indexOfWell()).production_cmode, prod_controls)) {
|
||||||
|
// Production mode, zero target. Treat as STOP.
|
||||||
|
control_eq = primary_variables.getWQTotal();
|
||||||
} else {
|
} else {
|
||||||
// Find rates.
|
// Find rates.
|
||||||
const auto rates = getRates();
|
const auto rates = getRates();
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
#include <opm/simulators/wells/WellAssemble.hpp>
|
#include <opm/simulators/wells/WellAssemble.hpp>
|
||||||
#include <opm/simulators/wells/WellBhpThpCalculator.hpp>
|
#include <opm/simulators/wells/WellBhpThpCalculator.hpp>
|
||||||
#include <opm/simulators/wells/WellInterfaceFluidSystem.hpp>
|
#include <opm/simulators/wells/WellInterfaceFluidSystem.hpp>
|
||||||
|
#include <opm/simulators/wells/WellState.hpp>
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
@@ -142,6 +143,9 @@ assembleControlEq(const WellState& well_state,
|
|||||||
bhp_from_thp,
|
bhp_from_thp,
|
||||||
control_eq,
|
control_eq,
|
||||||
deferred_logger);
|
deferred_logger);
|
||||||
|
} else if (rateControlWithZeroTarget(well_state.well(well_.indexOfWell()).production_cmode, prod_controls)) {
|
||||||
|
// Production mode, zero target. Treat as STOP.
|
||||||
|
control_eq = primary_variables.eval(PrimaryVariables::WQTotal);
|
||||||
} else {
|
} else {
|
||||||
// Find rates.
|
// Find rates.
|
||||||
const auto rates = getRates();
|
const auto rates = getRates();
|
||||||
|
|||||||
@@ -43,6 +43,32 @@
|
|||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
|
||||||
|
bool rateControlWithZeroTarget(const Well::ProducerCMode mode,
|
||||||
|
const Well::ProductionControls& controls)
|
||||||
|
{
|
||||||
|
switch (mode) {
|
||||||
|
case Well::ProducerCMode::ORAT:
|
||||||
|
return controls.oil_rate == 0.0;
|
||||||
|
case Well::ProducerCMode::WRAT:
|
||||||
|
return controls.water_rate == 0.0;
|
||||||
|
case Well::ProducerCMode::GRAT:
|
||||||
|
return controls.gas_rate == 0.0;
|
||||||
|
case Well::ProducerCMode::LRAT:
|
||||||
|
return controls.liquid_rate == 0.0;
|
||||||
|
case Well::ProducerCMode::CRAT:
|
||||||
|
// Unsupported, will cause exception elsewhere, treat as nonzero target here.
|
||||||
|
return false;
|
||||||
|
case Well::ProducerCMode::RESV:
|
||||||
|
if (controls.prediction_mode) {
|
||||||
|
return controls.resv_rate == 0.0;
|
||||||
|
} else {
|
||||||
|
return controls.water_rate == 0.0 && controls.oil_rate == 0.0 && controls.gas_rate == 0.0;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template<class FluidSystem>
|
template<class FluidSystem>
|
||||||
WellAssemble<FluidSystem>::
|
WellAssemble<FluidSystem>::
|
||||||
WellAssemble(const WellInterfaceFluidSystem<FluidSystem>& well)
|
WellAssemble(const WellInterfaceFluidSystem<FluidSystem>& well)
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include <opm/core/props/BlackoilPhases.hpp>
|
#include <opm/core/props/BlackoilPhases.hpp>
|
||||||
|
|
||||||
#include <opm/input/eclipse/Schedule/ScheduleTypes.hpp>
|
#include <opm/input/eclipse/Schedule/ScheduleTypes.hpp>
|
||||||
|
#include <opm/input/eclipse/Schedule/Well/WellEnums.hpp>
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
@@ -43,6 +44,10 @@ class WellState;
|
|||||||
class WellInjectionControls;
|
class WellInjectionControls;
|
||||||
class WellProductionControls;
|
class WellProductionControls;
|
||||||
|
|
||||||
|
/// Helper to avoid singular control equations.
|
||||||
|
bool rateControlWithZeroTarget(const WellProducerCMode mode,
|
||||||
|
const WellProductionControls& controls);
|
||||||
|
|
||||||
template<class FluidSystem>
|
template<class FluidSystem>
|
||||||
class WellAssemble {
|
class WellAssemble {
|
||||||
static constexpr int Water = BlackoilPhases::Aqua;
|
static constexpr int Water = BlackoilPhases::Aqua;
|
||||||
@@ -80,6 +85,8 @@ private:
|
|||||||
const WellInterfaceFluidSystem<FluidSystem>& well_;
|
const WellInterfaceFluidSystem<FluidSystem>& well_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // OPM_WELL_ASSEMBLE_HEADER_INCLUDED
|
#endif // OPM_WELL_ASSEMBLE_HEADER_INCLUDED
|
||||||
|
|||||||
Reference in New Issue
Block a user