From e685eccdc902c67361f0d497afcfa77739d369f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Tue, 22 Jan 2019 19:00:46 +0100 Subject: [PATCH] Restart: Save/Restore Historical Cumulative Production This commit adds support for saving and restoring cumulative production quantities like WOPTH, GWPTH, FGPTH, GGITH, and WWITH. While here, also cater to the case of wells alternating between injecting gas and injecting water. This means that we'll save and restore cumulative gas/water injection for all injectors, irrespective of current injecting phase. Update unit tests accordingly. --- opm/output/eclipse/AggregateGroupData.hpp | 18 +++- opm/output/eclipse/VectorItems/group.hpp | 11 ++ opm/output/eclipse/VectorItems/well.hpp | 32 ++++-- src/opm/output/eclipse/AggregateGroupData.cpp | 7 +- src/opm/output/eclipse/AggregateWellData.cpp | 101 ++++++++++-------- src/opm/output/eclipse/LoadRestart.cpp | 13 +++ src/opm/output/eclipse/Summary.cpp | 2 + tests/test_AggregateWellData.cpp | 64 ++++++++--- tests/test_Restart.cpp | 79 +++++++++++++- tests/test_Summary.cpp | 56 ++++++++++ 10 files changed, 310 insertions(+), 73 deletions(-) diff --git a/opm/output/eclipse/AggregateGroupData.hpp b/opm/output/eclipse/AggregateGroupData.hpp index bfaa61677..3ac4620fe 100644 --- a/opm/output/eclipse/AggregateGroupData.hpp +++ b/opm/output/eclipse/AggregateGroupData.hpp @@ -89,12 +89,16 @@ namespace Opm { namespace RestartIO { namespace Helpers { const std::vector restart_group_keys = {"GOPP", "GWPP", "GOPR", "GWPR", "GGPR", "GVPR", "GWIR", "GGIR", "GWCT", "GGOR", "GOPT", "GWPT", "GGPT", "GVPT", "GWIT", - "GGIT"}; + "GGIT", + "GOPTH", "GWPTH", "GGPTH", + "GWITH", "GGITH"}; const std::vector restart_field_keys = {"FOPP", "FWPP", "FOPR", "FWPR", "FGPR", "FVPR", "FWIR", "FGIR", "FWCT", "FGOR", "FOPT", "FWPT", "FGPT", "FVPT", "FWIT", - "FGIT"}; + "FGIT", + "FOPTH", "FWPTH", "FGPTH", + "FWITH", "FGITH"}; const std::map groupKeyToIndex = { {"GOPR", 0}, @@ -113,6 +117,11 @@ namespace Opm { namespace RestartIO { namespace Helpers { {"GGIT", 16}, {"GOPP", 22}, {"GWPP", 23}, + {"GOPTH", 135}, + {"GWPTH", 139}, + {"GWITH", 140}, + {"GGPTH", 143}, + {"GGITH", 144}, }; const std::map fieldKeyToIndex = { @@ -132,6 +141,11 @@ namespace Opm { namespace RestartIO { namespace Helpers { {"FGIT", 16}, {"FOPP", 22}, {"FWPP", 23}, + {"FOPTH", 135}, + {"FWPTH", 139}, + {"FWITH", 140}, + {"FGPTH", 143}, + {"FGITH", 144}, }; private: diff --git a/opm/output/eclipse/VectorItems/group.hpp b/opm/output/eclipse/VectorItems/group.hpp index 8c714fc06..46853a081 100644 --- a/opm/output/eclipse/VectorItems/group.hpp +++ b/opm/output/eclipse/VectorItems/group.hpp @@ -48,6 +48,17 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems OilPrPot = 22, // Group's oil production potential WatPrPot = 23, // Group's water production potential + + HistOilPrTotal = 135, // Group's total cumulative oil + // production (observed/historical rates) + HistWatPrTotal = 139, // Group's total cumulative water + // production (observed/historical rates) + HistWatInjTotal = 140, // Group's total cumulative water + // injection (observed/historical rates) + HistGasPrTotal = 143, // Group's total cumulative gas + // production (observed/historical rates) + HistGasInjTotal = 144, // Group's total cumulative gas injection + // (observed/historical rates) }; } // XGroup diff --git a/opm/output/eclipse/VectorItems/well.hpp b/opm/output/eclipse/VectorItems/well.hpp index 1203a20c4..bbde343f3 100644 --- a/opm/output/eclipse/VectorItems/well.hpp +++ b/opm/output/eclipse/VectorItems/well.hpp @@ -116,10 +116,15 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems BHPTarget = 6, // Well's bottom hole pressure target DatumDepth = 9, // Well's reference depth for BHP - LiqRateTarget_2 = 33, //Well's liquid rate target/limit for a well on WCONINJH control or for a producer - GasRateTarget_2 = 54, //Well's gas rate target/limit for a well on WCONINJH control or for producer - BHPTarget_2 = 55, //Well's bottom hole pressure target/limit - + + HistLiqRateTarget = 33, // Well's historical/observed liquid + // rate target/limit + + HistGasRateTarget = 54, // Well's historical/observed gas rate + // target/limit + + HistBHPTarget = 55, // Well's historical/observed bottom + // hole pressure target/limit }; } // SWell @@ -146,13 +151,22 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems GasFVF = 34, // Well's producing gas formation volume factor. - item37 = 36, // Unknown - item38 = 37, // Unknown + item37 = 36, // Unknown + item38 = 37, // Unknown - BHPTarget = 41, // Well's current BHP Target/Limit + BHPTarget = 41, // Well's current BHP Target/Limit - item82 = 81, // Unknown - item83 = 82, // Unknown + HistOilPrTotal = 75, // Well's total cumulative oil production + // (observed/historical rates) + HistWatPrTotal = 76, // Well's total cumulative water + // production (observed/historical rates) + HistGasPrTotal = 77, // Well's total cumulative gas production + // (observed(historical rates) + + HistWatInjTotal = 81, // Well's total cumulative water injection + // (observed/historical rates) + HistGasInjTotal = 82, // Well's total cumulative gas injection + // (observed/historical rates) WatVoidPrRate = 122, // Well's voidage production rate GasVoidPrRate = 123, // Well's voidage production rate diff --git a/src/opm/output/eclipse/AggregateGroupData.cpp b/src/opm/output/eclipse/AggregateGroupData.cpp index eb20e4e01..f55bc5d8d 100644 --- a/src/opm/output/eclipse/AggregateGroupData.cpp +++ b/src/opm/output/eclipse/AggregateGroupData.cpp @@ -381,7 +381,8 @@ namespace { for (const auto& key : keys) { if ((key[3] == 'T') && ((key[2] == 'I') || (key[2] == 'P'))) { - // Don't write cumulative quantities in case of + // Don't write cumulative quantities in case of OPM + // extended restart files. continue; } @@ -424,7 +425,7 @@ namespace { }*/ } } - } + } // XGrp namespace ZGrp { std::size_t entriesPerGroup(const std::vector& inteHead) @@ -447,7 +448,7 @@ namespace { WV::WindowSize{ entriesPerGroup(inteHead) } }; } - } + } // ZGrp } // Anonymous void diff --git a/src/opm/output/eclipse/AggregateWellData.cpp b/src/opm/output/eclipse/AggregateWellData.cpp index ca0aee54e..d2339afe4 100644 --- a/src/opm/output/eclipse/AggregateWellData.cpp +++ b/src/opm/output/eclipse/AggregateWellData.cpp @@ -30,7 +30,6 @@ #include #include #include -//#include #include #include @@ -511,13 +510,13 @@ namespace { if ((pp.GasRate != 0.0) || (!predMode)) { sWell[Ix::GasRateTarget] = swprop(M::gas_surface_rate, pp.GasRate); - sWell[Ix::GasRateTarget_2] = sWell[Ix::GasRateTarget]; + sWell[Ix::HistGasRateTarget] = sWell[Ix::GasRateTarget]; } if (pp.LiquidRate != 0.0 || (!predMode)) { sWell[Ix::LiqRateTarget] = swprop(M::liquid_surface_rate, pp.LiquidRate); - sWell[Ix::LiqRateTarget_2] = sWell[Ix::LiqRateTarget]; + sWell[Ix::HistLiqRateTarget] = sWell[Ix::LiqRateTarget]; } else { sWell[Ix::LiqRateTarget] = @@ -542,26 +541,29 @@ namespace { sWell[Ix::BHPTarget] = pp.BHPLimit != 0.0 ? swprop(M::pressure, pp.BHPLimit) : swprop(M::pressure, 1.0*::Opm::unit::atm); - sWell[Ix::BHPTarget_2] = sWell[Ix::BHPTarget]; + sWell[Ix::HistBHPTarget] = sWell[Ix::BHPTarget]; } else if (well.isInjector(sim_step)) { const auto& ip = well.getInjectionProperties(sim_step); using IP = ::Opm::WellInjector::ControlModeEnum; - using IT = ::Opm::WellInjector::TypeEnum; + using IT = ::Opm::WellInjector::TypeEnum; - if (ip.hasInjectionControl(IP::RATE)) { - if (ip.injectorType == IT::OIL) { - sWell[Ix::OilRateTarget] = swprop(M::liquid_surface_rate, ip.surfaceInjectionRate); - } - if (ip.injectorType == IT::WATER) { - sWell[Ix::WatRateTarget] = swprop(M::liquid_surface_rate, ip.surfaceInjectionRate); - sWell[Ix::LiqRateTarget_2] = sWell[Ix::WatRateTarget]; - } - if (ip.injectorType == IT::GAS) { - sWell[Ix::GasRateTarget] = swprop(M::gas_surface_rate, ip.surfaceInjectionRate); - sWell[Ix::GasRateTarget_2] = sWell[Ix::GasRateTarget]; - } + if (ip.hasInjectionControl(IP::RATE)) { + if (ip.injectorType == IT::OIL) { + sWell[Ix::OilRateTarget] = + swprop(M::liquid_surface_rate, ip.surfaceInjectionRate); + } + if (ip.injectorType == IT::WATER) { + sWell[Ix::WatRateTarget] = + swprop(M::liquid_surface_rate, ip.surfaceInjectionRate); + sWell[Ix::HistLiqRateTarget] = sWell[Ix::WatRateTarget]; + } + if (ip.injectorType == IT::GAS) { + sWell[Ix::GasRateTarget] = + swprop(M::gas_surface_rate, ip.surfaceInjectionRate); + sWell[Ix::HistGasRateTarget] = sWell[Ix::GasRateTarget]; + } } if (ip.hasInjectionControl(IP::RESV)) { @@ -575,7 +577,7 @@ namespace { sWell[Ix::BHPTarget] = ip.hasInjectionControl(IP::BHP) ? swprop(M::pressure, ip.BHPLimit) : swprop(M::pressure, 1.0E05*::Opm::unit::psia); - sWell[Ix::BHPTarget_2] = sWell[Ix::BHPTarget]; + sWell[Ix::HistBHPTarget] = sWell[Ix::BHPTarget]; } sWell[Ix::DatumDepth] = @@ -647,15 +649,41 @@ namespace { xWell[Ix::WatCut] = get("WWCT"); xWell[Ix::GORatio] = get("WGOR"); - if (ecl_compatible_rst) { - xWell[Ix::OilPrTotal] = get("WOPT"); - xWell[Ix::WatPrTotal] = get("WWPT"); - xWell[Ix::GasPrTotal] = get("WGPT"); - xWell[Ix::VoidPrTotal] = get("WVPT"); - } + if (ecl_compatible_rst) { + xWell[Ix::OilPrTotal] = get("WOPT"); + xWell[Ix::WatPrTotal] = get("WWPT"); + xWell[Ix::GasPrTotal] = get("WGPT"); + xWell[Ix::VoidPrTotal] = get("WVPT"); + } + // Not fully characterised. xWell[Ix::item37] = xWell[Ix::WatPrRate]; xWell[Ix::item38] = xWell[Ix::GasPrRate]; + + if (ecl_compatible_rst) { + xWell[Ix::HistOilPrTotal] = get("WOPTH"); + xWell[Ix::HistWatPrTotal] = get("WWPTH"); + xWell[Ix::HistGasPrTotal] = get("WGPTH"); + } + } + + template + void assignCommonInjector(GetSummaryVector& get, + const bool ecl_compatible_rst, + XWellArray& xWell) + { + using Ix = ::Opm::RestartIO::Helpers::VectorItems::XWell::index; + + xWell[Ix::FlowBHP] = get("WBHP"); + + if (ecl_compatible_rst) { + // Note: Assign both water and gas cumulatives to support + // case of well alternating between injecting water and gas. + xWell[Ix::WatInjTotal] = get("WWIT"); + xWell[Ix::GasInjTotal] = get("WGIT"); + xWell[Ix::HistWatInjTotal] = get("WWITH"); + xWell[Ix::HistGasInjTotal] = get("WGITH"); + } } template @@ -673,19 +701,14 @@ namespace { return smry.has(key) ? smry.get(key) : 0.0; }; - // Injection rates reported as negative, cumulative - // totals as positive. + assignCommonInjector(get, ecl_compatible_rst, xWell); + + // Injection rates reported as negative. xWell[Ix::WatPrRate] = -get("WWIR"); xWell[Ix::LiqPrRate] = xWell[Ix::WatPrRate]; - xWell[Ix::FlowBHP] = get("WBHP"); - - if (ecl_compatible_rst) { - xWell[Ix::WatInjTotal] = get("WWIT"); - } - + // Not fully characterised. xWell[Ix::item37] = xWell[Ix::WatPrRate]; - xWell[Ix::item82] = xWell[Ix::WatInjTotal]; xWell[Ix::WatVoidPrRate] = -get("WWVIR"); } @@ -705,17 +728,12 @@ namespace { return smry.has(key) ? smry.get(key) : 0.0; }; - // Injection rates reported as negative production rates, - // cumulative injection totals as positive. + assignCommonInjector(get, ecl_compatible_rst, xWell); + + // Injection rates reported as negative production rates. xWell[Ix::GasPrRate] = -get("WGIR"); xWell[Ix::VoidPrRate] = -get("WGVIR"); - xWell[Ix::FlowBHP] = get("WBHP"); - - if (ecl_compatible_rst) { - xWell[Ix::GasInjTotal] = get("WGIT"); - } - xWell[Ix::GasFVF] = (std::abs(xWell[Ix::GasPrRate]) > 0.0) ? xWell[Ix::VoidPrRate] / xWell[Ix::GasPrRate] : 0.0; @@ -724,7 +742,6 @@ namespace { // Not fully characterised. xWell[Ix::item38] = xWell[Ix::GasPrRate]; - xWell[Ix::item83] = xWell[Ix::GasInjTotal]; xWell[Ix::GasVoidPrRate] = xWell[Ix::VoidPrRate]; } diff --git a/src/opm/output/eclipse/LoadRestart.cpp b/src/opm/output/eclipse/LoadRestart.cpp index 92da30c2d..07e5d35ae 100644 --- a/src/opm/output/eclipse/LoadRestart.cpp +++ b/src/opm/output/eclipse/LoadRestart.cpp @@ -1088,6 +1088,13 @@ namespace { smry.add(key("WWIT"), xwel[VI::XWell::index::WatInjTotal]); smry.add(key("WGIT"), xwel[VI::XWell::index::GasInjTotal]); + + smry.add(key("WOPTH"), xwel[VI::XWell::index::HistOilPrTotal]); + smry.add(key("WWPTH"), xwel[VI::XWell::index::HistWatPrTotal]); + smry.add(key("WGPTH"), xwel[VI::XWell::index::HistGasPrTotal]); + + smry.add(key("WWITH"), xwel[VI::XWell::index::HistWatInjTotal]); + smry.add(key("WGITH"), xwel[VI::XWell::index::HistGasInjTotal]); } void assign_group_cumulatives(const std::string& group, @@ -1118,6 +1125,12 @@ namespace { smry.add(key("WIT"), xgrp[VI::XGroup::index::WatInjTotal]); smry.add(key("GIT"), xgrp[VI::XGroup::index::GasInjTotal]); + + smry.add(key("OPTH"), xgrp[VI::XGroup::index::HistOilPrTotal]); + smry.add(key("WPTH"), xgrp[VI::XGroup::index::HistWatPrTotal]); + smry.add(key("GPTH"), xgrp[VI::XGroup::index::HistGasPrTotal]); + smry.add(key("WITH"), xgrp[VI::XGroup::index::HistWatInjTotal]); + smry.add(key("GITH"), xgrp[VI::XGroup::index::HistGasInjTotal]); } Opm::SummaryState diff --git a/src/opm/output/eclipse/Summary.cpp b/src/opm/output/eclipse/Summary.cpp index 0b70db34f..1ef8d5abe 100644 --- a/src/opm/output/eclipse/Summary.cpp +++ b/src/opm/output/eclipse/Summary.cpp @@ -65,6 +65,8 @@ namespace { "WIR", "GIR", "WIT", "GIT", "WCT", "GOR", + "OPTH", "WPTH", "GPTH", + "WITH", "GITH", }; } diff --git a/tests/test_AggregateWellData.cpp b/tests/test_AggregateWellData.cpp index 51c1062fd..3bc0d498a 100644 --- a/tests/test_AggregateWellData.cpp +++ b/tests/test_AggregateWellData.cpp @@ -1,4 +1,5 @@ /* + Copyright 2019 Equinor Copyright 2018 Statoil ASA This file is part of the Open Porous Media project (OPM). @@ -232,6 +233,11 @@ TSTEP -- 8 state.add("WWCT:OP_1" , 0.625); state.add("WGOR:OP_1" , 234.5); state.add("WBHP:OP_1" , 314.15); + state.add("WOPTH:OP_1", 345.6); + state.add("WWPTH:OP_1", 456.7); + state.add("WGPTH:OP_1", 567.8); + state.add("WWITH:OP_1", 0.0); + state.add("WGITH:OP_1", 0.0); state.add("WGVIR:OP_1", 0.0); state.add("WWVIR:OP_1", 0.0); @@ -250,6 +256,11 @@ TSTEP -- 8 state.add("WWCT:OP_2" , 0.0); state.add("WGOR:OP_2" , 0.0); state.add("WBHP:OP_2" , 400.6); + state.add("WOPTH:OP_2", 0.0); + state.add("WWPTH:OP_2", 0.0); + state.add("WGPTH:OP_2", 0.0); + state.add("WWITH:OP_2", 1515.0); + state.add("WGITH:OP_2", 3030.0); state.add("WGVIR:OP_2", 1234.0); state.add("WWVIR:OP_2", 4321.0); @@ -268,6 +279,11 @@ TSTEP -- 8 state.add("WWCT:OP_3" , 0.0625); state.add("WGOR:OP_3" , 1234.5); state.add("WBHP:OP_3" , 314.15); + state.add("WOPTH:OP_3", 2345.6); + state.add("WWPTH:OP_3", 3456.7); + state.add("WGPTH:OP_3", 4567.8); + state.add("WWITH:OP_3", 0.0); + state.add("WGITH:OP_3", 0.0); state.add("WGVIR:OP_3", 0.0); state.add("WWVIR:OP_3", 43.21); @@ -561,17 +577,27 @@ BOOST_AUTO_TEST_CASE (Dynamic_Well_Data_Step1) BOOST_CHECK_CLOSE(xwell[i0 + Ix::LiqPrRate], 1.0 + 2.0, 1.0e-10); BOOST_CHECK_CLOSE(xwell[i0 + Ix::VoidPrRate], 4.0, 1.0e-10); - BOOST_CHECK_CLOSE(xwell[i0 + Ix::FlowBHP], 314.15, 1.0e-10); - BOOST_CHECK_CLOSE(xwell[i0 + Ix::WatCut] , 0.625, 1.0e-10); - BOOST_CHECK_CLOSE(xwell[i0 + Ix::GORatio], 234.5, 1.0e-10); + BOOST_CHECK_CLOSE(xwell[i0 + Ix::FlowBHP], 314.15 , 1.0e-10); + BOOST_CHECK_CLOSE(xwell[i0 + Ix::WatCut] , 0.625, 1.0e-10); + BOOST_CHECK_CLOSE(xwell[i0 + Ix::GORatio], 234.5 , 1.0e-10); BOOST_CHECK_CLOSE(xwell[i0 + Ix::OilPrTotal], 10.0, 1.0e-10); BOOST_CHECK_CLOSE(xwell[i0 + Ix::WatPrTotal], 20.0, 1.0e-10); BOOST_CHECK_CLOSE(xwell[i0 + Ix::GasPrTotal], 30.0, 1.0e-10); BOOST_CHECK_CLOSE(xwell[i0 + Ix::VoidPrTotal], 40.0, 1.0e-10); - BOOST_CHECK_CLOSE(xwell[i0 + Ix::item37], xwell[i0 + Ix::WatPrRate], 1.0e-10); - BOOST_CHECK_CLOSE(xwell[i0 + Ix::item38], xwell[i0 + Ix::GasPrRate], 1.0e-10); + BOOST_CHECK_CLOSE(xwell[i0 + Ix::item37], + xwell[i0 + Ix::WatPrRate], 1.0e-10); + + BOOST_CHECK_CLOSE(xwell[i0 + Ix::item38], + xwell[i0 + Ix::GasPrRate], 1.0e-10); + + BOOST_CHECK_CLOSE(xwell[i0 + Ix::HistOilPrTotal], 345.6, 1.0e-10); + BOOST_CHECK_CLOSE(xwell[i0 + Ix::HistWatPrTotal], 456.7, 1.0e-10); + BOOST_CHECK_CLOSE(xwell[i0 + Ix::HistGasPrTotal], 567.8, 1.0e-10); + + BOOST_CHECK_CLOSE(xwell[i0 + Ix::HistWatInjTotal], 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(xwell[i0 + Ix::HistGasInjTotal], 0.0, 1.0e-10); } // XWEL (OP_2) @@ -585,6 +611,7 @@ BOOST_AUTO_TEST_CASE (Dynamic_Well_Data_Step1) BOOST_CHECK_CLOSE(xwell[i1 + Ix::VoidPrRate], -1234.0, 1.0e-10); BOOST_CHECK_CLOSE(xwell[i1 + Ix::FlowBHP], 400.6, 1.0e-10); + BOOST_CHECK_CLOSE(xwell[i1 + Ix::WatInjTotal], 1000.0, 1.0e-10); BOOST_CHECK_CLOSE(xwell[i1 + Ix::GasInjTotal], 2000.0, 1.0e-10); // Bg = VGIR / GIR = 1234.0 / 200.0 @@ -593,11 +620,11 @@ BOOST_AUTO_TEST_CASE (Dynamic_Well_Data_Step1) BOOST_CHECK_CLOSE(xwell[i1 + Ix::item38], xwell[i1 + Ix::GasPrRate], 1.0e-10); - BOOST_CHECK_CLOSE(xwell[i1 + Ix::item83], - xwell[i1 + Ix::GasInjTotal], 1.0e-10); - - BOOST_CHECK_CLOSE(xwell[i1 + Ix::GasVoidPrRate], - xwell[i1 + Ix::VoidPrRate], 1.0e-10); + BOOST_CHECK_CLOSE(xwell[i1 + Ix::HistOilPrTotal] , 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(xwell[i1 + Ix::HistWatPrTotal] , 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(xwell[i1 + Ix::HistGasPrTotal] , 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(xwell[i1 + Ix::HistWatInjTotal], 1515.0, 1.0e-10); + BOOST_CHECK_CLOSE(xwell[i1 + Ix::HistGasInjTotal], 3030.0, 1.0e-10); } } @@ -672,6 +699,10 @@ BOOST_AUTO_TEST_CASE (Dynamic_Well_Data_Step2) BOOST_CHECK_CLOSE(xwell[i0 + Ix::item38], xwell[i0 + Ix::GasPrRate], 1.0e-10); + + BOOST_CHECK_CLOSE(xwell[i0 + Ix::HistOilPrTotal], 345.6, 1.0e-10); + BOOST_CHECK_CLOSE(xwell[i0 + Ix::HistWatPrTotal], 456.7, 1.0e-10); + BOOST_CHECK_CLOSE(xwell[i0 + Ix::HistGasPrTotal], 567.8, 1.0e-10); } // XWEL (OP_2) -- water injector @@ -690,14 +721,17 @@ BOOST_AUTO_TEST_CASE (Dynamic_Well_Data_Step2) BOOST_CHECK_CLOSE(xwell[i1 + Ix::FlowBHP], 400.6, 1.0e-10); BOOST_CHECK_CLOSE(xwell[i1 + Ix::WatInjTotal], 1000.0, 1.0e-10); + BOOST_CHECK_CLOSE(xwell[i1 + Ix::GasInjTotal], 2000.0, 1.0e-10); // Copy of WWIR BOOST_CHECK_CLOSE(xwell[i1 + Ix::item37], xwell[i1 + Ix::WatPrRate], 1.0e-10); - // Copy of WWIT - BOOST_CHECK_CLOSE(xwell[i1 + Ix::item82], - xwell[i1 + Ix::WatInjTotal], 1.0e-10); + BOOST_CHECK_CLOSE(xwell[i1 + Ix::HistOilPrTotal] , 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(xwell[i1 + Ix::HistWatPrTotal] , 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(xwell[i1 + Ix::HistGasPrTotal] , 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(xwell[i1 + Ix::HistWatInjTotal], 1515.0, 1.0e-10); + BOOST_CHECK_CLOSE(xwell[i1 + Ix::HistGasInjTotal], 3030.0, 1.0e-10); // WWVIR BOOST_CHECK_CLOSE(xwell[i1 + Ix::WatVoidPrRate], @@ -733,6 +767,10 @@ BOOST_AUTO_TEST_CASE (Dynamic_Well_Data_Step2) // Copy of WGPR BOOST_CHECK_CLOSE(xwell[i2 + Ix::item38], xwell[i2 + Ix::GasPrRate], 1.0e-10); + + BOOST_CHECK_CLOSE(xwell[i2 + Ix::HistOilPrTotal], 2345.6, 1.0e-10); + BOOST_CHECK_CLOSE(xwell[i2 + Ix::HistWatPrTotal], 3456.7, 1.0e-10); + BOOST_CHECK_CLOSE(xwell[i2 + Ix::HistGasPrTotal], 4567.8, 1.0e-10); } } diff --git a/tests/test_Restart.cpp b/tests/test_Restart.cpp index 0fb26a47d..8c3edaedb 100644 --- a/tests/test_Restart.cpp +++ b/tests/test_Restart.cpp @@ -366,6 +366,11 @@ Opm::SummaryState sim_state() state.add("WWCT:OP_1" , 0.625); state.add("WGOR:OP_1" , 234.5); state.add("WBHP:OP_1" , 314.15); + state.add("WOPTH:OP_1", 345.6); + state.add("WWPTH:OP_1", 456.7); + state.add("WGPTH:OP_1", 567.8); + state.add("WWITH:OP_1", 0.0); + state.add("WGITH:OP_1", 0.0); state.add("WGVIR:OP_1", 0.0); state.add("WWVIR:OP_1", 0.0); @@ -384,6 +389,11 @@ Opm::SummaryState sim_state() state.add("WWCT:OP_2" , 0.0); state.add("WGOR:OP_2" , 0.0); state.add("WBHP:OP_2" , 400.6); + state.add("WOPTH:OP_2", 0.0); + state.add("WWPTH:OP_2", 0.0); + state.add("WGPTH:OP_2", 0.0); + state.add("WWITH:OP_2", 1515.0); + state.add("WGITH:OP_2", 3030.0); state.add("WGVIR:OP_2", 1234.0); state.add("WWVIR:OP_2", 4321.0); @@ -402,6 +412,11 @@ Opm::SummaryState sim_state() state.add("WWCT:OP_3" , 0.0625); state.add("WGOR:OP_3" , 1234.5); state.add("WBHP:OP_3" , 314.15); + state.add("WOPTH:OP_3", 2345.6); + state.add("WWPTH:OP_3", 3456.7); + state.add("WGPTH:OP_3", 4567.8); + state.add("WWITH:OP_3", 0.0); + state.add("WGITH:OP_3", 0.0); state.add("WGVIR:OP_3", 0.0); state.add("WWVIR:OP_3", 43.21); @@ -419,6 +434,13 @@ Opm::SummaryState sim_state() state.add("GGIT:OP" , 27182.8); state.add("GWCT:OP" , 0.625); state.add("GGOR:OP" , 1234.5); + state.add("GGVIR:OP", 123.45); + state.add("GWVIR:OP", 1234.56); + state.add("GOPTH:OP", 5678.90); + state.add("GWPTH:OP", 6789.01); + state.add("GGPTH:OP", 7890.12); + state.add("GWITH:OP", 8901.23); + state.add("GGITH:OP", 9012.34); state.add("FOPR" , 1100.0); state.add("FWPR" , 1200.0); @@ -433,7 +455,14 @@ Opm::SummaryState sim_state() state.add("FWIT" , 314159.2); state.add("FGIT" , 271828.1); state.add("FWCT" , 0.625); - state.add("FGOR" , 1234.5); + state.add("FGOR" , 1234.5); + state.add("FOPTH", 56789.01); + state.add("FWPTH", 67890.12); + state.add("FGPTH", 78901.23); + state.add("FWITH", 89012.34); + state.add("FGITH", 90123.45); + state.add("FGVIR", 1234.56); + state.add("FWVIR", 12345.67); return state; } @@ -835,13 +864,18 @@ BOOST_AUTO_TEST_CASE(Restore_Cumulatives) // Verify that the restored summary state has all of its requisite // cumulative summary vectors. - // Producer => W*IT saved/restored as zero (0.0) + // Producer => W*IT{,H} saved/restored as zero (0.0) BOOST_CHECK(rstSumState.has("WOPT:OP_1")); BOOST_CHECK(rstSumState.has("WGPT:OP_1")); BOOST_CHECK(rstSumState.has("WWPT:OP_1")); BOOST_CHECK(rstSumState.has("WVPT:OP_1")); BOOST_CHECK(rstSumState.has("WWIT:OP_1")); BOOST_CHECK(rstSumState.has("WGIT:OP_1")); + BOOST_CHECK(rstSumState.has("WOPTH:OP_1")); + BOOST_CHECK(rstSumState.has("WGPTH:OP_1")); + BOOST_CHECK(rstSumState.has("WWPTH:OP_1")); + BOOST_CHECK(rstSumState.has("WWITH:OP_1")); + BOOST_CHECK(rstSumState.has("WGITH:OP_1")); BOOST_CHECK_CLOSE(rstSumState.get("WOPT:OP_1"), 10.0, 1.0e-10); BOOST_CHECK_CLOSE(rstSumState.get("WGPT:OP_1"), 30.0, 1.0e-10); @@ -849,21 +883,36 @@ BOOST_AUTO_TEST_CASE(Restore_Cumulatives) BOOST_CHECK_CLOSE(rstSumState.get("WVPT:OP_1"), 40.0, 1.0e-10); BOOST_CHECK_CLOSE(rstSumState.get("WWIT:OP_1"), 0.0, 1.0e-10); BOOST_CHECK_CLOSE(rstSumState.get("WGIT:OP_1"), 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(rstSumState.get("WOPTH:OP_1"), 345.6, 1.0e-10); + BOOST_CHECK_CLOSE(rstSumState.get("WWPTH:OP_1"), 456.7, 1.0e-10); + BOOST_CHECK_CLOSE(rstSumState.get("WGPTH:OP_1"), 567.8, 1.0e-10); + BOOST_CHECK_CLOSE(rstSumState.get("WWITH:OP_1"), 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(rstSumState.get("WGITH:OP_1"), 0.0, 1.0e-10); - // Gas injector => W*PT and WWIT saved/restored as zero (0.0) + // Gas injector => W*PT{,H} saved/restored as zero (0.0) BOOST_CHECK(rstSumState.has("WOPT:OP_2")); BOOST_CHECK(rstSumState.has("WGPT:OP_2")); BOOST_CHECK(rstSumState.has("WWPT:OP_2")); BOOST_CHECK(rstSumState.has("WVPT:OP_2")); BOOST_CHECK(rstSumState.has("WWIT:OP_2")); BOOST_CHECK(rstSumState.has("WGIT:OP_2")); + BOOST_CHECK(rstSumState.has("WOPTH:OP_2")); + BOOST_CHECK(rstSumState.has("WGPTH:OP_2")); + BOOST_CHECK(rstSumState.has("WWPTH:OP_2")); + BOOST_CHECK(rstSumState.has("WWITH:OP_2")); + BOOST_CHECK(rstSumState.has("WGITH:OP_2")); BOOST_CHECK_CLOSE(rstSumState.get("WOPT:OP_2"), 0.0, 1.0e-10); BOOST_CHECK_CLOSE(rstSumState.get("WGPT:OP_2"), 0.0, 1.0e-10); BOOST_CHECK_CLOSE(rstSumState.get("WWPT:OP_2"), 0.0, 1.0e-10); BOOST_CHECK_CLOSE(rstSumState.get("WVPT:OP_2"), 0.0, 1.0e-10); - BOOST_CHECK_CLOSE(rstSumState.get("WWIT:OP_2"), 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(rstSumState.get("WWIT:OP_2"), 1000.0, 1.0e-10); BOOST_CHECK_CLOSE(rstSumState.get("WGIT:OP_2"), 2000.0, 1.0e-10); + BOOST_CHECK_CLOSE(rstSumState.get("WOPTH:OP_2"), 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(rstSumState.get("WGPTH:OP_2"), 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(rstSumState.get("WWPTH:OP_2"), 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(rstSumState.get("WWITH:OP_2"), 1515.0, 1.0e-10); + BOOST_CHECK_CLOSE(rstSumState.get("WGITH:OP_2"), 3030.0, 1.0e-10); // Group cumulatives saved/restored for all phases BOOST_CHECK(rstSumState.has("GOPT:OP")); @@ -872,6 +921,11 @@ BOOST_AUTO_TEST_CASE(Restore_Cumulatives) BOOST_CHECK(rstSumState.has("GVPT:OP")); BOOST_CHECK(rstSumState.has("GWIT:OP")); BOOST_CHECK(rstSumState.has("GGIT:OP")); + BOOST_CHECK(rstSumState.has("GOPTH:OP")); + BOOST_CHECK(rstSumState.has("GGPTH:OP")); + BOOST_CHECK(rstSumState.has("GWPTH:OP")); + BOOST_CHECK(rstSumState.has("GWITH:OP")); + BOOST_CHECK(rstSumState.has("GGITH:OP")); BOOST_CHECK_CLOSE(rstSumState.get("GOPT:OP"), 1100.0, 1.0e-10); BOOST_CHECK_CLOSE(rstSumState.get("GWPT:OP"), 1200.0, 1.0e-10); @@ -880,6 +934,12 @@ BOOST_AUTO_TEST_CASE(Restore_Cumulatives) BOOST_CHECK_CLOSE(rstSumState.get("GWIT:OP"), 31415.9, 1.0e-10); BOOST_CHECK_CLOSE(rstSumState.get("GGIT:OP"), 27182.8, 1.0e-10); + BOOST_CHECK_CLOSE(rstSumState.get("GOPTH:OP"), 5678.90, 1.0e-10); + BOOST_CHECK_CLOSE(rstSumState.get("GGPTH:OP"), 7890.12, 1.0e-10); + BOOST_CHECK_CLOSE(rstSumState.get("GWPTH:OP"), 6789.01, 1.0e-10); + BOOST_CHECK_CLOSE(rstSumState.get("GWITH:OP"), 8901.23, 1.0e-10); + BOOST_CHECK_CLOSE(rstSumState.get("GGITH:OP"), 9012.34, 1.0e-10); + // Field cumulatives saved/restored for all phases BOOST_CHECK(rstSumState.has("FOPT")); BOOST_CHECK(rstSumState.has("FGPT")); @@ -887,6 +947,11 @@ BOOST_AUTO_TEST_CASE(Restore_Cumulatives) BOOST_CHECK(rstSumState.has("FVPT")); BOOST_CHECK(rstSumState.has("FWIT")); BOOST_CHECK(rstSumState.has("FGIT")); + BOOST_CHECK(rstSumState.has("FOPTH")); + BOOST_CHECK(rstSumState.has("FGPTH")); + BOOST_CHECK(rstSumState.has("FWPTH")); + BOOST_CHECK(rstSumState.has("FWITH")); + BOOST_CHECK(rstSumState.has("FGITH")); BOOST_CHECK_CLOSE(rstSumState.get("FOPT"), 11000.0, 1.0e-10); BOOST_CHECK_CLOSE(rstSumState.get("FWPT"), 12000.0, 1.0e-10); @@ -894,6 +959,12 @@ BOOST_AUTO_TEST_CASE(Restore_Cumulatives) BOOST_CHECK_CLOSE(rstSumState.get("FVPT"), 14000.0, 1.0e-10); BOOST_CHECK_CLOSE(rstSumState.get("FWIT"), 314159.2, 1.0e-10); BOOST_CHECK_CLOSE(rstSumState.get("FGIT"), 271828.1, 1.0e-10); + + BOOST_CHECK_CLOSE(rstSumState.get("FOPTH"), 56789.01, 1.0e-10); + BOOST_CHECK_CLOSE(rstSumState.get("FGPTH"), 78901.23, 1.0e-10); + BOOST_CHECK_CLOSE(rstSumState.get("FWPTH"), 67890.12, 1.0e-10); + BOOST_CHECK_CLOSE(rstSumState.get("FWITH"), 89012.34, 1.0e-10); + BOOST_CHECK_CLOSE(rstSumState.get("FGITH"), 90123.45, 1.0e-10); } diff --git a/tests/test_Summary.cpp b/tests/test_Summary.cpp index 53ea476b6..cd5ccdd0a 100644 --- a/tests/test_Summary.cpp +++ b/tests/test_Summary.cpp @@ -2921,6 +2921,13 @@ BOOST_AUTO_TEST_CASE(Reset) rstrt.add("WWIT:W_1", 5.0); rstrt.add("WGIT:W_1", 6.0); + rstrt.add("WOPTH:W_1", 0.1); + rstrt.add("WWPTH:W_1", 0.2); + rstrt.add("WGPTH:W_1", 0.3); + + rstrt.add("WWITH:W_1", 0.5); + rstrt.add("WGITH:W_1", 0.6); + rstrt.add("GOPT:NoSuchGroup", 1.0); rstrt.add("GWPT:NoSuchGroup", 2.0); rstrt.add("GGPT:NoSuchGroup", 3.0); @@ -2937,6 +2944,13 @@ BOOST_AUTO_TEST_CASE(Reset) rstrt.add("FWIT", 50.0); rstrt.add("FGIT", 60.0); + rstrt.add("FOPTH", 0.01); + rstrt.add("FWPTH", 0.02); + rstrt.add("FGPTH", 0.03); + + rstrt.add("FWITH", 0.05); + rstrt.add("FGITH", 0.06); + smry.reset_cumulative_quantities(rstrt); const auto& sumstate = smry.get_restart_vectors(); @@ -2969,6 +2983,13 @@ BOOST_AUTO_TEST_CASE(Reset) BOOST_CHECK_CLOSE(sumstate.get("WWIT:W_1"), 5.0, 1.0e-10); BOOST_CHECK_CLOSE(sumstate.get("WGIT:W_1"), 6.0, 1.0e-10); + BOOST_CHECK_CLOSE(sumstate.get("WOPTH:W_1"), 0.1, 1.0e-10); + BOOST_CHECK_CLOSE(sumstate.get("WWPTH:W_1"), 0.2, 1.0e-10); + BOOST_CHECK_CLOSE(sumstate.get("WGPTH:W_1"), 0.3, 1.0e-10); + + BOOST_CHECK_CLOSE(sumstate.get("WWITH:W_1"), 0.5, 1.0e-10); + BOOST_CHECK_CLOSE(sumstate.get("WGITH:W_1"), 0.6, 1.0e-10); + // Cumulatives unset for W_2. BOOST_CHECK_CLOSE(sumstate.get("WOPT:W_2"), 0.0, 1.0e-10); BOOST_CHECK_CLOSE(sumstate.get("WWPT:W_2"), 0.0, 1.0e-10); @@ -2978,6 +2999,13 @@ BOOST_AUTO_TEST_CASE(Reset) BOOST_CHECK_CLOSE(sumstate.get("WWIT:W_2"), 0.0, 1.0e-10); BOOST_CHECK_CLOSE(sumstate.get("WGIT:W_2"), 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(sumstate.get("WOPTH:W_2"), 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(sumstate.get("WWPTH:W_2"), 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(sumstate.get("WGPTH:W_2"), 0.0, 1.0e-10); + + BOOST_CHECK_CLOSE(sumstate.get("WWITH:W_2"), 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(sumstate.get("WGITH:W_2"), 0.0, 1.0e-10); + // Cumulatives unset for W_3. BOOST_CHECK_CLOSE(sumstate.get("WOPT:W_3"), 0.0, 1.0e-10); BOOST_CHECK_CLOSE(sumstate.get("WWPT:W_3"), 0.0, 1.0e-10); @@ -2987,6 +3015,13 @@ BOOST_AUTO_TEST_CASE(Reset) BOOST_CHECK_CLOSE(sumstate.get("WWIT:W_3"), 0.0, 1.0e-10); BOOST_CHECK_CLOSE(sumstate.get("WGIT:W_3"), 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(sumstate.get("WOPTH:W_3"), 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(sumstate.get("WWPTH:W_3"), 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(sumstate.get("WGPTH:W_3"), 0.0, 1.0e-10); + + BOOST_CHECK_CLOSE(sumstate.get("WWITH:W_3"), 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(sumstate.get("WGITH:W_3"), 0.0, 1.0e-10); + // Cumulatives unset for G_1. BOOST_CHECK_CLOSE(sumstate.get("GOPT:G_1"), 0.0, 1.0e-10); BOOST_CHECK_CLOSE(sumstate.get("GWPT:G_1"), 0.0, 1.0e-10); @@ -2996,6 +3031,13 @@ BOOST_AUTO_TEST_CASE(Reset) BOOST_CHECK_CLOSE(sumstate.get("GWIT:G_1"), 0.0, 1.0e-10); BOOST_CHECK_CLOSE(sumstate.get("GGIT:G_1"), 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(sumstate.get("GOPTH:G_1"), 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(sumstate.get("GWPTH:G_1"), 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(sumstate.get("GGPTH:G_1"), 0.0, 1.0e-10); + + BOOST_CHECK_CLOSE(sumstate.get("GWITH:G_1"), 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(sumstate.get("GGITH:G_1"), 0.0, 1.0e-10); + // Cumulatives unset for G_2. BOOST_CHECK_CLOSE(sumstate.get("GOPT:G_2"), 0.0, 1.0e-10); BOOST_CHECK_CLOSE(sumstate.get("GWPT:G_2"), 0.0, 1.0e-10); @@ -3005,6 +3047,13 @@ BOOST_AUTO_TEST_CASE(Reset) BOOST_CHECK_CLOSE(sumstate.get("GWIT:G_2"), 0.0, 1.0e-10); BOOST_CHECK_CLOSE(sumstate.get("GGIT:G_2"), 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(sumstate.get("GOPTH:G_2"), 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(sumstate.get("GWPTH:G_2"), 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(sumstate.get("GGPTH:G_2"), 0.0, 1.0e-10); + + BOOST_CHECK_CLOSE(sumstate.get("GWITH:G_2"), 0.0, 1.0e-10); + BOOST_CHECK_CLOSE(sumstate.get("GGITH:G_2"), 0.0, 1.0e-10); + // Cumulatives reset for FIELD. BOOST_CHECK_CLOSE(sumstate.get("FOPT"), 10.0, 1.0e-10); BOOST_CHECK_CLOSE(sumstate.get("FWPT"), 20.0, 1.0e-10); @@ -3013,6 +3062,13 @@ BOOST_AUTO_TEST_CASE(Reset) BOOST_CHECK_CLOSE(sumstate.get("FWIT"), 50.0, 1.0e-10); BOOST_CHECK_CLOSE(sumstate.get("FGIT"), 60.0, 1.0e-10); + + BOOST_CHECK_CLOSE(sumstate.get("FOPTH"), 0.01, 1.0e-10); + BOOST_CHECK_CLOSE(sumstate.get("FWPTH"), 0.02, 1.0e-10); + BOOST_CHECK_CLOSE(sumstate.get("FGPTH"), 0.03, 1.0e-10); + + BOOST_CHECK_CLOSE(sumstate.get("FWITH"), 0.05, 1.0e-10); + BOOST_CHECK_CLOSE(sumstate.get("FGITH"), 0.06, 1.0e-10); } BOOST_AUTO_TEST_SUITE_END()