diff --git a/opm/simulators/wells/BlackoilWellModel.hpp b/opm/simulators/wells/BlackoilWellModel.hpp index 966d74ad8..9ea4016ad 100644 --- a/opm/simulators/wells/BlackoilWellModel.hpp +++ b/opm/simulators/wells/BlackoilWellModel.hpp @@ -289,7 +289,6 @@ template class WellContributions; const int iterationIdx); WellInterfacePtr getWell(const std::string& well_name) const; - bool hasOpenLocalWell(const std::string& well_name) const; using PressureMatrix = Dune::BCRSMatrix>; diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.cpp b/opm/simulators/wells/BlackoilWellModelGeneric.cpp index abc9fab1d..1214aa98a 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.cpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.cpp @@ -149,13 +149,27 @@ template bool BlackoilWellModelGeneric:: hasWell(const std::string& wname) const { - return std::any_of(this->wells_ecl_.begin(), this->wells_ecl_.end(), + return std::any_of(this->wells_ecl_.begin(), + this->wells_ecl_.end(), [&wname](const Well& well) { return well.name() == wname; }); } +template +bool +BlackoilWellModelGeneric:: +hasOpenLocalWell(const std::string& wname) const +{ + return std::any_of(well_container_generic_.begin(), + well_container_generic_.end(), + [&wname](const auto* elem) -> bool + { + return elem->name() == wname; + }); +} + template bool BlackoilWellModelGeneric:: wellsActive() const diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.hpp b/opm/simulators/wells/BlackoilWellModelGeneric.hpp index 6d2ff6f09..c00865fec 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.hpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.hpp @@ -103,8 +103,13 @@ public: /// return true if wells are available in the reservoir bool wellsActive() const; + + //! \brief Returns true if well is defined and has connections on current rank. bool hasWell(const std::string& wname) const; + //! \brief Returns true if well is defined, open and has connections on current rank. + bool hasOpenLocalWell(const std::string& well_name) const; + /// return true if network is active (at least one network well in prediction mode) bool networkActive() const; diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index 16bdc4889..17d18fe78 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -2378,21 +2378,6 @@ namespace Opm { return *well; } - template - bool - BlackoilWellModel:: - hasOpenLocalWell(const std::string& well_name) const - { - return std::any_of(well_container_.begin(), well_container_.end(), - [&well_name](const WellInterfacePtr& elem) -> bool - { - return elem->name() == well_name; - }); - } - - - - template int BlackoilWellModel::