mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Fix REIN for multi level groups by passing the top phase
This commit is contained in:
parent
725b90504c
commit
c1748604f0
@ -1954,7 +1954,9 @@ namespace Opm {
|
|||||||
well_state.setCurrentProductionGroupControl(group.name(), newControl);
|
well_state.setCurrentProductionGroupControl(group.name(), newControl);
|
||||||
ss << "Switching control mode for group "<< group.name() << " to " << Group::ProductionCMode2String(newControl);
|
ss << "Switching control mode for group "<< group.name() << " to " << Group::ProductionCMode2String(newControl);
|
||||||
}
|
}
|
||||||
wellGroupHelpers::setGroupControl(group, schedule(), reportStepIdx, false, well_state, ss);
|
// Pass a dummy phase for producer groups. The topPhase is only relevant for injector groups
|
||||||
|
const Phase topPhase = Phase::WATER;
|
||||||
|
wellGroupHelpers::setGroupControl(group, schedule(), topPhase, reportStepIdx, false, well_state, ss);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -1991,7 +1993,9 @@ namespace Opm {
|
|||||||
}
|
}
|
||||||
well_state.setCurrentInjectionGroupControl(group.name(), newControl);
|
well_state.setCurrentInjectionGroupControl(group.name(), newControl);
|
||||||
}
|
}
|
||||||
wellGroupHelpers::setGroupControl(group, schedule(), reportStepIdx, /*isInjector*/true, well_state, ss);
|
const auto& summaryState = ebosSimulator_.vanguard().summaryState();
|
||||||
|
const Phase& topPhase = group.injectionControls(summaryState).phase;
|
||||||
|
wellGroupHelpers::setGroupControl(group, schedule(), topPhase, reportStepIdx, /*isInjector*/true, well_state, ss);
|
||||||
|
|
||||||
if (!ss.str().empty())
|
if (!ss.str().empty())
|
||||||
deferred_logger.info(ss.str());
|
deferred_logger.info(ss.str());
|
||||||
|
@ -29,15 +29,17 @@ namespace Opm {
|
|||||||
namespace wellGroupHelpers
|
namespace wellGroupHelpers
|
||||||
{
|
{
|
||||||
|
|
||||||
inline void setGroupControl(const Group& group, const Schedule& schedule, const int reportStepIdx, const bool injector, WellStateFullyImplicitBlackoil& wellState, std::ostringstream& ss) {
|
inline void setGroupControl(const Group& group, const Schedule& schedule, const Phase& topPhase, const int reportStepIdx, const bool injector, WellStateFullyImplicitBlackoil& wellState, std::ostringstream& ss) {
|
||||||
|
|
||||||
for (const std::string& groupName : group.groups()) {
|
for (const std::string& groupName : group.groups()) {
|
||||||
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
||||||
setGroupControl(groupTmp, schedule, reportStepIdx, injector, wellState, ss);
|
setGroupControl(groupTmp, schedule, topPhase, reportStepIdx, injector, wellState, ss);
|
||||||
if (injector)
|
if (injector) {
|
||||||
wellState.setCurrentInjectionGroupControl(groupName, Group::InjectionCMode::FLD);
|
if (groupTmp.injection_phase() == topPhase || wellState.currentInjectionGroupControl(groupName) == Group::InjectionCMode::NONE) // only switch sub groups with same face or NONE
|
||||||
else
|
wellState.setCurrentInjectionGroupControl(groupName, Group::InjectionCMode::FLD);
|
||||||
|
} else {
|
||||||
wellState.setCurrentProductionGroupControl(groupName, Group::ProductionCMode::FLD);
|
wellState.setCurrentProductionGroupControl(groupName, Group::ProductionCMode::FLD);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& end = wellState.wellMap().end();
|
const auto& end = wellState.wellMap().end();
|
||||||
@ -64,9 +66,21 @@ namespace Opm {
|
|||||||
|
|
||||||
if (wellEcl.isInjector() && injector) {
|
if (wellEcl.isInjector() && injector) {
|
||||||
// only switch if the well phase is the same as the group phase
|
// only switch if the well phase is the same as the group phase
|
||||||
if (group.injection_phase() != wellEcl.getPreferredPhase())
|
// Get the current controls.
|
||||||
|
const Well::InjectorType& injectorType = wellEcl.getInjectionProperties().injectorType;
|
||||||
|
|
||||||
|
if (injectorType == Well::InjectorType::WATER && topPhase != Phase::WATER)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (injectorType == Well::InjectorType::OIL && topPhase != Phase::OIL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (injectorType == Well::InjectorType::GAS && topPhase != Phase::GAS)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (injectorType == Well::InjectorType::MULTI)
|
||||||
|
throw("Expected WATER, OIL or GAS as type for injectors " + wellEcl.name());
|
||||||
|
|
||||||
if (wellState.currentInjectionControls()[well_index] != Well::InjectorCMode::GRUP) {
|
if (wellState.currentInjectionControls()[well_index] != Well::InjectorCMode::GRUP) {
|
||||||
wellState.currentInjectionControls()[well_index] = Well::InjectorCMode::GRUP;
|
wellState.currentInjectionControls()[well_index] = Well::InjectorCMode::GRUP;
|
||||||
ss <<"\n Injector " << wellName << " switches to GRUP control limit";
|
ss <<"\n Injector " << wellName << " switches to GRUP control limit";
|
||||||
@ -102,7 +116,7 @@ namespace Opm {
|
|||||||
if (schedule.gConSale(reportStepIdx).has(group.name())) {
|
if (schedule.gConSale(reportStepIdx).has(group.name())) {
|
||||||
wellState.setCurrentInjectionGroupControl(group.name(), Group::InjectionCMode::SALE);
|
wellState.setCurrentInjectionGroupControl(group.name(), Group::InjectionCMode::SALE);
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
setGroupControl(group, schedule, reportStepIdx, /*injector*/true, wellState, ss);
|
setGroupControl(group, schedule, Phase::GAS, reportStepIdx, /*injector*/true, wellState, ss);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user