move hasOpenLocalWell to BlackoilWellModelGeneric

This commit is contained in:
Arne Morten Kvarving 2025-01-09 13:31:43 +01:00
parent 98949004c6
commit 64f9ebb06c
4 changed files with 20 additions and 17 deletions

View File

@ -289,7 +289,6 @@ template<class Scalar> 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<Opm::MatrixBlock<Scalar, 1, 1>>;

View File

@ -149,13 +149,27 @@ template<class Scalar>
bool BlackoilWellModelGeneric<Scalar>::
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<class Scalar>
bool
BlackoilWellModelGeneric<Scalar>::
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<class Scalar>
bool BlackoilWellModelGeneric<Scalar>::
wellsActive() const

View File

@ -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;

View File

@ -2378,21 +2378,6 @@ namespace Opm {
return *well;
}
template<typename TypeTag>
bool
BlackoilWellModel<TypeTag>::
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 <typename TypeTag>
int
BlackoilWellModel<TypeTag>::