a flag to WellCollection whether group control active

This commit is contained in:
Kai Bao 2016-11-17 14:20:01 +01:00
parent 6e4f9e708e
commit 4427c85d77
3 changed files with 26 additions and 6 deletions

View File

@ -50,6 +50,10 @@ namespace Opm
}
if (groupChild.isProductionGroup(timeStep) || groupChild.isInjectionGroup(timeStep)) {
group_control_active_ = true;
}
std::shared_ptr<WellsGroupInterface> child = createGroupWellsGroup(groupChild, timeStep, phaseUsage);
if (child->injSpec().control_mode_ == InjectionSpecification::VREP) {
@ -308,8 +312,15 @@ namespace Opm
}
bool WellCollection::havingVREPGroups() const {
bool WellCollection::havingVREPGroups() const
{
return having_vrep_groups_;
}
bool WellCollection::groupControlActive() const
{
return group_control_active_;
}
}

View File

@ -136,6 +136,9 @@ namespace Opm
/// When we have VREP group, we need to update the targets based on the updated production voidage rates for each iteration.
bool havingVREPGroups() const;
/// Whether we have active group control
bool groupControlActive() const;
private:
// To account for the possibility of a forest
std::vector<std::shared_ptr<WellsGroupInterface> > roots_;
@ -145,6 +148,8 @@ namespace Opm
bool having_vrep_groups_ = false;
bool group_control_active_ = false;
};

View File

@ -423,15 +423,19 @@ WellsManager::init(const Opm::EclipseState& eclipseState,
} while( !group_stack.empty() );
}
for (auto w = wells.begin(), e = wells.end(); w != e; ++w) {
well_collection_.addWell(*w, timeStep, pu);
for (size_t i = 0; i < wells_on_proc.size(); ++i) {
// wells_on_proc is a vector of flag to indicate whether a well is on the process
if (wells_on_proc[i]) {
well_collection_.addWell(wells[i], timeStep, pu);
}
}
well_collection_.setWellsPointer(w_);
setupGuideRates(wells, timeStep, well_data, well_names_to_index, pu, well_potentials);
well_collection_.applyGroupControls();
if (well_collection_.groupControlActive()) {
setupGuideRates(wells, timeStep, well_data, well_names_to_index, pu, well_potentials);
well_collection_.applyGroupControls();
}
// Debug output.
#define EXTRA_OUTPUT