From 38c01e91e19de7b7d9a7510094765dc9e37ecaba Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Tue, 1 Dec 2020 08:17:16 +0100 Subject: [PATCH] Improve error message for connection in inactive cell --- .../eclipse/EclipseState/Schedule/Well/WellConnections.hpp | 3 ++- .../eclipse/EclipseState/Schedule/KeywordHandlers.cpp | 2 +- .../eclipse/EclipseState/Schedule/Well/WellConnections.cpp | 7 ++++--- tests/parser/ConnectionTests.cpp | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp index 3409d14b5..c3c1ec174 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp @@ -63,7 +63,7 @@ namespace Opm { const Connection::CTFKind ctf_kind = Connection::CTFKind::DeckValue, const std::size_t seqIndex = 0, const bool defaultSatTabId = true); - void loadCOMPDAT(const DeckRecord& record, const EclipseGrid& grid, const FieldPropsManager& field_properties, const KeywordLocation& location); + void loadCOMPDAT(const DeckRecord& record, const EclipseGrid& grid, const FieldPropsManager& field_properties, const std::string& wname, const KeywordLocation& location); using const_iterator = std::vector< Connection >::const_iterator; @@ -156,6 +156,7 @@ namespace Opm { const std::vector* permy, const std::vector* permz, const std::vector& ntg, + const std::string& wname, const KeywordLocation& location); size_t findClosestConnection(int oi, int oj, double oz, size_t start_pos); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp index 9e6158e42..eba0f76b8 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp @@ -153,7 +153,7 @@ namespace { for (const auto& name : wellnames) { auto well2 = std::shared_ptr(new Well( this->getWell(name, handlerContext.currentStep))); auto connections = std::shared_ptr( new WellConnections( well2->getConnections())); - connections->loadCOMPDAT(record, handlerContext.grid, handlerContext.fieldPropsManager, handlerContext.keyword.location()); + connections->loadCOMPDAT(record, handlerContext.grid, handlerContext.fieldPropsManager, name, handlerContext.keyword.location()); if (well2->updateConnections(connections, handlerContext.grid, handlerContext.fieldPropsManager.get_int("PVTNUM"))) { this->updateWell(std::move(well2), handlerContext.currentStep); wells.insert( name ); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.cpp index f5bad5d99..abf642577 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.cpp @@ -271,14 +271,14 @@ inline std::array< size_t, 3> directionIndices(const Opm::Connection::Direction defaultSatTabId); } - void WellConnections::loadCOMPDAT(const DeckRecord& record, const EclipseGrid& grid, const FieldPropsManager& field_properties, const KeywordLocation& location) { + void WellConnections::loadCOMPDAT(const DeckRecord& record, const EclipseGrid& grid, const FieldPropsManager& field_properties, const std::string& wname, const KeywordLocation& location) { const auto permx = field_properties.try_get("PERMX"); const auto permy = field_properties.try_get("PERMY"); const auto permz = field_properties.try_get("PERMZ"); const auto& ntg = field_properties.get_double("NTG"); const auto& satnum_data = field_properties.get_int("SATNUM"); - this->loadCOMPDAT(record, grid, satnum_data, permx, permy, permz, ntg, location); + this->loadCOMPDAT(record, grid, satnum_data, permx, permy, permz, ntg, wname, location); } void WellConnections::loadCOMPDAT(const DeckRecord& record, @@ -288,6 +288,7 @@ inline std::array< size_t, 3> directionIndices(const Opm::Connection::Direction const std::vector* permy, const std::vector* permz, const std::vector& ntg, + const std::string& wname, const KeywordLocation& location) { const auto& itemI = record.getItem( "I" ); @@ -331,7 +332,7 @@ inline std::array< size_t, 3> directionIndices(const Opm::Connection::Direction if (!grid.cellActive(I, J, k)) { auto msg = fmt::format("Problem with COMPDAT keyword\n" "In {} line {}\n" - "The cell ({},{},{}) is not active and the connection will be ignored", location.filename, location.lineno, I,J,k); + "The cell ({},{},{}) in well {} is not active and the connection will be ignored", location.filename, location.lineno, I,J,k, wname); OpmLog::warning(msg); continue; } diff --git a/tests/parser/ConnectionTests.cpp b/tests/parser/ConnectionTests.cpp index 00c21a5d2..e672edbd6 100644 --- a/tests/parser/ConnectionTests.cpp +++ b/tests/parser/ConnectionTests.cpp @@ -62,7 +62,7 @@ Opm::WellConnections loadCOMPDAT(const std::string& compdat_keyword) { const auto& keyword = deck.getKeyword("COMPDAT", 0); Opm::WellConnections connections(Opm::Connection::Order::TRACK, 10,10); for (const auto& rec : keyword) - connections.loadCOMPDAT(rec, grid, field_props, {}); + connections.loadCOMPDAT(rec, grid, field_props, "WELL", {}); return connections; }