Merge pull request #2160 from joakim-hove/rename-well2

Rename Well2 -> Well and Group2 -> Group
This commit is contained in:
Atgeirr Flø Rasmussen
2019-11-14 10:33:54 +01:00
committed by GitHub
27 changed files with 620 additions and 620 deletions

View File

@@ -234,7 +234,7 @@ namespace Opm {
protected:
Simulator& ebosSimulator_;
std::unique_ptr<WellsManager> wells_manager_;
std::vector< Well2 > wells_ecl_;
std::vector< Well > wells_ecl_;
bool wells_active_;
@@ -375,19 +375,19 @@ namespace Opm {
// whether there exists any multisegment well open on this process
bool anyMSWellOpenLocal(const Wells* wells) const;
const Well2& getWellEcl(const std::string& well_name) const;
const Well& getWellEcl(const std::string& well_name) const;
void checkGroupConstraints(const Group2& group, Opm::DeferredLogger& deferred_logger);
void checkGroupConstraints(const Group& group, Opm::DeferredLogger& deferred_logger);
void actionOnBrokenConstraints(const Group2& group, const Group2::ExceedAction& exceed_action, const Group2::ProductionCMode& newControl, const int reportStepIdx, Opm::DeferredLogger& deferred_logger);
void actionOnBrokenConstraints(const Group& group, const Group::ExceedAction& exceed_action, const Group::ProductionCMode& newControl, const int reportStepIdx, Opm::DeferredLogger& deferred_logger);
void actionOnBrokenConstraints(const Group2& group, const Group2::InjectionCMode& newControl, const int reportStepIdx, Opm::DeferredLogger& deferred_logger);
void actionOnBrokenConstraints(const Group& group, const Group::InjectionCMode& newControl, const int reportStepIdx, Opm::DeferredLogger& deferred_logger);
WellInterfacePtr getWell(const std::string& well_name) const;
void updateWsolvent(const Group2& group, const Schedule& schedule, const int reportStepIdx, const WellStateFullyImplicitBlackoil& wellState);
void updateWsolvent(const Group& group, const Schedule& schedule, const int reportStepIdx, const WellStateFullyImplicitBlackoil& wellState);
void setWsolvent(const Group2& group, const Schedule& schedule, const int reportStepIdx, double wsolvent);
void setWsolvent(const Group& group, const Schedule& schedule, const int reportStepIdx, double wsolvent);

View File

@@ -87,7 +87,7 @@ namespace Opm {
}
// Create cartesian to compressed mapping
const auto& schedule_wells = schedule().getWells2atEnd();
const auto& schedule_wells = schedule().getWellsatEnd();
const auto& cartesianSize = Opm::UgGridHelpers::cartDims(grid());
// initialize the additional cell connections introduced by wells.
@@ -213,7 +213,7 @@ namespace Opm {
const auto& defunct_well_names = ebosSimulator_.vanguard().defunctWellNames();
const auto& eclState = ebosSimulator_.vanguard().eclState();
const auto& summaryState = ebosSimulator_.vanguard().summaryState();
wells_ecl_ = schedule().getWells2(timeStepIdx);
wells_ecl_ = schedule().getWells(timeStepIdx);
// Create wells and well state.
wells_manager_.reset( new WellsManager (eclState,
@@ -309,7 +309,7 @@ namespace Opm {
well_state_.currentInjectionControls()[w] = controls.cmode;
}
}
const Group2& fieldGroup = schedule().getGroup2("FIELD", timeStepIdx);
const Group& fieldGroup = schedule().getGroup("FIELD", timeStepIdx);
wellGroupHelpers::setCmodeGroup(fieldGroup, schedule(), summaryState, timeStepIdx, well_state_);
// Compute reservoir volumes for RESV controls.
@@ -405,7 +405,7 @@ namespace Opm {
const double& waterpot = well_state_.wellPotentials()[well->indexOfWell() * np + phase_usage_.phase_pos[BlackoilPhases::Aqua]];
guideRate_->compute(well->name(), reportStepIdx, simulationTime, oilpot, gaspot, waterpot);
}
const Group2& fieldGroup = schedule().getGroup2("FIELD", reportStepIdx);
const Group& fieldGroup = schedule().getGroup("FIELD", reportStepIdx);
wellGroupHelpers::updateGuideRateForGroups(fieldGroup, schedule(), phase_usage_, reportStepIdx, simulationTime, guideRate_.get(), well_state_);
// compute wsolvent fraction for REIN wells
@@ -434,9 +434,9 @@ namespace Opm {
// some preparation before the well can be used
well->init(&phase_usage_, depth_, gravity_, number_of_cells_);
const Well2& wellEcl = schedule().getWell2(well_name, timeStepIdx);
const Well& wellEcl = schedule().getWell(well_name, timeStepIdx);
double well_efficiency_factor = wellEcl.getEfficiencyFactor();
wellGroupHelpers::accumulateGroupEfficiencyFactor(schedule().getGroup2(wellEcl.groupName(), timeStepIdx), schedule(), timeStepIdx, well_efficiency_factor);
wellGroupHelpers::accumulateGroupEfficiencyFactor(schedule().getGroup(wellEcl.groupName(), timeStepIdx), schedule(), timeStepIdx, well_efficiency_factor);
well->setWellEfficiencyFactor(well_efficiency_factor);
well->setVFPProperties(vfp_properties_.get());
well->setGuideRate(guideRate_.get());
@@ -562,7 +562,7 @@ namespace Opm {
const Wells* wells = wellsmanager.c_wells();
wells_ecl_ = schedule().getWells2(report_step);
wells_ecl_ = schedule().getWells(report_step);
const int nw = wells->number_of_wells;
if (nw > 0) {
@@ -644,7 +644,7 @@ namespace Opm {
OPM_DEFLOG_THROW(std::runtime_error, "Could not find well " + well_name + " in wells_ecl ", deferred_logger);
}
const Well2& well_ecl = wells_ecl_[index_well];
const Well& well_ecl = wells_ecl_[index_well];
// A new WCON keywords can re-open a well that was closed/shut due to Physical limit
if ( wellTestState_.hasWellClosed(well_name)) {
@@ -730,7 +730,7 @@ namespace Opm {
OPM_DEFLOG_THROW(std::logic_error, "Could not find well " << well_name << " in wells_ecl ", deferred_logger);
}
const Well2& well_ecl = wells_ecl_[index_well_ecl];
const Well& well_ecl = wells_ecl_[index_well_ecl];
// Finding the location of the well in wells struct.
const int nw = numLocalWells();
@@ -793,7 +793,7 @@ namespace Opm {
const int nupcol = schedule().getNupcol(reportStepIdx);
if (iterationIdx < nupcol) {
if( localWellsActive() ) {
const Group2& fieldGroup = schedule().getGroup2("FIELD", reportStepIdx);
const Group& fieldGroup = schedule().getGroup("FIELD", reportStepIdx);
std::vector<double> groupTargetReduction(numPhases(), 0.0);
wellGroupHelpers::updateGroupTargetReduction(fieldGroup, schedule(), reportStepIdx, /*isInjector*/ false, well_state_, groupTargetReduction);
std::vector<double> groupTargetReductionInj(numPhases(), 0.0);
@@ -1128,7 +1128,7 @@ namespace Opm {
// update group controls
if (checkGroupControl) {
const int reportStepIdx = ebosSimulator_.episodeIndex();
const Group2& fieldGroup = schedule().getGroup2("FIELD", reportStepIdx);
const Group& fieldGroup = schedule().getGroup("FIELD", reportStepIdx);
checkGroupConstraints(fieldGroup, deferred_logger);
}
@@ -1188,8 +1188,8 @@ namespace Opm {
summaryConfig.hasSummaryKey( "WOPP:" + well->name()) ||
summaryConfig.hasSummaryKey( "WGPP:" + well->name())) && well->wellType() == PRODUCER);
const Well2& eclWell = well->wellEcl();
bool needPotentialsForGuideRate = eclWell.getGuideRatePhase() == Well2::GuideRateTarget::UNDEFINED;
const Well& eclWell = well->wellEcl();
bool needPotentialsForGuideRate = eclWell.getGuideRatePhase() == Well::GuideRateTarget::UNDEFINED;
if (write_restart_file || needed_for_summary || needPotentialsForGuideRate)
{
std::vector<double> potentials;
@@ -1276,9 +1276,9 @@ namespace Opm {
}
for (auto& well : well_container_) {
const Well2& wellEcl = well->wellEcl();
const Well& wellEcl = well->wellEcl();
double well_efficiency_factor = wellEcl.getEfficiencyFactor();
wellGroupHelpers::accumulateGroupEfficiencyFactor(schedule().getGroup2(wellEcl.groupName(), reportStepIdx), schedule(), reportStepIdx, well_efficiency_factor);
wellGroupHelpers::accumulateGroupEfficiencyFactor(schedule().getGroup(wellEcl.groupName(), reportStepIdx), schedule(), reportStepIdx, well_efficiency_factor);
well->setWellEfficiencyFactor(well_efficiency_factor);
}
}
@@ -1490,8 +1490,8 @@ namespace Opm {
state.bhp()[ well_index ] = well.bhp;
state.temperature()[ well_index ] = well.temperature;
//state.currentInjectionControls()[ well_index ] = static_cast<Opm::Well2::InjectorCMode>(well.injectionControl);
//state.currentProductionControls()[ well_index ] = static_cast<Well2::ProducerCMode>(well.productionControl);
//state.currentInjectionControls()[ well_index ] = static_cast<Opm::Well::InjectorCMode>(well.injectionControl);
//state.currentProductionControls()[ well_index ] = static_cast<Well::ProducerCMode>(well.productionControl);
const auto wellrate_index = well_index * np;
for( size_t i = 0; i < phs.size(); ++i ) {
@@ -1528,7 +1528,7 @@ namespace Opm {
if (handle_ms_well && !well.segments.empty()) {
// we need the well_ecl_ information
const std::string& well_name = wm.first;
const Well2& well_ecl = getWellEcl(well_name);
const Well& well_ecl = getWellEcl(well_name);
const WellSegments& segment_set = well_ecl.getSegments();
@@ -1568,7 +1568,7 @@ namespace Opm {
for (int w = 0; w < nw; ++w) {
const std::string well_name = std::string(wells->name[w]);
const Well2& well_ecl = getWellEcl(well_name);
const Well& well_ecl = getWellEcl(well_name);
if (well_ecl.isMultiSegment() ) {
any_ms_well_open = true;
@@ -1583,14 +1583,14 @@ namespace Opm {
template<typename TypeTag>
const Well2&
const Well&
BlackoilWellModel<TypeTag>::
getWellEcl(const std::string& well_name) const
{
// finding the iterator of the well in wells_ecl
auto well_ecl = std::find_if(wells_ecl_.begin(),
wells_ecl_.end(),
[&well_name](const Well2& elem)->bool {
[&well_name](const Well& elem)->bool {
return elem.name() == well_name;
});
@@ -1621,12 +1621,12 @@ namespace Opm {
template<typename TypeTag>
void
BlackoilWellModel<TypeTag>::
checkGroupConstraints(const Group2& group, Opm::DeferredLogger& deferred_logger) {
checkGroupConstraints(const Group& group, Opm::DeferredLogger& deferred_logger) {
// call recursively
const int reportStepIdx = ebosSimulator_.episodeIndex();
for (const std::string& groupName : group.groups()) {
checkGroupConstraints( schedule().getGroup2(groupName, reportStepIdx), deferred_logger);
checkGroupConstraints( schedule().getGroup(groupName, reportStepIdx), deferred_logger);
}
const auto& summaryState = ebosSimulator_.vanguard().summaryState();
@@ -1656,42 +1656,42 @@ namespace Opm {
throw("Expected WATER, OIL or GAS as type for group injector: " + group.name());
}
if (group.has_control(Group2::InjectionCMode::NONE))
if (group.has_control(Group::InjectionCMode::NONE))
{
// do nothing??
}
if (group.has_control(Group2::InjectionCMode::RATE))
if (group.has_control(Group::InjectionCMode::RATE))
{
double current_rate = 0.0;
current_rate += wellGroupHelpers::sumWellRates(group, schedule(), well_state, reportStepIdx, phasePos, /*isInjector*/true);
if (controls.surface_max_rate < current_rate) {
actionOnBrokenConstraints(group, Group2::InjectionCMode::RATE, reportStepIdx, deferred_logger);
actionOnBrokenConstraints(group, Group::InjectionCMode::RATE, reportStepIdx, deferred_logger);
}
}
if (group.has_control(Group2::InjectionCMode::RESV))
if (group.has_control(Group::InjectionCMode::RESV))
{
double current_rate = 0.0;
current_rate += wellGroupHelpers::sumWellResRates(group, schedule(), well_state, reportStepIdx, phasePos, /*isInjector*/true);
if (controls.resv_max_rate < current_rate) {
actionOnBrokenConstraints(group, Group2::InjectionCMode::RESV, reportStepIdx, deferred_logger);
actionOnBrokenConstraints(group, Group::InjectionCMode::RESV, reportStepIdx, deferred_logger);
} }
if (group.has_control(Group2::InjectionCMode::REIN))
if (group.has_control(Group::InjectionCMode::REIN))
{
double production_Rate = 0.0;
const Group2& groupRein = schedule().getGroup2(controls.reinj_group, reportStepIdx);
const Group& groupRein = schedule().getGroup(controls.reinj_group, reportStepIdx);
production_Rate += wellGroupHelpers::sumWellRates(groupRein, schedule(), well_state, reportStepIdx, phasePos, /*isInjector*/false);
double current_rate = 0.0;
current_rate += wellGroupHelpers::sumWellRates(group, schedule(), well_state, reportStepIdx, phasePos, /*isInjector*/true);
if (controls.target_reinj_fraction*production_Rate < current_rate) {
actionOnBrokenConstraints(group, Group2::InjectionCMode::REIN, reportStepIdx, deferred_logger);
actionOnBrokenConstraints(group, Group::InjectionCMode::REIN, reportStepIdx, deferred_logger);
} }
if (group.has_control(Group2::InjectionCMode::VREP))
if (group.has_control(Group::InjectionCMode::VREP))
{
double voidage_rate = 0.0;
const Group2& groupVoidage = schedule().getGroup2(controls.voidage_group, reportStepIdx);
const Group& groupVoidage = schedule().getGroup(controls.voidage_group, reportStepIdx);
voidage_rate += wellGroupHelpers::sumWellResRates(groupVoidage, schedule(), well_state, reportStepIdx, phase_usage_.phase_pos[BlackoilPhases::Aqua], false);
voidage_rate += wellGroupHelpers::sumWellResRates(groupVoidage, schedule(), well_state, reportStepIdx, phase_usage_.phase_pos[BlackoilPhases::Liquid], false);
voidage_rate += wellGroupHelpers::sumWellResRates(groupVoidage, schedule(), well_state, reportStepIdx, phase_usage_.phase_pos[BlackoilPhases::Vapour], false);
@@ -1702,10 +1702,10 @@ namespace Opm {
total_rate += wellGroupHelpers::sumWellResRates(group, schedule(), well_state, reportStepIdx, phase_usage_.phase_pos[BlackoilPhases::Vapour], true);
if (controls.target_void_fraction*voidage_rate < total_rate) {
actionOnBrokenConstraints(group, Group2::InjectionCMode::VREP, reportStepIdx, deferred_logger);
actionOnBrokenConstraints(group, Group::InjectionCMode::VREP, reportStepIdx, deferred_logger);
}
}
if (group.has_control(Group2::InjectionCMode::FLD))
if (group.has_control(Group::InjectionCMode::FLD))
{
// do nothing???
//OPM_THROW(std::runtime_error, "Group " + group.name() + "FLD control for injecting groups not implemented" );
@@ -1715,52 +1715,52 @@ namespace Opm {
{
const auto controls = group.productionControls(summaryState);
if (group.has_control(Group2::ProductionCMode::NONE))
if (group.has_control(Group::ProductionCMode::NONE))
{
}
if (group.has_control(Group2::ProductionCMode::ORAT))
if (group.has_control(Group::ProductionCMode::ORAT))
{
double current_rate = 0.0;
current_rate += wellGroupHelpers::sumWellRates(group, schedule(), well_state, reportStepIdx, phase_usage_.phase_pos[BlackoilPhases::Liquid], false);
if (controls.oil_target < current_rate ) {
actionOnBrokenConstraints(group, controls.exceed_action, Group2::ProductionCMode::ORAT, reportStepIdx, deferred_logger);
actionOnBrokenConstraints(group, controls.exceed_action, Group::ProductionCMode::ORAT, reportStepIdx, deferred_logger);
}
}
if (group.has_control(Group2::ProductionCMode::WRAT))
if (group.has_control(Group::ProductionCMode::WRAT))
{
double current_rate = 0.0;
current_rate += wellGroupHelpers::sumWellRates(group, schedule(), well_state, reportStepIdx, phase_usage_.phase_pos[BlackoilPhases::Aqua], false);
if (controls.water_target < current_rate ) {
actionOnBrokenConstraints(group, controls.exceed_action, Group2::ProductionCMode::WRAT, reportStepIdx, deferred_logger);
actionOnBrokenConstraints(group, controls.exceed_action, Group::ProductionCMode::WRAT, reportStepIdx, deferred_logger);
}
}
if (group.has_control(Group2::ProductionCMode::GRAT))
if (group.has_control(Group::ProductionCMode::GRAT))
{
double current_rate = 0.0;
current_rate += wellGroupHelpers::sumWellRates(group, schedule(), well_state, reportStepIdx, phase_usage_.phase_pos[BlackoilPhases::Vapour], false);
if (controls.gas_target < current_rate ) {
actionOnBrokenConstraints(group, controls.exceed_action, Group2::ProductionCMode::GRAT, reportStepIdx, deferred_logger);
actionOnBrokenConstraints(group, controls.exceed_action, Group::ProductionCMode::GRAT, reportStepIdx, deferred_logger);
}
}
if (group.has_control(Group2::ProductionCMode::LRAT))
if (group.has_control(Group::ProductionCMode::LRAT))
{
double current_rate = 0.0;
current_rate += wellGroupHelpers::sumWellRates(group, schedule(), well_state, reportStepIdx, phase_usage_.phase_pos[BlackoilPhases::Liquid], false);
current_rate += wellGroupHelpers::sumWellRates(group, schedule(), well_state, reportStepIdx, phase_usage_.phase_pos[BlackoilPhases::Aqua], false);
if (controls.liquid_target < current_rate ) {
actionOnBrokenConstraints(group, controls.exceed_action, Group2::ProductionCMode::LRAT, reportStepIdx, deferred_logger);
actionOnBrokenConstraints(group, controls.exceed_action, Group::ProductionCMode::LRAT, reportStepIdx, deferred_logger);
}
}
if (group.has_control(Group2::ProductionCMode::CRAT))
if (group.has_control(Group::ProductionCMode::CRAT))
{
OPM_DEFLOG_THROW(std::runtime_error, "Group " + group.name() + "CRAT control for production groups not implemented" , deferred_logger);
}
if (group.has_control(Group2::ProductionCMode::RESV))
if (group.has_control(Group::ProductionCMode::RESV))
{
double current_rate = 0.0;
current_rate += wellGroupHelpers::sumWellResRates(group, schedule(), well_state, reportStepIdx, phase_usage_.phase_pos[BlackoilPhases::Aqua], true);
@@ -1768,15 +1768,15 @@ namespace Opm {
current_rate += wellGroupHelpers::sumWellResRates(group, schedule(), well_state, reportStepIdx, phase_usage_.phase_pos[BlackoilPhases::Vapour], true);
if (controls.resv_target < current_rate ) {
actionOnBrokenConstraints(group, controls.exceed_action, Group2::ProductionCMode::RESV, reportStepIdx, deferred_logger);
actionOnBrokenConstraints(group, controls.exceed_action, Group::ProductionCMode::RESV, reportStepIdx, deferred_logger);
}
}
if (group.has_control(Group2::ProductionCMode::PRBL))
if (group.has_control(Group::ProductionCMode::PRBL))
{
OPM_DEFLOG_THROW(std::runtime_error, "Group " + group.name() + "PRBL control for production groups not implemented", deferred_logger);
}
if (group.has_control(Group2::ProductionCMode::FLD))
if (group.has_control(Group::ProductionCMode::FLD))
{
// do nothing???
}
@@ -1792,43 +1792,43 @@ namespace Opm {
template<typename TypeTag>
void
BlackoilWellModel<TypeTag>::
actionOnBrokenConstraints(const Group2& group, const Group2::ExceedAction& exceed_action, const Group2::ProductionCMode& newControl, const int reportStepIdx, Opm::DeferredLogger& deferred_logger) {
actionOnBrokenConstraints(const Group& group, const Group::ExceedAction& exceed_action, const Group::ProductionCMode& newControl, const int reportStepIdx, Opm::DeferredLogger& deferred_logger) {
auto& well_state = well_state_;
const Group2::ProductionCMode& oldControl = well_state.currentProductionGroupControl(group.name());
const Group::ProductionCMode& oldControl = well_state.currentProductionGroupControl(group.name());
std::ostringstream ss;
if (oldControl != newControl) {
const std::string from = Group2::ProductionCMode2String(oldControl);
const std::string from = Group::ProductionCMode2String(oldControl);
ss << "Group " << group.name() << " exceeding "
<< from << " limit \n";
}
switch(exceed_action) {
case Group2::ExceedAction::NONE: {
case Group::ExceedAction::NONE: {
OPM_DEFLOG_THROW(std::runtime_error, "Group " + group.name() + "GroupProductionExceedLimit NONE not implemented", deferred_logger);
break;
}
case Group2::ExceedAction::CON: {
case Group::ExceedAction::CON: {
OPM_DEFLOG_THROW(std::runtime_error, "Group " + group.name() + "GroupProductionExceedLimit CON not implemented", deferred_logger);
break;
}
case Group2::ExceedAction::CON_PLUS: {
case Group::ExceedAction::CON_PLUS: {
OPM_DEFLOG_THROW(std::runtime_error, "Group " + group.name() + "GroupProductionExceedLimit CON_PLUS not implemented", deferred_logger);
break;
}
case Group2::ExceedAction::WELL: {
case Group::ExceedAction::WELL: {
OPM_DEFLOG_THROW(std::runtime_error, "Group " + group.name() + "GroupProductionExceedLimit WELL not implemented", deferred_logger);
break;
}
case Group2::ExceedAction::PLUG: {
case Group::ExceedAction::PLUG: {
OPM_DEFLOG_THROW(std::runtime_error, "Group " + group.name() + "GroupProductionExceedLimit PLUG not implemented", deferred_logger);
break;
}
case Group2::ExceedAction::RATE: {
case Group::ExceedAction::RATE: {
if (oldControl != newControl) {
well_state.setCurrentProductionGroupControl(group.name(), newControl);
ss << "Switching control mode for group to " << Group2::ProductionCMode2String(newControl);
ss << "Switching control mode for group to " << Group::ProductionCMode2String(newControl);
}
wellGroupHelpers::setGroupControl(group, schedule(), reportStepIdx, false, well_state, ss);
break;
@@ -1851,16 +1851,16 @@ namespace Opm {
template<typename TypeTag>
void
BlackoilWellModel<TypeTag>::
actionOnBrokenConstraints(const Group2& group, const Group2::InjectionCMode& newControl, const int reportStepIdx, Opm::DeferredLogger& deferred_logger) {
actionOnBrokenConstraints(const Group& group, const Group::InjectionCMode& newControl, const int reportStepIdx, Opm::DeferredLogger& deferred_logger) {
auto& well_state = well_state_;
const Group2::InjectionCMode& oldControl = well_state.currentInjectionGroupControl(group.name());
const Group::InjectionCMode& oldControl = well_state.currentInjectionGroupControl(group.name());
std::ostringstream ss;
if (oldControl != newControl) {
const std::string from = Group2::InjectionCMode2String(oldControl);
const std::string from = Group::InjectionCMode2String(oldControl);
ss << "Group " << group.name() << " exceeding "
<< from << " limit \n";
ss << "Switching control mode for group to " << Group2::InjectionCMode2String(newControl);
ss << "Switching control mode for group to " << Group::InjectionCMode2String(newControl);
auto cc = Dune::MPIHelper::getCollectiveCommunication();
if (cc.size() > 1) {
ss << " on rank " << cc.rank();
@@ -1877,17 +1877,17 @@ namespace Opm {
template<typename TypeTag>
void
BlackoilWellModel<TypeTag>::
updateWsolvent(const Group2& group, const Schedule& schedule, const int reportStepIdx, const WellStateFullyImplicitBlackoil& wellState) {
updateWsolvent(const Group& group, const Schedule& schedule, const int reportStepIdx, const WellStateFullyImplicitBlackoil& wellState) {
for (const std::string& groupName : group.groups()) {
const Group2& groupTmp = schedule.getGroup2(groupName, reportStepIdx);
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
updateWsolvent(groupTmp, schedule, reportStepIdx, wellState);
}
if (group.isProductionGroup())
return;
const Group2::InjectionCMode& currentGroupControl = wellState.currentInjectionGroupControl(group.name());
if( currentGroupControl == Group2::InjectionCMode::REIN ) {
const Group::InjectionCMode& currentGroupControl = wellState.currentInjectionGroupControl(group.name());
if( currentGroupControl == Group::InjectionCMode::REIN ) {
int gasPos = phase_usage_.phase_pos[BlackoilPhases::Vapour];
double gasProductionRate = wellGroupHelpers::sumWellRates(group, schedule, wellState, reportStepIdx, gasPos, /*isInjector*/false);
double solventProductionRate = wellGroupHelpers::sumSolventRates(group, schedule, wellState, reportStepIdx, /*isInjector*/false);
@@ -1903,15 +1903,15 @@ namespace Opm {
template<typename TypeTag>
void
BlackoilWellModel<TypeTag>::
setWsolvent(const Group2& group, const Schedule& schedule, const int reportStepIdx, double wsolvent) {
setWsolvent(const Group& group, const Schedule& schedule, const int reportStepIdx, double wsolvent) {
for (const std::string& groupName : group.groups()) {
const Group2& groupTmp = schedule.getGroup2(groupName, reportStepIdx);
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
setWsolvent(groupTmp, schedule, reportStepIdx, wsolvent);
}
for (const std::string& wellName : group.wells()) {
const auto& wellTmp = schedule.getWell2(wellName, reportStepIdx);
if (wellTmp.getStatus() == Well2::Status::SHUT)
const auto& wellTmp = schedule.getWell(wellName, reportStepIdx);
if (wellTmp.getStatus() == Well::Status::SHUT)
continue;
auto well = getWell(wellName);

View File

@@ -98,7 +98,7 @@ namespace Opm
// TODO: for now, we only use one type to save some implementation efforts, while improve later.
typedef DenseAd::Evaluation<double, /*size=*/numEq + numWellEq> EvalWell;
MultisegmentWell(const Well2& well, const int time_step, const Wells* wells,
MultisegmentWell(const Well& well, const int time_step, const Wells* wells,
const ModelParameters& param,
const RateConverterType& rate_converter,
const int pvtRegionIdx,
@@ -323,7 +323,7 @@ namespace Opm
template <class ValueType>
ValueType calculateBhpFromThp(const std::vector<ValueType>& rates, const Well2& well, const SummaryState& summaryState, Opm::DeferredLogger& deferred_logger) const;
ValueType calculateBhpFromThp(const std::vector<ValueType>& rates, const Well& well, const SummaryState& summaryState, Opm::DeferredLogger& deferred_logger) const;
double calculateThpFromBhp(const std::vector<double>& rates, const double bhp, Opm::DeferredLogger& deferred_logger) const;
void updateThp(WellState& well_state, Opm::DeferredLogger& deferred_logger) const;
@@ -352,8 +352,8 @@ namespace Opm
Opm::DeferredLogger& deferred_logger);
void assembleControlEq(const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, Opm::DeferredLogger& deferred_logger);
void assembleGroupProductionControl(const Group2& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, EvalWell& control_eq, double efficincyFactor, Opm::DeferredLogger& deferred_logger);
void assembleGroupInjectionControl(const Group2& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, const Well2::InjectorType& injectorType, EvalWell& control_eq, double efficincyFactor, Opm::DeferredLogger& deferred_logger);
void assembleGroupProductionControl(const Group& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, EvalWell& control_eq, double efficincyFactor, Opm::DeferredLogger& deferred_logger);
void assembleGroupInjectionControl(const Group& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, const Well::InjectorType& injectorType, EvalWell& control_eq, double efficincyFactor, Opm::DeferredLogger& deferred_logger);
void assemblePressureEq(const int seg) const;

View File

@@ -28,7 +28,7 @@ namespace Opm
template <typename TypeTag>
MultisegmentWell<TypeTag>::
MultisegmentWell(const Well2& well, const int time_step, const Wells* wells,
MultisegmentWell(const Well& well, const int time_step, const Wells* wells,
const ModelParameters& param,
const RateConverterType& rate_converter,
const int pvtRegionIdx,
@@ -287,20 +287,20 @@ namespace Opm
{
const auto& controls = well.injectionControls(summaryState);
Well2::InjectorType injectorType = controls.injector_type;
Well::InjectorType injectorType = controls.injector_type;
int phasePos;
switch (injectorType) {
case Well2::InjectorType::WATER:
case Well::InjectorType::WATER:
{
phasePos = pu.phase_pos[BlackoilPhases::Aqua];
break;
}
case Well2::InjectorType::OIL:
case Well::InjectorType::OIL:
{
phasePos = pu.phase_pos[BlackoilPhases::Liquid];
break;
}
case Well2::InjectorType::GAS:
case Well::InjectorType::GAS:
{
phasePos = pu.phase_pos[BlackoilPhases::Vapour];
break;
@@ -309,16 +309,16 @@ namespace Opm
throw("Expected WATER, OIL or GAS as type for injectors " + well.name());
}
const Opm::Well2::InjectorCMode& current = well_state.currentInjectionControls()[well_index];
const Opm::Well::InjectorCMode& current = well_state.currentInjectionControls()[well_index];
switch(current) {
case Well2::InjectorCMode::RATE:
case Well::InjectorCMode::RATE:
{
well_state.wellRates()[well_index*np + phasePos] = controls.surface_rate;
break;
}
case Well2::InjectorCMode::RESV:
case Well::InjectorCMode::RESV:
{
std::vector<double> convert_coeff(number_of_phases_, 1.0);
Base::rateConverter_.calcCoeff(/*fipreg*/ 0, Base::pvtRegionIdx_, convert_coeff);
@@ -327,7 +327,7 @@ namespace Opm
break;
}
case Well2::InjectorCMode::THP:
case Well::InjectorCMode::THP:
{
std::vector<double> rates(3, 0.0);
for (int p = 0; p<np; ++p) {
@@ -337,17 +337,17 @@ namespace Opm
well_state.bhp()[well_index] = bhp;
break;
}
case Well2::InjectorCMode::BHP:
case Well::InjectorCMode::BHP:
{
well_state.segPress()[top_segment_index] = controls.bhp_limit;
break;
}
case Well2::InjectorCMode::GRUP:
case Well::InjectorCMode::GRUP:
{
//do nothing at the moment
break;
}
case Well2::InjectorCMode::CMODE_UNDEFINED:
case Well::InjectorCMode::CMODE_UNDEFINED:
{
OPM_DEFLOG_THROW(std::runtime_error, "Well control must be specified for well " + name(), deferred_logger );
}
@@ -357,11 +357,11 @@ namespace Opm
//Producer
else
{
const Well2::ProducerCMode& current = well_state.currentProductionControls()[well_index];
const Well::ProducerCMode& current = well_state.currentProductionControls()[well_index];
const auto& controls = well.productionControls(summaryState);
switch (current) {
case Well2::ProducerCMode::ORAT:
case Well::ProducerCMode::ORAT:
{
double current_rate = -well_state.wellRates()[ well_index*np + pu.phase_pos[Oil] ];
@@ -373,7 +373,7 @@ namespace Opm
}
break;
}
case Well2::ProducerCMode::WRAT:
case Well::ProducerCMode::WRAT:
{
double current_rate = -well_state.wellRates()[ well_index*np + pu.phase_pos[Water] ];
@@ -385,7 +385,7 @@ namespace Opm
}
break;
}
case Well2::ProducerCMode::GRAT:
case Well::ProducerCMode::GRAT:
{
double current_rate = -well_state.wellRates()[ well_index*np + pu.phase_pos[Gas] ];
@@ -398,7 +398,7 @@ namespace Opm
break;
}
case Well2::ProducerCMode::LRAT:
case Well::ProducerCMode::LRAT:
{
double current_rate = -well_state.wellRates()[ well_index*np + pu.phase_pos[Water] ]
- well_state.wellRates()[ well_index*np + pu.phase_pos[Oil] ];
@@ -411,11 +411,11 @@ namespace Opm
}
break;
}
case Well2::ProducerCMode::CRAT:
case Well::ProducerCMode::CRAT:
{
OPM_DEFLOG_THROW(std::runtime_error, "CRAT control not supported " << name(), deferred_logger);
}
case Well2::ProducerCMode::RESV:
case Well::ProducerCMode::RESV:
{
std::vector<double> convert_coeff(number_of_phases_, 1.0);
Base::rateConverter_.calcCoeff(/*fipreg*/ 0, Base::pvtRegionIdx_, convert_coeff);
@@ -451,12 +451,12 @@ namespace Opm
}
break;
}
case Well2::ProducerCMode::BHP:
case Well::ProducerCMode::BHP:
{
well_state.segPress()[top_segment_index] = controls.bhp_limit;
break;
}
case Well2::ProducerCMode::THP:
case Well::ProducerCMode::THP:
{
std::vector<double> rates(3, 0.0);
for (int p = 0; p<np; ++p) {
@@ -466,16 +466,16 @@ namespace Opm
well_state.bhp()[well_index] = bhp;
break;
}
case Well2::ProducerCMode::GRUP:
case Well::ProducerCMode::GRUP:
{
//do nothing at the moment
break;
}
case Well2::ProducerCMode::CMODE_UNDEFINED:
case Well::ProducerCMode::CMODE_UNDEFINED:
{
OPM_DEFLOG_THROW(std::runtime_error, "Well control must be specified for well " + name(), deferred_logger );
}
case Well2::ProducerCMode::NONE:
case Well::ProducerCMode::NONE:
{
OPM_DEFLOG_THROW(std::runtime_error, "Well control must be specified for well " + name() , deferred_logger);
}
@@ -726,7 +726,7 @@ namespace Opm
// TODO: to test using rate conversion coefficients to see if it will be better than
// this default one
const Well2& well = Base::wellEcl();
const Well& well = Base::wellEcl();
// the index of the top segment in the WellState
const int top_segment_index = well_state.topSegmentIndex(index_of_well_);
@@ -761,7 +761,7 @@ namespace Opm
auto phase = well.getInjectionProperties().injectorType;
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
if (phase == Well2::InjectorType::WATER) {
if (phase == Well::InjectorType::WATER) {
primary_variables_[seg][WFrac] = 1.0;
} else {
primary_variables_[seg][WFrac] = 0.0;
@@ -769,7 +769,7 @@ namespace Opm
}
if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) {
if (phase == Well2::InjectorType::GAS) {
if (phase == Well::InjectorType::GAS) {
primary_variables_[seg][GFrac] = 1.0;
} else {
primary_variables_[seg][GFrac] = 0.0;
@@ -1517,23 +1517,23 @@ namespace Opm
// and the derivatives with respect to WFrac GFrac in segment seg_upwind.
// the derivative with respect to SPres should be zero.
if (seg == 0 && well_type_ == INJECTOR) {
const Well2& well = Base::wellEcl();
const Well& well = Base::wellEcl();
auto phase = well.getInjectionProperties().injectorType;
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)
&& Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx) == comp_idx
&& phase == Well2::InjectorType::WATER)
&& phase == Well::InjectorType::WATER)
return primary_variables_evaluation_[seg][GTotal] / scalingFactor(ebosCompIdxToFlowCompIdx(comp_idx));
if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)
&& Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx) == comp_idx
&& phase == Well2::InjectorType::OIL)
&& phase == Well::InjectorType::OIL)
return primary_variables_evaluation_[seg][GTotal] / scalingFactor(ebosCompIdxToFlowCompIdx(comp_idx));
if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)
&& Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx) == comp_idx
&& phase == Well2::InjectorType::GAS)
&& phase == Well::InjectorType::GAS)
return primary_variables_evaluation_[seg][GTotal] / scalingFactor(ebosCompIdxToFlowCompIdx(comp_idx));
return 0.0;
@@ -1631,26 +1631,26 @@ namespace Opm
if (wellIsStopped_) {
control_eq = getSegmentGTotal(0);
} else if (well.isInjector() ) {
const Opm::Well2::InjectorCMode& current = well_state.currentInjectionControls()[well_index];
const Opm::Well::InjectorCMode& current = well_state.currentInjectionControls()[well_index];
const auto controls = well.injectionControls(summaryState);
Well2::InjectorType injectorType = controls.injector_type;
Well::InjectorType injectorType = controls.injector_type;
double scaling = 1.0;
const auto& pu = phaseUsage();
switch (injectorType) {
case Well2::InjectorType::WATER:
case Well::InjectorType::WATER:
{
scaling = scalingFactor(pu.phase_pos[BlackoilPhases::Aqua]);
break;
}
case Well2::InjectorType::OIL:
case Well::InjectorType::OIL:
{
scaling = scalingFactor(pu.phase_pos[BlackoilPhases::Liquid]);
break;
}
case Well2::InjectorType::GAS:
case Well::InjectorType::GAS:
{
scaling = scalingFactor(pu.phase_pos[BlackoilPhases::Vapour]);
break;
@@ -1660,13 +1660,13 @@ namespace Opm
}
switch(current) {
case Well2::InjectorCMode::RATE:
case Well::InjectorCMode::RATE:
{
control_eq = getSegmentGTotal(0) * efficiencyFactor / scaling - controls.surface_rate;
break;
}
case Well2::InjectorCMode::RESV:
case Well::InjectorCMode::RESV:
{
std::vector<double> convert_coeff(number_of_phases_, 1.0);
Base::rateConverter_.calcCoeff(/*fipreg*/ 0, Base::pvtRegionIdx_, convert_coeff);
@@ -1674,17 +1674,17 @@ namespace Opm
double coeff = 1.0;
switch (injectorType) {
case Well2::InjectorType::WATER:
case Well::InjectorType::WATER:
{
coeff = convert_coeff[pu.phase_pos[BlackoilPhases::Aqua]];
break;
}
case Well2::InjectorType::OIL:
case Well::InjectorType::OIL:
{
coeff = convert_coeff[pu.phase_pos[BlackoilPhases::Liquid]];
break;
}
case Well2::InjectorType::GAS:
case Well::InjectorType::GAS:
{
coeff = convert_coeff[pu.phase_pos[BlackoilPhases::Vapour]];
break;
@@ -1698,7 +1698,7 @@ namespace Opm
break;
}
case Well2::InjectorCMode::THP:
case Well::InjectorCMode::THP:
{
std::vector<EvalWell> rates(3, 0.);
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
@@ -1712,20 +1712,20 @@ namespace Opm
}
control_eq = getSegmentPressure(0) - calculateBhpFromThp(rates, well, summaryState, deferred_logger);
break; }
case Well2::InjectorCMode::BHP:
case Well::InjectorCMode::BHP:
{
const auto& bhp = controls.bhp_limit;
control_eq = getSegmentPressure(0) - bhp;
break;
}
case Well2::InjectorCMode::GRUP:
case Well::InjectorCMode::GRUP:
{
assert(well.isAvailableForGroupControl());
const auto& group = schedule.getGroup2( well.groupName(), current_step_ );
const auto& group = schedule.getGroup( well.groupName(), current_step_ );
assembleGroupInjectionControl(group, well_state, schedule, summaryState, controls.injector_type, control_eq, efficiencyFactor, deferred_logger);
break;
}
case Well2::InjectorCMode::CMODE_UNDEFINED:
case Well::InjectorCMode::CMODE_UNDEFINED:
{
OPM_DEFLOG_THROW(std::runtime_error, "Well control must be specified for well " + name(), deferred_logger);
}
@@ -1736,25 +1736,25 @@ namespace Opm
//Producer
else
{
const Well2::ProducerCMode& current = well_state.currentProductionControls()[well_index];
const Well::ProducerCMode& current = well_state.currentProductionControls()[well_index];
const auto controls = well.productionControls(summaryState);
switch (current) {
case Well2::ProducerCMode::ORAT:
case Well::ProducerCMode::ORAT:
{
assert(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx));
const EvalWell& rate = -getSegmentRate(0, Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx));
control_eq = rate * efficiencyFactor - controls.oil_rate;
break;
}
case Well2::ProducerCMode::WRAT:
case Well::ProducerCMode::WRAT:
{
assert(FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx));
const EvalWell& rate = -getSegmentRate(0, Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx));
control_eq = rate * efficiencyFactor - controls.water_rate;
break;
}
case Well2::ProducerCMode::GRAT:
case Well::ProducerCMode::GRAT:
{
assert(FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx));
const EvalWell& rate = -getSegmentRate(0, Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx));
@@ -1762,7 +1762,7 @@ namespace Opm
break;
}
case Well2::ProducerCMode::LRAT:
case Well::ProducerCMode::LRAT:
{
assert(FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx));
assert(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx));
@@ -1771,11 +1771,11 @@ namespace Opm
control_eq = rate * efficiencyFactor - controls.liquid_rate;
break;
}
case Well2::ProducerCMode::CRAT:
case Well::ProducerCMode::CRAT:
{
OPM_DEFLOG_THROW(std::runtime_error, "CRAT control not supported " << name(), deferred_logger);
}
case Well2::ProducerCMode::RESV:
case Well::ProducerCMode::RESV:
{
EvalWell total_rate(0.); // reservoir rate
std::vector<double> convert_coeff(number_of_phases_, 1.0);
@@ -1805,12 +1805,12 @@ namespace Opm
}
break;
}
case Well2::ProducerCMode::BHP:
case Well::ProducerCMode::BHP:
{
control_eq = getSegmentPressure(0) - controls.bhp_limit;
break;
}
case Well2::ProducerCMode::THP:
case Well::ProducerCMode::THP:
{
std::vector<EvalWell> rates(3, 0.);
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
@@ -1824,19 +1824,19 @@ namespace Opm
}
control_eq = getSegmentPressure(0) - calculateBhpFromThp(rates, well, summaryState, deferred_logger);
break; }
case Well2::ProducerCMode::GRUP:
case Well::ProducerCMode::GRUP:
{
assert(well.isAvailableForGroupControl());
const auto& group = schedule.getGroup2( well.groupName(), current_step_ );
const auto& group = schedule.getGroup( well.groupName(), current_step_ );
assembleGroupProductionControl(group, well_state, schedule, summaryState, control_eq, efficiencyFactor, deferred_logger);
break;
}
case Well2::ProducerCMode::CMODE_UNDEFINED:
case Well::ProducerCMode::CMODE_UNDEFINED:
{
OPM_DEFLOG_THROW(std::runtime_error, "Well control must be specified for well " + name(), deferred_logger );
}
case Well2::ProducerCMode::NONE:
case Well::ProducerCMode::NONE:
{
OPM_DEFLOG_THROW(std::runtime_error, "Well control must be specified for well " + name(), deferred_logger );
}
@@ -1931,7 +1931,7 @@ namespace Opm
ValueType
MultisegmentWell<TypeTag>::
calculateBhpFromThp(const std::vector<ValueType>& rates,
const Well2& well,
const Well& well,
const SummaryState& summaryState,
Opm::DeferredLogger& deferred_logger) const
{
@@ -1975,14 +1975,14 @@ namespace Opm
template <typename TypeTag>
void
MultisegmentWell<TypeTag>::
assembleGroupInjectionControl(const Group2& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, const Well2::InjectorType& injectorType, EvalWell& control_eq, double efficiencyFactor, Opm::DeferredLogger& deferred_logger)
assembleGroupInjectionControl(const Group& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, const Well::InjectorType& injectorType, EvalWell& control_eq, double efficiencyFactor, Opm::DeferredLogger& deferred_logger)
{
const auto& well = well_ecl_;
const auto pu = phaseUsage();
const Group2::InjectionCMode& currentGroupControl = well_state.currentInjectionGroupControl(group.name());
if (currentGroupControl == Group2::InjectionCMode::FLD) {
const Group::InjectionCMode& currentGroupControl = well_state.currentInjectionGroupControl(group.name());
if (currentGroupControl == Group::InjectionCMode::FLD) {
// Inject share of parents control
const auto& parent = schedule.getGroup2( group.parent(), current_step_ );
const auto& parent = schedule.getGroup( group.parent(), current_step_ );
if (group.getTransferGroupEfficiencyFactor())
efficiencyFactor *= group.getGroupEfficiencyFactor();
@@ -1996,32 +1996,32 @@ namespace Opm
const auto& groupcontrols = group.injectionControls(summaryState);
int phasePos;
Well2::GuideRateTarget wellTarget;
Group2::GuideRateTarget groupTarget;
Well::GuideRateTarget wellTarget;
Group::GuideRateTarget groupTarget;
double scaling = 1.0;
switch (injectorType) {
case Well2::InjectorType::WATER:
case Well::InjectorType::WATER:
{
phasePos = pu.phase_pos[BlackoilPhases::Aqua];
wellTarget = Well2::GuideRateTarget::WAT;
groupTarget = Group2::GuideRateTarget::WAT;
wellTarget = Well::GuideRateTarget::WAT;
groupTarget = Group::GuideRateTarget::WAT;
scaling = scalingFactor(pu.phase_pos[BlackoilPhases::Aqua]);
break;
}
case Well2::InjectorType::OIL:
case Well::InjectorType::OIL:
{
phasePos = pu.phase_pos[BlackoilPhases::Liquid];
wellTarget = Well2::GuideRateTarget::OIL;
groupTarget = Group2::GuideRateTarget::OIL;
wellTarget = Well::GuideRateTarget::OIL;
groupTarget = Group::GuideRateTarget::OIL;
scaling = scalingFactor(pu.phase_pos[BlackoilPhases::Liquid]);
break;
}
case Well2::InjectorType::GAS:
case Well::InjectorType::GAS:
{
phasePos = pu.phase_pos[BlackoilPhases::Vapour];
wellTarget = Well2::GuideRateTarget::GAS;
groupTarget = Group2::GuideRateTarget::GAS;
wellTarget = Well::GuideRateTarget::GAS;
groupTarget = Group::GuideRateTarget::GAS;
scaling = scalingFactor(pu.phase_pos[BlackoilPhases::Vapour]);
break;
}
@@ -2035,18 +2035,18 @@ namespace Opm
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, groupTarget, /*isInjector*/true, fraction);
switch(currentGroupControl) {
case Group2::InjectionCMode::NONE:
case Group::InjectionCMode::NONE:
{
OPM_DEFLOG_THROW(std::runtime_error, "NONE group control not implemented for injectors" , deferred_logger);
break;
}
case Group2::InjectionCMode::RATE:
case Group::InjectionCMode::RATE:
{
control_eq = getSegmentGTotal(0) / scaling - fraction * (groupcontrols.surface_max_rate / efficiencyFactor - groupTargetReduction);
break;
}
case Group2::InjectionCMode::RESV:
case Group::InjectionCMode::RESV:
{
std::vector<double> convert_coeff(number_of_phases_, 1.0);
Base::rateConverter_.calcCoeff(/*fipreg*/ 0, Base::pvtRegionIdx_, convert_coeff);
@@ -2055,7 +2055,7 @@ namespace Opm
control_eq = getSegmentGTotal(0) / scaling - fraction * target;
break;
}
case Group2::InjectionCMode::REIN:
case Group::InjectionCMode::REIN:
{
double productionRate = well_state.currentInjectionVREPRates(groupcontrols.reinj_group);
productionRate /= efficiencyFactor;
@@ -2063,7 +2063,7 @@ namespace Opm
control_eq = getSegmentGTotal(0) / scaling - fraction * target;
break;
}
case Group2::InjectionCMode::VREP:
case Group::InjectionCMode::VREP:
{
std::vector<double> convert_coeff(number_of_phases_, 1.0);
Base::rateConverter_.calcCoeff(/*fipreg*/ 0, Base::pvtRegionIdx_, convert_coeff);
@@ -2074,7 +2074,7 @@ namespace Opm
control_eq = getSegmentGTotal(0) / scaling - fraction * target ;
break;
}
case Group2::InjectionCMode::FLD:
case Group::InjectionCMode::FLD:
{
// The FLD case is handled earlier
assert(false);
@@ -2094,17 +2094,17 @@ namespace Opm
template <typename TypeTag>
void
MultisegmentWell<TypeTag>::
assembleGroupProductionControl(const Group2& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, EvalWell& control_eq, double efficiencyFactor, Opm::DeferredLogger& deferred_logger)
assembleGroupProductionControl(const Group& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, EvalWell& control_eq, double efficiencyFactor, Opm::DeferredLogger& deferred_logger)
{
const auto& well = well_ecl_;
const auto pu = phaseUsage();
const Group2::ProductionCMode& currentGroupControl = well_state.currentProductionGroupControl(group.name());
const Group::ProductionCMode& currentGroupControl = well_state.currentProductionGroupControl(group.name());
if (currentGroupControl == Group2::ProductionCMode::FLD ) {
if (currentGroupControl == Group::ProductionCMode::FLD ) {
// Produce share of parents control
const auto& parent = schedule.getGroup2( group.parent(), current_step_ );
const auto& parent = schedule.getGroup( group.parent(), current_step_ );
if (group.getTransferGroupEfficiencyFactor())
efficiencyFactor *= group.getGroupEfficiencyFactor();
@@ -2118,16 +2118,16 @@ namespace Opm
const std::vector<double>& groupTargetReductions = well_state.currentProductionGroupReductionRates(group.name());
switch(currentGroupControl) {
case Group2::ProductionCMode::NONE:
case Group::ProductionCMode::NONE:
{
OPM_DEFLOG_THROW(std::runtime_error, "NONE group control not implemented for producers" , deferred_logger);
break;
}
case Group2::ProductionCMode::ORAT:
case Group::ProductionCMode::ORAT:
{
double groupTargetReduction = groupTargetReductions[pu.phase_pos[Oil]];
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, Well2::GuideRateTarget::OIL, /*isInjector*/false);
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, Group2::GuideRateTarget::OIL, /*isInjector*/false, fraction);
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, Well::GuideRateTarget::OIL, /*isInjector*/false);
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, Group::GuideRateTarget::OIL, /*isInjector*/false, fraction);
const double rate_target = std::max(0.0, groupcontrols.oil_target / efficiencyFactor - groupTargetReduction);
assert(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx));
@@ -2135,11 +2135,11 @@ namespace Opm
control_eq = rate - fraction * rate_target;
break;
}
case Group2::ProductionCMode::WRAT:
case Group::ProductionCMode::WRAT:
{
double groupTargetReduction = groupTargetReductions[pu.phase_pos[Water]];
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, Well2::GuideRateTarget::WAT, /*isInjector*/false);
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, Group2::GuideRateTarget::WAT, /*isInjector*/false, fraction);
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, Well::GuideRateTarget::WAT, /*isInjector*/false);
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, Group::GuideRateTarget::WAT, /*isInjector*/false, fraction);
const double rate_target = std::max(0.0, groupcontrols.water_target / efficiencyFactor - groupTargetReduction);
assert(FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx));
@@ -2147,22 +2147,22 @@ namespace Opm
control_eq = rate - fraction * rate_target;
break;
}
case Group2::ProductionCMode::GRAT:
case Group::ProductionCMode::GRAT:
{
double groupTargetReduction = groupTargetReductions[pu.phase_pos[Gas]];
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, Well2::GuideRateTarget::GAS, /*isInjector*/false);
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, Group2::GuideRateTarget::GAS, /*isInjector*/false, fraction);
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, Well::GuideRateTarget::GAS, /*isInjector*/false);
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, Group::GuideRateTarget::GAS, /*isInjector*/false, fraction);
const double rate_target = std::max(0.0, groupcontrols.gas_target / efficiencyFactor - groupTargetReduction);
assert(FluidSystem::phaseIsActive(FluidSystem::gasCompIdx));
const EvalWell& rate = -getSegmentRate(0, Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx));
control_eq = rate - fraction * rate_target;
break;
}
case Group2::ProductionCMode::LRAT:
case Group::ProductionCMode::LRAT:
{
double groupTargetReduction = groupTargetReductions[pu.phase_pos[Oil]] + groupTargetReductions[pu.phase_pos[Water]];
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, Well2::GuideRateTarget::LIQ, /*isInjector*/false);
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, Group2::GuideRateTarget::LIQ, /*isInjector*/false, fraction);
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, Well::GuideRateTarget::LIQ, /*isInjector*/false);
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, Group::GuideRateTarget::LIQ, /*isInjector*/false, fraction);
const double rate_target = std::max(0.0, groupcontrols.liquid_target / efficiencyFactor - groupTargetReduction);
assert(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx));
@@ -2172,22 +2172,22 @@ namespace Opm
control_eq = rate - fraction * rate_target;
break;
}
case Group2::ProductionCMode::CRAT:
case Group::ProductionCMode::CRAT:
{
OPM_DEFLOG_THROW(std::runtime_error, "CRAT group control not implemented for producers", deferred_logger );
break;
}
case Group2::ProductionCMode::RESV:
case Group::ProductionCMode::RESV:
{
OPM_DEFLOG_THROW(std::runtime_error, "RESV group control not implemented for producers", deferred_logger );
break;
}
case Group2::ProductionCMode::PRBL:
case Group::ProductionCMode::PRBL:
{
OPM_DEFLOG_THROW(std::runtime_error, "PRBL group control not implemented for producers", deferred_logger );
break;
}
case Group2::ProductionCMode::FLD:
case Group::ProductionCMode::FLD:
{
// The FLD case is handled earlier
assert(false);
@@ -3060,19 +3060,19 @@ namespace Opm
const int well_index = index_of_well_;
if (well.isInjector() )
{
const Opm::Well2::InjectorCMode& current = well_state.currentInjectionControls()[well_index];
const Opm::Well::InjectorCMode& current = well_state.currentInjectionControls()[well_index];
switch(current) {
case Well2::InjectorCMode::THP:
case Well::InjectorCMode::THP:
control_tolerance = param_.tolerance_pressure_ms_wells_;
break;
case Well2::InjectorCMode::BHP:
case Well::InjectorCMode::BHP:
control_tolerance = param_.tolerance_wells_;
break;
case Well2::InjectorCMode::RATE:
case Well2::InjectorCMode::RESV:
case Well::InjectorCMode::RATE:
case Well::InjectorCMode::RESV:
control_tolerance = param_.tolerance_wells_;
break;
case Well2::InjectorCMode::GRUP:
case Well::InjectorCMode::GRUP:
control_tolerance = param_.tolerance_wells_;
break;
default:
@@ -3082,23 +3082,23 @@ namespace Opm
if (well.isProducer() )
{
const Well2::ProducerCMode& current = well_state.currentProductionControls()[well_index];
const Well::ProducerCMode& current = well_state.currentProductionControls()[well_index];
switch(current) {
case Well2::ProducerCMode::THP:
case Well::ProducerCMode::THP:
control_tolerance = param_.tolerance_pressure_ms_wells_; // 0.1 bar
break;
case Well2::ProducerCMode::BHP:
case Well::ProducerCMode::BHP:
control_tolerance = param_.tolerance_wells_; // 0.01 bar
break;
case Well2::ProducerCMode::ORAT:
case Well2::ProducerCMode::WRAT:
case Well2::ProducerCMode::GRAT:
case Well2::ProducerCMode::LRAT:
case Well2::ProducerCMode::RESV:
case Well2::ProducerCMode::CRAT:
case Well::ProducerCMode::ORAT:
case Well::ProducerCMode::WRAT:
case Well::ProducerCMode::GRAT:
case Well::ProducerCMode::LRAT:
case Well::ProducerCMode::RESV:
case Well::ProducerCMode::CRAT:
control_tolerance = param_.tolerance_wells_; // smaller tolerance for rate control
break;
case Well2::ProducerCMode::GRUP:
case Well::ProducerCMode::GRUP:
control_tolerance = param_.tolerance_wells_; // smaller tolerance for rate control
break;
default:
@@ -3128,22 +3128,22 @@ namespace Opm
const int well_index = index_of_well_;
if (well.isInjector() )
{
const Opm::Well2::InjectorCMode& current = well_state.currentInjectionControls()[well_index];
const Opm::Well::InjectorCMode& current = well_state.currentInjectionControls()[well_index];
switch(current) {
case Well2::InjectorCMode::THP:
case Well::InjectorCMode::THP:
ctrltype = CR::WellFailure::Type::ControlTHP;
control_tolerance = param_.tolerance_pressure_ms_wells_;
break;
case Well2::InjectorCMode::BHP:
case Well::InjectorCMode::BHP:
ctrltype = CR::WellFailure::Type::ControlBHP;
control_tolerance = param_.tolerance_pressure_ms_wells_;
break;
case Well2::InjectorCMode::RATE:
case Well2::InjectorCMode::RESV:
case Well::InjectorCMode::RATE:
case Well::InjectorCMode::RESV:
ctrltype = CR::WellFailure::Type::ControlRate;
control_tolerance = param_.tolerance_wells_;
break;
case Well2::InjectorCMode::GRUP:
case Well::InjectorCMode::GRUP:
ctrltype = CR::WellFailure::Type::ControlRate;
control_tolerance = param_.tolerance_wells_;
break;
@@ -3154,26 +3154,26 @@ namespace Opm
if (well.isProducer() )
{
const Well2::ProducerCMode& current = well_state.currentProductionControls()[well_index];
const Well::ProducerCMode& current = well_state.currentProductionControls()[well_index];
switch(current) {
case Well2::ProducerCMode::THP:
case Well::ProducerCMode::THP:
ctrltype = CR::WellFailure::Type::ControlTHP;
control_tolerance = param_.tolerance_pressure_ms_wells_;
break;
case Well2::ProducerCMode::BHP:
case Well::ProducerCMode::BHP:
ctrltype = CR::WellFailure::Type::ControlBHP;
control_tolerance = param_.tolerance_pressure_ms_wells_;
break;
case Well2::ProducerCMode::ORAT:
case Well2::ProducerCMode::WRAT:
case Well2::ProducerCMode::GRAT:
case Well2::ProducerCMode::LRAT:
case Well2::ProducerCMode::RESV:
case Well2::ProducerCMode::CRAT:
case Well::ProducerCMode::ORAT:
case Well::ProducerCMode::WRAT:
case Well::ProducerCMode::GRAT:
case Well::ProducerCMode::LRAT:
case Well::ProducerCMode::RESV:
case Well::ProducerCMode::CRAT:
ctrltype = CR::WellFailure::Type::ControlRate;
control_tolerance = param_.tolerance_wells_;
break;
case Well2::ProducerCMode::GRUP:
case Well::ProducerCMode::GRUP:
ctrltype = CR::WellFailure::Type::ControlRate;
control_tolerance = param_.tolerance_wells_;
break;

View File

@@ -26,17 +26,17 @@
#include <locale>
#include <opm/parser/eclipse/EclipseState/Schedule/Events.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
#include <opm/core/well_controls.h>
namespace Opm
{
namespace SimFIBODetails {
typedef std::unordered_map<std::string, Well2 > WellMap;
typedef std::unordered_map<std::string, Well > WellMap;
inline WellMap
mapWells(const std::vector< Well2 >& wells)
mapWells(const std::vector< Well >& wells)
{
WellMap wmap;
@@ -88,7 +88,7 @@ namespace Opm
inline void
historyRates(const PhaseUsage& pu,
const Well2::ProductionControls& p,
const Well::ProductionControls& p,
std::vector<double>& rates)
{
assert (! p.prediction_mode);

View File

@@ -140,7 +140,7 @@ namespace Opm
using Base::contiFoamEqIdx;
static const int contiEnergyEqIdx = Indices::contiEnergyEqIdx;
StandardWell(const Well2& well, const int time_step, const Wells* wells,
StandardWell(const Well& well, const int time_step, const Wells* wells,
const ModelParameters& param,
const RateConverterType& rate_converter,
const int pvtRegionIdx,
@@ -366,7 +366,7 @@ namespace Opm
Opm::DeferredLogger& deferred_logger) const;
template <class ValueType>
ValueType calculateBhpFromThp(const std::vector<ValueType>& rates, const Well2& well, const SummaryState& summaryState, Opm::DeferredLogger& deferred_logger) const;
ValueType calculateBhpFromThp(const std::vector<ValueType>& rates, const Well& well, const SummaryState& summaryState, Opm::DeferredLogger& deferred_logger) const;
double calculateThpFromBhp(const std::vector<double>& rates, const double bhp, Opm::DeferredLogger& deferred_logger) const;
@@ -395,8 +395,8 @@ namespace Opm
void assembleControlEq(const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, Opm::DeferredLogger& deferred_logger);
void assembleGroupProductionControl(const Group2& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, EvalWell& control_eq, double efficincyFactor, Opm::DeferredLogger& deferred_logger);
void assembleGroupInjectionControl(const Group2& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, const Well2::InjectorType& injectorType, EvalWell& control_eq, double efficincyFactor, Opm::DeferredLogger& deferred_logger);
void assembleGroupProductionControl(const Group& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, EvalWell& control_eq, double efficincyFactor, Opm::DeferredLogger& deferred_logger);
void assembleGroupInjectionControl(const Group& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, const Well::InjectorType& injectorType, EvalWell& control_eq, double efficincyFactor, Opm::DeferredLogger& deferred_logger);
// handle the non reasonable fractions due to numerical overshoot

View File

@@ -28,7 +28,7 @@ namespace Opm
template<typename TypeTag>
StandardWell<TypeTag>::
StandardWell(const Well2& well, const int time_step, const Wells* wells,
StandardWell(const Well& well, const int time_step, const Wells* wells,
const ModelParameters& param,
const RateConverterType& rate_converter,
const int pvtRegionIdx,
@@ -631,7 +631,7 @@ namespace Opm
// change temperature for injecting fluids
if (well_type_ == INJECTOR && cq_s[activeCompIdx] > 0.0){
// only handles single phase injection now
assert(this->well_ecl_.injectorType() != Well2::InjectorType::MULTI);
assert(this->well_ecl_.injectorType() != Well::InjectorType::MULTI);
fs.setTemperature(this->well_ecl_.temperature());
typedef typename std::decay<decltype(fs)>::type::Scalar FsScalar;
typename FluidSystem::template ParameterCache<FsScalar> paramCache;
@@ -752,36 +752,36 @@ namespace Opm
if (wellIsStopped_) {
control_eq = getWQTotal();
} else if (well.isInjector()) {
const Opm::Well2::InjectorCMode& current = well_state.currentInjectionControls()[well_index];
const Opm::Well::InjectorCMode& current = well_state.currentInjectionControls()[well_index];
const auto& controls = well.injectionControls(summaryState);
switch(current) {
case Well2::InjectorCMode::RATE:
case Well::InjectorCMode::RATE:
{
control_eq = getWQTotal() * efficiencyFactor - controls.surface_rate;
break;
}
case Well2::InjectorCMode::RESV:
case Well::InjectorCMode::RESV:
{
std::vector<double> convert_coeff(number_of_phases_, 1.0);
Base::rateConverter_.calcCoeff(/*fipreg*/ 0, Base::pvtRegionIdx_, convert_coeff);
const auto& pu = phaseUsage();
Well2::InjectorType injectorType = controls.injector_type;
Well::InjectorType injectorType = controls.injector_type;
double coeff = 1.0;
switch (injectorType) {
case Well2::InjectorType::WATER:
case Well::InjectorType::WATER:
{
coeff = convert_coeff[pu.phase_pos[BlackoilPhases::Aqua]];
break;
}
case Well2::InjectorType::OIL:
case Well::InjectorType::OIL:
{
coeff = convert_coeff[pu.phase_pos[BlackoilPhases::Liquid]];
break;
}
case Well2::InjectorType::GAS:
case Well::InjectorType::GAS:
{
coeff = convert_coeff[pu.phase_pos[BlackoilPhases::Vapour]];
break;
@@ -795,7 +795,7 @@ namespace Opm
break;
}
case Well2::InjectorCMode::THP:
case Well::InjectorCMode::THP:
{
std::vector<EvalWell> rates(3, {numWellEq_ + numEq, 0.});
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
@@ -810,20 +810,20 @@ namespace Opm
control_eq = getBhp() - calculateBhpFromThp(rates, well, summaryState, deferred_logger);
break;
}
case Well2::InjectorCMode::BHP:
case Well::InjectorCMode::BHP:
{
const auto& bhp = controls.bhp_limit;
control_eq = getBhp() - bhp;
break;
}
case Well2::InjectorCMode::GRUP:
case Well::InjectorCMode::GRUP:
{
assert(well.isAvailableForGroupControl());
const auto& group = schedule.getGroup2( well.groupName(), current_step_ );
const auto& group = schedule.getGroup( well.groupName(), current_step_ );
assembleGroupInjectionControl(group, well_state, schedule, summaryState, controls.injector_type, control_eq, efficiencyFactor, deferred_logger);
break;
}
case Well2::InjectorCMode::CMODE_UNDEFINED:
case Well::InjectorCMode::CMODE_UNDEFINED:
{
OPM_DEFLOG_THROW(std::runtime_error, "Well control must be specified for well " + name() , deferred_logger);
}
@@ -834,25 +834,25 @@ namespace Opm
//Producer
else
{
const Well2::ProducerCMode& current = well_state.currentProductionControls()[well_index];
const Well::ProducerCMode& current = well_state.currentProductionControls()[well_index];
const auto& controls = well.productionControls(summaryState);
switch (current) {
case Well2::ProducerCMode::ORAT:
case Well::ProducerCMode::ORAT:
{
assert(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx));
EvalWell rate = -getQs(Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx));
control_eq = rate * efficiencyFactor - controls.oil_rate;
break;
}
case Well2::ProducerCMode::WRAT:
case Well::ProducerCMode::WRAT:
{
assert(FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx));
EvalWell rate = -getQs(Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx));
control_eq = rate * efficiencyFactor - controls.water_rate;
break;
}
case Well2::ProducerCMode::GRAT:
case Well::ProducerCMode::GRAT:
{
assert(FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx));
EvalWell rate = -getQs(Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx));
@@ -860,7 +860,7 @@ namespace Opm
break;
}
case Well2::ProducerCMode::LRAT:
case Well::ProducerCMode::LRAT:
{
assert(FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx));
assert(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx));
@@ -869,11 +869,11 @@ namespace Opm
control_eq = rate * efficiencyFactor - controls.liquid_rate;
break;
}
case Well2::ProducerCMode::CRAT:
case Well::ProducerCMode::CRAT:
{
OPM_DEFLOG_THROW(std::runtime_error, "CRAT control not supported " << name(), deferred_logger);
}
case Well2::ProducerCMode::RESV:
case Well::ProducerCMode::RESV:
{
EvalWell total_rate(numWellEq_ + numEq, 0.); // reservoir rate
std::vector<double> convert_coeff(number_of_phases_, 1.0);
@@ -903,12 +903,12 @@ namespace Opm
}
break;
}
case Well2::ProducerCMode::BHP:
case Well::ProducerCMode::BHP:
{
control_eq = getBhp() - controls.bhp_limit;
break;
}
case Well2::ProducerCMode::THP:
case Well::ProducerCMode::THP:
{
std::vector<EvalWell> rates(3, {numWellEq_ + numEq, 0.});
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
@@ -923,19 +923,19 @@ namespace Opm
control_eq = getBhp() - calculateBhpFromThp(rates, well, summaryState, deferred_logger);
break;
}
case Well2::ProducerCMode::GRUP:
case Well::ProducerCMode::GRUP:
{
assert(well.isAvailableForGroupControl());
const auto& group = schedule.getGroup2( well.groupName(), current_step_ );
const auto& group = schedule.getGroup( well.groupName(), current_step_ );
assembleGroupProductionControl(group, well_state, schedule, summaryState, control_eq, efficiencyFactor, deferred_logger);
break;
}
case Well2::ProducerCMode::CMODE_UNDEFINED:
case Well::ProducerCMode::CMODE_UNDEFINED:
{
OPM_DEFLOG_THROW(std::runtime_error, "Well control must be specified for well " + name(),deferred_logger);
}
case Well2::ProducerCMode::NONE:
case Well::ProducerCMode::NONE:
{
OPM_DEFLOG_THROW(std::runtime_error, "Well control must be specified for well " + name(), deferred_logger);
}
@@ -955,16 +955,16 @@ namespace Opm
template <typename TypeTag>
void
StandardWell<TypeTag>::
assembleGroupInjectionControl(const Group2& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, const Well2::InjectorType& injectorType, EvalWell& control_eq, double efficiencyFactor, Opm::DeferredLogger& deferred_logger)
assembleGroupInjectionControl(const Group& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, const Well::InjectorType& injectorType, EvalWell& control_eq, double efficiencyFactor, Opm::DeferredLogger& deferred_logger)
{
const auto& well = well_ecl_;
const auto pu = phaseUsage();
const auto& groupcontrols = group.injectionControls(summaryState);
const Group2::InjectionCMode& currentGroupControl = well_state.currentInjectionGroupControl(group.name());
const Group::InjectionCMode& currentGroupControl = well_state.currentInjectionGroupControl(group.name());
if (currentGroupControl == Group2::InjectionCMode::FLD) {
if (currentGroupControl == Group::InjectionCMode::FLD) {
// Inject share of parents control
const auto& parent = schedule.getGroup2( group.parent(), current_step_ );
const auto& parent = schedule.getGroup( group.parent(), current_step_ );
if (group.getTransferGroupEfficiencyFactor())
efficiencyFactor *= group.getGroupEfficiencyFactor();
@@ -976,29 +976,29 @@ namespace Opm
return;
int phasePos;
Well2::GuideRateTarget wellTarget;
Group2::GuideRateTarget groupTarget;
Well::GuideRateTarget wellTarget;
Group::GuideRateTarget groupTarget;
switch (injectorType) {
case Well2::InjectorType::WATER:
case Well::InjectorType::WATER:
{
phasePos = pu.phase_pos[BlackoilPhases::Aqua];
wellTarget = Well2::GuideRateTarget::WAT;
groupTarget = Group2::GuideRateTarget::WAT;
wellTarget = Well::GuideRateTarget::WAT;
groupTarget = Group::GuideRateTarget::WAT;
break;
}
case Well2::InjectorType::OIL:
case Well::InjectorType::OIL:
{
phasePos = pu.phase_pos[BlackoilPhases::Liquid];
wellTarget = Well2::GuideRateTarget::OIL;
groupTarget = Group2::GuideRateTarget::OIL;
wellTarget = Well::GuideRateTarget::OIL;
groupTarget = Group::GuideRateTarget::OIL;
break;
}
case Well2::InjectorType::GAS:
case Well::InjectorType::GAS:
{
phasePos = pu.phase_pos[BlackoilPhases::Vapour];
wellTarget = Well2::GuideRateTarget::GAS;
groupTarget = Group2::GuideRateTarget::GAS;
wellTarget = Well::GuideRateTarget::GAS;
groupTarget = Group::GuideRateTarget::GAS;
break;
}
default:
@@ -1011,18 +1011,18 @@ namespace Opm
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, groupTarget, /*isInjector*/true, fraction);
switch(currentGroupControl) {
case Group2::InjectionCMode::NONE:
case Group::InjectionCMode::NONE:
{
OPM_DEFLOG_THROW(std::runtime_error, "NONE group control not implemented for injectors" , deferred_logger);
break;
}
case Group2::InjectionCMode::RATE:
case Group::InjectionCMode::RATE:
{
double target = std::max(0.0, (groupcontrols.surface_max_rate / efficiencyFactor - groupTargetReduction) );
control_eq = getWQTotal() - fraction * target;
break;
}
case Group2::InjectionCMode::RESV:
case Group::InjectionCMode::RESV:
{
std::vector<double> convert_coeff(number_of_phases_, 1.0);
Base::rateConverter_.calcCoeff(/*fipreg*/ 0, Base::pvtRegionIdx_, convert_coeff);
@@ -1031,7 +1031,7 @@ namespace Opm
control_eq = getWQTotal() - fraction * target;
break;
}
case Group2::InjectionCMode::REIN:
case Group::InjectionCMode::REIN:
{
double productionRate = well_state.currentInjectionVREPRates(groupcontrols.reinj_group);
productionRate /= efficiencyFactor;
@@ -1039,7 +1039,7 @@ namespace Opm
control_eq = getWQTotal() - fraction * target;
break;
}
case Group2::InjectionCMode::VREP:
case Group::InjectionCMode::VREP:
{
std::vector<double> convert_coeff(number_of_phases_, 1.0);
Base::rateConverter_.calcCoeff(/*fipreg*/ 0, Base::pvtRegionIdx_, convert_coeff);
@@ -1065,7 +1065,7 @@ namespace Opm
control_eq = getWQTotal() - fraction * target;
break;
}
case Group2::InjectionCMode::FLD:
case Group::InjectionCMode::FLD:
{
// The FLD case is handled earlier
assert(false);
@@ -1084,16 +1084,16 @@ namespace Opm
template <typename TypeTag>
void
StandardWell<TypeTag>::
assembleGroupProductionControl(const Group2& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, EvalWell& control_eq, double efficiencyFactor, Opm::DeferredLogger& deferred_logger)
assembleGroupProductionControl(const Group& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, EvalWell& control_eq, double efficiencyFactor, Opm::DeferredLogger& deferred_logger)
{
const auto& well = well_ecl_;
const auto pu = phaseUsage();
const Group2::ProductionCMode& currentGroupControl = well_state.currentProductionGroupControl(group.name());
if (currentGroupControl == Group2::ProductionCMode::FLD) {
const Group::ProductionCMode& currentGroupControl = well_state.currentProductionGroupControl(group.name());
if (currentGroupControl == Group::ProductionCMode::FLD) {
// Produce share of parents control
const auto& parent = schedule.getGroup2( group.parent(), current_step_ );
const auto& parent = schedule.getGroup( group.parent(), current_step_ );
if (group.getTransferGroupEfficiencyFactor())
efficiencyFactor *= group.getGroupEfficiencyFactor();
@@ -1109,16 +1109,16 @@ namespace Opm
const std::vector<double>& groupTargetReductions = well_state.currentProductionGroupReductionRates(group.name());
switch(currentGroupControl) {
case Group2::ProductionCMode::NONE:
case Group::ProductionCMode::NONE:
{
OPM_DEFLOG_THROW(std::runtime_error, "NONE group control not implemented for producers" , deferred_logger);
break;
}
case Group2::ProductionCMode::ORAT:
case Group::ProductionCMode::ORAT:
{
double groupTargetReduction = groupTargetReductions[pu.phase_pos[Oil]];
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, Well2::GuideRateTarget::OIL, /*isInjector*/false);
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, Group2::GuideRateTarget::OIL, /*isInjector*/false, fraction);
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, Well::GuideRateTarget::OIL, /*isInjector*/false);
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, Group::GuideRateTarget::OIL, /*isInjector*/false, fraction);
const double rate_target = std::max(0.0, groupcontrols.oil_target / efficiencyFactor - groupTargetReduction);
assert(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx));
@@ -1126,11 +1126,11 @@ namespace Opm
control_eq = rate - fraction * rate_target;
break;
}
case Group2::ProductionCMode::WRAT:
case Group::ProductionCMode::WRAT:
{
double groupTargetReduction = groupTargetReductions[pu.phase_pos[Water]];
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, Well2::GuideRateTarget::WAT, /*isInjector*/false);
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, Group2::GuideRateTarget::WAT, /*isInjector*/false, fraction);
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, Well::GuideRateTarget::WAT, /*isInjector*/false);
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, Group::GuideRateTarget::WAT, /*isInjector*/false, fraction);
const double rate_target = std::max(0.0, groupcontrols.water_target / efficiencyFactor - groupTargetReduction);
assert(FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx));
@@ -1138,11 +1138,11 @@ namespace Opm
control_eq = rate - fraction * rate_target;
break;
}
case Group2::ProductionCMode::GRAT:
case Group::ProductionCMode::GRAT:
{
double groupTargetReduction = groupTargetReductions[pu.phase_pos[Gas]];
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, Well2::GuideRateTarget::GAS, /*isInjector*/false);
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, Group2::GuideRateTarget::GAS, /*isInjector*/false, fraction);
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, Well::GuideRateTarget::GAS, /*isInjector*/false);
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, Group::GuideRateTarget::GAS, /*isInjector*/false, fraction);
const double rate_target = std::max(0.0, groupcontrols.gas_target / efficiencyFactor - groupTargetReduction);
assert(FluidSystem::phaseIsActive(FluidSystem::gasCompIdx));
@@ -1150,11 +1150,11 @@ namespace Opm
control_eq = rate - fraction * rate_target;
break;
}
case Group2::ProductionCMode::LRAT:
case Group::ProductionCMode::LRAT:
{
double groupTargetReduction = groupTargetReductions[pu.phase_pos[Oil]] + groupTargetReductions[pu.phase_pos[Water]];
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, Well2::GuideRateTarget::LIQ, /*isInjector*/false);
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, Group2::GuideRateTarget::LIQ, /*isInjector*/false, fraction);
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, Well::GuideRateTarget::LIQ, /*isInjector*/false);
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, Group::GuideRateTarget::LIQ, /*isInjector*/false, fraction);
const double rate_target = std::max(0.0, groupcontrols.liquid_target / efficiencyFactor - groupTargetReduction);
assert(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx));
@@ -1164,19 +1164,19 @@ namespace Opm
control_eq = rate - fraction * rate_target;
break;
}
case Group2::ProductionCMode::CRAT:
case Group::ProductionCMode::CRAT:
{
OPM_DEFLOG_THROW(std::runtime_error, "CRAT group control not implemented for producers", deferred_logger );
break;
}
case Group2::ProductionCMode::RESV:
case Group::ProductionCMode::RESV:
{
double groupTargetReduction = groupTargetReductions[pu.phase_pos[Oil]]
+ groupTargetReductions[pu.phase_pos[Gas]]
+ groupTargetReductions[pu.phase_pos[Water]];
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, Well2::GuideRateTarget::RES, /*isInjector*/false);
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, Group2::GuideRateTarget::RES, /*isInjector*/false, fraction);
double fraction = wellGroupHelpers::wellFractionFromGuideRates(well, schedule, well_state, current_step_, Base::guide_rate_, Well::GuideRateTarget::RES, /*isInjector*/false);
wellGroupHelpers::accumulateGroupFractions(well.groupName(), group.name(), schedule, well_state, current_step_, Base::guide_rate_, Group::GuideRateTarget::RES, /*isInjector*/false, fraction);
EvalWell total_rate(numWellEq_ + numEq, 0.); // reservoir rate
std::vector<double> convert_coeff(number_of_phases_, 1.0);
@@ -1190,12 +1190,12 @@ namespace Opm
control_eq = total_rate - fraction * rate_target;
break;
}
case Group2::ProductionCMode::PRBL:
case Group::ProductionCMode::PRBL:
{
OPM_DEFLOG_THROW(std::runtime_error, "PRBL group control not implemented for producers", deferred_logger );
break;
}
case Group2::ProductionCMode::FLD:
case Group::ProductionCMode::FLD:
{
// The FLD case is handled earlier
assert(false);
@@ -1611,20 +1611,20 @@ namespace Opm
{
const auto& controls = well.injectionControls(summaryState);
Well2::InjectorType injectorType = controls.injector_type;
Well::InjectorType injectorType = controls.injector_type;
int phasePos;
switch (injectorType) {
case Well2::InjectorType::WATER:
case Well::InjectorType::WATER:
{
phasePos = pu.phase_pos[BlackoilPhases::Aqua];
break;
}
case Well2::InjectorType::OIL:
case Well::InjectorType::OIL:
{
phasePos = pu.phase_pos[BlackoilPhases::Liquid];
break;
}
case Well2::InjectorType::GAS:
case Well::InjectorType::GAS:
{
phasePos = pu.phase_pos[BlackoilPhases::Vapour];
break;
@@ -1633,16 +1633,16 @@ namespace Opm
throw("Expected WATER, OIL or GAS as type for injectors " + well.name());
}
const Opm::Well2::InjectorCMode& current = well_state.currentInjectionControls()[well_index];
const Opm::Well::InjectorCMode& current = well_state.currentInjectionControls()[well_index];
switch(current) {
case Well2::InjectorCMode::RATE:
case Well::InjectorCMode::RATE:
{
well_state.wellRates()[well_index*np + phasePos] = controls.surface_rate;
break;
}
case Well2::InjectorCMode::RESV:
case Well::InjectorCMode::RESV:
{
std::vector<double> convert_coeff(number_of_phases_, 1.0);
Base::rateConverter_.calcCoeff(/*fipreg*/ 0, Base::pvtRegionIdx_, convert_coeff);
@@ -1651,7 +1651,7 @@ namespace Opm
break;
}
case Well2::InjectorCMode::THP:
case Well::InjectorCMode::THP:
{
std::vector<double> rates(3, 0.0);
for (int p = 0; p<np; ++p) {
@@ -1661,17 +1661,17 @@ namespace Opm
well_state.bhp()[well_index] = bhp;
break;
}
case Well2::InjectorCMode::BHP:
case Well::InjectorCMode::BHP:
{
well_state.bhp()[well_index] = controls.bhp_limit;
break;
}
case Well2::InjectorCMode::GRUP:
case Well::InjectorCMode::GRUP:
{
//do nothing at the moment
break;
}
case Well2::InjectorCMode::CMODE_UNDEFINED:
case Well::InjectorCMode::CMODE_UNDEFINED:
{
OPM_DEFLOG_THROW(std::runtime_error, "Well control must be specified for well " + name(), deferred_logger );
}
@@ -1681,11 +1681,11 @@ namespace Opm
//Producer
else
{
const Well2::ProducerCMode& current = well_state.currentProductionControls()[well_index];
const Well::ProducerCMode& current = well_state.currentProductionControls()[well_index];
const auto& controls = well.productionControls(summaryState);
switch (current) {
case Well2::ProducerCMode::ORAT:
case Well::ProducerCMode::ORAT:
{
double current_rate = -well_state.wellRates()[ well_index*np + pu.phase_pos[Oil] ];
@@ -1697,7 +1697,7 @@ namespace Opm
}
break;
}
case Well2::ProducerCMode::WRAT:
case Well::ProducerCMode::WRAT:
{
double current_rate = -well_state.wellRates()[ well_index*np + pu.phase_pos[Water] ];
@@ -1709,7 +1709,7 @@ namespace Opm
}
break;
}
case Well2::ProducerCMode::GRAT:
case Well::ProducerCMode::GRAT:
{
double current_rate = -well_state.wellRates()[ well_index*np + pu.phase_pos[Gas] ];
@@ -1722,7 +1722,7 @@ namespace Opm
break;
}
case Well2::ProducerCMode::LRAT:
case Well::ProducerCMode::LRAT:
{
double current_rate = -well_state.wellRates()[ well_index*np + pu.phase_pos[Water] ]
- well_state.wellRates()[ well_index*np + pu.phase_pos[Oil] ];
@@ -1735,11 +1735,11 @@ namespace Opm
}
break;
}
case Well2::ProducerCMode::CRAT:
case Well::ProducerCMode::CRAT:
{
OPM_DEFLOG_THROW(std::runtime_error, "CRAT control not supported " << name(), deferred_logger);
}
case Well2::ProducerCMode::RESV:
case Well::ProducerCMode::RESV:
{
std::vector<double> convert_coeff(number_of_phases_, 1.0);
Base::rateConverter_.calcCoeff(/*fipreg*/ 0, Base::pvtRegionIdx_, convert_coeff);
@@ -1775,12 +1775,12 @@ namespace Opm
}
break;
}
case Well2::ProducerCMode::BHP:
case Well::ProducerCMode::BHP:
{
well_state.bhp()[well_index] = controls.bhp_limit;
break;
}
case Well2::ProducerCMode::THP:
case Well::ProducerCMode::THP:
{
well_state.thp()[well_index] = controls.thp_limit;
auto bhp = computeBhpAtThpLimitProd(ebos_simulator, summaryState, deferred_logger);
@@ -1792,16 +1792,16 @@ namespace Opm
}
break;
}
case Well2::ProducerCMode::GRUP:
case Well::ProducerCMode::GRUP:
{
//do nothing at the moment
break;
}
case Well2::ProducerCMode::CMODE_UNDEFINED:
case Well::ProducerCMode::CMODE_UNDEFINED:
{
OPM_DEFLOG_THROW(std::runtime_error, "Well control must be specified for well " + name(), deferred_logger );
}
case Well2::ProducerCMode::NONE:
case Well::ProducerCMode::NONE:
{
OPM_DEFLOG_THROW(std::runtime_error, "Well control must be specified for well " + name() , deferred_logger);
}
@@ -2823,8 +2823,8 @@ namespace Opm
// does the well have a THP related constraint?
const auto& summaryState = ebosSimulator.vanguard().summaryState();
const Well2::ProducerCMode& current_control = well_state.currentProductionControls()[this->index_of_well_];
if ( !well.Base::wellHasTHPConstraints(summaryState) || current_control == Well2::ProducerCMode::BHP ) {
const Well::ProducerCMode& current_control = well_state.currentProductionControls()[this->index_of_well_];
if ( !well.Base::wellHasTHPConstraints(summaryState) || current_control == Well::ProducerCMode::BHP ) {
// get the bhp value based on the bhp constraints
const double bhp = well.mostStrictBhpFromBhpLimits(summaryState);
assert(std::abs(bhp) != std::numeric_limits<double>::max());
@@ -2886,7 +2886,7 @@ namespace Opm
auto phase = well_ecl_.getInjectionProperties().injectorType;
// only single phase injection handled
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
if (phase == Well2::InjectorType::WATER) {
if (phase == Well::InjectorType::WATER) {
primary_variables_[WFrac] = 1.0;
} else {
primary_variables_[WFrac] = 0.0;
@@ -2894,7 +2894,7 @@ namespace Opm
}
if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) {
if (phase == Well2::InjectorType::GAS) {
if (phase == Well::InjectorType::GAS) {
primary_variables_[GFrac] = 1.0 - wsolvent();
if (has_solvent) {
primary_variables_[SFrac] = wsolvent();
@@ -2945,7 +2945,7 @@ namespace Opm
ValueType
StandardWell<TypeTag>::
calculateBhpFromThp(const std::vector<ValueType>& rates,
const Well2& well,
const Well& well,
const SummaryState& summaryState,
Opm::DeferredLogger& deferred_logger) const
{
@@ -3485,22 +3485,22 @@ namespace Opm
}
else if (well.isInjector() )
{
const Opm::Well2::InjectorCMode& current = well_state.currentInjectionControls()[well_index];
const Opm::Well::InjectorCMode& current = well_state.currentInjectionControls()[well_index];
switch(current) {
case Well2::InjectorCMode::THP:
case Well::InjectorCMode::THP:
ctrltype = CR::WellFailure::Type::ControlTHP;
control_tolerance = 1.e4; // 0.1 bar
break;
case Well2::InjectorCMode::BHP:
case Well::InjectorCMode::BHP:
ctrltype = CR::WellFailure::Type::ControlBHP;
control_tolerance = 1.e3; // 0.01 bar
break;
case Well2::InjectorCMode::RATE:
case Well2::InjectorCMode::RESV:
case Well::InjectorCMode::RATE:
case Well::InjectorCMode::RESV:
ctrltype = CR::WellFailure::Type::ControlRate;
control_tolerance = 1.e-4; //
break;
case Well2::InjectorCMode::GRUP:
case Well::InjectorCMode::GRUP:
ctrltype = CR::WellFailure::Type::ControlRate;
control_tolerance = 1.e-6; //
break;
@@ -3510,26 +3510,26 @@ namespace Opm
}
else if (well.isProducer() )
{
const Well2::ProducerCMode& current = well_state.currentProductionControls()[well_index];
const Well::ProducerCMode& current = well_state.currentProductionControls()[well_index];
switch(current) {
case Well2::ProducerCMode::THP:
case Well::ProducerCMode::THP:
ctrltype = CR::WellFailure::Type::ControlTHP;
control_tolerance = 1.e4; // 0.1 bar
break;
case Well2::ProducerCMode::BHP:
case Well::ProducerCMode::BHP:
ctrltype = CR::WellFailure::Type::ControlBHP;
control_tolerance = 1.e3; // 0.01 bar
break;
case Well2::ProducerCMode::ORAT:
case Well2::ProducerCMode::WRAT:
case Well2::ProducerCMode::GRAT:
case Well2::ProducerCMode::LRAT:
case Well2::ProducerCMode::RESV:
case Well2::ProducerCMode::CRAT:
case Well::ProducerCMode::ORAT:
case Well::ProducerCMode::WRAT:
case Well::ProducerCMode::GRAT:
case Well::ProducerCMode::LRAT:
case Well::ProducerCMode::RESV:
case Well::ProducerCMode::CRAT:
ctrltype = CR::WellFailure::Type::ControlRate;
control_tolerance = 1.e-4; // smaller tolerance for rate control
break;
case Well2::ProducerCMode::GRUP:
case Well::ProducerCMode::GRUP:
ctrltype = CR::WellFailure::Type::ControlRate;
control_tolerance = 1.e-6; // smaller tolerance for rate control
break;

View File

@@ -60,7 +60,7 @@ public:
cartesianToCompressed[ *cell ] = cell - begin;
}
const auto& schedule_wells = schedule.getWells2atEnd();
const auto& schedule_wells = schedule.getWellsatEnd();
wells_.reserve(schedule_wells.size());
// initialize the additional cell connections introduced by wells.

View File

@@ -29,15 +29,15 @@ namespace Opm {
namespace wellGroupHelpers
{
inline void setCmodeGroup(const Group2& group, const Schedule& schedule, const SummaryState& summaryState, const int reportStepIdx, WellStateFullyImplicitBlackoil& wellState) {
inline void setCmodeGroup(const Group& group, const Schedule& schedule, const SummaryState& summaryState, const int reportStepIdx, WellStateFullyImplicitBlackoil& wellState) {
for (const std::string& groupName : group.groups()) {
setCmodeGroup( schedule.getGroup2(groupName, reportStepIdx), schedule, summaryState, reportStepIdx, wellState);
setCmodeGroup( schedule.getGroup(groupName, reportStepIdx), schedule, summaryState, reportStepIdx, wellState);
}
if (!wellState.hasInjectionGroupControl(group.name())) {
// use NONE as default control
wellState.setCurrentInjectionGroupControl(group.name(), Group2::InjectionCMode::NONE);
wellState.setCurrentInjectionGroupControl(group.name(), Group::InjectionCMode::NONE);
if (group.isInjectionGroup()) {
const auto controls = group.injectionControls(summaryState);
wellState.setCurrentInjectionGroupControl(group.name(), controls.cmode);
@@ -45,7 +45,7 @@ namespace Opm {
}
if (!wellState.hasProductionGroupControl(group.name())) {
// use NONE as default control
wellState.setCurrentProductionGroupControl(group.name(), Group2::ProductionCMode::NONE);
wellState.setCurrentProductionGroupControl(group.name(), Group::ProductionCMode::NONE);
if (group.isProductionGroup()) {
const auto controls = group.productionControls(summaryState);
wellState.setCurrentProductionGroupControl(group.name(), controls.cmode);
@@ -54,21 +54,21 @@ namespace Opm {
}
inline void accumulateGroupEfficiencyFactor(const Group2& group, const Schedule& schedule, const int reportStepIdx, double& factor) {
inline void accumulateGroupEfficiencyFactor(const Group& group, const Schedule& schedule, const int reportStepIdx, double& factor) {
factor *= group.getGroupEfficiencyFactor();
if (group.parent() != "FIELD")
accumulateGroupEfficiencyFactor(schedule.getGroup2(group.parent(), reportStepIdx), schedule, reportStepIdx, factor);
accumulateGroupEfficiencyFactor(schedule.getGroup(group.parent(), reportStepIdx), schedule, reportStepIdx, factor);
}
inline void setGroupControl(const Group2& 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 int reportStepIdx, const bool injector, WellStateFullyImplicitBlackoil& wellState, std::ostringstream& ss) {
for (const std::string& groupName : group.groups()) {
const Group2& groupTmp = schedule.getGroup2(groupName, reportStepIdx);
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
setGroupControl(groupTmp, schedule, reportStepIdx, injector, wellState, ss);
if (injector)
wellState.setCurrentInjectionGroupControl(groupName, Group2::InjectionCMode::FLD);
wellState.setCurrentInjectionGroupControl(groupName, Group::InjectionCMode::FLD);
else
wellState.setCurrentProductionGroupControl(groupName, Group2::ProductionCMode::FLD);
wellState.setCurrentProductionGroupControl(groupName, Group::ProductionCMode::FLD);
}
const auto& end = wellState.wellMap().end();
@@ -78,17 +78,17 @@ namespace Opm {
continue;
int well_index = it->second[0];
const auto& wellEcl = schedule.getWell2(wellName, reportStepIdx);
const auto& wellEcl = schedule.getWell(wellName, reportStepIdx);
if (wellEcl.getStatus() == Well2::Status::SHUT)
if (wellEcl.getStatus() == Well::Status::SHUT)
continue;
if (!wellEcl.isAvailableForGroupControl())
continue;
if (wellEcl.isProducer() && !injector) {
if (wellState.currentProductionControls()[well_index] != Well2::ProducerCMode::GRUP) {
wellState.currentProductionControls()[well_index] = Well2::ProducerCMode::GRUP;
if (wellState.currentProductionControls()[well_index] != Well::ProducerCMode::GRUP) {
wellState.currentProductionControls()[well_index] = Well::ProducerCMode::GRUP;
ss <<"\n Producer " << wellName << " switches to GRUP control limit";
}
}
@@ -98,8 +98,8 @@ namespace Opm {
if (group.injection_phase() != wellEcl.getPreferredPhase())
continue;
if (wellState.currentInjectionControls()[well_index] != Well2::InjectorCMode::GRUP) {
wellState.currentInjectionControls()[well_index] = Well2::InjectorCMode::GRUP;
if (wellState.currentInjectionControls()[well_index] != Well::InjectorCMode::GRUP) {
wellState.currentInjectionControls()[well_index] = Well::InjectorCMode::GRUP;
ss <<"\n Injector " << wellName << " switches to GRUP control limit";
}
}
@@ -107,15 +107,15 @@ namespace Opm {
}
inline void computeGroupTargetReduction(const Group2& group, const WellStateFullyImplicitBlackoil& wellState, const Schedule& schedule, const int reportStepIdx, const int phasePos, const bool isInjector, double& groupTargetReduction )
inline void computeGroupTargetReduction(const Group& group, const WellStateFullyImplicitBlackoil& wellState, const Schedule& schedule, const int reportStepIdx, const int phasePos, const bool isInjector, double& groupTargetReduction )
{
for (const std::string& groupName : group.groups()) {
const Group2& groupTmp = schedule.getGroup2(groupName, reportStepIdx);
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
computeGroupTargetReduction(groupTmp, wellState, schedule, reportStepIdx, phasePos, isInjector, groupTargetReduction);
}
for (const std::string& wellName : group.wells()) {
const auto& wellTmp = schedule.getWell2(wellName, reportStepIdx);
const auto& wellTmp = schedule.getWell(wellName, reportStepIdx);
if (wellTmp.isProducer() && isInjector)
continue;
@@ -123,7 +123,7 @@ namespace Opm {
if (wellTmp.isInjector() && !isInjector)
continue;
if (wellTmp.getStatus() == Well2::Status::SHUT)
if (wellTmp.getStatus() == Well::Status::SHUT)
continue;
const auto& end = wellState.wellMap().end();
@@ -135,22 +135,22 @@ namespace Opm {
const auto wellrate_index = well_index * wellState.numPhases();
// add contributino from wells not under group control
if (isInjector) {
if (wellState.currentInjectionControls()[well_index] != Well2::InjectorCMode::GRUP)
if (wellState.currentInjectionControls()[well_index] != Well::InjectorCMode::GRUP)
groupTargetReduction += wellState.wellRates()[wellrate_index + phasePos];
} else {
if (wellState.currentProductionControls()[well_index] != Well2::ProducerCMode::GRUP)
if (wellState.currentProductionControls()[well_index] != Well::ProducerCMode::GRUP)
groupTargetReduction -= wellState.wellRates()[wellrate_index + phasePos];
}
}
}
inline double sumWellPhaseRates(const std::vector<double>& rates, const Group2& group, const Schedule& schedule, const WellStateFullyImplicitBlackoil& wellState, const int reportStepIdx, const int phasePos,
inline double sumWellPhaseRates(const std::vector<double>& rates, const Group& group, const Schedule& schedule, const WellStateFullyImplicitBlackoil& wellState, const int reportStepIdx, const int phasePos,
const bool injector) {
double rate = 0.0;
for (const std::string& groupName : group.groups()) {
const Group2& groupTmp = schedule.getGroup2(groupName, reportStepIdx);
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
rate += groupTmp.getGroupEfficiencyFactor()*sumWellPhaseRates(rates, groupTmp, schedule, wellState, reportStepIdx, phasePos, injector);
}
const auto& end = wellState.wellMap().end();
@@ -161,12 +161,12 @@ namespace Opm {
int well_index = it->second[0];
const auto& wellEcl = schedule.getWell2(wellName, reportStepIdx);
const auto& wellEcl = schedule.getWell(wellName, reportStepIdx);
//only count producers or injectors
if ( (wellEcl.isProducer() && injector) || (wellEcl.isInjector() && !injector))
continue;
if (wellEcl.getStatus() == Well2::Status::SHUT)
if (wellEcl.getStatus() == Well::Status::SHUT)
continue;
double factor = wellEcl.getEfficiencyFactor();
@@ -179,19 +179,19 @@ namespace Opm {
return rate;
}
inline double sumWellRates(const Group2& group, const Schedule& schedule, const WellStateFullyImplicitBlackoil& wellState, const int reportStepIdx, const int phasePos, const bool injector) {
inline double sumWellRates(const Group& group, const Schedule& schedule, const WellStateFullyImplicitBlackoil& wellState, const int reportStepIdx, const int phasePos, const bool injector) {
return sumWellPhaseRates(wellState.wellRates(), group, schedule, wellState, reportStepIdx, phasePos, injector);
}
inline double sumWellResRates(const Group2& group, const Schedule& schedule, const WellStateFullyImplicitBlackoil& wellState, const int reportStepIdx, const int phasePos, const bool injector) {
inline double sumWellResRates(const Group& group, const Schedule& schedule, const WellStateFullyImplicitBlackoil& wellState, const int reportStepIdx, const int phasePos, const bool injector) {
return sumWellPhaseRates(wellState.wellReservoirRates(), group, schedule, wellState, reportStepIdx, phasePos, injector);
}
inline double sumSolventRates(const Group2& group, const Schedule& schedule, const WellStateFullyImplicitBlackoil& wellState, const int reportStepIdx, const bool injector) {
inline double sumSolventRates(const Group& group, const Schedule& schedule, const WellStateFullyImplicitBlackoil& wellState, const int reportStepIdx, const bool injector) {
double rate = 0.0;
for (const std::string& groupName : group.groups()) {
const Group2& groupTmp = schedule.getGroup2(groupName, reportStepIdx);
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
rate += groupTmp.getGroupEfficiencyFactor()*sumSolventRates(groupTmp, schedule, wellState, reportStepIdx, injector);
}
const auto& end = wellState.wellMap().end();
@@ -202,12 +202,12 @@ namespace Opm {
int well_index = it->second[0];
const auto& wellEcl = schedule.getWell2(wellName, reportStepIdx);
const auto& wellEcl = schedule.getWell(wellName, reportStepIdx);
//only count producers or injectors
if ( (wellEcl.isProducer() && injector) || (wellEcl.isInjector() && !injector))
continue;
if (wellEcl.getStatus() == Well2::Status::SHUT)
if (wellEcl.getStatus() == Well::Status::SHUT)
continue;
double factor = wellEcl.getEfficiencyFactor();
@@ -219,26 +219,26 @@ namespace Opm {
return rate;
}
inline void updateGroupTargetReduction(const Group2& group, const Schedule& schedule, const int reportStepIdx, const bool isInjector, WellStateFullyImplicitBlackoil& wellState, std::vector<double>& groupTargetReduction)
inline void updateGroupTargetReduction(const Group& group, const Schedule& schedule, const int reportStepIdx, const bool isInjector, WellStateFullyImplicitBlackoil& wellState, std::vector<double>& groupTargetReduction)
{
const int np = wellState.numPhases();
for (const std::string& groupName : group.groups()) {
std::vector<double> thisGroupTargetReduction(np, 0.0);
const Group2& groupTmp = schedule.getGroup2(groupName, reportStepIdx);
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
updateGroupTargetReduction(groupTmp, schedule, reportStepIdx, isInjector, wellState, thisGroupTargetReduction);
// accumulate group contribution from sub group
if (isInjector) {
const Group2::InjectionCMode& currentGroupControl = wellState.currentInjectionGroupControl(groupName);
if (currentGroupControl != Group2::InjectionCMode::FLD) {
const Group::InjectionCMode& currentGroupControl = wellState.currentInjectionGroupControl(groupName);
if (currentGroupControl != Group::InjectionCMode::FLD) {
for (int phase = 0; phase < np; phase++) {
groupTargetReduction[phase] += sumWellRates(groupTmp, schedule, wellState, reportStepIdx, phase, isInjector);
}
continue;
}
} else {
const Group2::ProductionCMode& currentGroupControl = wellState.currentProductionGroupControl(groupName);
if (currentGroupControl != Group2::ProductionCMode::FLD) {
const Group::ProductionCMode& currentGroupControl = wellState.currentProductionGroupControl(groupName);
if (currentGroupControl != Group::ProductionCMode::FLD) {
for (int phase = 0; phase < np; phase++) {
groupTargetReduction[phase] += sumWellRates(groupTmp, schedule, wellState, reportStepIdx, phase, isInjector);
}
@@ -251,7 +251,7 @@ namespace Opm {
}
}
for (const std::string& wellName : group.wells()) {
const auto& wellTmp = schedule.getWell2(wellName, reportStepIdx);
const auto& wellTmp = schedule.getWell(wellName, reportStepIdx);
if (wellTmp.isProducer() && isInjector)
continue;
@@ -259,7 +259,7 @@ namespace Opm {
if (wellTmp.isInjector() && !isInjector)
continue;
if (wellTmp.getStatus() == Well2::Status::SHUT)
if (wellTmp.getStatus() == Well::Status::SHUT)
continue;
const auto& end = wellState.wellMap().end();
@@ -271,12 +271,12 @@ namespace Opm {
const auto wellrate_index = well_index * wellState.numPhases();
// add contributino from wells not under group control
if (isInjector) {
if (wellState.currentInjectionControls()[well_index] != Well2::InjectorCMode::GRUP)
if (wellState.currentInjectionControls()[well_index] != Well::InjectorCMode::GRUP)
for (int phase = 0; phase < np; phase++) {
groupTargetReduction[phase] += wellState.wellRates()[wellrate_index + phase];
}
} else {
if (wellState.currentProductionControls()[well_index] != Well2::ProducerCMode::GRUP)
if (wellState.currentProductionControls()[well_index] != Well::ProducerCMode::GRUP)
for (int phase = 0; phase < np; phase++) {
groupTargetReduction[phase] -= wellState.wellRates()[wellrate_index + phase];
}
@@ -290,9 +290,9 @@ namespace Opm {
inline void updateGuideRateForGroups(const Group2& group, const Schedule& schedule, const PhaseUsage& pu, const int reportStepIdx, const double& simTime, GuideRate* guideRate, WellStateFullyImplicitBlackoil& wellState) {
inline void updateGuideRateForGroups(const Group& group, const Schedule& schedule, const PhaseUsage& pu, const int reportStepIdx, const double& simTime, GuideRate* guideRate, WellStateFullyImplicitBlackoil& wellState) {
for (const std::string& groupName : group.groups()) {
const Group2& groupTmp = schedule.getGroup2(groupName, reportStepIdx);
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
updateGuideRateForGroups(groupTmp, schedule, pu, reportStepIdx, simTime, guideRate, wellState);
}
bool isInjector = group.isInjectionGroup();
@@ -316,9 +316,9 @@ namespace Opm {
guideRate->compute(group.name(), reportStepIdx, simTime, oilPot, gasPot, waterPot);
}
inline void updateVREPForGroups(const Group2& group, const Schedule& schedule, const int reportStepIdx, WellStateFullyImplicitBlackoil& wellState, double& resv) {
inline void updateVREPForGroups(const Group& group, const Schedule& schedule, const int reportStepIdx, WellStateFullyImplicitBlackoil& wellState, double& resv) {
for (const std::string& groupName : group.groups()) {
const Group2& groupTmp = schedule.getGroup2(groupName, reportStepIdx);
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
double thisResv = 0.0;
updateVREPForGroups(groupTmp, schedule, reportStepIdx, wellState, thisResv);
resv += thisResv;
@@ -331,10 +331,10 @@ namespace Opm {
wellState.setCurrentInjectionVREPRates(group.name(), resv);
}
inline void updateREINForGroups(const Group2& group, const Schedule& schedule, const int reportStepIdx, WellStateFullyImplicitBlackoil& wellState, std::vector<double>& rein) {
inline void updateREINForGroups(const Group& group, const Schedule& schedule, const int reportStepIdx, WellStateFullyImplicitBlackoil& wellState, std::vector<double>& rein) {
const int np = wellState.numPhases();
for (const std::string& groupName : group.groups()) {
const Group2& groupTmp = schedule.getGroup2(groupName, reportStepIdx);
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
std::vector<double> thisRein(np, 0.0);
updateREINForGroups(groupTmp, schedule, reportStepIdx, wellState, thisRein);
for (int phase = 0; phase < np; ++phase) {
@@ -347,11 +347,11 @@ namespace Opm {
wellState.setCurrentInjectionREINRates(group.name(), rein);
}
inline double wellFractionFromGuideRates(const Well2& well, const Schedule& schedule, const WellStateFullyImplicitBlackoil& wellState, const int reportStepIdx, const GuideRate* guideRate, const Well2::GuideRateTarget& wellTarget, const bool isInjector) {
inline double wellFractionFromGuideRates(const Well& well, const Schedule& schedule, const WellStateFullyImplicitBlackoil& wellState, const int reportStepIdx, const GuideRate* guideRate, const Well::GuideRateTarget& wellTarget, const bool isInjector) {
double groupTotalGuideRate = 0.0;
const Group2& groupTmp = schedule.getGroup2(well.groupName(), reportStepIdx);
const Group& groupTmp = schedule.getGroup(well.groupName(), reportStepIdx);
for (const std::string& wellName : groupTmp.wells()) {
const auto& wellTmp = schedule.getWell2(wellName, reportStepIdx);
const auto& wellTmp = schedule.getWell(wellName, reportStepIdx);
if (wellTmp.isProducer() && isInjector)
continue;
@@ -359,7 +359,7 @@ namespace Opm {
if (wellTmp.isInjector() && !isInjector)
continue;
if (wellTmp.getStatus() == Well2::Status::SHUT)
if (wellTmp.getStatus() == Well::Status::SHUT)
continue;
const auto& end = wellState.wellMap().end();
@@ -371,10 +371,10 @@ namespace Opm {
// only count wells under group control
if (isInjector) {
if (wellState.currentInjectionControls()[well_index] != Well2::InjectorCMode::GRUP)
if (wellState.currentInjectionControls()[well_index] != Well::InjectorCMode::GRUP)
continue;
} else {
if (wellState.currentProductionControls()[well_index] != Well2::ProducerCMode::GRUP)
if (wellState.currentProductionControls()[well_index] != Well::ProducerCMode::GRUP)
continue;
}
@@ -388,20 +388,20 @@ namespace Opm {
return wellGuideRate / groupTotalGuideRate;
}
inline double groupFractionFromGuideRates(const Group2& group, const Schedule& schedule, const WellStateFullyImplicitBlackoil& wellState, const int reportStepIdx, const GuideRate* guideRate, const Group2::GuideRateTarget& groupTarget, const bool isInjector) {
inline double groupFractionFromGuideRates(const Group& group, const Schedule& schedule, const WellStateFullyImplicitBlackoil& wellState, const int reportStepIdx, const GuideRate* guideRate, const Group::GuideRateTarget& groupTarget, const bool isInjector) {
double groupTotalGuideRate = 0.0;
const Group2& groupParent = schedule.getGroup2(group.parent(), reportStepIdx);
const Group& groupParent = schedule.getGroup(group.parent(), reportStepIdx);
for (const std::string& groupName : groupParent.groups()) {
const Group2& groupTmp = schedule.getGroup2(groupName, reportStepIdx);
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
// only count group under group control from its parent
if (isInjector) {
const Group2::InjectionCMode& currentGroupControl = wellState.currentInjectionGroupControl(groupName);
if (currentGroupControl != Group2::InjectionCMode::FLD)
const Group::InjectionCMode& currentGroupControl = wellState.currentInjectionGroupControl(groupName);
if (currentGroupControl != Group::InjectionCMode::FLD)
continue;
} else {
const Group2::ProductionCMode& currentGroupControl = wellState.currentProductionGroupControl(groupName);
if (currentGroupControl != Group2::ProductionCMode::FLD)
const Group::ProductionCMode& currentGroupControl = wellState.currentProductionGroupControl(groupName);
if (currentGroupControl != Group::ProductionCMode::FLD)
continue;
}
@@ -418,9 +418,9 @@ namespace Opm {
return groupGuideRate / groupTotalGuideRate;
}
inline void accumulateGroupFractions(const std::string& groupName, const std::string& controlGroupName, const Schedule& schedule, const WellStateFullyImplicitBlackoil& wellState,const int reportStepIdx, const GuideRate* guideRate, const Group2::GuideRateTarget& groupTarget, const bool isInjector, double& fraction) {
inline void accumulateGroupFractions(const std::string& groupName, const std::string& controlGroupName, const Schedule& schedule, const WellStateFullyImplicitBlackoil& wellState,const int reportStepIdx, const GuideRate* guideRate, const Group::GuideRateTarget& groupTarget, const bool isInjector, double& fraction) {
const Group2& group = schedule.getGroup2(groupName, reportStepIdx);
const Group& group = schedule.getGroup(groupName, reportStepIdx);
if (groupName != controlGroupName) {
fraction *= groupFractionFromGuideRates(group, schedule, wellState, reportStepIdx, guideRate, groupTarget, isInjector);
accumulateGroupFractions(group.parent(), controlGroupName, schedule, wellState, reportStepIdx, guideRate, groupTarget, isInjector, fraction);

View File

@@ -28,7 +28,7 @@
#include <opm/common/ErrorMacros.hpp>
#include <opm/common/Exceptions.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/GuideRate.hpp>
@@ -118,7 +118,7 @@ namespace Opm
compositionSwitchEnabled,
Indices::numPhases >;
/// Constructor
WellInterface(const Well2& well, const int time_step, const Wells* wells,
WellInterface(const Well& well, const int time_step, const Wells* wells,
const ModelParameters& param,
const RateConverterType& rate_converter,
const int pvtRegionIdx,
@@ -237,7 +237,7 @@ namespace Opm
void closeCompletions(WellTestState& wellTestState);
const Well2& wellEcl() const;
const Well& wellEcl() const;
// TODO: theoretically, it should be a const function
// Simulator is not const is because that assembleWellEq is non-const Simulator
@@ -282,7 +282,7 @@ namespace Opm
// to indicate a invalid completion
static const int INVALIDCOMPLETION = INT_MAX;
const Well2 well_ecl_;
const Well well_ecl_;
const int current_step_;

View File

@@ -27,7 +27,7 @@ namespace Opm
template<typename TypeTag>
WellInterface<TypeTag>::
WellInterface(const Well2& well, const int time_step, const Wells* wells,
WellInterface(const Well& well, const int time_step, const Wells* wells,
const ModelParameters& param,
const RateConverterType& rate_converter,
const int pvtRegionIdx,
@@ -108,7 +108,7 @@ namespace Opm
well_productivity_index_logger_counter_ = 0;
wellIsStopped_ = false;
if (well.getStatus() == Well2::Status::STOP) {
if (well.getStatus() == Well::Status::STOP) {
wellIsStopped_ = true;
}
@@ -116,7 +116,7 @@ namespace Opm
if (has_solvent && well.isInjector()) {
auto injectorType = well_ecl_.injectorType();
if (injectorType == Well2::InjectorType::GAS) {
if (injectorType == Well::InjectorType::GAS) {
wsolvent_ = well_ecl_.getSolventFraction();
}
}
@@ -250,7 +250,7 @@ namespace Opm
template<typename TypeTag>
const Well2&
const Well&
WellInterface<TypeTag>::
wellEcl() const
{
@@ -343,7 +343,7 @@ namespace Opm
auto injectorType = well_ecl_.injectorType();
if (injectorType == Well2::InjectorType::WATER) {
if (injectorType == Well::InjectorType::WATER) {
WellPolymerProperties polymer = well_ecl_.getPolymerProperties();
const double polymer_injection_concentration = polymer.m_polymerConcentration;
return polymer_injection_concentration;
@@ -368,7 +368,7 @@ namespace Opm
auto injectorType = well_ecl_.injectorType();
if (injectorType == Well2::InjectorType::GAS) {
if (injectorType == Well::InjectorType::GAS) {
WellFoamProperties fprop = well_ecl_.getFoamProperties();
return fprop.m_foamConcentration;
} else {
@@ -386,13 +386,13 @@ namespace Opm
{
if (well_ecl_.isInjector()) {
const auto controls = well_ecl_.injectionControls(summaryState);
if (controls.hasControl(Well2::InjectorCMode::THP))
if (controls.hasControl(Well::InjectorCMode::THP))
return true;
}
if (well_ecl_.isProducer( )) {
const auto controls = well_ecl_.productionControls(summaryState);
if (controls.hasControl(Well2::ProducerCMode::THP))
if (controls.hasControl(Well::ProducerCMode::THP))
return true;
}
@@ -457,9 +457,9 @@ namespace Opm
const auto& well = well_ecl_;
std::string from;
if (well.isInjector()) {
from = Well2::InjectorCMode2String(well_state.currentInjectionControls()[index_of_well_]);
from = Well::InjectorCMode2String(well_state.currentInjectionControls()[index_of_well_]);
} else {
from = Well2::ProducerCMode2String(well_state.currentProductionControls()[index_of_well_]);
from = Well::ProducerCMode2String(well_state.currentProductionControls()[index_of_well_]);
}
bool changed = checkConstraints(well_state, summaryState);
@@ -470,9 +470,9 @@ namespace Opm
if (changed) {
std::string to;
if (well.isInjector()) {
to = Well2::InjectorCMode2String(well_state.currentInjectionControls()[index_of_well_]);
to = Well::InjectorCMode2String(well_state.currentInjectionControls()[index_of_well_]);
} else {
to = Well2::ProducerCMode2String(well_state.currentProductionControls()[index_of_well_]);
to = Well::ProducerCMode2String(well_state.currentProductionControls()[index_of_well_]);
}
std::ostringstream ss;
ss << " Switching control mode for well " << name()
@@ -1381,35 +1381,35 @@ namespace Opm
if (well.isInjector()) {
const auto controls = well.injectionControls(summaryState);
Opm::Well2::InjectorCMode& currentControl = well_state.currentInjectionControls()[well_index];
Opm::Well::InjectorCMode& currentControl = well_state.currentInjectionControls()[well_index];
if (controls.hasControl(Well2::InjectorCMode::BHP) && currentControl != Well2::InjectorCMode::BHP)
if (controls.hasControl(Well::InjectorCMode::BHP) && currentControl != Well::InjectorCMode::BHP)
{
const auto& bhp = controls.bhp_limit;
double current_bhp = well_state.bhp()[well_index];
if (bhp < current_bhp) {
currentControl = Well2::InjectorCMode::BHP;
currentControl = Well::InjectorCMode::BHP;
return true;
}
}
if (controls.hasControl(Well2::InjectorCMode::RATE) && currentControl != Well2::InjectorCMode::RATE)
if (controls.hasControl(Well::InjectorCMode::RATE) && currentControl != Well::InjectorCMode::RATE)
{
Well2::InjectorType injectorType = controls.injector_type;
Well::InjectorType injectorType = controls.injector_type;
double current_rate = 0.0;
switch (injectorType) {
case Well2::InjectorType::WATER:
case Well::InjectorType::WATER:
{
current_rate = well_state.wellRates()[ wellrate_index + pu.phase_pos[BlackoilPhases::Aqua] ];
break;
}
case Well2::InjectorType::OIL:
case Well::InjectorType::OIL:
{
current_rate = well_state.wellRates()[ wellrate_index + pu.phase_pos[BlackoilPhases::Liquid] ];
break;
}
case Well2::InjectorType::GAS:
case Well::InjectorType::GAS:
{
current_rate = well_state.wellRates()[ wellrate_index + pu.phase_pos[BlackoilPhases::Vapour] ];
break;
@@ -1419,13 +1419,13 @@ namespace Opm
}
if (controls.surface_rate < current_rate) {
currentControl = Well2::InjectorCMode::RATE;
currentControl = Well::InjectorCMode::RATE;
return true;
}
}
if (controls.hasControl(Well2::InjectorCMode::RESV) && currentControl != Well2::InjectorCMode::RESV)
if (controls.hasControl(Well::InjectorCMode::RESV) && currentControl != Well::InjectorCMode::RESV)
{
double current_rate = 0.0;
if( pu.phase_used[BlackoilPhases::Aqua] )
@@ -1438,17 +1438,17 @@ namespace Opm
current_rate += well_state.wellReservoirRates()[ wellrate_index + pu.phase_pos[BlackoilPhases::Vapour] ];
if (controls.reservoir_rate < current_rate) {
currentControl = Well2::InjectorCMode::RESV;
currentControl = Well::InjectorCMode::RESV;
return true;
}
}
if (controls.hasControl(Well2::InjectorCMode::THP) && currentControl != Well2::InjectorCMode::THP)
if (controls.hasControl(Well::InjectorCMode::THP) && currentControl != Well::InjectorCMode::THP)
{
const auto& thp = controls.thp_limit;
double current_thp = well_state.thp()[well_index];
if (thp < current_thp) {
currentControl = Well2::InjectorCMode::THP;
currentControl = Well::InjectorCMode::THP;
return true;
}
}
@@ -1457,52 +1457,52 @@ namespace Opm
if (well.isProducer( )) {
const auto controls = well.productionControls(summaryState);
Well2::ProducerCMode& currentControl = well_state.currentProductionControls()[well_index];
Well::ProducerCMode& currentControl = well_state.currentProductionControls()[well_index];
if (controls.hasControl(Well2::ProducerCMode::BHP) && currentControl != Well2::ProducerCMode::BHP )
if (controls.hasControl(Well::ProducerCMode::BHP) && currentControl != Well::ProducerCMode::BHP )
{
const double bhp = controls.bhp_limit;
double current_bhp = well_state.bhp()[well_index];
if (bhp > current_bhp) {
currentControl = Well2::ProducerCMode::BHP;
currentControl = Well::ProducerCMode::BHP;
return true;
}
}
if (controls.hasControl(Well2::ProducerCMode::ORAT) && currentControl != Well2::ProducerCMode::ORAT) {
if (controls.hasControl(Well::ProducerCMode::ORAT) && currentControl != Well::ProducerCMode::ORAT) {
double current_rate = -well_state.wellRates()[ wellrate_index + pu.phase_pos[BlackoilPhases::Liquid] ];
if (controls.oil_rate < current_rate ) {
currentControl = Well2::ProducerCMode::ORAT;
currentControl = Well::ProducerCMode::ORAT;
return true;
}
}
if (controls.hasControl(Well2::ProducerCMode::WRAT) && currentControl != Well2::ProducerCMode::WRAT ) {
if (controls.hasControl(Well::ProducerCMode::WRAT) && currentControl != Well::ProducerCMode::WRAT ) {
double current_rate = -well_state.wellRates()[ wellrate_index + pu.phase_pos[BlackoilPhases::Aqua] ];
if (controls.water_rate < current_rate ) {
currentControl = Well2::ProducerCMode::WRAT;
currentControl = Well::ProducerCMode::WRAT;
return true;
}
}
if (controls.hasControl(Well2::ProducerCMode::GRAT) && currentControl != Well2::ProducerCMode::GRAT ) {
if (controls.hasControl(Well::ProducerCMode::GRAT) && currentControl != Well::ProducerCMode::GRAT ) {
double current_rate = -well_state.wellRates()[ wellrate_index + pu.phase_pos[BlackoilPhases::Vapour] ];
if (controls.gas_rate < current_rate ) {
currentControl = Well2::ProducerCMode::GRAT;
currentControl = Well::ProducerCMode::GRAT;
return true;
}
}
if (controls.hasControl(Well2::ProducerCMode::LRAT) && currentControl != Well2::ProducerCMode::LRAT) {
if (controls.hasControl(Well::ProducerCMode::LRAT) && currentControl != Well::ProducerCMode::LRAT) {
double current_rate = -well_state.wellRates()[ wellrate_index + pu.phase_pos[BlackoilPhases::Liquid] ];
current_rate -= well_state.wellRates()[ wellrate_index + pu.phase_pos[BlackoilPhases::Aqua] ];
if (controls.liquid_rate < current_rate ) {
currentControl = Well2::ProducerCMode::LRAT;
currentControl = Well::ProducerCMode::LRAT;
return true;
}
}
if (controls.hasControl(Well2::ProducerCMode::RESV) && currentControl != Well2::ProducerCMode::RESV ) {
if (controls.hasControl(Well::ProducerCMode::RESV) && currentControl != Well::ProducerCMode::RESV ) {
double current_rate = 0.0;
if( pu.phase_used[BlackoilPhases::Aqua] )
current_rate -= well_state.wellReservoirRates()[ wellrate_index + pu.phase_pos[BlackoilPhases::Aqua] ];
@@ -1514,7 +1514,7 @@ namespace Opm
current_rate -= well_state.wellReservoirRates()[ wellrate_index + pu.phase_pos[BlackoilPhases::Vapour] ];
if (controls.prediction_mode && controls.resv_rate > current_rate) {
currentControl = Well2::ProducerCMode::RESV;
currentControl = Well::ProducerCMode::RESV;
return true;
}
@@ -1539,18 +1539,18 @@ namespace Opm
}
if (resv_rate < current_rate) {
currentControl = Well2::ProducerCMode::RESV;
currentControl = Well::ProducerCMode::RESV;
return true;
}
}
}
if (controls.hasControl(Well2::ProducerCMode::THP) && currentControl != Well2::ProducerCMode::THP)
if (controls.hasControl(Well::ProducerCMode::THP) && currentControl != Well::ProducerCMode::THP)
{
const auto& thp = controls.thp_limit;
double current_thp = well_state.thp()[well_index];
if (thp > current_thp) {
currentControl = Well2::ProducerCMode::THP;
currentControl = Well::ProducerCMode::THP;
return true;
}
}

View File

@@ -27,7 +27,7 @@
#include <opm/core/props/BlackoilPhases.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
#include <opm/common/ErrorMacros.hpp>
@@ -70,7 +70,7 @@ namespace Opm
void init(const Wells* wells,
const std::vector<double>& cellPressures,
const Schedule& schedule,
const std::vector<Well2>& wells_ecl,
const std::vector<Well>& wells_ecl,
const int report_step,
const WellStateFullyImplicitBlackoil* prevState,
const PhaseUsage& pu)
@@ -303,7 +303,7 @@ namespace Opm
}
void resize(const Wells* wells, const std::vector<Well2>& wells_ecl, const Schedule& schedule,
void resize(const Wells* wells, const std::vector<Well>& wells_ecl, const Schedule& schedule,
const bool handle_ms_well, const size_t numCells, const PhaseUsage& pu)
{
const std::vector<double> tmp(numCells, 0.0); // <- UGLY HACK to pass the size
@@ -319,13 +319,13 @@ namespace Opm
const std::vector<double>& perfPhaseRates() const { return perfphaserates_; }
/// One current control per injecting well.
std::vector<Opm::Well2::InjectorCMode>& currentInjectionControls() { return current_injection_controls_; }
const std::vector<Opm::Well2::InjectorCMode>& currentInjectionControls() const { return current_injection_controls_; }
std::vector<Opm::Well::InjectorCMode>& currentInjectionControls() { return current_injection_controls_; }
const std::vector<Opm::Well::InjectorCMode>& currentInjectionControls() const { return current_injection_controls_; }
/// One current control per producing well.
std::vector<Well2::ProducerCMode>& currentProductionControls() { return current_production_controls_; }
const std::vector<Well2::ProducerCMode>& currentProductionControls() const { return current_production_controls_; }
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) {
return current_production_group_controls_.count(groupName) > 0;
@@ -336,10 +336,10 @@ namespace Opm
}
/// One current control per group.
void setCurrentProductionGroupControl(const std::string& groupName, const Group2::ProductionCMode& groupControl ) {
void setCurrentProductionGroupControl(const std::string& groupName, const Group::ProductionCMode& groupControl ) {
current_production_group_controls_[groupName] = groupControl;
}
const Group2::ProductionCMode& currentProductionGroupControl(const std::string& groupName) const {
const Group::ProductionCMode& currentProductionGroupControl(const std::string& groupName) const {
auto it = current_production_group_controls_.find(groupName);
if (it == current_production_group_controls_.end())
@@ -349,10 +349,10 @@ namespace Opm
}
/// One current control per group.
void setCurrentInjectionGroupControl(const std::string& groupName, const Group2::InjectionCMode& groupControl ) {
void setCurrentInjectionGroupControl(const std::string& groupName, const Group::InjectionCMode& groupControl ) {
current_injection_group_controls_[groupName] = groupControl;
}
const Group2::InjectionCMode& currentInjectionGroupControl(const std::string& groupName) const {
const Group::InjectionCMode& currentInjectionGroupControl(const std::string& groupName) const {
auto it = current_injection_group_controls_.find(groupName);
if (it == current_injection_group_controls_.end())
@@ -520,7 +520,7 @@ namespace Opm
/// init the MS well related.
void initWellStateMSWell(const Wells* wells, const std::vector<Well2>& wells_ecl,
void initWellStateMSWell(const Wells* wells, const std::vector<Well>& wells_ecl,
const PhaseUsage& pu, const WellStateFullyImplicitBlackoil* prev_well_state)
{
// still using the order in wells
@@ -837,10 +837,10 @@ namespace Opm
private:
std::vector<double> perfphaserates_;
std::vector<Opm::Well2::InjectorCMode> current_injection_controls_;
std::vector<Well2::ProducerCMode> current_production_controls_;
std::map<std::string, Group2::ProductionCMode> current_production_group_controls_;
std::map<std::string, Group2::InjectionCMode> current_injection_group_controls_;
std::vector<Opm::Well::InjectorCMode> current_injection_controls_;
std::vector<Well::ProducerCMode> current_production_controls_;
std::map<std::string, Group::ProductionCMode> current_production_group_controls_;
std::map<std::string, Group::InjectionCMode> current_injection_group_controls_;
std::map<std::string, std::vector<double>> production_group_reduction_rates;
std::map<std::string, std::vector<double>> injection_group_reduction_rates;