From 4224e26321f15d0c3b68d38b8edaf49ecdf85e86 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Mon, 24 Jan 2022 13:40:49 +0100 Subject: [PATCH] Accept empty list of matching_wells when resolving '?' --- src/opm/input/eclipse/Schedule/Schedule.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/opm/input/eclipse/Schedule/Schedule.cpp b/src/opm/input/eclipse/Schedule/Schedule.cpp index 09ee4eedd..5c942af5d 100644 --- a/src/opm/input/eclipse/Schedule/Schedule.cpp +++ b/src/opm/input/eclipse/Schedule/Schedule.cpp @@ -703,7 +703,17 @@ void Schedule::iterateScheduleSection(std::size_t load_start, std::size_t load_e void Schedule::invalidNamePattern( const std::string& namePattern, const HandlerContext& context) const { std::string msg_fmt = fmt::format("No wells/groups match the pattern: \'{}\'", namePattern); - context.parseContext.handleError(ParseContext::SCHEDULE_INVALID_NAME, msg_fmt, context.keyword.location(), context.errors); + if (namePattern == "?") { + /* + In particular when an ACTIONX keyword is called via PYACTION + coming in here with an empty list of matching wells is not + entirely unheard of. It is probably not what the user wanted and + we give a warning, but the simulation continues. + */ + auto msg = OpmInputError::format("No matching wells for ACTIONX {keyword} in {file} line {line}.", context.keyword.location()); + OpmLog::warning(msg); + } else + context.parseContext.handleError(ParseContext::SCHEDULE_INVALID_NAME, msg_fmt, context.keyword.location(), context.errors); } GTNode Schedule::groupTree(const std::string& root_node, std::size_t report_step, std::size_t level, const std::optional& parent_name) const {