diff --git a/src/opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.cpp b/src/opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.cpp index 1a4dce6ab..d2f55e4f8 100644 --- a/src/opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.cpp +++ b/src/opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.cpp @@ -381,6 +381,26 @@ inline std::array< int, 3 > getijk( const Connection& completion ) { } } + bool isKnownSegmentKeyword(const DeckKeyword& keyword) + { + const auto& kw = keyword.name(); + + if (kw.size() > 4) { + // Easy check first--handles SUMMARY and SUMTHIN &c. + return false; + } + + const auto kw_whitelist = std::vector { + "SOFR", "SGFR", "SWFR", "SPR", + }; + + return std::any_of(kw_whitelist.begin(), kw_whitelist.end(), + [&kw](const char* known) -> bool + { + return kw == known; + }); + } + bool isMultiSegmentWell(const std::size_t last_timestep, const Well* well) { @@ -546,8 +566,9 @@ inline std::array< int, 3 > getijk( const Connection& completion ) { // SGFR // / -- All segments in all MS wells at all times. - if (keyword.name() == "SUMMARY") { - // The SUMMARY keyword itself invokes keywordS(). Ignore it. + if (! isKnownSegmentKeyword(keyword)) { + // Ignore keywords that have not been explicitly white-listed + // for treatment as segment summary vectors. return; } diff --git a/tests/SOFR_TEST.DATA b/tests/SOFR_TEST.DATA index 25d199644..3f56ba903 100644 --- a/tests/SOFR_TEST.DATA +++ b/tests/SOFR_TEST.DATA @@ -96,6 +96,12 @@ SUMMARY -- ALL +-- SUMTHIN is here to verify that the explicit keyword white-listing +-- in SummaryConfig.cpp works correctly. We should not treat SUMTHIN +-- as a segment-related summary vector. +SUMTHIN + 1 / + SOFR 'PROD01' 1 / 'PROD01' 10 /