Merge pull request #2459 from jalvestad/group_constraints_summary

Make available current Production/Injection Group Control parameters for use in  Restart
This commit is contained in:
Bård Skaflestad
2020-03-19 16:54:34 +01:00
committed by GitHub
7 changed files with 106 additions and 7 deletions

View File

@@ -33,9 +33,12 @@
#include <cassert>
#include <tuple>
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/GuideRate.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp>
#include <opm/simulators/timestepping/SimulatorReport.hpp>
#include <opm/simulators/wells/PerforationData.hpp>
@@ -183,6 +186,32 @@ namespace Opm {
void initFromRestartFile(const RestartValue& restartValues);
Opm::data::Group groupData(const int reportStepIdx, Opm::Schedule& sched) const
{
Opm::data::Group dw;
for (const std::string gname : sched.groupNames(reportStepIdx)) {
const auto& grup = sched.getGroup(gname, reportStepIdx);
const auto& grup_type = grup.getGroupType();
Opm::data::currentGroupConstraints cgc;
cgc.currentProdConstraint = Opm::Group::ProductionCMode::NONE;
cgc.currentGasInjectionConstraint = Opm::Group::InjectionCMode::NONE;
cgc.currentWaterInjectionConstraint = Opm::Group::InjectionCMode::NONE;
if (this->well_state_.hasProductionGroupControl(gname)) {
cgc.currentProdConstraint = this->well_state_.currentProductionGroupControl(gname);
}
if ((grup_type == Opm::Group::GroupType::INJECTION) || (grup_type == Opm::Group::GroupType::MIXED)) {
if (this->well_state_.hasInjectionGroupControl(Opm::Phase::WATER, gname)) {
cgc.currentWaterInjectionConstraint = this->well_state_.currentInjectionGroupControl(Opm::Phase::WATER, gname);
}
if (this->well_state_.hasInjectionGroupControl(Opm::Phase::GAS, gname)) {
cgc.currentGasInjectionConstraint = this->well_state_.currentInjectionGroupControl(Opm::Phase::GAS, gname);
}
}
dw.emplace(gname, cgc);
}
return dw;
}
Opm::data::Wells wellData() const
{ return well_state_.report(phase_usage_, Opm::UgGridHelpers::globalCell(grid())); }

View File

@@ -21,6 +21,8 @@
#ifndef OPM_WELLGROUPHELPERS_HEADER_INCLUDED
#define OPM_WELLGROUPHELPERS_HEADER_INCLUDED
#include <opm/output/data/Groups.hpp>
#include <vector>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleTypes.hpp>
@@ -129,7 +131,6 @@ namespace Opm {
}
}
inline void accumulateGroupEfficiencyFactor(const Group& group, const Schedule& schedule, const int reportStepIdx, double& factor) {
factor *= group.getGroupEfficiencyFactor();
if (group.parent() != "FIELD")

View File

@@ -22,6 +22,7 @@
#include <opm/core/props/BlackoilPhases.hpp>
#include <opm/output/data/Wells.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
#include <opm/simulators/wells/PerforationData.hpp>

View File

@@ -315,11 +315,11 @@ namespace Opm
std::vector<Well::ProducerCMode>& currentProductionControls() { return current_production_controls_; }
const std::vector<Well::ProducerCMode>& currentProductionControls() const { return current_production_controls_; }
bool hasProductionGroupControl(const std::string& groupName) {
bool hasProductionGroupControl(const std::string& groupName) const {
return current_production_group_controls_.count(groupName) > 0;
}
bool hasInjectionGroupControl(const Opm::Phase& phase, const std::string& groupName) {
bool hasInjectionGroupControl(const Opm::Phase& phase, const std::string& groupName) const {
return current_injection_group_controls_.count(std::make_pair(phase, groupName)) > 0;
}