From bf1b2dbef993247d1b89280e862a6315284ec787 Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 27 Jul 2023 14:53:11 +0200 Subject: [PATCH 1/7] fixing unit test --- src/opm/input/eclipse/Schedule/KeywordHandlers.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp b/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp index 5021924bc..acccd2c72 100644 --- a/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp +++ b/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp @@ -795,6 +795,11 @@ File {} line {}.)", wname, location.keyword, location.filename, location.lineno) this->invalidNamePattern(groupNamePattern, handlerContext); const auto& pressure_item = record.getItem(); const int vfp_table = record.getItem().get(0); + // It is assumed here that item 6 (ADD_GAS_LIFT_GAS) has the two options ON and FLO. THe option ALQ is not supported. + // For standard network the summation of ALQ values are weighted with efficiency factors. For extended networks + // this calculation using efficiency factors is the default set by WEFAC item 3 (YES), the value NO is not supported. + // Therefore in opm-simulators (opm/simulators/wells/WellGroupHelpers.cpp) no changes are needed. + const bool add_gas_lift_gas = DeckItem::to_bool(record.getItem().get(0)); for (const auto& group_name : group_names) { const auto& group = this->snapshots.back().groups.get(group_name); @@ -836,8 +841,10 @@ File {} line {}.)", wname, location.keyword, location.filename, location.lineno) } // To use update_node the node should be associated to a branch via add_branch() // so the update of nodes is postponed after creation of branches - for(const auto& node: nodes) + for(const auto& node: nodes) { + node.add_gas_lift_gas(add_gas_lift_gas); network.update_node(node); + } this->snapshots.back().network.update( std::move(network)); } From d1eed2cd4d2f3e00b17792b1c3878efec6bd59f5 Mon Sep 17 00:00:00 2001 From: Paul Date: Sun, 30 Jul 2023 21:00:37 +0200 Subject: [PATCH 2/7] allow for wildcards --- .../eclipse/Schedule/KeywordHandlers.cpp | 45 ++++++++++++++++ tests/parser/GroupTests.cpp | 52 +++++++++++++++++++ 2 files changed, 97 insertions(+) diff --git a/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp b/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp index acccd2c72..b0b0773f9 100644 --- a/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp +++ b/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp @@ -786,6 +786,7 @@ File {} line {}.)", wname, location.keyword, location.filename, location.lineno) } void Schedule::handleGRUPNET(HandlerContext& handlerContext) { +<<<<<<< HEAD auto network = this->snapshots.back().network.get(); std::vector nodes; for (const auto& record : handlerContext.keyword) { @@ -847,6 +848,50 @@ File {} line {}.)", wname, location.keyword, location.filename, location.lineno) } this->snapshots.back().network.update( std::move(network)); } +======= + + auto network = this->snapshots.back().network.get(); + std::vector nodes; + for (const auto& record : handlerContext.keyword) { + const std::string& groupNamePattern = record.getItem().getTrimmedString(0); + const auto group_names = this->groupNames(groupNamePattern); + if (group_names.empty()) + this->invalidNamePattern(groupNamePattern, handlerContext); + const auto& pressure_item = record.getItem(); + const int vfp_table = record.getItem().get(0); + + for (const auto& group_name : group_names) { + auto& group = this->snapshots.back().groups.get(group_name); + group.updateNetVFPTable(vfp_table); + const auto& parent_name = group.parent(); + if (parent_name != "") + { + const std::string& downtree_node = group_name; + const std::string& uptree_node = parent_name; + if (vfp_table == 0 && network.has_node(downtree_node) && network.has_node(uptree_node)) { + network.drop_branch(uptree_node, downtree_node); + } else { + const auto alq_eq = Network::Branch::AlqEqfromString(record.getItem().get(0)); + if (alq_eq == Network::Branch::AlqEQ::ALQ_INPUT) { + double alq_value = record.getItem().get(0); + network.add_branch(Network::Branch(downtree_node, uptree_node, vfp_table, alq_value)); + } else { + network.add_branch(Network::Branch(downtree_node, uptree_node, vfp_table, alq_eq)); + } + } + } + Network::Node node { group_name }; + if (pressure_item.hasValue(0) && (pressure_item.get(0) > 0)) + node.terminal_pressure(pressure_item.getSIDouble(0)); + nodes.push_back(node); + } + } + this->snapshots.back().network.update( network ); + for(const auto& node: nodes) + network.add_node(node); + this->snapshots.back().network.update( std::move( network )); + } +>>>>>>> 0d7cc9b4e (allow for wildcards) void Schedule::handleGRUPTREE(HandlerContext& handlerContext) { for (const auto& record : handlerContext.keyword) { diff --git a/tests/parser/GroupTests.cpp b/tests/parser/GroupTests.cpp index aa59b8036..7d049ef02 100644 --- a/tests/parser/GroupTests.cpp +++ b/tests/parser/GroupTests.cpp @@ -180,6 +180,58 @@ WCONPROD } +<<<<<<< HEAD +======= + + + +BOOST_AUTO_TEST_CASE(createDeckWithGRUPNET) { + std::string input = + "START -- 0 \n" + "31 AUG 1993 / \n" + "SCHEDULE\n" + + "GRUPTREE \n" + " 'MANI-B2' 'FIELD' / \n" + " 'MANI-B1' 'FIELD' / \n" + " 'MANI-K1' 'FIELD' / \n" + " 'B1-DUMMY' 'MANI-K1' / \n" + " 'MANI-D1' 'FIELD' / \n" + " 'PROD' 'MANI-D1' / \n" + " 'MANI-D2' 'MANI-D1' / \n" + " 'MANI-K2' 'MANI-D1' / \n" + " 'D2-DUMMY' 'MANI-K2' / \n" + " 'MANI-E1' 'MANI-K2' / \n" + " 'MANI-E2' 'MANI-K2' / \n" + "/\n" + + "GRUPNET \n" + " 'FIELD' 20.000 5* / \n" + " 'PROD' 20.000 5* / \n" + " 'MANI-B2' 1* 8 1* 'NO' 2* / \n" + " 'MANI-B1' 1* 8 1* 'NO' 2* / \n" + " 'MANI-K1' 1* 9999 4* / \n" + " 'B1-DUMMY' 1* 9999 4* / \n" + " 'MANI-D*' 1* 8 1* 'NO' 2* / \n" + " 'MANI-K2' 1* 9999 4* / \n" + " 'D2-DUMMY' 1* 9999 4* / \n" + " 'MANI-E1' 1* 9 1* 'NO' 2* / \n" + " 'MANI-E2' 1* 9 4* / \n" + "/\n"; + + + 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); +} + + +>>>>>>> 0d7cc9b4e (allow for wildcards) BOOST_AUTO_TEST_CASE(GroupCreate) { Opm::Group g1("NAME", 1, 0, UnitSystem::newMETRIC()); Opm::Group g2("NAME", 1, 0, UnitSystem::newMETRIC()); From f04bbefaee33ada04639aad75f5d86df5ced22e1 Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 3 Aug 2023 10:20:46 +0200 Subject: [PATCH 3/7] add gas-lift to standard network --- src/opm/input/eclipse/Deck/DeckItem.cpp | 3 +++ src/opm/input/eclipse/Schedule/KeywordHandlers.cpp | 9 ++++++++- .../eclipse/share/keywords/000_Eclipse100/G/GRUPNET | 9 ++++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/opm/input/eclipse/Deck/DeckItem.cpp b/src/opm/input/eclipse/Deck/DeckItem.cpp index 9f4af6c1e..5180f4efe 100644 --- a/src/opm/input/eclipse/Deck/DeckItem.cpp +++ b/src/opm/input/eclipse/Deck/DeckItem.cpp @@ -503,6 +503,9 @@ bool DeckItem::to_bool(std::string string_value) { if (string_value == "1") return true; + if (string_value == "FLO") + return true; + if (string_value == "FALSE") return false; diff --git a/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp b/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp index b0b0773f9..66dcd9f2f 100644 --- a/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp +++ b/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp @@ -786,7 +786,6 @@ File {} line {}.)", wname, location.keyword, location.filename, location.lineno) } void Schedule::handleGRUPNET(HandlerContext& handlerContext) { -<<<<<<< HEAD auto network = this->snapshots.back().network.get(); std::vector nodes; for (const auto& record : handlerContext.keyword) { @@ -850,6 +849,8 @@ File {} line {}.)", wname, location.keyword, location.filename, location.lineno) } ======= +======= +>>>>>>> dfdfbda56 (add gas-lift to standard network) auto network = this->snapshots.back().network.get(); std::vector nodes; for (const auto& record : handlerContext.keyword) { @@ -859,6 +860,11 @@ File {} line {}.)", wname, location.keyword, location.filename, location.lineno) this->invalidNamePattern(groupNamePattern, handlerContext); const auto& pressure_item = record.getItem(); const int vfp_table = record.getItem().get(0); + // It is assumed here that item 6 (ADD_GAS_LIFT_GAS) has the two options ON and FLO. THe option ALQ is not supported. + // For standard network the summation of ALQ values are weighted with efficiency factors. For extended networks + // this calculation using efficiency factors is the default set by WEFAC item 3 (YES), the value NO is not supported. + // Therefore in opm-simulators (opm/simulators/wells/WellGroupHelpers.cpp) no changes are needed. + const bool add_gas_lift_gas = DeckItem::to_bool(record.getItem().get(0)); for (const auto& group_name : group_names) { auto& group = this->snapshots.back().groups.get(group_name); @@ -883,6 +889,7 @@ File {} line {}.)", wname, location.keyword, location.filename, location.lineno) Network::Node node { group_name }; if (pressure_item.hasValue(0) && (pressure_item.get(0) > 0)) node.terminal_pressure(pressure_item.getSIDouble(0)); + node.add_gas_lift_gas(add_gas_lift_gas); nodes.push_back(node); } } diff --git a/src/opm/input/eclipse/share/keywords/000_Eclipse100/G/GRUPNET b/src/opm/input/eclipse/share/keywords/000_Eclipse100/G/GRUPNET index 32ca01c02..212748785 100644 --- a/src/opm/input/eclipse/share/keywords/000_Eclipse100/G/GRUPNET +++ b/src/opm/input/eclipse/share/keywords/000_Eclipse100/G/GRUPNET @@ -6,35 +6,42 @@ ], "items": [ { + "item": 1, "name": "NAME", "value_type": "STRING" }, { + "item": 2, "name": "TERMINAL_PRESSURE", "value_type": "DOUBLE", "dimension": "Pressure" }, { + "item": 3, "name": "VFP_TABLE", "value_type": "INT", "default": 0 }, { + "item": 4, "name": "ALQ", "value_type": "DOUBLE", "default": 0 }, { + "item": 5, "name": "SUB_SEA_MANIFOLD", "value_type": "STRING", "default": "NO" }, { - "name": "LIFT_GAS_FLOW_THROUGH", + "item": 6, + "name": "ADD_GAS_LIFT_GAS", "value_type": "STRING", "default": "NO" }, { + "item": 7, "name": "ALQ_SURFACE_DENSITY", "value_type": "STRING", "default": "NONE" From 75e63184740d600a5b2fe63a8dda2898409718e8 Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 24 Aug 2023 13:21:58 +0200 Subject: [PATCH 4/7] rebase --- .../eclipse/Schedule/KeywordHandlers.cpp | 57 +------------------ 1 file changed, 2 insertions(+), 55 deletions(-) diff --git a/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp b/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp index 66dcd9f2f..74391c91f 100644 --- a/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp +++ b/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp @@ -806,6 +806,7 @@ File {} line {}.)", wname, location.keyword, location.filename, location.lineno) const std::string& downtree_node = group_name; const std::string& uptree_node = group.parent(); Network::Node node { group_name }; + node.add_gas_lift_gas(add_gas_lift_gas); // A terminal node is a node with a fixed pressure const bool is_terminal_node = pressure_item.hasValue(0) && (pressure_item.get(0) >= 0); if (is_terminal_node) { @@ -841,64 +842,10 @@ File {} line {}.)", wname, location.keyword, location.filename, location.lineno) } // To use update_node the node should be associated to a branch via add_branch() // so the update of nodes is postponed after creation of branches - for(const auto& node: nodes) { - node.add_gas_lift_gas(add_gas_lift_gas); + for(const auto& node: nodes) network.update_node(node); - } this->snapshots.back().network.update( std::move(network)); } -======= - -======= ->>>>>>> dfdfbda56 (add gas-lift to standard network) - auto network = this->snapshots.back().network.get(); - std::vector nodes; - for (const auto& record : handlerContext.keyword) { - const std::string& groupNamePattern = record.getItem().getTrimmedString(0); - const auto group_names = this->groupNames(groupNamePattern); - if (group_names.empty()) - this->invalidNamePattern(groupNamePattern, handlerContext); - const auto& pressure_item = record.getItem(); - const int vfp_table = record.getItem().get(0); - // It is assumed here that item 6 (ADD_GAS_LIFT_GAS) has the two options ON and FLO. THe option ALQ is not supported. - // For standard network the summation of ALQ values are weighted with efficiency factors. For extended networks - // this calculation using efficiency factors is the default set by WEFAC item 3 (YES), the value NO is not supported. - // Therefore in opm-simulators (opm/simulators/wells/WellGroupHelpers.cpp) no changes are needed. - const bool add_gas_lift_gas = DeckItem::to_bool(record.getItem().get(0)); - - for (const auto& group_name : group_names) { - auto& group = this->snapshots.back().groups.get(group_name); - group.updateNetVFPTable(vfp_table); - const auto& parent_name = group.parent(); - if (parent_name != "") - { - const std::string& downtree_node = group_name; - const std::string& uptree_node = parent_name; - if (vfp_table == 0 && network.has_node(downtree_node) && network.has_node(uptree_node)) { - network.drop_branch(uptree_node, downtree_node); - } else { - const auto alq_eq = Network::Branch::AlqEqfromString(record.getItem().get(0)); - if (alq_eq == Network::Branch::AlqEQ::ALQ_INPUT) { - double alq_value = record.getItem().get(0); - network.add_branch(Network::Branch(downtree_node, uptree_node, vfp_table, alq_value)); - } else { - network.add_branch(Network::Branch(downtree_node, uptree_node, vfp_table, alq_eq)); - } - } - } - Network::Node node { group_name }; - if (pressure_item.hasValue(0) && (pressure_item.get(0) > 0)) - node.terminal_pressure(pressure_item.getSIDouble(0)); - node.add_gas_lift_gas(add_gas_lift_gas); - nodes.push_back(node); - } - } - this->snapshots.back().network.update( network ); - for(const auto& node: nodes) - network.add_node(node); - this->snapshots.back().network.update( std::move( network )); - } ->>>>>>> 0d7cc9b4e (allow for wildcards) void Schedule::handleGRUPTREE(HandlerContext& handlerContext) { for (const auto& record : handlerContext.keyword) { From bd878c231266c5f1b43b19e6506dd171f816b180 Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 24 Aug 2023 14:38:59 +0200 Subject: [PATCH 5/7] reverted file --- tests/parser/GroupTests.cpp | 52 ------------------------------------- 1 file changed, 52 deletions(-) diff --git a/tests/parser/GroupTests.cpp b/tests/parser/GroupTests.cpp index 7d049ef02..aa59b8036 100644 --- a/tests/parser/GroupTests.cpp +++ b/tests/parser/GroupTests.cpp @@ -180,58 +180,6 @@ WCONPROD } -<<<<<<< HEAD -======= - - - -BOOST_AUTO_TEST_CASE(createDeckWithGRUPNET) { - std::string input = - "START -- 0 \n" - "31 AUG 1993 / \n" - "SCHEDULE\n" - - "GRUPTREE \n" - " 'MANI-B2' 'FIELD' / \n" - " 'MANI-B1' 'FIELD' / \n" - " 'MANI-K1' 'FIELD' / \n" - " 'B1-DUMMY' 'MANI-K1' / \n" - " 'MANI-D1' 'FIELD' / \n" - " 'PROD' 'MANI-D1' / \n" - " 'MANI-D2' 'MANI-D1' / \n" - " 'MANI-K2' 'MANI-D1' / \n" - " 'D2-DUMMY' 'MANI-K2' / \n" - " 'MANI-E1' 'MANI-K2' / \n" - " 'MANI-E2' 'MANI-K2' / \n" - "/\n" - - "GRUPNET \n" - " 'FIELD' 20.000 5* / \n" - " 'PROD' 20.000 5* / \n" - " 'MANI-B2' 1* 8 1* 'NO' 2* / \n" - " 'MANI-B1' 1* 8 1* 'NO' 2* / \n" - " 'MANI-K1' 1* 9999 4* / \n" - " 'B1-DUMMY' 1* 9999 4* / \n" - " 'MANI-D*' 1* 8 1* 'NO' 2* / \n" - " 'MANI-K2' 1* 9999 4* / \n" - " 'D2-DUMMY' 1* 9999 4* / \n" - " 'MANI-E1' 1* 9 1* 'NO' 2* / \n" - " 'MANI-E2' 1* 9 4* / \n" - "/\n"; - - - 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); -} - - ->>>>>>> 0d7cc9b4e (allow for wildcards) BOOST_AUTO_TEST_CASE(GroupCreate) { Opm::Group g1("NAME", 1, 0, UnitSystem::newMETRIC()); Opm::Group g2("NAME", 1, 0, UnitSystem::newMETRIC()); From ee8c0a28a177b782e7d170b62241068f9adbd504 Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 4 Sep 2023 10:55:54 +0200 Subject: [PATCH 6/7] changed a comment --- src/opm/input/eclipse/Schedule/KeywordHandlers.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp b/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp index 74391c91f..2d62dec92 100644 --- a/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp +++ b/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp @@ -796,9 +796,8 @@ File {} line {}.)", wname, location.keyword, location.filename, location.lineno) const auto& pressure_item = record.getItem(); const int vfp_table = record.getItem().get(0); // It is assumed here that item 6 (ADD_GAS_LIFT_GAS) has the two options ON and FLO. THe option ALQ is not supported. - // For standard network the summation of ALQ values are weighted with efficiency factors. For extended networks - // this calculation using efficiency factors is the default set by WEFAC item 3 (YES), the value NO is not supported. - // Therefore in opm-simulators (opm/simulators/wells/WellGroupHelpers.cpp) no changes are needed. + // For standard networks the summation of ALQ values are weighted with efficiency factors. + // Note that, currently, extended networks uses always efficiency factors (this is the default set by WEFAC item 3 (YES), the value NO is not supported.) const bool add_gas_lift_gas = DeckItem::to_bool(record.getItem().get(0)); for (const auto& group_name : group_names) { From ad076fc3c2dccaf141cd47bc03e59cd5cbe8776b Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 5 Sep 2023 13:53:31 +0200 Subject: [PATCH 7/7] removed usage of Deckitem::to_bool() --- src/opm/input/eclipse/Deck/DeckItem.cpp | 3 --- src/opm/input/eclipse/Schedule/KeywordHandlers.cpp | 9 ++++++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/opm/input/eclipse/Deck/DeckItem.cpp b/src/opm/input/eclipse/Deck/DeckItem.cpp index 5180f4efe..9f4af6c1e 100644 --- a/src/opm/input/eclipse/Deck/DeckItem.cpp +++ b/src/opm/input/eclipse/Deck/DeckItem.cpp @@ -503,9 +503,6 @@ bool DeckItem::to_bool(std::string string_value) { if (string_value == "1") return true; - if (string_value == "FLO") - return true; - if (string_value == "FALSE") return false; diff --git a/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp b/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp index 2d62dec92..6f2b75109 100644 --- a/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp +++ b/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp @@ -795,10 +795,13 @@ File {} line {}.)", wname, location.keyword, location.filename, location.lineno) this->invalidNamePattern(groupNamePattern, handlerContext); const auto& pressure_item = record.getItem(); const int vfp_table = record.getItem().get(0); - // It is assumed here that item 6 (ADD_GAS_LIFT_GAS) has the two options ON and FLO. THe option ALQ is not supported. + // It is assumed here that item 6 (ADD_GAS_LIFT_GAS) has the two options NO and FLO. THe option ALQ is not supported. // For standard networks the summation of ALQ values are weighted with efficiency factors. // Note that, currently, extended networks uses always efficiency factors (this is the default set by WEFAC item 3 (YES), the value NO is not supported.) - const bool add_gas_lift_gas = DeckItem::to_bool(record.getItem().get(0)); + const std::string& add_gas_lift_gas_string = record.getItem().get(0); + bool add_gas_lift_gas = false; + if (add_gas_lift_gas_string == "FLO") + add_gas_lift_gas = true; for (const auto& group_name : group_names) { const auto& group = this->snapshots.back().groups.get(group_name); @@ -841,7 +844,7 @@ File {} line {}.)", wname, location.keyword, location.filename, location.lineno) } // To use update_node the node should be associated to a branch via add_branch() // so the update of nodes is postponed after creation of branches - for(const auto& node: nodes) + for(const auto& node: nodes) network.update_node(node); this->snapshots.back().network.update( std::move(network)); }