From 941df67e24c1a215189bab961ca92be74670b4d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Wed, 14 Apr 2021 16:35:11 +0200 Subject: [PATCH 1/3] Identify More Connection Restart Items In particular, add named items for cumulative production and injection in the XCON array. These are needed in order to generate continuous connection-level curves in restarted runs. While here, also add a named item for the well-level cumulative oil injection quantity. --- opm/output/eclipse/VectorItems/connection.hpp | 14 +++++++++++++- opm/output/eclipse/VectorItems/well.hpp | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/opm/output/eclipse/VectorItems/connection.hpp b/opm/output/eclipse/VectorItems/connection.hpp index 24e352f7c..2cbca3fc0 100644 --- a/opm/output/eclipse/VectorItems/connection.hpp +++ b/opm/output/eclipse/VectorItems/connection.hpp @@ -67,13 +67,25 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems WaterRate = 1, // Surface flow rate (water) GasRate = 2, // Surface Flow rate (gas) + OilPrTotal = 3, // Total cumulative oil production + WatPrTotal = 4, // Total cumulative water production + GasPrTotal = 5, // Total cumulative gas production + + OilInjTotal = 6, // Total cumulative oil injection + WatInjTotal = 7, // Total cumulative water injection + GasInjTotal = 8, // Total cumulative gas injection + + GORatio = 10, // Producing gas/oil ratio + OilRate_Copy = 17, // Surface flow rate (oil) WaterRate_Copy = 18, // Surface flow rate (water) GasRate_Copy = 19, // Surface Flow rate (gas) Pressure = 34, // Connection pressure value - ResVRate = 49, // Reservoir voidage rate + ResVRate = 49, // Reservoir voidage rate + VoidPrTotal = 50, // Total cumulative reservoir voidage volume production + VoidInjTotal = 51, // Total cumulative reservoir voidage volume injection }; } // XConn }}}} // Opm::RestartIO::Helpers::VectorItems diff --git a/opm/output/eclipse/VectorItems/well.hpp b/opm/output/eclipse/VectorItems/well.hpp index c1258ade1..5cbbe3c2e 100644 --- a/opm/output/eclipse/VectorItems/well.hpp +++ b/opm/output/eclipse/VectorItems/well.hpp @@ -202,6 +202,7 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems VoidPrTotal = 21, // Well's total cumulative reservoir // voidage production + OilInjTotal = 22, // Well's total cumulative oil injection WatInjTotal = 23, // Well's total cumulative water injection GasInjTotal = 24, // Well's total cumulative gas injection VoidInjTotal = 25, // Well's total cumulative reservoir volume injection From 8d1e13fd0c24c5efbdf8430288b57af2e079b9c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Wed, 14 Apr 2021 16:41:57 +0200 Subject: [PATCH 2/3] Configure Additional Summary Quantites for Restart In particular, ensure that connection-level cumulatives are always available in the SummaryState. Also generate the connection-level flowing gas/oil ratio (CGOR) while here. --- src/opm/output/eclipse/Summary.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/opm/output/eclipse/Summary.cpp b/src/opm/output/eclipse/Summary.cpp index ca3696a15..c2d8f84da 100644 --- a/src/opm/output/eclipse/Summary.cpp +++ b/src/opm/output/eclipse/Summary.cpp @@ -178,10 +178,21 @@ namespace { {"COPR", Opm::EclIO::SummaryNode::Type::Rate}, {"CWPR", Opm::EclIO::SummaryNode::Type::Rate}, {"CGPR", Opm::EclIO::SummaryNode::Type::Rate}, + {"CVPR", Opm::EclIO::SummaryNode::Type::Rate}, + {"COPT", Opm::EclIO::SummaryNode::Type::Total}, + {"CWPT", Opm::EclIO::SummaryNode::Type::Total}, + {"CGPT", Opm::EclIO::SummaryNode::Type::Total}, + {"CVPT", Opm::EclIO::SummaryNode::Type::Total}, {"COIR", Opm::EclIO::SummaryNode::Type::Rate}, {"CWIR", Opm::EclIO::SummaryNode::Type::Rate}, {"CGIR", Opm::EclIO::SummaryNode::Type::Rate}, - {"CPR", Opm::EclIO::SummaryNode::Type::Pressure} + {"CVIR", Opm::EclIO::SummaryNode::Type::Rate}, + {"COIT", Opm::EclIO::SummaryNode::Type::Total}, + {"CWIT", Opm::EclIO::SummaryNode::Type::Total}, + {"CGIT", Opm::EclIO::SummaryNode::Type::Total}, + {"CVIT", Opm::EclIO::SummaryNode::Type::Total}, + {"CPR", Opm::EclIO::SummaryNode::Type::Pressure}, + {"CGOR", Opm::EclIO::SummaryNode::Type::Ratio}, }; using Cat = Opm::EclIO::SummaryNode::Category; From 65538e3ac90da1706a3a08713443d8f06116a684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Wed, 14 Apr 2021 16:49:44 +0200 Subject: [PATCH 3/3] Save/Restore Connection Level Cumulatives to/from Restart MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit add support for saving connection-level cumulative quantities (e.g., those denoted by summary vectors COPT or CVIT) to the restart file (in the 'XCON' array) and to restore these values back to the 'SummaryState' object upon simulation restart. Thanks to Torbjørn Skille and Jostein Alvestad for invaluable assistance in characterising these XCON items. --- .../eclipse/AggregateConnectionData.cpp | 112 +++++++------- src/opm/output/eclipse/LoadRestart.cpp | 47 +++++- tests/test_AggregateConnectionData.cpp | 139 +++++++++++++----- tests/test_Restart.cpp | 21 ++- 4 files changed, 221 insertions(+), 98 deletions(-) diff --git a/src/opm/output/eclipse/AggregateConnectionData.cpp b/src/opm/output/eclipse/AggregateConnectionData.cpp index 07a5a1e9c..970826bd2 100755 --- a/src/opm/output/eclipse/AggregateConnectionData.cpp +++ b/src/opm/output/eclipse/AggregateConnectionData.cpp @@ -38,6 +38,8 @@ #include #include +#include + namespace VI = Opm::RestartIO::Helpers::VectorItems; // ##################################################################### @@ -61,23 +63,28 @@ namespace { const Opm::data::Well* wellRes, ConnOp&& connOp) { + const auto& wellName = well.name(); + const auto wellID = well.seqIndex(); + const auto isProd = well.isProducer(); + std::size_t connID = 0; for (const auto* connPtr : well.getConnections().output(grid)) { const auto* dynConnRes = (wellRes == nullptr) ? nullptr : wellRes->find_connection(connPtr->global_index()); - connOp(well, *connPtr, connID, connPtr->global_index(), dynConnRes); + connOp(wellName, wellID, isProd, *connPtr, connID, + connPtr->global_index(), dynConnRes); ++connID; } } template - void wellConnectionLoop(const Opm::Schedule& sched, - const std::size_t sim_step, - const Opm::EclipseGrid& grid, + void wellConnectionLoop(const Opm::Schedule& sched, + const std::size_t sim_step, + const Opm::EclipseGrid& grid, const Opm::data::Wells& xw, - ConnOp&& connOp) + ConnOp&& connOp) { for (const auto& wname : sched.wellNames(sim_step)) { const auto well_iter = xw.find(wname); @@ -234,60 +241,60 @@ namespace { } template - void dynamicContrib(const Opm::Well& well, - const std::size_t& global_index, + void dynamicContrib(const std::string& well_name, + const bool is_producer, + const std::size_t global_index, const Opm::SummaryState& summary_state, - const Opm::data::Connection& x, - const Opm::UnitSystem& units, - XConnArray& xConn) + XConnArray& xConn) { - using M = ::Opm::UnitSystem::measure; using Ix = ::Opm::RestartIO::Helpers::VectorItems::XConn::index; - using R = ::Opm::data::Rates::opt; - const auto& wname = well.name(); - xConn[Ix::Pressure] = summary_state.get_conn_var(wname, "CPR", global_index + 1); + auto get = [global_index, &well_name, &summary_state] + (const std::string& var) + { + return summary_state + .get_conn_var(well_name, var, global_index + 1, 0.0); + }; - // Note flow rate sign. Treat production rates as positive. - const auto& Q = x.rates; - if (well.isProducer()) { - if (summary_state.has_conn_var(wname, "COPR", global_index + 1)) - xConn[Ix::OilRate] = summary_state.get_conn_var(wname, "COPR", global_index + 1); + auto connRate = [is_producer, &get](const char phase) -> double + { + const auto var = + fmt::format("C{}{}R", phase, is_producer ? 'P' : 'I'); - if (summary_state.has_conn_var(wname, "CWPR", global_index + 1)) - xConn[Ix::WaterRate] = summary_state.get_conn_var(wname, "CWPR", global_index + 1); + const auto val = get(var); - if (summary_state.has_conn_var(wname, "CGPR", global_index + 1)) - xConn[Ix::GasRate] = summary_state.get_conn_var(wname, "CGPR", global_index + 1); - } else { - if (summary_state.has_conn_var(wname, "COIR", global_index + 1)) - xConn[Ix::OilRate] = -summary_state.get_conn_var(wname, "COIR", global_index + 1); + // Note: Production rates are positive but injection rates + // are reported as negative values in XCON. + return is_producer ? val : -val; + }; - if (summary_state.has_conn_var(wname, "CWIR", global_index + 1)) - xConn[Ix::WaterRate] = -summary_state.get_conn_var(wname, "CWIR", global_index + 1); + auto connTotal = [&get](const char phase, const char direction) + { + return get(fmt::format("C{}{}T", phase, direction)); + }; + + xConn[Ix::Pressure] = get("CPR"); + + xConn[Ix::OilRate] = connRate('O'); + xConn[Ix::WaterRate] = connRate('W'); + xConn[Ix::GasRate] = connRate('G'); + xConn[Ix::ResVRate] = connRate('V'); + + xConn[Ix::OilPrTotal] = connTotal('O', 'P'); + xConn[Ix::WatPrTotal] = connTotal('W', 'P'); + xConn[Ix::GasPrTotal] = connTotal('G', 'P'); + xConn[Ix::VoidPrTotal] = connTotal('V', 'P'); + + xConn[Ix::OilInjTotal] = connTotal('O', 'I'); + xConn[Ix::WatInjTotal] = connTotal('W', 'I'); + xConn[Ix::GasInjTotal] = connTotal('G', 'I'); + xConn[Ix::VoidInjTotal] = connTotal('V', 'I'); + + xConn[Ix::GORatio] = get("CGOR"); - if (summary_state.has_conn_var(wname, "CGIR", global_index + 1)) - xConn[Ix::GasRate] = -summary_state.get_conn_var(wname, "CGIR", global_index + 1); - } xConn[Ix::OilRate_Copy] = xConn[Ix::OilRate]; xConn[Ix::GasRate_Copy] = xConn[Ix::GasRate]; xConn[Ix::WaterRate_Copy] = xConn[Ix::WaterRate]; - - xConn[Ix::ResVRate] = 0.0; - if (Q.has(R::reservoir_oil)) { - xConn[Ix::ResVRate] -= - units.from_si(M::rate, Q.get(R::reservoir_oil)); - } - - if (Q.has(R::reservoir_water)) { - xConn[Ix::ResVRate] -= - units.from_si(M::rate, Q.get(R::reservoir_water)); - } - - if (Q.has(R::reservoir_gas)) { - xConn[Ix::ResVRate] -= - units.from_si(M::rate, Q.get(R::reservoir_gas)); - } } } // XConn } // Anonymous @@ -311,13 +318,14 @@ captureDeclaredConnData(const Schedule& sched, const std::size_t sim_step) { wellConnectionLoop(sched, sim_step, grid, xw, [&units, &summary_state, this] - (const Well& well, + (const std::string& wellName, + const std::size_t wellID, + const bool is_producer, const Connection& conn, const std::size_t connID, const std::size_t global_index, const data::Connection* dynConnRes) -> void { - const auto wellID = well.seqIndex(); auto ic = this->iConn_(wellID, connID); auto sc = this->sConn_(wellID, connID); @@ -327,10 +335,12 @@ captureDeclaredConnData(const Schedule& sched, if (dynConnRes != nullptr) { // Simulator provides dynamic connection results such as flow // rates and PI-adjusted transmissibility factors. - auto xc = this->xConn_(wellID, connID); SConn::dynamicContrib(*dynConnRes, units, sc); - XConn::dynamicContrib(well, global_index, summary_state, *dynConnRes, units, xc); } + + auto xc = this->xConn_(wellID, connID); + XConn::dynamicContrib(wellName, is_producer, + global_index, summary_state, xc); }); } diff --git a/src/opm/output/eclipse/LoadRestart.cpp b/src/opm/output/eclipse/LoadRestart.cpp index ffab3279a..a6d0e4366 100644 --- a/src/opm/output/eclipse/LoadRestart.cpp +++ b/src/opm/output/eclipse/LoadRestart.cpp @@ -868,6 +868,23 @@ namespace { return wells; } + template + void restoreConnCumulatives(const WellVectors::Window& xcon, + AssignCumulative&& asgn) + { + asgn("COPT", xcon[VI::XConn::index::OilPrTotal]); + asgn("COIT", xcon[VI::XConn::index::OilInjTotal]); + + asgn("CGPT", xcon[VI::XConn::index::GasPrTotal]); + asgn("CGIT", xcon[VI::XConn::index::GasInjTotal]); + + asgn("CWPT", xcon[VI::XConn::index::WatPrTotal]); + asgn("CWIT", xcon[VI::XConn::index::WatInjTotal]); + + asgn("CVPT", xcon[VI::XConn::index::VoidPrTotal]); + asgn("CVIT", xcon[VI::XConn::index::VoidInjTotal]); + } + void restoreConnRates(const WellVectors::Window& xcon, const Opm::UnitSystem& usys, const bool oil, @@ -912,6 +929,7 @@ namespace { const Opm::UnitSystem& usys, const Opm::Phases& phases, const WellVectors& wellData, + Opm::SummaryState& smry, Opm::data::Well& xw) { using M = ::Opm::UnitSystem::measure; @@ -945,6 +963,7 @@ namespace { return; } + const auto& wname = well.name(); for (auto rstConnID = 0*nConn; rstConnID < nConn; ++rstConnID) { const auto icon = wellData.icon(wellID, rstConnID); @@ -952,10 +971,18 @@ namespace { const auto j = icon[VI::IConn::index::CellJ] - 1; const auto k = icon[VI::IConn::index::CellK] - 1; - auto* xc = xw.find_connection(grid.getGlobalIndex(i, j, k)); + const auto globCell = grid.getGlobalIndex(i, j, k); + const auto xcon = wellData.xcon(wellID, rstConnID); + + restoreConnCumulatives(xcon, [globCell, &wname, &smry] + (const std::string& vector, const double value) + { + smry.update_conn_var(wname, vector, globCell + 1, value); + }); + + auto* xc = xw.find_connection(globCell); if (xc == nullptr) { continue; } - const auto xcon = wellData.xcon(wellID, rstConnID); restoreConnRates(xcon, usys, oil, gas, wat, *xc); xc->pressure = usys.to_si(M::pressure, xcon[Ix::Pressure]); @@ -1095,7 +1122,8 @@ namespace { const Opm::UnitSystem& usys, const Opm::Phases& phases, const WellVectors& wellData, - const SegmentVectors& segData) + const SegmentVectors& segData, + Opm::SummaryState& smry) { if (! wellData.hasDefinedWellValues()) { // Result set does not provide well information. @@ -1171,9 +1199,11 @@ namespace { xw.thp = usys.to_si(M::pressure, xwel[VI::XWell::index::TubHeadPr]); xw.temperature = 0.0; - // 4) Restore connection flow rates (xw.connections[i].rates) - // and pressure values (xw.connections[i].pressure). - restoreConnResults(well, wellID, grid, usys, phases, wellData, xw); + // 4) Restore connection flow rates (xw.connections[i].rates), + // cumulatives (Cx{P,I}T), and pressure values + // (xw.connections[i].pressure). + restoreConnResults(well, wellID, grid, usys, + phases, wellData, smry, xw); // 5) Restore well's active/current control restoreCurrentControl(wellID, wellData, xw); @@ -1202,6 +1232,7 @@ namespace { restore_wells_ecl(const ::Opm::EclipseState& es, const ::Opm::EclipseGrid& grid, const ::Opm::Schedule& schedule, + Opm::SummaryState& smry, std::shared_ptr rst_view) { auto soln = ::Opm::data::Wells{}; @@ -1222,7 +1253,7 @@ namespace { soln[well.name()] = restore_well(well, wellID, grid, units, - phases, wellData, segData); + phases, wellData, segData, smry); } return soln; @@ -1588,7 +1619,7 @@ namespace Opm { namespace RestartIO { auto xw = rst_view->hasKeyword("OPM_XWEL") ? restore_wells_opm(es, grid, schedule, *rst_view) - : restore_wells_ecl(es, grid, schedule, rst_view); + : restore_wells_ecl(es, grid, schedule, summary_state, rst_view); auto xgrp_nwrk = restore_grp_nwrk(schedule, es.getUnits(), rst_view); diff --git a/tests/test_AggregateConnectionData.cpp b/tests/test_AggregateConnectionData.cpp index cf0606401..a2838fbaa 100644 --- a/tests/test_AggregateConnectionData.cpp +++ b/tests/test_AggregateConnectionData.cpp @@ -17,22 +17,21 @@ along with OPM. If not, see . */ - #define BOOST_TEST_MODULE Aggregate_Connection_Data -#include + #include -#include -#include -#include -#include #include +#include #include - +#include #include #include +#include +#include + #include #include @@ -40,14 +39,15 @@ #include #include #include +#include + #include +#include #include #include #include #include -#include -#include struct MockIH { @@ -482,20 +482,22 @@ END { xw["PROD"].rates.set(o::wat, 1.0).set(o::oil, 2.0).set(o::gas, 3.0); xw["PROD"].bhp = 213.0; - double qo = 5.; - double qw = 4.; - double qg = 50.; + + const double qv = 12.34; { + const double qw = 4.0; + const double qo = 5.0; + const double qg = 50.0; + const auto& well = sched.getWell("PROD", 0); const auto& connections = well.getConnections(); for (int i = 0; i < 5; i++) { - xw["PROD"].connections.emplace_back(); - auto& c = xw["PROD"].connections.back(); + auto& c = xw["PROD"].connections.emplace_back(); - c.rates.set(o::wat, qw * (float(i) + 1.)) - .set(o::oil, qo * (float(i) + 1.)) - .set(o::gas, qg * (float(i) + 1.)); - c.pressure = 215.; + c.rates.set(o::wat, qw * (float(i) + 1.0)) + .set(o::oil, qo * (float(i) + 1.0)) + .set(o::gas, qg * (float(i) + 1.0)); + c.pressure = 215.0; c.index = connections[i].global_index(); c.trans_factor = connections[i].CF(); @@ -503,7 +505,16 @@ END sum_state.update_conn_var("PROD", "CWPR", global_index + 1, qw * (i + 1)); sum_state.update_conn_var("PROD", "COPR", global_index + 1, qo * (i + 1)); sum_state.update_conn_var("PROD", "CGPR", global_index + 1, qg * (i + 1)); - sum_state.update_conn_var("PROD", "CPR", global_index + 1, 215); + sum_state.update_conn_var("PROD", "CVPR", global_index + 1, qv * (i + 1)); + + sum_state.update_conn_var("PROD", "COPT", global_index + 1, qo * (i + 1) * 2.0); + sum_state.update_conn_var("PROD", "CWPT", global_index + 1, qw * (i + 1) * 2.0); + sum_state.update_conn_var("PROD", "CGPT", global_index + 1, qg * (i + 1) * 2.0); + sum_state.update_conn_var("PROD", "CVPT", global_index + 1, qv * (i + 1) * 2.0); + + sum_state.update_conn_var("PROD", "CGOR", global_index + 1, qg / qo); + + sum_state.update_conn_var("PROD", "CPR", global_index + 1, 215.0); } auto seg = Opm::data::Segment {}; @@ -520,13 +531,14 @@ END xw["WINJ"].rates.set(o::wat, 5.0); xw["WINJ"].rates.set(o::oil, 0.0); xw["WINJ"].rates.set(o::gas, 0.0); - qw = 7.; + + const double qw = 7.0; for (int i = 0; i < 4; i++) { xw["WINJ"].connections.emplace_back(); auto& c = xw["WINJ"].connections.back(); - c.rates.set(o::wat, qw * (float(i) + 1.)).set(o::oil, 0.).set(o::gas, 0.); - c.pressure = 218.; + c.rates.set(o::wat, qw * (float(i) + 1.0)).set(o::oil, 0.0).set(o::gas, 0.0); + c.pressure = 218.0; c.index = connections[i].global_index(); c.trans_factor = connections[i].CF(); @@ -534,7 +546,14 @@ END sum_state.update_conn_var("WINJ", "CWIR", global_index+ 1, qw*(i + 1)); sum_state.update_conn_var("WINJ", "COIR", global_index+ 1, 0.0); sum_state.update_conn_var("WINJ", "CGIR", global_index+ 1, 0.0); - sum_state.update_conn_var("WINJ", "CPR", global_index + 1, 218); + sum_state.update_conn_var("WINJ", "CVIR", global_index+ 1, qv*(i + 1)); + + sum_state.update_conn_var("WINJ", "COIT", global_index + 1, 543.21 * (i + 1)); + sum_state.update_conn_var("WINJ", "CWIT", global_index + 1, qw * (i + 1) * 2.0); + sum_state.update_conn_var("WINJ", "CGIT", global_index + 1, 9876.54 * (i + 1)); + sum_state.update_conn_var("WINJ", "CVIT", global_index + 1, qv * (i + 1) * 2.0); + + sum_state.update_conn_var("WINJ", "CPR", global_index + 1, 218.0); } } } @@ -706,34 +725,84 @@ BOOST_AUTO_TEST_CASE(Declared_Connection_Data) // PROD well int connNo = 1; auto i0 = (connNo - 1) * ih.nxconz; - BOOST_CHECK_CLOSE(xconn[i0 + Ix::OilRate], - 5. * (float(connNo)), + BOOST_CHECK_CLOSE(xconn[i0 + Ix::OilRate], 5.0 * (float(connNo)), 1.0e-5); // PROD - conn 1 : Surface oil rate - BOOST_CHECK_CLOSE(xconn[i0 + Ix::WaterRate], - 4. * (float(connNo)), + BOOST_CHECK_CLOSE(xconn[i0 + Ix::WaterRate], 4.0 * (float(connNo)), 1.0e-5); // PROD - conn 1 : Surface water rate - BOOST_CHECK_CLOSE(xconn[i0 + Ix::GasRate], - 50. * (float(connNo)), + BOOST_CHECK_CLOSE(xconn[i0 + Ix::GasRate], 50.0 * (float(connNo)), 1.0e-5); // PROD - conn 1 : Surface gas rate - BOOST_CHECK_CLOSE(xconn[i0 + Ix::Pressure], 215., 1.0e-5); // PROD - conn 1 : Connection pressure - BOOST_CHECK_CLOSE(xconn[i0 + Ix::ResVRate], 0., 1.0e-5); // PROD - conn 1 : Reservoir volume rate + BOOST_CHECK_CLOSE(xconn[i0 + Ix::ResVRate], + 12.34 * static_cast(connNo), + 1.0e-5); // PROD - conn 1 : Reservoir volume rate + + BOOST_CHECK_CLOSE(xconn[i0 + Ix::OilPrTotal], + 5.0 * static_cast(connNo) * 2.0, + 1.0e-5); + BOOST_CHECK_CLOSE(xconn[i0 + Ix::WatPrTotal], + 4.0 * static_cast(connNo) * 2.0, + 1.0e-5); + BOOST_CHECK_CLOSE(xconn[i0 + Ix::GasPrTotal], + 50.0 * static_cast(connNo) * 2.0, + 1.0e-5); + BOOST_CHECK_CLOSE(xconn[i0 + Ix::VoidPrTotal], + 12.34 * static_cast(connNo) * 2.0, + 1.0e-5); + + BOOST_CHECK_CLOSE(xconn[i0 + Ix::GORatio], + 50.0 / 5.0, + 1.0e-5); + + BOOST_CHECK_CLOSE(xconn[i0 + Ix::OilInjTotal] , 0.0, 1.0e-5); + BOOST_CHECK_CLOSE(xconn[i0 + Ix::WatInjTotal] , 0.0, 1.0e-5); + BOOST_CHECK_CLOSE(xconn[i0 + Ix::GasInjTotal] , 0.0, 1.0e-5); + BOOST_CHECK_CLOSE(xconn[i0 + Ix::VoidInjTotal], 0.0, 1.0e-5); + + BOOST_CHECK_CLOSE(xconn[i0 + Ix::Pressure], 215.0, 1.0e-5); // PROD - conn 1 : Connection pressure // WINJ well connNo = 3; i0 = ih.ncwmax * ih.nxconz + (connNo - 1) * ih.nxconz; BOOST_CHECK_CLOSE(xconn[i0 + Ix::WaterRate], - -7. * (float(connNo)), + -7.0 * (float(connNo)), 1.0e-5); // WINJ - conn 3 : Surface water rate BOOST_CHECK_CLOSE(xconn[i0 + Ix::Pressure], 218., 1.0e-5); // WINJ - conn 3 : Connection pressure - BOOST_CHECK_CLOSE(xconn[i0 + Ix::ResVRate], 0., 1.0e-5); // WINJ - conn 3 : Reservoir volume rate + BOOST_CHECK_CLOSE(xconn[i0 + Ix::ResVRate], + -12.34 * static_cast(connNo), + 1.0e-5); // WINJ - conn 3 : Reservoir volume rate + + BOOST_CHECK_CLOSE(xconn[i0 + Ix::OilPrTotal] , 0.0, 1.0e-5); + BOOST_CHECK_CLOSE(xconn[i0 + Ix::WatPrTotal] , 0.0, 1.0e-5); + BOOST_CHECK_CLOSE(xconn[i0 + Ix::GasPrTotal] , 0.0, 1.0e-5); + BOOST_CHECK_CLOSE(xconn[i0 + Ix::VoidPrTotal], 0.0, 1.0e-5); + + BOOST_CHECK_CLOSE(xconn[i0 + Ix::GORatio], 0.0, 1.0e-5); + + BOOST_CHECK_CLOSE(xconn[i0 + Ix::OilInjTotal] , 543.21 * connNo, 1.0e-5); + BOOST_CHECK_CLOSE(xconn[i0 + Ix::WatInjTotal] , 7.0 * connNo * 2.0, 1.0e-5); + BOOST_CHECK_CLOSE(xconn[i0 + Ix::GasInjTotal] , 9876.54 * connNo, 1.0e-5); + BOOST_CHECK_CLOSE(xconn[i0 + Ix::VoidInjTotal], 12.34 * connNo * 2.0, 1.0e-5); connNo = 4; i0 = ih.ncwmax * ih.nxconz + (connNo - 1) * ih.nxconz; BOOST_CHECK_CLOSE(xconn[i0 + Ix::WaterRate], - -7. * (float(connNo)), + -7.0 * (float(connNo)), 1.0e-5); // WINJ - conn 3 : Surface water rate BOOST_CHECK_CLOSE(xconn[i0 + Ix::Pressure], 218., 1.0e-5); // WINJ - conn 3 : Connection pressure - BOOST_CHECK_CLOSE(xconn[i0 + Ix::ResVRate], 0., 1.0e-5); // WINJ - conn 3 : Reservoir volume rate + BOOST_CHECK_CLOSE(xconn[i0 + Ix::ResVRate], + -12.34 * static_cast(connNo), + 1.0e-5); // WINJ - conn 3 : Reservoir volume rate + + BOOST_CHECK_CLOSE(xconn[i0 + Ix::OilPrTotal] , 0.0, 1.0e-5); + BOOST_CHECK_CLOSE(xconn[i0 + Ix::WatPrTotal] , 0.0, 1.0e-5); + BOOST_CHECK_CLOSE(xconn[i0 + Ix::GasPrTotal] , 0.0, 1.0e-5); + BOOST_CHECK_CLOSE(xconn[i0 + Ix::VoidPrTotal], 0.0, 1.0e-5); + + BOOST_CHECK_CLOSE(xconn[i0 + Ix::GORatio], 0.0, 1.0e-5); + + BOOST_CHECK_CLOSE(xconn[i0 + Ix::OilInjTotal] , 543.21 * connNo, 1.0e-5); + BOOST_CHECK_CLOSE(xconn[i0 + Ix::WatInjTotal] , 7.0 * connNo * 2.0, 1.0e-5); + BOOST_CHECK_CLOSE(xconn[i0 + Ix::GasInjTotal] , 9876.54 * connNo, 1.0e-5); + BOOST_CHECK_CLOSE(xconn[i0 + Ix::VoidInjTotal], 12.34 * connNo * 2.0, 1.0e-5); } } diff --git a/tests/test_Restart.cpp b/tests/test_Restart.cpp index e08e5c2bb..b3f21d4d3 100644 --- a/tests/test_Restart.cpp +++ b/tests/test_Restart.cpp @@ -234,10 +234,24 @@ Opm::SummaryState sim_state(const Opm::Schedule& sched) state.update_conn_var(well.name(), "COIR", connection.global_index() + 1, 222); state.update_conn_var(well.name(), "CGIR", connection.global_index() + 1, 333); state.update_conn_var(well.name(), "CWIR", connection.global_index() + 1, 444); + state.update_conn_var(well.name(), "CVIR", connection.global_index() + 1, 555); + + state.update_conn_var(well.name(), "COIT", connection.global_index() + 1, 222 * 2.0); + state.update_conn_var(well.name(), "CGIT", connection.global_index() + 1, 333 * 2.0); + state.update_conn_var(well.name(), "CWIT", connection.global_index() + 1, 444 * 2.0); + state.update_conn_var(well.name(), "CWIT", connection.global_index() + 1, 555 * 2.0); } else { - state.update_conn_var(well.name(), "COPR", connection.global_index() + 1, 555); - state.update_conn_var(well.name(), "CGPR", connection.global_index() + 1, 666); - state.update_conn_var(well.name(), "CWPR", connection.global_index() + 1, 777); + state.update_conn_var(well.name(), "COPR", connection.global_index() + 1, 666); + state.update_conn_var(well.name(), "CGPR", connection.global_index() + 1, 777); + state.update_conn_var(well.name(), "CWPR", connection.global_index() + 1, 888); + state.update_conn_var(well.name(), "CVPR", connection.global_index() + 1, 999); + + state.update_conn_var(well.name(), "CGOR", connection.global_index() + 1, 777.0 / 666.0); + + state.update_conn_var(well.name(), "COPT", connection.global_index() + 1, 555 * 2.0); + state.update_conn_var(well.name(), "CGPT", connection.global_index() + 1, 666 * 2.0); + state.update_conn_var(well.name(), "CWPT", connection.global_index() + 1, 777 * 2.0); + state.update_conn_var(well.name(), "CVPT", connection.global_index() + 1, 999 * 2.0); } } } @@ -917,7 +931,6 @@ BOOST_AUTO_TEST_CASE(Restore_Cumulatives) setup.es, setup.grid, setup.schedule, /* extra_keys = */ {}); - // Verify that the restored summary state has all of its requisite // cumulative summary vectors.