added unit standard network test in NMetworkTests and removed test in GroupTests

This commit is contained in:
Paul
2023-08-13 14:57:28 +02:00
parent feb9c9c948
commit 83157a01dd
3 changed files with 47 additions and 56 deletions

View File

@@ -813,12 +813,12 @@ File {} line {}.)", wname, location.keyword, location.filename, location.lineno)
if (vfp_table != 0){
// Only non-terminal nodes with non-default vfp table value can be part of the network
is_valid_node = true;
} else {
if(network.has_node(group_name)) {
std::string msg = fmt::format("The group {} is not a terminal node of the network and should have a vfp table assigned to it.", group_name);
throw OpmInputError(msg, handlerContext.keyword.location());
}
}
} else {
if(network.has_node(node.name())) {
std::string msg = fmt::format("The group {} is not a terminal node of the network and should have a vfp table assigned to it.", group_name);
throw OpmInputError(msg, handlerContext.keyword.location());
}
}
}
if (is_valid_node)
nodes.push_back(node);

View File

@@ -179,56 +179,6 @@ WCONPROD
}
BOOST_AUTO_TEST_CASE(createDeckWithGRUPNET) {
const std::string input = R"(
START -- 0
31 AUG 1993 /
SCHEDULE
GRUPTREE
'MANI-B2' 'FIELD' /
'MANI-B1' 'FIELD' /
'MANI-K1' 'FIELD' /
'B1-DUMMY' 'MANI-K1' /
'MANI-D1' 'FIELD' /
'PROD' 'MANI-D1' /
'MANI-D2' 'MANI-D1' /
'MANI-K2' 'MANI-D1' /
'D2-DUMMY' 'MANI-K2' /
'MANI-E1' 'MANI-K2' /
'MANI-E2' 'MANI-K2' /
/
GRUPNET
'FIELD' 20.000 5* /
'PROD' 20.000 5* /
'MANI-B2' 1* 8 1* 'NO' 2* /
'MANI-B1' 1* 8 1* 'NO' 2* /
'MANI-K1' 1* 9999 4* /
'B1-DUMMY' 1* 9999 4* /
'MANI-D1' 1* 8 1* 'NO' 2* /
'MANI-D2' 1* 8 1* 'NO' 2* /
'MANI-K2' 1* 9999 4* /
'D2-DUMMY' 1* 9999 4* /
'MANI-E1' 1* 9 1* 'NO' 2* /
'MANI-E2' 1* 9 4* /
/)";
auto schedule = create_schedule(input);
const auto& group1 = schedule.getGroup("PROD", 0);
const auto& group2 = schedule.getGroup("MANI-E2", 0);
const auto& group3 = schedule.getGroup("MANI-K1", 0);
BOOST_CHECK_EQUAL(group1.getGroupNetVFPTable(), 0);
BOOST_CHECK_EQUAL(group2.getGroupNetVFPTable(), 9);
BOOST_CHECK_EQUAL(group3.getGroupNetVFPTable(), 9999);
}
BOOST_AUTO_TEST_CASE(GroupCreate) {
Opm::Group g1("NAME", 1, 0, UnitSystem::newMETRIC());
Opm::Group g2("NAME", 1, 0, UnitSystem::newMETRIC());

View File

@@ -369,3 +369,44 @@ BRANPROP
BOOST_CHECK_EQUAL_COLLECTIONS(nodes.begin(), nodes.end(), expect.begin(), expect.end());
}
BOOST_AUTO_TEST_CASE(StandardNetwork) {
const std::string input = R"(
SCHEDULE
GRUPTREE
'PROD' 'FIELD' /
'M5S' 'PLAT-A' /
'M5N' 'PLAT-A' /
'C1' 'M5N' /
'F1' 'M5N' /
'B1' 'M5S' /
'G1' 'M5S' /
/
GRUPNET
'PLAT-A' 21.000 5* /
'M5S' 1* 3 1* 'NO' 2* /
'B1' 1* 5 1* 'NO' 2* /
'C1' 1* 4 1* 'NO' 2* /
/)";
auto schedule = make_schedule(input);
const auto& network = schedule[0].network.get();
const auto& b1 = network.node("B1");
const auto upbranch = network.uptree_branch(b1.name());
const auto vfp_table = (*upbranch).vfp_table();
BOOST_CHECK_EQUAL(vfp_table.value(), 5);
BOOST_CHECK(!b1.terminal_pressure());
BOOST_CHECK(!b1.terminal_pressure());
const auto& p = network.node("PLAT-A");
BOOST_CHECK(p.terminal_pressure());
BOOST_CHECK_EQUAL(p.terminal_pressure().value(), 21 * 100000);
BOOST_CHECK(p == network.root());
}