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
commit 2a5c93356c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 620 additions and 620 deletions

View File

@ -190,7 +190,7 @@ public:
//distribute the grid and switch to the distributed view.
{
const auto wells = this->schedule().getWells2atEnd();
const auto wells = this->schedule().getWellsatEnd();
defunctWellNames_ = std::get<1>(grid_->loadBalance(edgeWeightsMethod, &wells, faceTrans.data()));
}
grid_->switchToDistributedView();

View File

@ -257,7 +257,7 @@ public:
if (!substep) {
const auto& schedule = simulator_.vanguard().schedule();
const auto& rft_config = schedule.rftConfig();
for (const auto& well: schedule.getWells2(reportStepNum)) {
for (const auto& well: schedule.getWells(reportStepNum)) {
// don't bother with wells not on this process
const auto& defunctWellNames = simulator_.vanguard().defunctWellNames();
@ -811,7 +811,7 @@ public:
{
const auto& schedule = simulator_.vanguard().schedule();
const auto& rft_config = schedule.rftConfig();
for (const auto& well: schedule.getWells2(reportStepNum)) {
for (const auto& well: schedule.getWells(reportStepNum)) {
// don't bother with wells not on this process
const auto& defunctWellNames = simulator_.vanguard().defunctWellNames();
@ -1147,7 +1147,7 @@ public:
continue;
}
const auto& well = schedule.getWell2(wname, reportStepNum);
const auto& well = schedule.getWell(wname, reportStepNum);
// Ignore injector wells
if (well.isInjector()){
@ -1166,7 +1166,7 @@ public:
};
const auto& controls = well.productionControls(st);
using CMode = ::Opm::Well2::ProducerCMode;
using CMode = ::Opm::Well::ProducerCMode;
auto fctl = [](const auto wmctl) -> std::string
{
@ -1247,7 +1247,7 @@ public:
continue;
}
const auto& well = schedule.getWell2(wname, reportStepNum);
const auto& well = schedule.getWell(wname, reportStepNum);
// Ignore Producer wells
if (well.isProducer()){
@ -1267,8 +1267,8 @@ public:
const auto& controls = well.injectionControls(st);
const auto ctlMode = controls.cmode;
const auto injType = controls.injector_type;
using CMode = ::Opm::Well2::InjectorCMode;
using WType = ::Opm::Well2::InjectorType;
using CMode = ::Opm::Well::InjectorCMode;
using WType = ::Opm::Well::InjectorType;
auto ftype = [](const auto wtype) -> std::string
{
@ -1376,7 +1376,7 @@ public:
continue;
}
const auto& well = schedule.getWell2(wname, reportStepNum);
const auto& well = schedule.getWell(wname, reportStepNum);
tmp_names[0] = wname; //WellCumDataType::WellName
@ -1393,8 +1393,8 @@ public:
const auto& controls = well.injectionControls(st);
const auto ctlMode = controls.cmode;
const auto injType = controls.injector_type;
using CMode = ::Opm::Well2::InjectorCMode;
using WType = ::Opm::Well2::InjectorType;
using CMode = ::Opm::Well::InjectorCMode;
using WType = ::Opm::Well::InjectorType;
auto ftype = [](const auto wtype) -> std::string
{
@ -1443,7 +1443,7 @@ public:
else if (well.isProducer()) {
const auto& controls = well.productionControls(st);
using CMode = ::Opm::Well2::ProducerCMode;
using CMode = ::Opm::Well::ProducerCMode;
auto fctl = [](const auto wmctl) -> std::string
{

View File

@ -482,10 +482,10 @@ protected:
// Wells
const int episodeIdx = simulator_.episodeIndex();
const auto& wells = simulator_.vanguard().schedule().getWells2(episodeIdx);
const auto& wells = simulator_.vanguard().schedule().getWells(episodeIdx);
for (const auto& well : wells) {
if (well.getStatus() == Opm::Well2::Status::SHUT)
if (well.getStatus() == Opm::Well::Status::SHUT)
continue;
const double wtracer = well.getTracerProperties().getConcentration(tracerNames_[tracerIdx]);

View File

@ -37,7 +37,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Events.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.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/TimeMap.hpp>
#include <opm/output/eclipse/RestartValue.hpp>
@ -110,7 +110,7 @@ public:
// create the wells which intersect with the current process' grid
for (size_t deckWellIdx = 0; deckWellIdx < deckSchedule.numWells(); ++deckWellIdx)
{
const Opm::Well2 deckWell = deckSchedule.getWells2atEnd()[deckWellIdx];
const Opm::Well deckWell = deckSchedule.getWellsatEnd()[deckWellIdx];
const std::string& wellName = deckWell.name();
Scalar wellTemperature = 273.15 + 15.56; // [K]
if (deckWell.isInjector())
@ -149,7 +149,7 @@ public:
// linearized system of equations
updateWellParameters_(episodeIdx, wellCompMap);
const std::vector<Opm::Well2>& deckWells = deckSchedule.getWells2(episodeIdx);
const std::vector<Opm::Well>& deckWells = deckSchedule.getWells(episodeIdx);
// set the injection data for the respective wells.
for (const auto& deckWell : deckWells) {
if (!hasWell(deckWell.name()))
@ -162,15 +162,15 @@ public:
auto deckWellStatus = deckWell.getStatus( );
switch (deckWellStatus) {
case Opm::Well2::Status::AUTO:
case Opm::Well::Status::AUTO:
// TODO: for now, auto means open...
case Opm::Well2::Status::OPEN:
case Opm::Well::Status::OPEN:
well->setWellStatus(Well::Open);
break;
case Opm::Well2::Status::STOP:
case Opm::Well::Status::STOP:
well->setWellStatus(Well::Closed);
break;
case Opm::Well2::Status::SHUT:
case Opm::Well::Status::SHUT:
well->setWellStatus(Well::Shut);
break;
}
@ -185,40 +185,40 @@ public:
well->setWellType(Well::Injector);
const auto controls = deckWell.injectionControls(summaryState);
switch (controls.injector_type) {
case Opm::Well2::InjectorType::WATER:
case Opm::Well::InjectorType::WATER:
well->setInjectedPhaseIndex(FluidSystem::waterPhaseIdx);
break;
case Opm::Well2::InjectorType::GAS:
case Opm::Well::InjectorType::GAS:
well->setInjectedPhaseIndex(FluidSystem::gasPhaseIdx);
break;
case Opm::Well2::InjectorType::OIL:
case Opm::Well::InjectorType::OIL:
well->setInjectedPhaseIndex(FluidSystem::oilPhaseIdx);
break;
case Opm::Well2::InjectorType::MULTI:
case Opm::Well::InjectorType::MULTI:
throw std::runtime_error("Not implemented: Multi-phase injector wells");
}
switch (controls.cmode) {
case Opm::Well2::InjectorCMode::RATE:
case Opm::Well::InjectorCMode::RATE:
well->setControlMode(Well::ControlMode::VolumetricSurfaceRate);
break;
case Opm::Well2::InjectorCMode::RESV:
case Opm::Well::InjectorCMode::RESV:
well->setControlMode(Well::ControlMode::VolumetricReservoirRate);
break;
case Opm::Well2::InjectorCMode::BHP:
case Opm::Well::InjectorCMode::BHP:
well->setControlMode(Well::ControlMode::BottomHolePressure);
break;
case Opm::Well2::InjectorCMode::THP:
case Opm::Well::InjectorCMode::THP:
well->setControlMode(Well::ControlMode::TubingHeadPressure);
break;
case Opm::Well2::InjectorCMode::GRUP:
case Opm::Well::InjectorCMode::GRUP:
throw std::runtime_error("Not implemented: Well groups");
case Opm::Well2::InjectorCMode::CMODE_UNDEFINED:
case Opm::Well::InjectorCMode::CMODE_UNDEFINED:
std::cout << "Warning: Control mode of injection well " << well->name()
<< " is undefined. Assuming well to be shut.\n";
well->setWellStatus(Well::WellStatus::Shut);
@ -226,19 +226,19 @@ public:
}
switch (controls.injector_type) {
case Opm::Well2::InjectorType::WATER:
case Opm::Well::InjectorType::WATER:
well->setVolumetricPhaseWeights(/*oil=*/0.0, /*gas=*/0.0, /*water=*/1.0);
break;
case Opm::Well2::InjectorType::OIL:
case Opm::Well::InjectorType::OIL:
well->setVolumetricPhaseWeights(/*oil=*/1.0, /*gas=*/0.0, /*water=*/0.0);
break;
case Opm::Well2::InjectorType::GAS:
case Opm::Well::InjectorType::GAS:
well->setVolumetricPhaseWeights(/*oil=*/0.0, /*gas=*/1.0, /*water=*/0.0);
break;
case Opm::Well2::InjectorType::MULTI:
case Opm::Well::InjectorType::MULTI:
throw std::runtime_error("Not implemented: Multi-phase injection wells");
}
@ -256,53 +256,53 @@ public:
const auto controls = deckWell.productionControls(summaryState);
switch (controls.cmode) {
case Opm::Well2::ProducerCMode::ORAT:
case Opm::Well::ProducerCMode::ORAT:
well->setControlMode(Well::ControlMode::VolumetricSurfaceRate);
well->setVolumetricPhaseWeights(/*oil=*/1.0, /*gas=*/0.0, /*water=*/0.0);
well->setMaximumSurfaceRate(controls.oil_rate);
break;
case Opm::Well2::ProducerCMode::GRAT:
case Opm::Well::ProducerCMode::GRAT:
well->setControlMode(Well::ControlMode::VolumetricSurfaceRate);
well->setVolumetricPhaseWeights(/*oil=*/0.0, /*gas=*/1.0, /*water=*/0.0);
well->setMaximumSurfaceRate(controls.gas_rate);
break;
case Opm::Well2::ProducerCMode::WRAT:
case Opm::Well::ProducerCMode::WRAT:
well->setControlMode(Well::ControlMode::VolumetricSurfaceRate);
well->setVolumetricPhaseWeights(/*oil=*/0.0, /*gas=*/0.0, /*water=*/1.0);
well->setMaximumSurfaceRate(controls.water_rate);
break;
case Opm::Well2::ProducerCMode::LRAT:
case Opm::Well::ProducerCMode::LRAT:
well->setControlMode(Well::ControlMode::VolumetricSurfaceRate);
well->setVolumetricPhaseWeights(/*oil=*/1.0, /*gas=*/0.0, /*water=*/1.0);
well->setMaximumSurfaceRate(controls.liquid_rate);
break;
case Opm::Well2::ProducerCMode::CRAT:
case Opm::Well::ProducerCMode::CRAT:
throw std::runtime_error("Not implemented: Linearly combined rates");
case Opm::Well2::ProducerCMode::RESV:
case Opm::Well::ProducerCMode::RESV:
well->setControlMode(Well::ControlMode::VolumetricReservoirRate);
well->setVolumetricPhaseWeights(/*oil=*/1.0, /*gas=*/1.0, /*water=*/1.0);
well->setMaximumSurfaceRate(controls.resv_rate);
break;
case Opm::Well2::ProducerCMode::BHP:
case Opm::Well::ProducerCMode::BHP:
well->setControlMode(Well::ControlMode::BottomHolePressure);
break;
case Opm::Well2::ProducerCMode::THP:
case Opm::Well::ProducerCMode::THP:
well->setControlMode(Well::ControlMode::TubingHeadPressure);
break;
case Opm::Well2::ProducerCMode::GRUP:
case Opm::Well::ProducerCMode::GRUP:
throw std::runtime_error("Not implemented: Well groups");
case Opm::Well2::ProducerCMode::NONE:
case Opm::Well::ProducerCMode::NONE:
// fall-through
case Opm::Well2::ProducerCMode::CMODE_UNDEFINED:
case Opm::Well::ProducerCMode::CMODE_UNDEFINED:
std::cout << "Warning: Control mode of production well " << well->name()
<< " is undefined. Assuming well to be shut.";
well->setWellStatus(Well::WellStatus::Shut);
@ -715,7 +715,7 @@ protected:
// compute the mapping from logically Cartesian indices to the well the
// respective connection.
const auto deckWells = deckSchedule.getWells2(reportStepIdx);
const auto deckWells = deckSchedule.getWells(reportStepIdx);
for (const auto& deckWell : deckWells) {
const std::string& wellName = deckWell.name();
@ -755,7 +755,7 @@ protected:
void updateWellParameters_(unsigned reportStepIdx, const WellConnectionsMap& wellConnections)
{
const auto& deckSchedule = simulator_.vanguard().schedule();
const auto deckWells = deckSchedule.getWells2(reportStepIdx);
const auto deckWells = deckSchedule.getWells(reportStepIdx);
// set the reference depth for all wells
for (const auto& deckWell : deckWells) {

View File

@ -20,8 +20,8 @@
#include "config.h"
#include <opm/core/wells/WellCollection.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/Group2.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
#include <boost/lexical_cast.hpp>
@ -30,7 +30,7 @@
namespace Opm
{
void WellCollection::addField(const Group2& fieldGroup, const SummaryState& summaryState, const PhaseUsage& phaseUsage) {
void WellCollection::addField(const Group& fieldGroup, const SummaryState& summaryState, const PhaseUsage& phaseUsage) {
WellsGroupInterface* fieldNode = findNode(fieldGroup.name());
if (fieldNode) {
OPM_THROW(std::runtime_error, "Trying to add FIELD node, but this already exists. Can only have one FIELD node.");
@ -39,7 +39,7 @@ namespace Opm
roots_.push_back(createGroupWellsGroup(fieldGroup, summaryState, phaseUsage));
}
void WellCollection::addGroup(const Group2& groupChild, std::string parent_name,
void WellCollection::addGroup(const Group& groupChild, std::string parent_name,
const SummaryState& summaryState, const PhaseUsage& phaseUsage) {
WellsGroupInterface* parent = findNode(parent_name);
if (!parent) {
@ -68,8 +68,8 @@ namespace Opm
child->setParent(parent);
}
void WellCollection::addWell(const Well2& wellChild, const SummaryState& summaryState, const PhaseUsage& phaseUsage) {
if (wellChild.getStatus() == Well2::Status::SHUT) {
void WellCollection::addWell(const Well& wellChild, const SummaryState& summaryState, const PhaseUsage& phaseUsage) {
if (wellChild.getStatus() == Well::Status::SHUT) {
//SHUT wells are not added to the well collection
return;
}

View File

@ -26,8 +26,8 @@
#include <opm/grid/UnstructuredGrid.h>
#include <opm/core/props/phaseUsageFromDeck.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/Group2.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp>
namespace Opm
{
@ -36,11 +36,11 @@ namespace Opm
{
public:
void addField(const Group2& fieldGroup, const SummaryState& summaryState, const PhaseUsage& phaseUsage);
void addField(const Group& fieldGroup, const SummaryState& summaryState, const PhaseUsage& phaseUsage);
void addWell(const Well2& wellChild, const SummaryState& summaryState, const PhaseUsage& phaseUsage);
void addWell(const Well& wellChild, const SummaryState& summaryState, const PhaseUsage& phaseUsage);
void addGroup(const Group2& groupChild, std::string parent_name,
void addGroup(const Group& groupChild, std::string parent_name,
const SummaryState& summaryState, const PhaseUsage& phaseUsage);
/// Adds the child to the collection

View File

@ -1556,14 +1556,14 @@ namespace Opm
}
} // anonymous namespace
std::shared_ptr<WellsGroupInterface> createGroupWellsGroup(const Group2& group, const SummaryState& st, const PhaseUsage& phase_usage )
std::shared_ptr<WellsGroupInterface> createGroupWellsGroup(const Group& group, const SummaryState& st, const PhaseUsage& phase_usage )
{
InjectionSpecification injection_specification;
ProductionSpecification production_specification;
if (group.isInjectionGroup()) {
const auto& injection = group.injectionControls(st);
injection_specification.injector_type_ = toInjectorType(injection.phase);
injection_specification.control_mode_ = toInjectionControlMode(Group2::InjectionCMode2String(injection.cmode));
injection_specification.control_mode_ = toInjectionControlMode(Group::InjectionCMode2String(injection.cmode));
injection_specification.surface_flow_max_rate_ = injection.surface_max_rate;
injection_specification.reservoir_flow_max_rate_ = injection.resv_max_rate;
injection_specification.reinjection_fraction_target_ = injection.target_reinj_fraction;
@ -1573,11 +1573,11 @@ namespace Opm
if (group.isProductionGroup()) {
const auto& production = group.productionControls(st);
production_specification.oil_max_rate_ = production.oil_target;
production_specification.control_mode_ = toProductionControlMode(Group2::ProductionCMode2String(production.cmode));
production_specification.control_mode_ = toProductionControlMode(Group::ProductionCMode2String(production.cmode));
production_specification.water_max_rate_ = production.water_target;
production_specification.gas_max_rate_ = production.gas_target;
production_specification.liquid_max_rate_ = production.liquid_target;
production_specification.procedure_ = toProductionProcedure(Group2::ExceedAction2String(production.exceed_action));
production_specification.procedure_ = toProductionProcedure(Group::ExceedAction2String(production.exceed_action));
production_specification.reservoir_flow_max_rate_ = production.resv_target;
}
@ -1596,19 +1596,19 @@ namespace Opm
'CMODE_UNDEFINED' - we do not carry that over the specification
objects here.
*/
std::shared_ptr<WellsGroupInterface> createWellWellsGroup(const Well2& well, const SummaryState& summaryState, const PhaseUsage& phase_usage )
std::shared_ptr<WellsGroupInterface> createWellWellsGroup(const Well& well, const SummaryState& summaryState, const PhaseUsage& phase_usage )
{
InjectionSpecification injection_specification;
ProductionSpecification production_specification;
if (well.isInjector()) {
const auto controls = well.injectionControls(summaryState);
injection_specification.BHP_limit_ = controls.bhp_limit;
injection_specification.injector_type_ = toInjectorType(Well2::InjectorType2String(controls.injector_type));
injection_specification.injector_type_ = toInjectorType(Well::InjectorType2String(controls.injector_type));
injection_specification.surface_flow_max_rate_ = controls.surface_rate;
injection_specification.reservoir_flow_max_rate_ = controls.reservoir_rate;
production_specification.guide_rate_ = 0.0; // We know we're not a producer
if (controls.cmode != Well2::InjectorCMode::CMODE_UNDEFINED) {
injection_specification.control_mode_ = toInjectionControlMode(Well2::InjectorCMode2String(controls.cmode));
if (controls.cmode != Well::InjectorCMode::CMODE_UNDEFINED) {
injection_specification.control_mode_ = toInjectionControlMode(Well::InjectorCMode2String(controls.cmode));
}
}
else if (well.isProducer()) {
@ -1618,8 +1618,8 @@ namespace Opm
production_specification.oil_max_rate_ = controls.oil_rate;
production_specification.water_max_rate_ = controls.water_rate;
injection_specification.guide_rate_ = 0.0; // we know we're not an injector
if (controls.cmode != Well2::ProducerCMode::CMODE_UNDEFINED) {
production_specification.control_mode_ = toProductionControlMode(Well2::ProducerCMode2String(controls.cmode));
if (controls.cmode != Well::ProducerCMode::CMODE_UNDEFINED) {
production_specification.control_mode_ = toProductionControlMode(Well::ProducerCMode2String(controls.cmode));
}
}
// Efficiency factor given specified with WEFAC

View File

@ -25,8 +25,8 @@
#include <opm/grid/UnstructuredGrid.h>
#include <opm/core/props/BlackoilPhases.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/Group2.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp>
#include <string>
#include <memory>
@ -541,7 +541,7 @@ namespace Opm
/// \param[in] well the Well to construct object for
/// \param[in] timeStep the time step in question
/// \param[in] the phase usage
std::shared_ptr<WellsGroupInterface> createWellWellsGroup(const Well2& well,
std::shared_ptr<WellsGroupInterface> createWellWellsGroup(const Well& well,
const SummaryState& summaryState,
const PhaseUsage& phase_usage );
@ -549,7 +549,7 @@ namespace Opm
/// \param[in] group the Group to construct object for
/// \param[in] timeStep the time step in question
/// \param[in] the phase usage
std::shared_ptr<WellsGroupInterface> createGroupWellsGroup(const Group2& group,
std::shared_ptr<WellsGroupInterface> createGroupWellsGroup(const Group& group,
const SummaryState& summaryState,
const PhaseUsage& phase_usage );
}

View File

@ -90,26 +90,26 @@ namespace WellsManagerDetail
}
Mode mode(Opm::Well2::ProducerCMode controlMode)
Mode mode(Opm::Well::ProducerCMode controlMode)
{
switch( controlMode ) {
case Opm::Well2::ProducerCMode::ORAT:
case Opm::Well::ProducerCMode::ORAT:
return ORAT;
case Opm::Well2::ProducerCMode::WRAT:
case Opm::Well::ProducerCMode::WRAT:
return WRAT;
case Opm::Well2::ProducerCMode::GRAT:
case Opm::Well::ProducerCMode::GRAT:
return GRAT;
case Opm::Well2::ProducerCMode::LRAT:
case Opm::Well::ProducerCMode::LRAT:
return LRAT;
case Opm::Well2::ProducerCMode::CRAT:
case Opm::Well::ProducerCMode::CRAT:
return CRAT;
case Opm::Well2::ProducerCMode::RESV:
case Opm::Well::ProducerCMode::RESV:
return RESV;
case Opm::Well2::ProducerCMode::BHP:
case Opm::Well::ProducerCMode::BHP:
return BHP;
case Opm::Well2::ProducerCMode::THP:
case Opm::Well::ProducerCMode::THP:
return THP;
case Opm::Well2::ProducerCMode::GRUP:
case Opm::Well::ProducerCMode::GRUP:
return GRUP;
default:
throw std::invalid_argument("unhandled enum value");
@ -153,18 +153,18 @@ namespace WellsManagerDetail
}
}
Mode mode(Opm::Well2::InjectorCMode controlMode)
Mode mode(Opm::Well::InjectorCMode controlMode)
{
switch ( controlMode ) {
case Opm::Well2::InjectorCMode::GRUP:
case Opm::Well::InjectorCMode::GRUP:
return GRUP;
case Opm::Well2::InjectorCMode::RESV:
case Opm::Well::InjectorCMode::RESV:
return RESV;
case Opm::Well2::InjectorCMode::RATE:
case Opm::Well::InjectorCMode::RATE:
return RATE;
case Opm::Well2::InjectorCMode::THP:
case Opm::Well::InjectorCMode::THP:
return THP;
case Opm::Well2::InjectorCMode::BHP:
case Opm::Well::InjectorCMode::BHP:
return BHP;
default:
throw std::invalid_argument("unhandled enum value");
@ -290,7 +290,7 @@ namespace Opm
void WellsManager::setupWellControls(const std::vector<Well2>& wells,
void WellsManager::setupWellControls(const std::vector<Well>& wells,
const SummaryState& summaryState,
std::vector<std::string>& well_names,
const PhaseUsage& phaseUsage,
@ -307,12 +307,12 @@ namespace Opm
const auto& well = (*wellIter);
if (well.getStatus() == Well2::Status::SHUT) {
if (well.getStatus() == Well::Status::SHUT) {
//SHUT wells are not added to the well list
continue;
}
if (well.getStatus() == Well2::Status::STOP) {
if (well.getStatus() == Well::Status::STOP) {
// Stopped wells are kept in the well list but marked as stopped.
well_controls_stop_well(w_->ctrls[well_index]);
}
@ -324,16 +324,16 @@ namespace Opm
int control_pos[5] = { -1, -1, -1, -1, -1 };
clear_well_controls(well_index, w_);
if (controls.hasControl(Well2::InjectorCMode::RATE)) {
if (controls.hasControl(Well::InjectorCMode::RATE)) {
control_pos[WellsManagerDetail::InjectionControl::RATE] = well_controls_get_num(w_->ctrls[well_index]);
double distr[3] = { 0.0, 0.0, 0.0 };
auto injectorType = controls.injector_type;
if (injectorType == Well2::InjectorType::WATER) {
if (injectorType == Well::InjectorType::WATER) {
distr[phaseUsage.phase_pos[BlackoilPhases::Aqua]] = 1.0;
} else if (injectorType == Well2::InjectorType::OIL) {
} else if (injectorType == Well::InjectorType::OIL) {
distr[phaseUsage.phase_pos[BlackoilPhases::Liquid]] = 1.0;
} else if (injectorType == Well2::InjectorType::GAS) {
} else if (injectorType == Well::InjectorType::GAS) {
distr[phaseUsage.phase_pos[BlackoilPhases::Vapour]] = 1.0;
}
@ -346,16 +346,16 @@ namespace Opm
w_);
}
if (ok && controls.hasControl(Well2::InjectorCMode::RESV)) {
if (ok && controls.hasControl(Well::InjectorCMode::RESV)) {
control_pos[WellsManagerDetail::InjectionControl::RESV] = well_controls_get_num(w_->ctrls[well_index]);
double distr[3] = { 0.0, 0.0, 0.0 };
auto injectorType = controls.injector_type;
if (injectorType == Well2::InjectorType::WATER) {
if (injectorType == Well::InjectorType::WATER) {
distr[phaseUsage.phase_pos[BlackoilPhases::Aqua]] = 1.0;
} else if (injectorType == Well2::InjectorType::OIL) {
} else if (injectorType == Well::InjectorType::OIL) {
distr[phaseUsage.phase_pos[BlackoilPhases::Liquid]] = 1.0;
} else if (injectorType == Well2::InjectorType::GAS) {
} else if (injectorType == Well::InjectorType::GAS) {
distr[phaseUsage.phase_pos[BlackoilPhases::Vapour]] = 1.0;
}
@ -368,7 +368,7 @@ namespace Opm
w_);
}
if (ok && controls.hasControl(Well2::InjectorCMode::BHP)) {
if (ok && controls.hasControl(Well::InjectorCMode::BHP)) {
control_pos[WellsManagerDetail::InjectionControl::BHP] = well_controls_get_num(w_->ctrls[well_index]);
ok = append_well_controls(BHP,
controls.bhp_limit,
@ -379,7 +379,7 @@ namespace Opm
w_);
}
if (ok && controls.hasControl(Well2::InjectorCMode::THP)) {
if (ok && controls.hasControl(Well::InjectorCMode::THP)) {
control_pos[WellsManagerDetail::InjectionControl::THP] = well_controls_get_num(w_->ctrls[well_index]);
const double thp_limit = controls.thp_limit;
const int vfp_number = controls.vfp_table_number;
@ -396,7 +396,7 @@ namespace Opm
OPM_THROW(std::runtime_error, "Failure occured appending controls for well " << well_names[well_index]);
}
if (controls.cmode != Well2::InjectorCMode::CMODE_UNDEFINED) {
if (controls.cmode != Well::InjectorCMode::CMODE_UNDEFINED) {
WellsManagerDetail::InjectionControl::Mode mode = WellsManagerDetail::InjectionControl::mode(controls.cmode);
int cpos = control_pos[mode];
if (cpos == -1 && mode != WellsManagerDetail::InjectionControl::GRUP) {
@ -411,17 +411,17 @@ namespace Opm
{
auto injectorType = controls.injector_type;
if (injectorType == Well2::InjectorType::WATER) {
if (injectorType == Well::InjectorType::WATER) {
if (!phaseUsage.phase_used[BlackoilPhases::Aqua]) {
OPM_THROW(std::runtime_error, "Water phase not used, yet found water-injecting well.");
}
cf[phaseUsage.phase_pos[BlackoilPhases::Aqua]] = 1.0;
} else if (injectorType == Well2::InjectorType::OIL) {
} else if (injectorType == Well::InjectorType::OIL) {
if (!phaseUsage.phase_used[BlackoilPhases::Liquid]) {
OPM_THROW(std::runtime_error, "Oil phase not used, yet found oil-injecting well.");
}
cf[phaseUsage.phase_pos[BlackoilPhases::Liquid]] = 1.0;
} else if (injectorType == Well2::InjectorType::GAS) {
} else if (injectorType == Well::InjectorType::GAS) {
if (!phaseUsage.phase_used[BlackoilPhases::Vapour]) {
OPM_THROW(std::runtime_error, "Gas phase not used, yet found gas-injecting well.");
}
@ -440,7 +440,7 @@ namespace Opm
int ok = 1;
clear_well_controls(well_index, w_);
if (ok && controls.hasControl(Well2::ProducerCMode::ORAT)) {
if (ok && controls.hasControl(Well::ProducerCMode::ORAT)) {
if (!phaseUsage.phase_used[BlackoilPhases::Liquid]) {
OPM_THROW(std::runtime_error, "Oil phase not active and ORAT control specified.");
}
@ -457,7 +457,7 @@ namespace Opm
w_);
}
if (ok && controls.hasControl(Well2::ProducerCMode::WRAT)) {
if (ok && controls.hasControl(Well::ProducerCMode::WRAT)) {
if (!phaseUsage.phase_used[BlackoilPhases::Aqua]) {
OPM_THROW(std::runtime_error, "Water phase not active and WRAT control specified.");
}
@ -473,7 +473,7 @@ namespace Opm
w_);
}
if (ok && controls.hasControl(Well2::ProducerCMode::GRAT)) {
if (ok && controls.hasControl(Well::ProducerCMode::GRAT)) {
if (!phaseUsage.phase_used[BlackoilPhases::Vapour]) {
OPM_THROW(std::runtime_error, "Gas phase not active and GRAT control specified.");
}
@ -489,7 +489,7 @@ namespace Opm
w_);
}
if (ok && controls.hasControl(Well2::ProducerCMode::LRAT)) {
if (ok && controls.hasControl(Well::ProducerCMode::LRAT)) {
if (!phaseUsage.phase_used[BlackoilPhases::Aqua]) {
OPM_THROW(std::runtime_error, "Water phase not active and LRAT control specified.");
}
@ -509,7 +509,7 @@ namespace Opm
w_);
}
if (ok && controls.hasControl(Well2::ProducerCMode::RESV)) {
if (ok && controls.hasControl(Well::ProducerCMode::RESV)) {
control_pos[WellsManagerDetail::ProductionControl::RESV] = well_controls_get_num(w_->ctrls[well_index]);
double distr[3] = { 1.0, 1.0, 1.0 };
ok = append_well_controls(RESERVOIR_RATE,
@ -521,7 +521,7 @@ namespace Opm
w_);
}
if (ok && controls.hasControl(Well2::ProducerCMode::THP)) {
if (ok && controls.hasControl(Well::ProducerCMode::THP)) {
const double thp_limit = controls.thp_limit;
const double alq_value = controls.alq_value;
const int vfp_number = controls.vfp_table_number;
@ -551,7 +551,7 @@ namespace Opm
OPM_THROW(std::runtime_error, "Failure occured appending controls for well " << well_names[well_index]);
}
if (controls.cmode != Well2::ProducerCMode::CMODE_UNDEFINED) {
if (controls.cmode != Well::ProducerCMode::CMODE_UNDEFINED) {
WellsManagerDetail::ProductionControl::Mode mode = WellsManagerDetail::ProductionControl::mode(controls.cmode);
int cpos = control_pos[mode];
if (cpos == -1 && mode != WellsManagerDetail::ProductionControl::GRUP) {
@ -596,12 +596,12 @@ namespace Opm
}
// only handle the guide rates from the keyword WGRUPCON
void WellsManager::setupGuideRates(const std::vector<Well2>& wells, std::vector<WellData>& well_data, std::map<std::string, int>& well_names_to_index)
void WellsManager::setupGuideRates(const std::vector<Well>& wells, std::vector<WellData>& well_data, std::map<std::string, int>& well_names_to_index)
{
for (auto wellIter = wells.begin(); wellIter != wells.end(); ++wellIter ) {
const auto& well = *wellIter;
if (well.getStatus() == Well2::Status::SHUT) {
if (well.getStatus() == Well::Status::SHUT) {
//SHUT wells does not need guide rates
continue;
}
@ -610,21 +610,21 @@ namespace Opm
WellNode& wellnode = *well_collection_.getLeafNodes()[wix];
// TODO: looks like only handling OIL phase guide rate for producers
if (well.getGuideRatePhase() != Well2::GuideRateTarget::UNDEFINED && well.getGuideRate() >= 0.) {
if (well.getGuideRatePhase() != Well::GuideRateTarget::UNDEFINED && well.getGuideRate() >= 0.) {
if (well_data[wix].type == PRODUCER) {
wellnode.prodSpec().guide_rate_ = well.getGuideRate();
if (well.getGuideRatePhase() == Well2::GuideRateTarget::OIL) {
if (well.getGuideRatePhase() == Well::GuideRateTarget::OIL) {
wellnode.prodSpec().guide_rate_type_ = ProductionSpecification::OIL;
} else {
OPM_THROW(std::runtime_error, "Guide rate type " << Well2::GuideRateTarget2String(well.getGuideRatePhase()) << " specified for producer "
OPM_THROW(std::runtime_error, "Guide rate type " << Well::GuideRateTarget2String(well.getGuideRatePhase()) << " specified for producer "
<< well.name() << " in WGRUPCON, cannot handle.");
}
} else if (well_data[wix].type == INJECTOR) {
wellnode.injSpec().guide_rate_ = well.getGuideRate();
if (well.getGuideRatePhase() == Well2::GuideRateTarget::RAT) {
if (well.getGuideRatePhase() == Well::GuideRateTarget::RAT) {
wellnode.injSpec().guide_rate_type_ = InjectionSpecification::RAT;
} else {
OPM_THROW(std::runtime_error, "Guide rate type " << Well2::GuideRateTarget2String(well.getGuideRatePhase()) << " specified for injector "
OPM_THROW(std::runtime_error, "Guide rate type " << Well::GuideRateTarget2String(well.getGuideRatePhase()) << " specified for injector "
<< well.name() << " in WGRUPCON, cannot handle.");
}
} else {

View File

@ -169,12 +169,12 @@ namespace Opm
WellsManager(const WellsManager& other);
WellsManager& operator=(const WellsManager& other);
static void setupCompressedToCartesian(const int* global_cell, int number_of_cells, std::map<int,int>& cartesian_to_compressed );
void setupWellControls(const std::vector<Well2>& wells, const SummaryState& summaryState,
void setupWellControls(const std::vector<Well>& wells, const SummaryState& summaryState,
std::vector<std::string>& well_names, const PhaseUsage& phaseUsage,
const std::vector<int>& wells_on_proc);
template<class C2F, class FC, class NTG>
void createWellsFromSpecs( const std::vector<Well2>& wells, size_t timeStep,
void createWellsFromSpecs( const std::vector<Well>& wells, size_t timeStep,
const C2F& cell_to_faces,
const int* cart_dims,
FC begin_face_centroids,
@ -190,7 +190,7 @@ namespace Opm
std::vector<int>& wells_on_proc,
const std::unordered_set<std::string>& deactivated_wells);
void setupGuideRates(const std::vector<Well2>& wells, std::vector<WellData>& well_data, std::map<std::string, int>& well_names_to_index);
void setupGuideRates(const std::vector<Well>& wells, std::vector<WellData>& well_data, std::map<std::string, int>& well_names_to_index);
// Data
Wells* w_;

View File

@ -34,7 +34,7 @@ namespace WellsManagerDetail
Mode mode(const std::string& control);
Mode mode(Opm::Well2::ProducerCMode controlMode);
Mode mode(Opm::Well::ProducerCMode controlMode);
} // namespace ProductionControl
@ -50,7 +50,7 @@ namespace WellsManagerDetail
*/
Mode mode(const std::string& control);
Mode mode(Opm::Well2::InjectorCMode controlMode);
Mode mode(Opm::Well::InjectorCMode controlMode);
} // namespace InjectionControl
@ -102,7 +102,7 @@ getCubeDim(const C2F& c2f,
namespace Opm
{
template<class C2F, class FC, class NTG>
void WellsManager::createWellsFromSpecs(const std::vector<Well2>& wells, size_t timeStep,
void WellsManager::createWellsFromSpecs(const std::vector<Well>& wells, size_t timeStep,
const C2F& /* c2f */,
const int* cart_dims,
FC /* begin_face_centroids */,
@ -136,7 +136,7 @@ void WellsManager::createWellsFromSpecs(const std::vector<Well2>& wells, size_t
for (auto wellIter= wells.begin(); wellIter != wells.end(); ++wellIter) {
const auto& well = (*wellIter);
if (well.getStatus() == Well2::Status::SHUT) {
if (well.getStatus() == Well::Status::SHUT) {
continue;
}
@ -327,7 +327,7 @@ WellsManager::init(const Opm::EclipseState& eclipseState,
// For easy lookup:
std::map<std::string, int> well_names_to_index;
const auto wells = schedule.getWells2(timeStep);
const auto wells = schedule.getWells(timeStep);
std::vector<int> wells_on_proc;
well_names.reserve(wells.size());
@ -371,16 +371,16 @@ WellsManager::init(const Opm::EclipseState& eclipseState,
setupWellControls(wells, summaryState, well_names, pu, wells_on_proc);
{
const auto& fieldGroup = schedule.getGroup2( "FIELD", timeStep);
const auto& fieldGroup = schedule.getGroup( "FIELD", timeStep);
well_collection_.addField(fieldGroup, summaryState, pu);
std::vector< std::string > group_stack = { "FIELD" };
do {
const auto& parent = schedule.getGroup2(group_stack.back(), timeStep);
const auto& parent = schedule.getGroup(group_stack.back(), timeStep);
group_stack.pop_back();
for (const auto& child: parent.groups()) {
group_stack.push_back(child);
well_collection_.addGroup( schedule.getGroup2( child, timeStep ), parent.name(), summaryState, pu );
well_collection_.addGroup( schedule.getGroup( child, timeStep ), parent.name(), summaryState, pu );
}
} while( !group_stack.empty() );

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;

View File

@ -28,9 +28,9 @@
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.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/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/Group2.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp>
using namespace Opm;
@ -50,11 +50,11 @@ BOOST_AUTO_TEST_CASE(AddWellsAndGroupToCollection) {
WellCollection collection;
// Add groups to WellCollection
const auto& fieldGroup = sched.getGroup2("FIELD", 2);
const auto& fieldGroup = sched.getGroup("FIELD", 2);
collection.addField(fieldGroup, summaryState, pu);
collection.addGroup( sched.getGroup2( "G1", 2 ), fieldGroup.name(), summaryState, pu);
collection.addGroup( sched.getGroup2( "G2", 2 ), fieldGroup.name(), summaryState, pu);
collection.addGroup( sched.getGroup( "G1", 2 ), fieldGroup.name(), summaryState, pu);
collection.addGroup( sched.getGroup( "G2", 2 ), fieldGroup.name(), summaryState, pu);
BOOST_CHECK_EQUAL("FIELD", collection.findNode("FIELD")->name());
BOOST_CHECK_EQUAL("FIELD", collection.findNode("G1")->getParent()->name());
@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE(AddWellsAndGroupToCollection) {
// Add wells to WellCollection
WellCollection wellCollection;
const auto wells = sched.getWells2atEnd();
const auto wells = sched.getWellsatEnd();
for (size_t i=0; i<wells.size(); i++) {
collection.addWell(wells[i], summaryState, pu);
}
@ -89,17 +89,17 @@ BOOST_AUTO_TEST_CASE(EfficiencyFactor) {
size_t timestep = 2;
WellCollection collection;
// Add groups to WellCollection
const auto& fieldGroup = sched.getGroup2("FIELD", timestep);
const auto& fieldGroup = sched.getGroup("FIELD", timestep);
collection.addField( fieldGroup, summaryState, pu);
collection.addGroup( sched.getGroup2( "G1", timestep ), fieldGroup.name(), summaryState, pu);
collection.addGroup( sched.getGroup2( "G2", timestep ), fieldGroup.name(), summaryState, pu);
collection.addGroup( sched.getGroup( "G1", timestep ), fieldGroup.name(), summaryState, pu);
collection.addGroup( sched.getGroup( "G2", timestep ), fieldGroup.name(), summaryState, pu);
BOOST_CHECK_EQUAL(1.0, collection.findNode("FIELD")->efficiencyFactor());
BOOST_CHECK_EQUAL(1.0, collection.findNode("G1")->getParent()->efficiencyFactor());
BOOST_CHECK_EQUAL(1.0, collection.findNode("G2")->getParent()->efficiencyFactor());
// Add wells to WellCollection
const auto wells1 = sched.getWells2(timestep);
const auto wells1 = sched.getWells(timestep);
for (size_t i=0; i<wells1.size(); i++) {
collection.addWell(wells1[i], summaryState, pu);
}

View File

@ -133,9 +133,9 @@ BOOST_GLOBAL_FIXTURE(GlobalFixture);
BOOST_AUTO_TEST_CASE(TestStandardWellInput) {
const SetupTest setup_test;
const Wells* wells = setup_test.wells_manager->c_wells();
const auto& wells_ecl = setup_test.schedule->getWells2(setup_test.current_timestep);
const auto& wells_ecl = setup_test.schedule->getWells(setup_test.current_timestep);
BOOST_CHECK_EQUAL( wells_ecl.size(), 2);
const Opm::Well2& well = wells_ecl[1];
const Opm::Well& well = wells_ecl[1];
const Opm::BlackoilModelParametersEbos<TTAG(EclFlowProblem) > param;
// For the conversion between the surface volume rate and resrevoir voidage rate
@ -160,7 +160,7 @@ BOOST_AUTO_TEST_CASE(TestStandardWellInput) {
BOOST_AUTO_TEST_CASE(TestBehavoir) {
const SetupTest setup_test;
const Wells* wells_struct = setup_test.wells_manager->c_wells();
const auto& wells_ecl = setup_test.schedule->getWells2(setup_test.current_timestep);
const auto& wells_ecl = setup_test.schedule->getWells(setup_test.current_timestep);
const int current_timestep = setup_test.current_timestep;
std::vector<std::unique_ptr<const StandardWell> > wells;

View File

@ -34,9 +34,9 @@
#include <opm/core/wells/WellsGroup.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/Group2.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/Group.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/parser/eclipse/EclipseState/EclipseState.hpp>
using namespace Opm;
@ -54,7 +54,7 @@ BOOST_AUTO_TEST_CASE(ConstructGroupFromWell) {
SummaryState summaryState(std::chrono::system_clock::from_time_t(sched.getStartTime()));
PhaseUsage pu = phaseUsageFromDeck(eclipseState);
auto wells = sched.getWells2atEnd();
auto wells = sched.getWellsatEnd();
for (size_t i=0; i<wells.size(); i++) {
const auto& well = wells[i];
@ -93,7 +93,7 @@ BOOST_AUTO_TEST_CASE(ConstructGroupFromGroup) {
Opm::SummaryState summaryState(std::chrono::system_clock::from_time_t(sched.getStartTime()));
for( const auto& grp_name : sched.groupNames() ) {
const auto& group = sched.getGroup2(grp_name, 2);
const auto& group = sched.getGroup(grp_name, 2);
std::shared_ptr<WellsGroupInterface> wellsGroup = createGroupWellsGroup(group, summaryState, pu);
BOOST_CHECK_EQUAL(group.name(), wellsGroup->name());
@ -131,7 +131,7 @@ BOOST_AUTO_TEST_CASE(EfficiencyFactor) {
Opm::SummaryState summaryState(std::chrono::system_clock::from_time_t(sched.getStartTime()));
for( const auto& grp_name : sched.groupNames() ) {
const auto& group = sched.getGroup2(grp_name, 2);
const auto& group = sched.getGroup(grp_name, 2);
std::shared_ptr<WellsGroupInterface> wellsGroup = createGroupWellsGroup(group, summaryState, pu);
BOOST_CHECK_EQUAL(group.name(), wellsGroup->name());

View File

@ -75,18 +75,18 @@ namespace {
const Opm::WellsManager wmgr{setup.es, setup.sched, setup.st, timeStep, *setup.grid.c_grid()};
state.init(wmgr.c_wells(), cpress, setup.sched,
setup.sched.getWells2(timeStep),
setup.sched.getWells(timeStep),
timeStep, nullptr, setup.pu);
state.initWellStateMSWell(wmgr.c_wells(),
setup.sched.getWells2(timeStep),
setup.sched.getWells(timeStep),
setup.pu, nullptr);
return state;
}
void setSegPress(const std::vector<Opm::Well2>& wells,
void setSegPress(const std::vector<Opm::Well>& wells,
Opm::WellStateFullyImplicitBlackoil& wstate)
{
const auto nWell = wells.size();
@ -118,7 +118,7 @@ namespace {
}
void setSegRates(const std::vector<Opm::Well2>& wells,
void setSegRates(const std::vector<Opm::Well>& wells,
const Opm::PhaseUsage& pu,
Opm::WellStateFullyImplicitBlackoil& wstate)
{
@ -180,7 +180,7 @@ BOOST_AUTO_TEST_CASE(Linearisation)
BOOST_CHECK_EQUAL(wstate.numSegment(), 6 + 1);
const auto& wells = setup.sched.getWells2atEnd();
const auto& wells = setup.sched.getWellsatEnd();
BOOST_CHECK_EQUAL(wells.size(), 2);
const auto prod01_first = wells[0].name() == "PROD01";
@ -199,7 +199,7 @@ BOOST_AUTO_TEST_CASE(Pressure)
auto wstate = buildWellState(setup, tstep);
const auto& wells = setup.sched.getWells2(tstep);
const auto& wells = setup.sched.getWells(tstep);
const auto prod01_first = wells[0].name() == "PROD01";
setSegPress(wells, wstate);
@ -243,7 +243,7 @@ BOOST_AUTO_TEST_CASE(Rates)
auto wstate = buildWellState(setup, tstep);
const auto wells = setup.sched.getWells2(tstep);
const auto wells = setup.sched.getWells(tstep);
const auto prod01_first = wells[0].name() == "PROD01";
const auto& pu = setup.pu;