diff --git a/opm/output/eclipse/VectorItems/well.hpp b/opm/output/eclipse/VectorItems/well.hpp index bbde343f3..4a7d1564b 100644 --- a/opm/output/eclipse/VectorItems/well.hpp +++ b/opm/output/eclipse/VectorItems/well.hpp @@ -33,19 +33,24 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems NConn = 4, // Number of active cells connected to well Group = 5, // Index (one-based) of well's current group WType = 6, // Well type - WCtrl = 7, // Well control + ActWCtrl = 7, // Well's active target control mode (constraint). item9 = 8, // Unknown item11 = 10, // Unknown VFPTab = 11, // ID (one-based) of well's current VFP table + PredReqWCtrl = 15, // Well's requested control mode from + // simulation deck (WCONINJE, WCONPROD). + item18 = 17, // Unknown XFlow = 22, item25 = 24, // Unknown item32 = 31, // Unknown item48 = 47, // Unknown - item50 = 49, // Unknown + + HistReqWCtrl = 49, // Well's requested control mode from + // simulation deck (WCONHIST, WCONINJH) MsWID = 70, // Multisegment well ID // Value 0 for regular wells diff --git a/src/opm/output/eclipse/AggregateWellData.cpp b/src/opm/output/eclipse/AggregateWellData.cpp index d2339afe4..1e9a4594c 100644 --- a/src/opm/output/eclipse/AggregateWellData.cpp +++ b/src/opm/output/eclipse/AggregateWellData.cpp @@ -337,7 +337,6 @@ namespace { GroupMapNameInd); iWell[Ix::WType] = wellType (well, sim_step); - iWell[Ix::WCtrl] = ctrlMode (well, sim_step); iWell[Ix::VFPTab] = wellVFPTab(well, sim_step); iWell[Ix::XFlow] = well.getAllowCrossFlow() ? 1 : 0; @@ -348,7 +347,31 @@ namespace { iWell[Ix::item32] = 7; iWell[Ix::item48] = - 1; - iWell[Ix::item50] = iWell[Ix::WCtrl]; + // 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. + iWell[Ix::ActWCtrl] = ctrlMode(well, sim_step); + + const auto isPred = + (well.isProducer(sim_step) && + well.getProductionProperties(sim_step).predictionMode) + || + (well.isInjector(sim_step) && + well.getInjectionProperties(sim_step).predictionMode); + + if (isPred) { + // Well in prediction mode (WCONPROD, WCONINJE). Assign + // requested control mode for prediction. + iWell[Ix::PredReqWCtrl] = iWell[Ix::ActWCtrl]; + iWell[Ix::HistReqWCtrl] = 0; + } + else { + // Well controlled by observed rates/BHP (WCONHIST, + // WCONINJH). Assign requested control mode for history. + iWell[Ix::PredReqWCtrl] = 0; // Possibly =1 instead. + iWell[Ix::HistReqWCtrl] = iWell[Ix::ActWCtrl]; + } // Multi-segmented well information iWell[Ix::MsWID] = 0; // MS Well ID (0 or 1..#MS wells) @@ -386,7 +409,7 @@ namespace { }); iWell[Ix::item9] = any_flowing_conn - ? iWell[Ix::WCtrl] : -1; + ? iWell[Ix::ActWCtrl] : -1; iWell[Ix::item11] = 1; } diff --git a/tests/test_AggregateWellData.cpp b/tests/test_AggregateWellData.cpp index 3bc0d498a..3a8be3c56 100644 --- a/tests/test_AggregateWellData.cpp +++ b/tests/test_AggregateWellData.cpp @@ -548,7 +548,7 @@ BOOST_AUTO_TEST_CASE (Dynamic_Well_Data_Step1) const auto& iwell = awd.getIWell(); - BOOST_CHECK_EQUAL(iwell[i0 + Ix::item9 ], iwell[i0 + Ix::WCtrl]); + BOOST_CHECK_EQUAL(iwell[i0 + Ix::item9 ], iwell[i0 + Ix::ActWCtrl]); BOOST_CHECK_EQUAL(iwell[i0 + Ix::item11], 1); } @@ -668,7 +668,7 @@ BOOST_AUTO_TEST_CASE (Dynamic_Well_Data_Step2) const auto& iwell = awd.getIWell(); BOOST_CHECK_EQUAL(iwell[i1 + Ix::item9], - iwell[i1 + Ix::WCtrl]); + iwell[i1 + Ix::ActWCtrl]); BOOST_CHECK_EQUAL(iwell[i1 + Ix::item11], 1); }