move checkGroupConstraints into BlackoilWellModelConstraints

This commit is contained in:
Arne Morten Kvarving 2022-10-24 09:36:05 +02:00
parent df27ec5d4d
commit 82cf0deef4
4 changed files with 42 additions and 42 deletions

View File

@ -337,4 +337,41 @@ checkGroupProductionConstraints(const Group& group,
return std::make_pair(Group::ProductionCMode::NONE, 1.0);
}
bool BlackoilWellModelConstraints::
checkGroupConstraints(const Group& group,
const int reportStepIdx,
DeferredLogger& deferred_logger) const
{
if (group.isInjectionGroup()) {
const Phase all[] = {Phase::WATER, Phase::OIL, Phase::GAS};
for (Phase phase : all) {
if (!group.hasInjectionControl(phase)) {
continue;
}
const auto& check = this->checkGroupInjectionConstraints(group,
reportStepIdx, phase);
if (check.first != Group::InjectionCMode::NONE) {
return true;
}
}
}
if (group.isProductionGroup()) {
const auto& check = this->checkGroupProductionConstraints(group,
reportStepIdx,
deferred_logger);
if (check.first != Group::ProductionCMode::NONE)
{
return true;
}
}
// call recursively down the group hierarchy
bool violated = false;
for (const std::string& groupName : group.groups()) {
const auto& grp = wellModel_.schedule().getGroup(groupName, reportStepIdx);
violated = violated || this->checkGroupConstraints(grp, reportStepIdx, deferred_logger);
}
return violated;
}
}

View File

@ -57,6 +57,11 @@ public:
const int reportStepIdx,
DeferredLogger& deferred_logger) const;
//! \brief Check the constraints of a well group.
bool checkGroupConstraints(const Group& group,
const int reportStepIdx,
DeferredLogger& deferred_logger) const;
private:
const BlackoilWellModelGeneric& wellModel_; //!< Reference to well model
};

View File

@ -540,44 +540,6 @@ initializeWellPerfData()
}
}
bool
BlackoilWellModelGeneric::
checkGroupConstraints(const Group& group,
const int reportStepIdx,
DeferredLogger& deferred_logger) const
{
if (group.isInjectionGroup()) {
const Phase all[] = {Phase::WATER, Phase::OIL, Phase::GAS};
for (Phase phase : all) {
if (!group.hasInjectionControl(phase)) {
continue;
}
const auto& check =
BlackoilWellModelConstraints(*this).
checkGroupInjectionConstraints(group, reportStepIdx, phase);
if (check.first != Group::InjectionCMode::NONE) {
return true;
}
}
}
if (group.isProductionGroup()) {
const auto& check =
BlackoilWellModelConstraints(*this).
checkGroupProductionConstraints(group, reportStepIdx, deferred_logger);
if (check.first != Group::ProductionCMode::NONE)
{
return true;
}
}
// call recursively down the group hiearchy
bool violated = false;
for (const std::string& groupName : group.groups()) {
violated = violated || checkGroupConstraints( schedule().getGroup(groupName, reportStepIdx), reportStepIdx, deferred_logger);
}
return violated;
}
void
BlackoilWellModelGeneric::
checkGconsaleLimits(const Group& group,

View File

@ -293,10 +293,6 @@ protected:
void calculateEfficiencyFactors(const int reportStepIdx);
bool checkGroupConstraints(const Group& group,
const int reportStepIdx,
DeferredLogger& deferred_logger) const;
void checkGconsaleLimits(const Group& group,
WellState& well_state,
const int reportStepIdx,