From 99a61e120b4d12228cf535666faa6ef1e3f8e7b9 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Fri, 12 Feb 2021 11:26:14 +0100 Subject: [PATCH] Implement BlackoilWellModel::hasWell() method --- opm/simulators/wells/BlackoilWellModel.hpp | 1 + opm/simulators/wells/BlackoilWellModel_impl.hpp | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/opm/simulators/wells/BlackoilWellModel.hpp b/opm/simulators/wells/BlackoilWellModel.hpp index f58fcd50e..2a903ffb7 100644 --- a/opm/simulators/wells/BlackoilWellModel.hpp +++ b/opm/simulators/wells/BlackoilWellModel.hpp @@ -268,6 +268,7 @@ namespace Opm { bool forceShutWellByNameIfPredictionMode(const std::string& wellname, const double simulation_time); double wellPI(int well_index) const; + bool hasWell(const std::string& wname); protected: Simulator& ebosSimulator_; diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index 12b98d9b3..bb7b0f069 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -1726,6 +1726,15 @@ namespace Opm { } + template + bool + BlackoilWellModel:: + hasWell(const std::string& wname) { + auto iter = std::find_if( this->wells_ecl_.begin(), this->wells_ecl_.end(), [&wname](const Well& well) { return well.name() == wname; }); + return (iter != this->wells_ecl_.end()); + } + + // convert well data from opm-common to well state from opm-core template void