Merge pull request #1617 from bska/summary-wmctl
Support Outputting Active Well Control to Summary File
This commit is contained in:
commit
01d6ad95e0
@ -656,7 +656,15 @@ private:
|
||||
std::ostream& operator<<( std::ostream&, const Well::WellInjectionProperties& );
|
||||
std::ostream& operator<<( std::ostream&, const WellProductionProperties& );
|
||||
|
||||
int eclipseControlMode(const Well::InjectorCMode imode,
|
||||
const InjectorType itype,
|
||||
const Well::Status wellStatus);
|
||||
|
||||
int eclipseControlMode(const Well::ProducerCMode pmode,
|
||||
const Well::Status wellStatus);
|
||||
|
||||
int eclipseControlMode(const Well& well,
|
||||
const SummaryState& st);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -145,81 +145,6 @@ namespace {
|
||||
return well.productionControls(st).vfp_table_number;
|
||||
}
|
||||
|
||||
int ctrlMode(const Opm::Well& well, const Opm::SummaryState& st)
|
||||
{
|
||||
using WMCtrlVal = VI::IWell::Value::WellCtrlMode;
|
||||
|
||||
if (well.isInjector()) {
|
||||
const auto& controls = well.injectionControls(st);
|
||||
|
||||
const auto wmctl = controls.cmode;
|
||||
const auto wtype = controls.injector_type;
|
||||
|
||||
using CMode = ::Opm::Well::InjectorCMode;
|
||||
using WType = ::Opm::InjectorType;
|
||||
|
||||
switch (wmctl) {
|
||||
case CMode::RATE: {
|
||||
switch (wtype) {
|
||||
case WType::OIL: return WMCtrlVal::OilRate;
|
||||
case WType::WATER: return WMCtrlVal::WatRate;
|
||||
case WType::GAS: return WMCtrlVal::GasRate;
|
||||
case WType::MULTI: return WMCtrlVal::WMCtlUnk;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CMode::RESV: return WMCtrlVal::ResVRate;
|
||||
case CMode::THP: return WMCtrlVal::THP;
|
||||
case CMode::BHP: return WMCtrlVal::BHP;
|
||||
case CMode::GRUP: return WMCtrlVal::Group;
|
||||
|
||||
default:
|
||||
{
|
||||
const auto stat = well.getStatus();
|
||||
|
||||
using WStat = ::Opm::Well::Status;
|
||||
|
||||
if (stat == WStat::SHUT) {
|
||||
return WMCtrlVal::Shut;
|
||||
}
|
||||
}
|
||||
return WMCtrlVal::WMCtlUnk;
|
||||
}
|
||||
}
|
||||
else if (well.isProducer()) {
|
||||
const auto& controls = well.productionControls(st);
|
||||
|
||||
using CMode = ::Opm::Well::ProducerCMode;
|
||||
|
||||
switch (controls.cmode) {
|
||||
case CMode::ORAT: return WMCtrlVal::OilRate;
|
||||
case CMode::WRAT: return WMCtrlVal::WatRate;
|
||||
case CMode::GRAT: return WMCtrlVal::GasRate;
|
||||
case CMode::LRAT: return WMCtrlVal::LiqRate;
|
||||
case CMode::RESV: return WMCtrlVal::ResVRate;
|
||||
case CMode::THP: return WMCtrlVal::THP;
|
||||
case CMode::BHP: return WMCtrlVal::BHP;
|
||||
case CMode::CRAT: return WMCtrlVal::CombRate;
|
||||
case CMode::GRUP: return WMCtrlVal::Group;
|
||||
|
||||
default:
|
||||
{
|
||||
const auto stat = well.getStatus();
|
||||
|
||||
using WStat = ::Opm::Well::Status;
|
||||
|
||||
if (stat == WStat::SHUT) {
|
||||
return WMCtrlVal::Shut;
|
||||
}
|
||||
}
|
||||
return WMCtrlVal::WMCtlUnk;
|
||||
}
|
||||
}
|
||||
|
||||
return WMCtrlVal::WMCtlUnk;
|
||||
}
|
||||
|
||||
bool wellControlDefined(const Opm::data::Well& xw)
|
||||
{
|
||||
using PMode = ::Opm::Well::ProducerCMode;
|
||||
@ -233,56 +158,15 @@ namespace {
|
||||
|
||||
int ctrlMode(const Opm::Well& well, const Opm::data::Well& xw)
|
||||
{
|
||||
using PMode = ::Opm::Well::ProducerCMode;
|
||||
using IMode = ::Opm::Well::InjectorCMode;
|
||||
using Val = VI::IWell::Value::WellCtrlMode;
|
||||
|
||||
const auto& curr = xw.current_control;
|
||||
|
||||
if (curr.isProducer) {
|
||||
switch (curr.prod) {
|
||||
case PMode::ORAT: return Val::OilRate;
|
||||
case PMode::WRAT: return Val::WatRate;
|
||||
case PMode::GRAT: return Val::GasRate;
|
||||
case PMode::LRAT: return Val::LiqRate;
|
||||
case PMode::RESV: return Val::ResVRate;
|
||||
case PMode::THP: return Val::THP;
|
||||
case PMode::BHP: return Val::BHP;
|
||||
case PMode::CRAT: return Val::CombRate;
|
||||
case PMode::GRUP: return Val::Group;
|
||||
|
||||
default:
|
||||
if (well.getStatus() == ::Opm::Well::Status::SHUT) {
|
||||
return Val::Shut;
|
||||
}
|
||||
}
|
||||
return ::Opm::eclipseControlMode(curr.prod, well.getStatus());
|
||||
}
|
||||
else { // injector
|
||||
using IType = ::Opm::InjectorType;
|
||||
|
||||
switch (curr.inj) {
|
||||
case IMode::RATE: {
|
||||
switch (well.injectorType()) {
|
||||
case IType::OIL: return Val::OilRate;
|
||||
case IType::WATER: return Val::WatRate;
|
||||
case IType::GAS: return Val::GasRate;
|
||||
case IType::MULTI: return Val::WMCtlUnk;
|
||||
}}
|
||||
break;
|
||||
|
||||
case IMode::RESV: return Val::ResVRate;
|
||||
case IMode::THP: return Val::THP;
|
||||
case IMode::BHP: return Val::BHP;
|
||||
case IMode::GRUP: return Val::Group;
|
||||
|
||||
default:
|
||||
if (well.getStatus() == ::Opm::Well::Status::SHUT) {
|
||||
return Val::Shut;
|
||||
}
|
||||
}
|
||||
return ::Opm::eclipseControlMode(curr.inj, well.injectorType(),
|
||||
well.getStatus());
|
||||
}
|
||||
|
||||
return Val::WMCtlUnk;
|
||||
}
|
||||
|
||||
int compOrder(const Opm::Well& well)
|
||||
@ -370,11 +254,11 @@ namespace {
|
||||
iWell[Ix::item32] = 7;
|
||||
iWell[Ix::item48] = - 1;
|
||||
|
||||
// Deliberate misrepresentation. Function 'ctrlMode()' returns
|
||||
// the target control mode requested in the simulation deck.
|
||||
// This item is supposed to be the well's actual, active target
|
||||
// control mode in the simulator.
|
||||
setCurrentControl(well, ctrlMode(well, st), iWell);
|
||||
// Deliberate misrepresentation. Function 'eclipseControlMode'
|
||||
// returns the target control mode requested in the simulation
|
||||
// deck. This item is supposed to be the well's actual, active
|
||||
// target control mode in the simulator.
|
||||
setCurrentControl(well, eclipseControlMode(well, st), iWell);
|
||||
|
||||
// Multi-segmented well information
|
||||
iWell[Ix::MsWID] = 0; // MS Well ID (0 or 1..#MS wells)
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQContext.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
|
||||
@ -805,6 +806,52 @@ inline quantity group_control( const fn_args& args ) {
|
||||
return {static_cast<double>(cntl_mode), Opm::UnitSystem::measure::identity};
|
||||
}
|
||||
|
||||
namespace {
|
||||
bool well_control_mode_defined(const ::Opm::data::Well& xw)
|
||||
{
|
||||
using PMode = ::Opm::Well::ProducerCMode;
|
||||
using IMode = ::Opm::Well::InjectorCMode;
|
||||
|
||||
const auto& curr = xw.current_control;
|
||||
|
||||
return (curr.isProducer && (curr.prod != PMode::CMODE_UNDEFINED))
|
||||
|| (!curr.isProducer && (curr.inj != IMode::CMODE_UNDEFINED));
|
||||
}
|
||||
}
|
||||
|
||||
inline quantity well_control_mode( const fn_args& args ) {
|
||||
const auto unit = Opm::UnitSystem::measure::identity;
|
||||
|
||||
if (args.schedule_wells.empty()) {
|
||||
// No wells. Possibly determining pertinent unit of measure
|
||||
// during SMSPEC configuration.
|
||||
return { 0.0, unit };
|
||||
}
|
||||
|
||||
const auto& well = args.schedule_wells.front();
|
||||
auto xwPos = args.wells.find(well.name());
|
||||
if (xwPos == args.wells.end()) {
|
||||
// No dynamic results for 'well'. Treat as shut/stopped.
|
||||
return { 0.0, unit };
|
||||
}
|
||||
|
||||
if (! well_control_mode_defined(xwPos->second)) {
|
||||
// No dynamic control mode defined. Use input control.
|
||||
const auto wmctl = ::Opm::eclipseControlMode(well, args.st);
|
||||
|
||||
return { static_cast<double>(wmctl), unit };
|
||||
}
|
||||
|
||||
// Well has simulator-provided active control mode. Pick the
|
||||
// appropriate value depending on well type (producer/injector).
|
||||
const auto& curr = xwPos->second.current_control;
|
||||
const auto wmctl = curr.isProducer
|
||||
? ::Opm::eclipseControlMode(curr.prod, well.getStatus())
|
||||
: ::Opm::eclipseControlMode(curr.inj, well.injectorType(),
|
||||
well.getStatus());
|
||||
|
||||
return { static_cast<double>(wmctl), unit };
|
||||
}
|
||||
|
||||
/*
|
||||
* A small DSL, really poor man's function composition, to avoid massive
|
||||
@ -902,6 +949,8 @@ static const std::unordered_map< std::string, ofun > funs = {
|
||||
{ "WTHP", thp },
|
||||
{ "WVPRT", res_vol_production_target },
|
||||
|
||||
{ "WMCTL", well_control_mode },
|
||||
|
||||
{ "GWIR", rate< rt::wat, injector > },
|
||||
{ "WGVIR", rate< rt::reservoir_gas, injector >},
|
||||
{ "WWVIR", rate< rt::reservoir_water, injector >},
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
#include <opm/io/eclipse/rst/well.hpp>
|
||||
#include <opm/output/eclipse/VectorItems/well.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeywords/W.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/updatingConnectionsWithSegments.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
|
||||
@ -1371,3 +1372,77 @@ bool Well::operator==(const Well& data) const {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int Opm::eclipseControlMode(const Opm::Well::InjectorCMode imode,
|
||||
const Opm::InjectorType itype,
|
||||
const Opm::Well::Status wellStatus)
|
||||
{
|
||||
using IMode = ::Opm::Well::InjectorCMode;
|
||||
using Val = ::Opm::RestartIO::Helpers::VectorItems::IWell::Value::WellCtrlMode;
|
||||
|
||||
using IType = ::Opm::InjectorType;
|
||||
|
||||
switch (imode) {
|
||||
case IMode::RATE: {
|
||||
switch (itype) {
|
||||
case IType::OIL: return Val::OilRate;
|
||||
case IType::WATER: return Val::WatRate;
|
||||
case IType::GAS: return Val::GasRate;
|
||||
case IType::MULTI: return Val::WMCtlUnk;
|
||||
}}
|
||||
break;
|
||||
|
||||
case IMode::RESV: return Val::ResVRate;
|
||||
case IMode::THP: return Val::THP;
|
||||
case IMode::BHP: return Val::BHP;
|
||||
case IMode::GRUP: return Val::Group;
|
||||
|
||||
default:
|
||||
if (wellStatus == ::Opm::Well::Status::SHUT) {
|
||||
return Val::Shut;
|
||||
}
|
||||
}
|
||||
|
||||
return Val::WMCtlUnk;
|
||||
}
|
||||
|
||||
int Opm::eclipseControlMode(const Opm::Well::ProducerCMode pmode,
|
||||
const Opm::Well::Status wellStatus)
|
||||
{
|
||||
using PMode = ::Opm::Well::ProducerCMode;
|
||||
using Val = ::Opm::RestartIO::Helpers::VectorItems::IWell::Value::WellCtrlMode;
|
||||
|
||||
switch (pmode) {
|
||||
case PMode::ORAT: return Val::OilRate;
|
||||
case PMode::WRAT: return Val::WatRate;
|
||||
case PMode::GRAT: return Val::GasRate;
|
||||
case PMode::LRAT: return Val::LiqRate;
|
||||
case PMode::RESV: return Val::ResVRate;
|
||||
case PMode::THP: return Val::THP;
|
||||
case PMode::BHP: return Val::BHP;
|
||||
case PMode::CRAT: return Val::CombRate;
|
||||
case PMode::GRUP: return Val::Group;
|
||||
|
||||
default:
|
||||
if (wellStatus == ::Opm::Well::Status::SHUT) {
|
||||
return Val::Shut;
|
||||
}
|
||||
}
|
||||
|
||||
return Val::WMCtlUnk;
|
||||
}
|
||||
|
||||
int Opm::eclipseControlMode(const Well& well,
|
||||
const SummaryState& st)
|
||||
{
|
||||
if (well.isProducer()) {
|
||||
const auto& ctrl = well.productionControls(st);
|
||||
|
||||
return eclipseControlMode(ctrl.cmode, well.getStatus());
|
||||
}
|
||||
else { // Injector
|
||||
const auto& ctrl = well.injectionControls(st);
|
||||
|
||||
return eclipseControlMode(ctrl.cmode, well.injectorType(), well.getStatus());
|
||||
}
|
||||
}
|
||||
|
@ -226,6 +226,15 @@ namespace {
|
||||
return is_in_set(countkw, keyword);
|
||||
}
|
||||
|
||||
bool is_control_mode(const std::string& keyword) {
|
||||
static const keyword_set countkw {
|
||||
"MCTP", "MCTW", "MCTG"
|
||||
};
|
||||
|
||||
return (keyword == "WMCTL")
|
||||
|| is_in_set(countkw, keyword.substr(1));
|
||||
}
|
||||
|
||||
bool is_region_to_region(const std::string& keyword) {
|
||||
using sz_t = std::string::size_type;
|
||||
if ((keyword.size() == sz_t{3}) && keyword[2] == 'F') return true;
|
||||
@ -246,6 +255,7 @@ namespace {
|
||||
if (is_ratio(keyword)) return SummaryConfigNode::Type::Ratio;
|
||||
if (is_pressure(keyword)) return SummaryConfigNode::Type::Pressure;
|
||||
if (is_count(keyword)) return SummaryConfigNode::Type::Count;
|
||||
if (is_control_mode(keyword)) return SummaryConfigNode::Type::Mode;
|
||||
|
||||
return SummaryConfigNode::Type::Undefined;
|
||||
}
|
||||
@ -295,18 +305,17 @@ inline void keywordW( SummaryConfig::keyword_list& list,
|
||||
const DeckKeyword& keyword,
|
||||
const Schedule& schedule ) {
|
||||
/*
|
||||
Here is a two step check whether this keyword should be discarded as not
|
||||
supported:
|
||||
Two step check for whether to discard this keyword as unsupported:
|
||||
|
||||
1. Well keywords ending with 'L' represent completions, they are not
|
||||
supported.
|
||||
1. Completion quantity keywords are currently not supported. These are
|
||||
well summary keywords, apart from "WMCTL", that end in 'L'.
|
||||
|
||||
2. If the keyword is a UDQ keyword there is no convention enforced to
|
||||
the last character, and in that case it is treated as a normal well
|
||||
keyword anyways.
|
||||
*/
|
||||
if (keyword.name().back() == 'L') {
|
||||
if (!is_udq(keyword.name())) {
|
||||
if (! (is_control_mode(keyword.name()) || is_udq(keyword.name()))) {
|
||||
const auto& location = keyword.location();
|
||||
std::string msg = std::string("The completion keywords like: " + keyword.name() + " are not supported at: " + location.filename + ", line " + std::to_string(location.lineno));
|
||||
parseContext.handleError( ParseContext::SUMMARY_UNHANDLED_KEYWORD, msg, errors);
|
||||
|
@ -3615,3 +3615,148 @@ DATES -- 4
|
||||
|
||||
gr.compute("XYZ",1, 1.0, oil_pot, gas_pot, wat_pot);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Injection_Control_Mode_From_Well) {
|
||||
const auto deck = ::Opm::Parser{}.parseString(R"(RUNSPEC
|
||||
DIMENS
|
||||
10 10 10
|
||||
/
|
||||
|
||||
START -- 0
|
||||
20 MAR 2020 /
|
||||
|
||||
GRID
|
||||
|
||||
DXV
|
||||
10*100 /
|
||||
DYV
|
||||
10*100 /
|
||||
DZV
|
||||
10*1 /
|
||||
|
||||
TOPS
|
||||
100*2000 /
|
||||
|
||||
PERMX
|
||||
1000*300 /
|
||||
PERMY
|
||||
1000*300 /
|
||||
PERMZ
|
||||
1000*3 /
|
||||
|
||||
PORO
|
||||
1000*0.25 /
|
||||
|
||||
SCHEDULE
|
||||
WELSPECS
|
||||
'W1' 'G1' 1 2 3.33 'OIL' 7*/
|
||||
'W2' 'G2' 1 3 3.33 'OIL' 3* YES /
|
||||
'W3' 'G3' 1 4 3.92 'OIL' 3* NO /
|
||||
'W4' 'G3' 2 2 3.92 'OIL' 3* NO /
|
||||
'W5' 'G3' 2 3 3.92 'OIL' 3* NO /
|
||||
'W6' 'G3' 2 4 3.92 'OIL' 3* NO /
|
||||
'W7' 'G3' 3 2 3.92 'OIL' 3* NO /
|
||||
/
|
||||
|
||||
WCONINJE
|
||||
'W1' 'WATER' 'OPEN' 'GRUP' /
|
||||
'W2' 'GAS' 'OPEN' 'RATE' 200 1* 450.0 /
|
||||
'W3' 'OIL' 'OPEN' 'RATE' 200 1* 450.0 /
|
||||
'W4' 'WATER' 'OPEN' 'RATE' 200 1* 450.0 /
|
||||
'W5' 'WATER' 'OPEN' 'RESV' 200 175 450.0 /
|
||||
'W6' 'GAS' 'OPEN' 'BHP' 200 1* 450.0 /
|
||||
'W7' 'GAS' 'OPEN' 'THP' 200 1* 450.0 150 /
|
||||
/
|
||||
|
||||
TSTEP
|
||||
30*30 /
|
||||
|
||||
END
|
||||
)");
|
||||
|
||||
const auto st = ::Opm::SummaryState{ std::chrono::system_clock::now() };
|
||||
const auto es = ::Opm::EclipseState{ deck };
|
||||
const auto sched = ::Opm::Schedule{ deck, es };
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(sched.getWell("W1", 10), st), -1);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(sched.getWell("W2", 10), st), 3);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(sched.getWell("W3", 10), st), 1);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(sched.getWell("W4", 10), st), 2);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(sched.getWell("W5", 10), st), 5);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(sched.getWell("W6", 10), st), 7);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(sched.getWell("W7", 10), st), 6);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Production_Control_Mode_From_Well) {
|
||||
const auto deck = ::Opm::Parser{}.parseString(R"(RUNSPEC
|
||||
DIMENS
|
||||
10 10 10
|
||||
/
|
||||
|
||||
START -- 0
|
||||
20 MAR 2020 /
|
||||
|
||||
GRID
|
||||
|
||||
DXV
|
||||
10*100 /
|
||||
DYV
|
||||
10*100 /
|
||||
DZV
|
||||
10*1 /
|
||||
|
||||
TOPS
|
||||
100*2000 /
|
||||
|
||||
PERMX
|
||||
1000*300 /
|
||||
PERMY
|
||||
1000*300 /
|
||||
PERMZ
|
||||
1000*3 /
|
||||
|
||||
PORO
|
||||
1000*0.25 /
|
||||
|
||||
SCHEDULE
|
||||
WELSPECS
|
||||
'W1' 'G1' 1 2 3.33 'OIL' 7*/
|
||||
'W2' 'G2' 1 3 3.33 'OIL' 3* YES /
|
||||
'W3' 'G3' 1 4 3.92 'OIL' 3* NO /
|
||||
'W4' 'G3' 2 2 3.92 'OIL' 3* NO /
|
||||
'W5' 'G3' 2 3 3.92 'OIL' 3* NO /
|
||||
'W6' 'G3' 2 4 3.92 'OIL' 3* NO /
|
||||
'W7' 'G3' 3 2 3.92 'OIL' 3* NO /
|
||||
'W8' 'G3' 3 3 3.92 'OIL' 3* NO /
|
||||
/
|
||||
|
||||
WCONPROD
|
||||
'W1' 'OPEN' 'GRUP' /
|
||||
'W2' 'OPEN' 'ORAT' 1000.0 /
|
||||
'W3' 'OPEN' 'WRAT' 1000.0 250.0 /
|
||||
'W4' 'OPEN' 'GRAT' 1000.0 250.0 30.0e3 /
|
||||
'W5' 'OPEN' 'LRAT' 1000.0 250.0 30.0e3 1500.0 /
|
||||
'W6' 'OPEN' 'RESV' 1000.0 250.0 30.0e3 1500.0 314.15 /
|
||||
'W7' 'OPEN' 'BHP' 1000.0 250.0 30.0e3 1500.0 314.15 27.1828 /
|
||||
'W8' 'OPEN' 'THP' 1000.0 250.0 30.0e3 1500.0 314.15 27.1828 31.415 /
|
||||
/
|
||||
|
||||
TSTEP
|
||||
30*30 /
|
||||
|
||||
END
|
||||
)");
|
||||
|
||||
const auto st = ::Opm::SummaryState{ std::chrono::system_clock::now() };
|
||||
const auto es = ::Opm::EclipseState{ deck };
|
||||
const auto sched = ::Opm::Schedule{ deck, es };
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(sched.getWell("W1", 10), st), -1);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(sched.getWell("W2", 10), st), 1);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(sched.getWell("W3", 10), st), 2);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(sched.getWell("W4", 10), st), 3);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(sched.getWell("W5", 10), st), 4);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(sched.getWell("W6", 10), st), 5);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(sched.getWell("W7", 10), st), 7);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(sched.getWell("W8", 10), st), 6);
|
||||
}
|
||||
|
@ -908,3 +908,179 @@ BOOST_AUTO_TEST_CASE(WellTypeTest) {
|
||||
BOOST_CHECK(wtp.preferred_phase() == Phase::WATER);
|
||||
BOOST_CHECK(wtp.injector_type() == InjectorType::GAS);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Injector_Control_Mode) {
|
||||
using IMode = ::Opm::Well::InjectorCMode;
|
||||
using IType = ::Opm::InjectorType;
|
||||
using WStat = ::Opm::Well::Status;
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::GRUP, IType::GAS, WStat::OPEN), -1);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::GRUP, IType::GAS, WStat::SHUT), -1);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::GRUP, IType::GAS, WStat::STOP), -1);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::GRUP, IType::GAS, WStat::AUTO), -1);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::GRUP, IType::WATER, WStat::OPEN), -1);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::GRUP, IType::WATER, WStat::SHUT), -1);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::GRUP, IType::WATER, WStat::STOP), -1);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::GRUP, IType::WATER, WStat::AUTO), -1);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::GRUP, IType::MULTI, WStat::OPEN), -1);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::GRUP, IType::MULTI, WStat::SHUT), -1);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::GRUP, IType::MULTI, WStat::STOP), -1);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::GRUP, IType::MULTI, WStat::AUTO), -1);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::GRUP, IType::OIL, WStat::OPEN), -1);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::GRUP, IType::OIL, WStat::SHUT), -1);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::GRUP, IType::OIL, WStat::STOP), -1);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::GRUP, IType::OIL, WStat::AUTO), -1);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RATE, IType::OIL, WStat::OPEN), 1);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RATE, IType::OIL, WStat::SHUT), 1);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RATE, IType::OIL, WStat::STOP), 1);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RATE, IType::OIL, WStat::AUTO), 1);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RATE, IType::WATER, WStat::OPEN), 2);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RATE, IType::WATER, WStat::SHUT), 2);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RATE, IType::WATER, WStat::STOP), 2);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RATE, IType::WATER, WStat::AUTO), 2);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RATE, IType::GAS, WStat::OPEN), 3);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RATE, IType::GAS, WStat::SHUT), 3);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RATE, IType::GAS, WStat::STOP), 3);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RATE, IType::GAS, WStat::AUTO), 3);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RATE, IType::MULTI, WStat::OPEN), -10);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RATE, IType::MULTI, WStat::SHUT), -10);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RATE, IType::MULTI, WStat::STOP), -10);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RATE, IType::MULTI, WStat::AUTO), -10);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RESV, IType::GAS, WStat::OPEN), 5);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RESV, IType::GAS, WStat::SHUT), 5);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RESV, IType::GAS, WStat::STOP), 5);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RESV, IType::GAS, WStat::AUTO), 5);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RESV, IType::WATER, WStat::OPEN), 5);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RESV, IType::WATER, WStat::SHUT), 5);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RESV, IType::WATER, WStat::STOP), 5);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RESV, IType::WATER, WStat::AUTO), 5);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RESV, IType::MULTI, WStat::OPEN), 5);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RESV, IType::MULTI, WStat::SHUT), 5);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RESV, IType::MULTI, WStat::STOP), 5);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RESV, IType::MULTI, WStat::AUTO), 5);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RESV, IType::OIL, WStat::OPEN), 5);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RESV, IType::OIL, WStat::SHUT), 5);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RESV, IType::OIL, WStat::STOP), 5);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::RESV, IType::OIL, WStat::AUTO), 5);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::THP, IType::GAS, WStat::OPEN), 6);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::THP, IType::GAS, WStat::SHUT), 6);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::THP, IType::GAS, WStat::STOP), 6);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::THP, IType::GAS, WStat::AUTO), 6);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::THP, IType::WATER, WStat::OPEN), 6);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::THP, IType::WATER, WStat::SHUT), 6);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::THP, IType::WATER, WStat::STOP), 6);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::THP, IType::WATER, WStat::AUTO), 6);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::THP, IType::MULTI, WStat::OPEN), 6);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::THP, IType::MULTI, WStat::SHUT), 6);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::THP, IType::MULTI, WStat::STOP), 6);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::THP, IType::MULTI, WStat::AUTO), 6);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::THP, IType::OIL, WStat::OPEN), 6);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::THP, IType::OIL, WStat::SHUT), 6);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::THP, IType::OIL, WStat::STOP), 6);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::THP, IType::OIL, WStat::AUTO), 6);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::BHP, IType::GAS, WStat::OPEN), 7);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::BHP, IType::GAS, WStat::SHUT), 7);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::BHP, IType::GAS, WStat::STOP), 7);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::BHP, IType::GAS, WStat::AUTO), 7);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::BHP, IType::WATER, WStat::OPEN), 7);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::BHP, IType::WATER, WStat::SHUT), 7);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::BHP, IType::WATER, WStat::STOP), 7);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::BHP, IType::WATER, WStat::AUTO), 7);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::BHP, IType::MULTI, WStat::OPEN), 7);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::BHP, IType::MULTI, WStat::SHUT), 7);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::BHP, IType::MULTI, WStat::STOP), 7);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::BHP, IType::MULTI, WStat::AUTO), 7);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::BHP, IType::OIL, WStat::OPEN), 7);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::BHP, IType::OIL, WStat::SHUT), 7);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::BHP, IType::OIL, WStat::STOP), 7);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::BHP, IType::OIL, WStat::AUTO), 7);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(IMode::CMODE_UNDEFINED, IType::WATER, WStat::SHUT), 0);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(static_cast<IMode>(1729), IType::WATER, WStat::SHUT), 0);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(static_cast<IMode>(1729), IType::WATER, WStat::STOP), -10); // Unknown combination
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(static_cast<IMode>(1729), IType::WATER, WStat::OPEN), -10); // Unknown combination
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Producer_Control_Mode) {
|
||||
using PMode = ::Opm::Well::ProducerCMode;
|
||||
using WStat = ::Opm::Well::Status;
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::GRUP, WStat::OPEN), -1);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::GRUP, WStat::STOP), -1);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::GRUP, WStat::SHUT), -1);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::GRUP, WStat::AUTO), -1);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::ORAT, WStat::OPEN), 1);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::ORAT, WStat::STOP), 1);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::ORAT, WStat::SHUT), 1);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::ORAT, WStat::AUTO), 1);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::WRAT, WStat::OPEN), 2);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::WRAT, WStat::STOP), 2);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::WRAT, WStat::SHUT), 2);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::WRAT, WStat::AUTO), 2);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::GRAT, WStat::OPEN), 3);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::GRAT, WStat::STOP), 3);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::GRAT, WStat::SHUT), 3);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::GRAT, WStat::AUTO), 3);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::LRAT, WStat::OPEN), 4);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::LRAT, WStat::STOP), 4);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::LRAT, WStat::SHUT), 4);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::LRAT, WStat::AUTO), 4);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::RESV, WStat::OPEN), 5);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::RESV, WStat::STOP), 5);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::RESV, WStat::SHUT), 5);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::RESV, WStat::AUTO), 5);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::THP, WStat::OPEN), 6);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::THP, WStat::STOP), 6);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::THP, WStat::SHUT), 6);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::THP, WStat::AUTO), 6);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::BHP, WStat::OPEN), 7);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::BHP, WStat::STOP), 7);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::BHP, WStat::SHUT), 7);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::BHP, WStat::AUTO), 7);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::CRAT, WStat::OPEN), 9);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::CRAT, WStat::STOP), 9);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::CRAT, WStat::SHUT), 9);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::CRAT, WStat::AUTO), 9);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::NONE, WStat::OPEN), -10);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::NONE, WStat::STOP), -10);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::NONE, WStat::SHUT), 0);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::NONE, WStat::AUTO), -10);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::CMODE_UNDEFINED, WStat::OPEN), -10);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::CMODE_UNDEFINED, WStat::STOP), -10);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::CMODE_UNDEFINED, WStat::SHUT), 0);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(PMode::CMODE_UNDEFINED, WStat::AUTO), -10);
|
||||
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(static_cast<PMode>(271828), WStat::OPEN), -10);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(static_cast<PMode>(271828), WStat::STOP), -10);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(static_cast<PMode>(271828), WStat::SHUT), 0);
|
||||
BOOST_CHECK_EQUAL(eclipseControlMode(static_cast<PMode>(271828), WStat::AUTO), -10);
|
||||
}
|
||||
|
@ -245,8 +245,8 @@ static data::Wells result_wells() {
|
||||
{ { segment.segNumber, segment } },
|
||||
data::CurrentControl{}
|
||||
};
|
||||
well1.current_control.isProducer = false;
|
||||
well1.current_control.inj =::Opm::Well::InjectorCMode::BHP;
|
||||
well1.current_control.isProducer = true;
|
||||
well1.current_control.prod = ::Opm::Well::ProducerCMode::THP;
|
||||
|
||||
using SegRes = decltype(well1.segments);
|
||||
using Ctrl = data::CurrentControl;
|
||||
@ -255,7 +255,8 @@ static data::Wells result_wells() {
|
||||
well2.current_control.prod = ::Opm::Well::ProducerCMode::ORAT;
|
||||
|
||||
data::Well well3 { rates3, 2.1 * ps, 2.2 * ps, 2.3 * ps, 3, { {well3_comp1} }, SegRes{}, Ctrl{} };
|
||||
well2.current_control.prod = ::Opm::Well::ProducerCMode::RESV;
|
||||
well3.current_control.isProducer = false;
|
||||
well3.current_control.inj = ::Opm::Well::InjectorCMode::BHP;
|
||||
|
||||
data::Well well6 { rates6, 2.1 * ps, 2.2 * ps, 2.3 * ps, 3, { {well6_comp1} }, SegRes{}, Ctrl{} };
|
||||
well6.current_control.isProducer = false;
|
||||
|
@ -172,8 +172,8 @@ static data::Wells result_wells() {
|
||||
{ { segment.segNumber, segment } },
|
||||
data::CurrentControl{}
|
||||
};
|
||||
well1.current_control.isProducer = false;
|
||||
well1.current_control.inj =::Opm::Well::InjectorCMode::BHP;
|
||||
well1.current_control.isProducer = true;
|
||||
well1.current_control.prod = ::Opm::Well::ProducerCMode::BHP;
|
||||
|
||||
data::Wells wellrates;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user