From 55a7d0af1920c387082d4f1a9923552c2a899085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Thu, 3 Feb 2022 23:08:57 +0100 Subject: [PATCH] Retrieve FIP Arrays of Inter-Region Flows This commit adds a new query SummaryConfig::fip_regions_interreg_flow that retrieves the set of FIP array names (e.g., FIPNUM and FIPXYZ) that are associated to any inter-region flow summary keywords. This query method returns an empty set if there are no inter-region flow summary keywords. --- .../SummaryConfig/SummaryConfig.hpp | 1 + .../SummaryConfig/SummaryConfig.cpp | 16 ++++++ tests/parser/SummaryConfigTests.cpp | 53 ++++++++++++++++++- 3 files changed, 69 insertions(+), 1 deletion(-) diff --git a/opm/input/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp b/opm/input/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp index 29fd1da4a..e4a2b4fa9 100644 --- a/opm/input/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp +++ b/opm/input/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp @@ -198,6 +198,7 @@ namespace Opm { */ bool require3DField( const std::string& keyword) const; std::set fip_regions() const; + std::set fip_regions_interreg_flow() const; std::unordered_set wbp_wells() const; bool operator==(const SummaryConfig& data) const; diff --git a/src/opm/input/eclipse/EclipseState/SummaryConfig/SummaryConfig.cpp b/src/opm/input/eclipse/EclipseState/SummaryConfig/SummaryConfig.cpp index 6b181fd1e..64f899a9e 100644 --- a/src/opm/input/eclipse/EclipseState/SummaryConfig/SummaryConfig.cpp +++ b/src/opm/input/eclipse/EclipseState/SummaryConfig/SummaryConfig.cpp @@ -1808,6 +1808,22 @@ std::set SummaryConfig::fip_regions() const { return reg_set; } +std::set SummaryConfig::fip_regions_interreg_flow() const +{ + using Category = EclIO::SummaryNode::Category; + + auto reg_set = std::set{}; + + for (const auto& node : this->m_keywords) { + if ((node.category() == Category::Region) && + is_region_to_region(node.keyword())) + { + reg_set.insert(node.fip_region()); + } + } + + return reg_set; +} bool SummaryConfig::operator==(const Opm::SummaryConfig& data) const { return this->m_keywords == data.m_keywords && diff --git a/tests/parser/SummaryConfigTests.cpp b/tests/parser/SummaryConfigTests.cpp index cb7a334fe..84d5d26d9 100644 --- a/tests/parser/SummaryConfigTests.cpp +++ b/tests/parser/SummaryConfigTests.cpp @@ -81,7 +81,7 @@ RUNSPEC DIMENS 10 10 10 / REGDIMS - 3/ + 3 3 / AQUDIMS 4 4 1* 1* 3 200 1* 1* / GRID @@ -119,6 +119,8 @@ FIPNUM 200*1 300*2 500*3 / FIPREG 200*10 300*20 500*30 / +FIPXYZ +200*2 300*3 500*1 / SOLUTION AQUCT 1 2040 1* 1000 .3 3.0e-5 1330 10 360.0 1 1* / @@ -1486,6 +1488,55 @@ RHPV_REG BOOST_CHECK(summary_config.hasKeyword("COPT")); } +BOOST_AUTO_TEST_CASE(InterReg_Flows) { + const auto deck_string = std::string { R"( +ROFT +1 2 / +/ + +ROFTGXYZ +1 2 / +/ + +RGFT_XYZ +1 2 / +/ + +RWFR-XYZ +1 3 / +2 3 / +/ + +RGFR+XYZ +1 3 / +2 3 / +/ + +RGFTL +2 3 / +/ +)" }; + + const auto summary_config = createSummary(deck_string); + + BOOST_CHECK_EQUAL(summary_config.size(), 8); + BOOST_CHECK(summary_config.hasKeyword("ROFT")); + BOOST_CHECK(summary_config.hasKeyword("ROFTGXYZ")); + BOOST_CHECK(summary_config.hasKeyword("RGFT_XYZ")); + BOOST_CHECK(summary_config.hasKeyword("RWFR-XYZ")); + BOOST_CHECK(summary_config.hasKeyword("RGFR+XYZ")); + BOOST_CHECK(summary_config.hasKeyword("RGFTL")); + + const auto fip_regions_ireg = summary_config.fip_regions_interreg_flow(); + const auto expect = std::vector { + "FIPNUM", "FIPXYZ", + }; + + BOOST_CHECK_MESSAGE(std::is_permutation(fip_regions_ireg.begin(), fip_regions_ireg.end(), + expect.begin(), expect.end()), + "Inter-regional arrays must match expected set"); +} + BOOST_AUTO_TEST_CASE( WOPRL ) { const std::string input1 = R"( WOPRL