intial changes to add current group controls to summary

This commit is contained in:
Jostein Alvestad 2020-02-11 12:55:31 +01:00
parent d7522c68b2
commit 0dcacb41d4
4 changed files with 68 additions and 0 deletions

View File

@ -32,6 +32,9 @@
#include "ecloutputblackoilmodule.hh"
#include <opm/models/blackoil/blackoilmodel.hh>
#include <opm/simulators/wells/BlackoilWellModel.hpp>
#include <opm/models/discretization/ecfv/ecfvdiscretization.hh>
#include <opm/models/io/baseoutputwriter.hh>
#include <opm/models/parallel/tasklets.hh>
@ -39,6 +42,7 @@
#include <ebos/nncsorter.hpp>
#include <opm/output/eclipse/EclipseIO.hpp>
#include <opm/output/eclipse/RestartValue.hpp>
#include <opm/output/eclipse/Summary.hpp>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
@ -257,6 +261,15 @@ public:
Opm::data::Wells localWellData = simulator_.problem().wellModel().wellData();
/*const Group& fieldGroup = schedule().getGroup("FIELD", reportStepNum);
wellGroupHelpers::setCmodeGroup(fieldGroup, simulator_.vanguard().schedule(), simulator_.vanguard().summaryState(), reportStepNum, well_state_);
Opm::data::Group localGroupData = simulator_.problem().wellModel().groupData(reportStepNum, simulator_.vanguard().schedule());
for (const auto& cp_constr : localGroupData.currentProdConstraint) {
std::cout << "cp_constr.first: " << cp_constr.first << " cp_constr.second: " << static_cast<int>(cp_constr.second) << std::endl;
}*/
const auto& gridView = simulator_.vanguard().gridView();
int numElements = gridView.size(/*codim=*/0);
bool log = collectToIORank_.isIORank();

View File

@ -36,6 +36,7 @@
#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/output/data/Groups.hpp>
#include <opm/simulators/timestepping/SimulatorReport.hpp>
#include <opm/simulators/wells/PerforationData.hpp>
@ -183,9 +184,30 @@ namespace Opm {
void initFromRestartFile(const RestartValue& restartValues);
/*Opm::data::Group groupData(const int reportStepIdx, Opm::Schedule& sched)
{
Opm::data::Group dw;
std::pair<const std::string, const Opm::Group::ProductionCMode> groupPCPair;
std::pair<const std::string, const Opm::Group::InjectionCMode> groupICPair;
for (const std::string gname : sched.groupNames(reportStepIdx)) {
if (this->well_state_.hasProductionGroupControl(gname)) {
groupPCPair = std::make_pair(gname, this->well_state_.currentProductionGroupControl(gname));
dw.currentProdConstraint.insert(groupPCPair);
}
if (this->well_state_.hasInjectionGroupControl(gname)) {
groupICPair = std::make_pair(gname, this->well_state_.currentInjectionGroupControl(gname));
dw.currentInjectionConstraint.insert(groupICPair);
}
}
return dw;
} */
Opm::data::Wells wellData() const
{ return well_state_.report(phase_usage_, Opm::UgGridHelpers::globalCell(grid())); }
//Opm::data::Group groupData(const int reportStepIdx) const
//{ return g_report(reportStepIdx); }
// substract Binv(D)rw from r;
void apply( BVector& r) const;
@ -249,6 +271,7 @@ namespace Opm {
WellInterfacePtr createWellForWellTest(const std::string& well_name, const int report_step, Opm::DeferredLogger& deferred_logger) const;
WellState well_state_;
WellState previous_well_state_;
WellState well_state_nupcol_;

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,6 +131,33 @@ namespace Opm {
}
}
Opm::data::Group getActiveCmodeGroup(const Group& group, const Schedule& schedule, const SummaryState& summaryState, const int reportStepIdx, WellStateFullyImplicitBlackoil& wellState) {
Opm::data::Group cagc;
std::pair<const std::string, const Opm::Group::ProductionCMode> groupPCPair;
std::pair<const std::string, const Opm::Group::InjectionCMode> groupICPair;
for (const std::string& groupName : group.groups()) {
Opm::data::Group cagc_tmp = getActiveCmodeGroup( schedule.getGroup(groupName, reportStepIdx), schedule, summaryState, reportStepIdx, wellState);
for (const auto& item : cagc_tmp.currentInjectionConstraint) {
cagc.currentInjectionConstraint.insert(item);
}
for (const auto& item : cagc_tmp.currentProdConstraint) {
cagc.currentProdConstraint.insert(item);
}
}
if (wellState.hasInjectionGroupControl(group.name())) {
groupICPair = std::make_pair(group.name(), wellState.currentInjectionGroupControl(group.name()));
cagc.currentInjectionConstraint.insert(groupICPair);
}
if (wellState.hasProductionGroupControl(group.name())) {
groupPCPair = std::make_pair(group.name(), wellState.currentProductionGroupControl(group.name()));
cagc.currentProdConstraint.insert(groupPCPair);
}
}
inline void accumulateGroupEfficiencyFactor(const Group& group, const Schedule& schedule, const int reportStepIdx, double& factor) {
factor *= group.getGroupEfficiencyFactor();

View File

@ -22,7 +22,9 @@
#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/parser/eclipse/EclipseState/Schedule/Group/Group.hpp>
#include <opm/simulators/wells/PerforationData.hpp>
#include <array>
@ -228,6 +230,7 @@ namespace Opm
std::vector<bool> open_for_output_;
private:
WellMapType wellMap_;
void initSingleWell(const std::vector<double>& cellPressures,