diff --git a/opm/input/eclipse/Schedule/Schedule.hpp b/opm/input/eclipse/Schedule/Schedule.hpp index 0818f5532..29a711988 100644 --- a/opm/input/eclipse/Schedule/Schedule.hpp +++ b/opm/input/eclipse/Schedule/Schedule.hpp @@ -645,7 +645,9 @@ namespace Opm void prefetch_cell_properties(const ScheduleGrid& grid, const DeckKeyword& keyword); void store_wgnames(const DeckKeyword& keyword); - std::vector wellNames(const std::string& pattern, const HandlerContext& context); + std::vector wellNames(const std::string& pattern, + const HandlerContext& context, + bool allowEmpty = false); std::vector wellNames(const std::string& pattern, std::size_t timeStep, const std::vector& matching_wells, InputErrorAction error_action, ErrorGuard& errors, const KeywordLocation& location) const; void invalidNamePattern( const std::string& namePattern, const HandlerContext& context) const; static std::string formatDate(std::time_t t); diff --git a/src/opm/input/eclipse/Schedule/Schedule.cpp b/src/opm/input/eclipse/Schedule/Schedule.cpp index 5a4c24caf..8da9592f8 100644 --- a/src/opm/input/eclipse/Schedule/Schedule.cpp +++ b/src/opm/input/eclipse/Schedule/Schedule.cpp @@ -1216,11 +1216,14 @@ void Schedule::iterateScheduleSection(std::size_t load_start, std::size_t load_e - std::vector Schedule::wellNames(const std::string& pattern, const HandlerContext& context) { + std::vector Schedule::wellNames(const std::string& pattern, + const HandlerContext& context, + bool allowEmpty) + { std::vector valid_names; const auto& report_step = context.currentStep; auto names = this->wellNames(pattern, report_step, context.matching_wells); - if (names.empty()) { + if (names.empty() && !allowEmpty) { const auto& location = context.keyword.location(); if (this->action_wgnames.has_well(pattern)) { std::string msg = fmt::format(R"(Well: {} not yet defined for keyword {}.