mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Support at Least NTFIP Distinict Regions for Inter-Region Flow
This commit ensures that we have backing support for region IDs up
to and including NTFIP (TABDIMS(5), REGDIMS(1)). The existing setup
would fail (segmentation violation) in the case of a summary vector
of the form
ROFT
36 31 /
/
when the maximum FIPNUM value was 30. We nevertheless support
maximum FIPNUM values exceeding NTFIP.
We add a new optional parameter to the EclInterRegionFlowMap
constructor. The parameter allows client code to specifiy a
"minimum maximum" region ID that all ranks must support. This value
will be enforced during parallel aggregation.
This commit is contained in:
@@ -3382,4 +3382,80 @@ BOOST_AUTO_TEST_CASE(Four_Processes)
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Four_Processes_Declared_MaxID)
|
||||
{
|
||||
using Map = Opm::EclInterRegFlowMap;
|
||||
|
||||
const auto fipnum = all_same_region();
|
||||
const auto fipspl = left_right_split_region();
|
||||
const auto fipchk = checker_board_region();
|
||||
const auto fipsep = all_separate_region();
|
||||
|
||||
auto rank = std::vector<Map>(4, Map {
|
||||
fipnum.size(), {
|
||||
{ "FIPNUM", std::cref(fipnum) },
|
||||
{ "FIPSPL", std::cref(fipspl) },
|
||||
{ "FIPCHK", std::cref(fipchk) },
|
||||
{ "FIPSEP", std::cref(fipsep) },
|
||||
}, 42});
|
||||
|
||||
addConnections(FourProc::P1::isInterior, rank[0]);
|
||||
rank[0].assignGlobalMaxRegionID({3, 2, 50, 4});
|
||||
|
||||
addConnections(FourProc::P2::isInterior, rank[1]);
|
||||
addConnections(FourProc::P3::isInterior, rank[2]);
|
||||
|
||||
addConnections(FourProc::P4::isInterior, rank[3]);
|
||||
rank[3].assignGlobalMaxRegionID({5, 2, 2, 4});
|
||||
|
||||
for (auto& r : rank) {
|
||||
r.compress();
|
||||
}
|
||||
|
||||
auto buffer = makeMessageBuffer();
|
||||
|
||||
rank[1].write(buffer);
|
||||
rank[0].write(buffer);
|
||||
rank[3].write(buffer);
|
||||
rank[2].read(buffer);
|
||||
rank[2].read(buffer);
|
||||
rank[2].read(buffer);
|
||||
|
||||
BOOST_CHECK_MESSAGE(rank[2].readIsConsistent(),
|
||||
"Consistent write() must yield consistent read()");
|
||||
|
||||
BOOST_CHECK_THROW(rank[2].addConnection({ 0, TwoProc::P1::isInterior(0) },
|
||||
{ 1, TwoProc::P1::isInterior(1) }, conn_01()),
|
||||
std::logic_error);
|
||||
|
||||
rank[2].compress();
|
||||
|
||||
const auto iregFlows = rank[2].getInterRegFlows();
|
||||
BOOST_REQUIRE_EQUAL(iregFlows.size(), std::size_t{4});
|
||||
|
||||
// FIPNUM
|
||||
{
|
||||
const auto& map = iregFlows[0];
|
||||
BOOST_CHECK_EQUAL(map.numRegions(), 42);
|
||||
|
||||
for (auto r1 = 0*map.numRegions(); r1 < map.numRegions(); ++r1) {
|
||||
for (auto r2 = r1 + 1; r2 < map.numRegions(); ++r2) {
|
||||
auto flow = map.getInterRegFlows(r1, r2);
|
||||
BOOST_CHECK_MESSAGE(! flow.has_value(),
|
||||
"There must not be inter-regional flow "
|
||||
"between regions " << r1 << " and " << r2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FIPSPL
|
||||
BOOST_CHECK_EQUAL(iregFlows[1].numRegions(), 42);
|
||||
|
||||
// FIPCHK
|
||||
BOOST_CHECK_EQUAL(iregFlows[2].numRegions(), 50);
|
||||
|
||||
// FIPSEP
|
||||
BOOST_CHECK_EQUAL(iregFlows[3].numRegions(), 42);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END() // MultiArray_Wrapper
|
||||
|
||||
Reference in New Issue
Block a user