Skip to content

Commit a18fca9

Browse files
committed
Populate Region Variable Mapping From Summary Config
This commit adds a special purpose helper function, populateRegVarMapping() that, based on the run's configured summary vectors, populates an object of type data::RegionVariableMapping. In this initial implementation, we define a variable named ConnOPT if any of the *OEW* summary vectors are configured in the run's SUMMARY section. Those OEW vectors require tracking the per-region cumulative oil production from wells and it's easier to have a dedicated variable for this than to introduce extra "COPT" summary vectors that are visible to the user through the result set's summary files (e.g., .SMSPEC and .UNSMRY).
1 parent 1093c0f commit a18fca9

3 files changed

Lines changed: 102 additions & 0 deletions

File tree

CMakeLists_files.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ list(APPEND MAIN_SOURCE_FILES
146146
opm/input/eclipse/EclipseState/SimulationConfig/RockConfig.cpp
147147
opm/input/eclipse/EclipseState/SimulationConfig/SimulationConfig.cpp
148148
opm/input/eclipse/EclipseState/SimulationConfig/ThresholdPressure.cpp
149+
opm/input/eclipse/EclipseState/SummaryConfig/RegionVariableSupport.cpp
149150
opm/input/eclipse/EclipseState/SummaryConfig/SummaryConfig.cpp
150151
opm/input/eclipse/EclipseState/Tables/Aqudims.cpp
151152
opm/input/eclipse/EclipseState/Tables/ColumnSchema.cpp
@@ -1011,6 +1012,7 @@ list(APPEND PUBLIC_HEADER_FILES
10111012
opm/input/eclipse/EclipseState/SimulationConfig/RockConfig.hpp
10121013
opm/input/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp
10131014
opm/input/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp
1015+
opm/input/eclipse/EclipseState/SummaryConfig/RegionVariableSupport.hpp
10141016
opm/input/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp
10151017
opm/input/eclipse/EclipseState/Tables/Aqudims.hpp
10161018
opm/input/eclipse/EclipseState/Tables/AqutabTable.hpp
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
Copyright 2026 Equinor ASA.
3+
4+
This file is part of the Open Porous Media project (OPM).
5+
6+
OPM is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
OPM is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with OPM. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
20+
#include <opm/input/eclipse/EclipseState/SummaryConfig/RegionVariableSupport.hpp>
21+
22+
#include <opm/output/data/RegionVariableMapping.hpp>
23+
24+
#include <opm/input/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
25+
26+
namespace {
27+
void populateOilEfficiencyVariables(const Opm::SummaryConfig& sumcfg,
28+
Opm::data::RegionVariableMapping& regVarMap)
29+
{
30+
// FOEW, ROEW, ROEW_<REG>
31+
const auto oew_kws = sumcfg.keywords(R"(*OEW*)");
32+
33+
if (oew_kws.empty()) {
34+
// No *OEW* vectors requested. Nothing to do.
35+
return;
36+
}
37+
38+
using RegSet = Opm::data::RegionVariableMapping::RegionSet;
39+
40+
regVarMap.add(Opm::data::RegionVariableMapping::Variable { "ConnOPT" },
41+
/* is_cumulative = */ true);
42+
43+
for (const auto& oew_kw : oew_kws) {
44+
if (oew_kw.category() == Opm::SummaryConfigNode::Category::Region) {
45+
regVarMap.add(RegSet { oew_kw.fip_region() });
46+
}
47+
else {
48+
// Not a region level vector. Typically FOEW. Ensure that
49+
// we have FIPNUM for this case.
50+
regVarMap.add(RegSet { "FIPNUM" });
51+
}
52+
}
53+
}
54+
} // Anonymous namespace
55+
56+
// ===========================================================================
57+
// Public interface below separator
58+
// ===========================================================================
59+
60+
void Opm::populateRegVarMapping(const SummaryConfig& sumcfg,
61+
data::RegionVariableMapping& regVarMap)
62+
{
63+
populateOilEfficiencyVariables(sumcfg, regVarMap);
64+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
Copyright 2026 Equinor ASA.
3+
4+
This file is part of the Open Porous Media project (OPM).
5+
6+
OPM is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
OPM is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with OPM. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
20+
#ifndef OPM_REGION_VARIABLE_SUPPORT_HPP
21+
#define OPM_REGION_VARIABLE_SUPPORT_HPP
22+
23+
namespace Opm {
24+
class SummaryConfig;
25+
} // namespace Opm
26+
27+
namespace Opm::data {
28+
class RegionVariableMapping;
29+
} // namespace Opm::data
30+
31+
namespace Opm {
32+
void populateRegVarMapping(const SummaryConfig& sumcfg,
33+
data::RegionVariableMapping& regVarMap);
34+
}
35+
36+
#endif // OPM_REGION_VARIABLE_SUPPORT_HPP

0 commit comments

Comments
 (0)