Merge pull request #1999 from joakim-hove/rst-cmode

Rst cmode
This commit is contained in:
Joakim Hove 2020-10-07 09:05:58 +02:00 committed by GitHub
commit efbfbaa90c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 51 additions and 37 deletions

View File

@ -41,6 +41,9 @@ struct RstGroup {
std::string name;
int parent_group;
int prod_cmode;
int winj_cmode;
int ginj_cmode;
float oil_rate_limit;
float water_rate_limit;

View File

@ -53,6 +53,9 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
namespace IGroup {
enum index : std::vector<int>::size_type {
ProdCMode = 1,
WInjCMode = 16,
GInjCMode = 21,
ParentGroup = 28,
};
}

View File

@ -40,6 +40,9 @@ RstGroup::RstGroup(const ::Opm::UnitSystem& unit_system,
const double * xgrp) :
name(trim_copy(zwel[0])),
parent_group(igrp[header.nwgmax + VI::IGroup::ParentGroup] ),
prod_cmode(igrp[header.nwgmax + VI::IGroup::ProdCMode]),
winj_cmode(igrp[header.nwgmax + VI::IGroup::WInjCMode]),
ginj_cmode(igrp[header.nwgmax + VI::IGroup::GInjCMode]),
oil_rate_limit( unit_system.to_si(M::liquid_surface_rate, sgrp[VI::SGroup::OilRateLimit])),
water_rate_limit( unit_system.to_si(M::liquid_surface_rate, sgrp[VI::SGroup::WatRateLimit])),
gas_rate_limit( unit_system.to_si(M::gas_surface_rate, sgrp[VI::SGroup::GasRateLimit])),

View File

@ -572,37 +572,38 @@ void productionGroup(const Opm::Schedule& sched,
Other reduction options are currently not covered in the code
*/
using IGroup = ::Opm::RestartIO::Helpers::VectorItems::IGroup::index;
if (higher_lev_ctrl > 0 && (group.getGroupType() != Opm::Group::GroupType::NONE)) {
iGrp[nwgmax + 1]
iGrp[nwgmax + IGroup::ProdCMode]
= (prod_guide_rate_def != Opm::Group::GuideRateTarget::NO_GUIDE_RATE) ? higher_lev_ctrl_mode : 0;
} else {
switch (pctl_mode) {
case Opm::Group::ProductionCMode::NONE:
iGrp[nwgmax + 1] = 0;
iGrp[nwgmax + IGroup::ProdCMode] = 0;
break;
case Opm::Group::ProductionCMode::ORAT:
iGrp[nwgmax + 1] = 1;
iGrp[nwgmax + IGroup::ProdCMode] = 1;
break;
case Opm::Group::ProductionCMode::WRAT:
iGrp[nwgmax + 1] = 2;
iGrp[nwgmax + IGroup::ProdCMode] = 2;
break;
case Opm::Group::ProductionCMode::GRAT:
iGrp[nwgmax + 1] = 3;
iGrp[nwgmax + IGroup::ProdCMode] = 3;
break;
case Opm::Group::ProductionCMode::LRAT:
iGrp[nwgmax + 1] = 4;
iGrp[nwgmax + IGroup::ProdCMode] = 4;
break;
case Opm::Group::ProductionCMode::RESV:
iGrp[nwgmax + 1] = 5;
iGrp[nwgmax + IGroup::ProdCMode] = 5;
break;
case Opm::Group::ProductionCMode::FLD:
iGrp[nwgmax + 1] = 0; // need to be checked!!
iGrp[nwgmax + IGroup::ProdCMode] = 0; // need to be checked!!
break;
default:
iGrp[nwgmax + 1] = 0;
iGrp[nwgmax + IGroup::ProdCMode] = 0;
}
}
iGrp[nwgmax + 9] = iGrp[nwgmax + 1];
iGrp[nwgmax + 9] = iGrp[nwgmax + IGroup::ProdCMode];
switch (prod_cmode) {
case Opm::Group::ProductionCMode::NONE:
@ -660,8 +661,10 @@ void injectionGroup(const Opm::Schedule& sched,
const std::map<Opm::Group::InjectionCMode, int>& cmodeToNum,
IGrpArray& iGrp)
{
using IGroup = ::Opm::RestartIO::Helpers::VectorItems::IGroup::index;
const bool is_field = group.name() == "FIELD";
auto group_parent_list = groupParentSeqIndex(sched, group, simStep);
using IGroup = ::Opm::RestartIO::Helpers::VectorItems::IGroup::index;
// set "default value" in case a group is only injection group
if (group.isInjectionGroup() && !group.isProductionGroup()) {
@ -670,12 +673,15 @@ void injectionGroup(const Opm::Schedule& sched,
// use default value if group is not available for group control
if (groupInjectionControllable(sched, sumState, group, Opm::Phase::WATER, simStep)) {
if ((group.hasInjectionControl(Opm::Phase::WATER)) || (group.getGroupType() == Opm::Group::GroupType::NONE)) {
const double cur_winj_ctrl
= is_field ? sumState.get("FMCTW", -1) : sumState.get_group_var(group.name(), "GMCTW", -1);
const auto& winj_cmode = (group.hasInjectionControl(Opm::Phase::WATER))
? group.injectionControls(Opm::Phase::WATER, sumState).cmode
: Opm::Group::InjectionCMode::NONE;
if (!is_field) {
if (is_field) {
iGrp[nwgmax + 17] = 0;
iGrp[nwgmax + 22] = 0;
} else {
const double cur_winj_ctrl = sumState.get_group_var(group.name(), "GMCTW", -1);
const auto& winj_cmode = (group.hasInjectionControl(Opm::Phase::WATER))
? group.injectionControls(Opm::Phase::WATER, sumState).cmode
: Opm::Group::InjectionCMode::NONE;
int higher_lev_winj_ctrl = higherLevelInjControlGroupSeqIndex(sched, sumState, group, "GMCTW", simStep);
int higher_lev_winj_cmode
= higherLevelInjCMode_NotNoneFld_SeqIndex(sched, sumState, group, Opm::Phase::WATER, simStep);
@ -725,9 +731,6 @@ void injectionGroup(const Opm::Schedule& sched,
} else {
iGrp[nwgmax + 17] = -1;
}
} else { // group name "FIELD"
iGrp[nwgmax + 17] = 0;
iGrp[nwgmax + 22] = 0;
}
// item[nwgmax + 16] - mode for operation for water injection
// 1 - RATE
@ -740,9 +743,9 @@ void injectionGroup(const Opm::Schedule& sched,
: Opm::Group::InjectionCMode::NONE;
const auto it = cmodeToNum.find(inj_mode);
if (it != cmodeToNum.end()) {
iGrp[nwgmax + 16] = it->second;
iGrp[nwgmax + 18] = iGrp[nwgmax + 16];
iGrp[nwgmax + 19] = iGrp[nwgmax + 16];
iGrp[nwgmax + IGroup::WInjCMode] = it->second;
iGrp[nwgmax + 18] = iGrp[nwgmax + IGroup::WInjCMode];
iGrp[nwgmax + 19] = iGrp[nwgmax + IGroup::WInjCMode];
}
}
}
@ -750,12 +753,19 @@ void injectionGroup(const Opm::Schedule& sched,
// use default value if group is not available for group control
if (groupInjectionControllable(sched, sumState, group, Opm::Phase::GAS, simStep)) {
if ((group.hasInjectionControl(Opm::Phase::GAS)) || (group.getGroupType() == Opm::Group::GroupType::NONE)) {
const double cur_ginj_ctrl
= is_field ? sumState.get("FMCTG", -1) : sumState.get_group_var(group.name(), "GMCTG", -1);
const auto& ginj_cmode = (group.hasInjectionControl(Opm::Phase::GAS))
? group.injectionControls(Opm::Phase::GAS, sumState).cmode
: Opm::Group::InjectionCMode::NONE;
if (!is_field) {
if (is_field) {
iGrp[nwgmax + 17] = 0;
iGrp[nwgmax + 22] = 0;
// parameters connected to oil injection - not implemented in flow yet
iGrp[nwgmax + 11] = 0;
iGrp[nwgmax + 12] = 0;
}
else {
const double cur_ginj_ctrl = sumState.get_group_var(group.name(), "GMCTG", -1);
const auto& ginj_cmode = (group.hasInjectionControl(Opm::Phase::GAS))
? group.injectionControls(Opm::Phase::GAS, sumState).cmode
: Opm::Group::InjectionCMode::NONE;
int higher_lev_ginj_ctrl = higherLevelInjControlGroupSeqIndex(sched, sumState, group, "GMCTG", simStep);
int higher_lev_ginj_cmode
= higherLevelInjCMode_NotNoneFld_SeqIndex(sched, sumState, group, Opm::Phase::GAS, simStep);
@ -803,13 +813,8 @@ void injectionGroup(const Opm::Schedule& sched,
} else {
iGrp[nwgmax + 22] = -1;
}
} else { // group name "FIELD"
iGrp[nwgmax + 17] = 0;
iGrp[nwgmax + 22] = 0;
// parameters connected to oil injection - not implemented in flow yet
iGrp[nwgmax + 11] = 0;
iGrp[nwgmax + 12] = 0;
}
// item[nwgmax + 21] - mode for operation for gas injection
// 1 - RATE
// 2 - RESV
@ -821,9 +826,9 @@ void injectionGroup(const Opm::Schedule& sched,
: Opm::Group::InjectionCMode::NONE;
const auto it = cmodeToNum.find(inj_mode);
if (it != cmodeToNum.end()) {
iGrp[nwgmax + 21] = it->second;
iGrp[nwgmax + 23] = iGrp[nwgmax + 21];
iGrp[nwgmax + 24] = iGrp[nwgmax + 21];
iGrp[nwgmax + IGroup::GInjCMode] = it->second;
iGrp[nwgmax + 23] = iGrp[nwgmax + IGroup::GInjCMode];
iGrp[nwgmax + 24] = iGrp[nwgmax + IGroup::GInjCMode];
}
}
}