mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Use new well implementation Well2 from opm-common
This commit is contained in:
@@ -191,7 +191,7 @@ public:
|
||||
|
||||
//distribute the grid and switch to the distributed view.
|
||||
{
|
||||
const auto wells = this->schedule().getWells();
|
||||
const auto wells = this->schedule().getWells2atEnd();
|
||||
defunctWellNames_ = std::get<1>(grid_->loadBalance(&wells, faceTrans.data()));
|
||||
}
|
||||
grid_->switchToDistributedView();
|
||||
|
||||
@@ -194,18 +194,18 @@ public:
|
||||
if (!substep) {
|
||||
const auto& schedule = simulator_.vanguard().schedule();
|
||||
const auto& rft_config = schedule.rftConfig();
|
||||
for (const auto& well: schedule.getWells(reportStepNum)) {
|
||||
for (const auto& well: schedule.getWells2(reportStepNum)) {
|
||||
|
||||
// don't bother with wells not on this process
|
||||
const auto& defunctWellNames = simulator_.vanguard().defunctWellNames();
|
||||
if (defunctWellNames.find(well->name()) != defunctWellNames.end()) {
|
||||
if (defunctWellNames.find(well.name()) != defunctWellNames.end()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!rft_config.active(reportStepNum))
|
||||
continue;
|
||||
|
||||
for (const auto& connection: well->getConnections(reportStepNum)) {
|
||||
for (const auto& connection: well.getConnections()) {
|
||||
const size_t i = size_t(connection.getI());
|
||||
const size_t j = size_t(connection.getJ());
|
||||
const size_t k = size_t(connection.getK());
|
||||
@@ -730,24 +730,24 @@ public:
|
||||
{
|
||||
const auto& schedule = simulator_.vanguard().schedule();
|
||||
const auto& rft_config = schedule.rftConfig();
|
||||
for (const auto& well: schedule.getWells(reportStepNum)) {
|
||||
for (const auto& well: schedule.getWells2(reportStepNum)) {
|
||||
|
||||
// don't bother with wells not on this process
|
||||
const auto& defunctWellNames = simulator_.vanguard().defunctWellNames();
|
||||
if (defunctWellNames.find(well->name()) != defunctWellNames.end()) {
|
||||
if (defunctWellNames.find(well.name()) != defunctWellNames.end()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//add data infrastructure for shut wells
|
||||
if (!wellDatas.count(well->name())) {
|
||||
if (!wellDatas.count(well.name())) {
|
||||
Opm::data::Well wellData;
|
||||
|
||||
if (!rft_config.active(reportStepNum))
|
||||
continue;
|
||||
|
||||
wellData.connections.resize(well->getConnections(reportStepNum).size());
|
||||
wellData.connections.resize(well.getConnections().size());
|
||||
size_t count = 0;
|
||||
for (const auto& connection: well->getConnections(reportStepNum)) {
|
||||
for (const auto& connection: well.getConnections()) {
|
||||
const size_t i = size_t(connection.getI());
|
||||
const size_t j = size_t(connection.getJ());
|
||||
const size_t k = size_t(connection.getK());
|
||||
@@ -757,10 +757,10 @@ public:
|
||||
connectionData.index = index;
|
||||
count++;
|
||||
}
|
||||
wellDatas.emplace(std::make_pair(well->name(), wellData));
|
||||
wellDatas.emplace(std::make_pair(well.name(), wellData));
|
||||
}
|
||||
|
||||
Opm::data::Well& wellData = wellDatas.at(well->name());
|
||||
Opm::data::Well& wellData = wellDatas.at(well.name());
|
||||
for (auto& connectionData: wellData.connections) {
|
||||
const auto index = connectionData.index;
|
||||
if (oilConnectionPressures_.count(index) > 0)
|
||||
|
||||
@@ -477,15 +477,15 @@ protected:
|
||||
|
||||
// Wells
|
||||
const int episodeIdx = simulator_.episodeIndex();
|
||||
const auto& wells = simulator_.vanguard().schedule().getWells(episodeIdx);
|
||||
for (auto well : wells) {
|
||||
const auto& wells = simulator_.vanguard().schedule().getWells2(episodeIdx);
|
||||
for (const auto& well : wells) {
|
||||
|
||||
if (well->getStatus(episodeIdx) == Opm::WellCommon::SHUT)
|
||||
if (well.getStatus() == Opm::WellCommon::SHUT)
|
||||
continue;
|
||||
|
||||
const double wtracer = well->getTracerProperties(episodeIdx).getConcentration(tracerNames_[tracerIdx]);
|
||||
const double wtracer = well.getTracerProperties().getConcentration(tracerNames_[tracerIdx]);
|
||||
std::array<int, 3> cartesianCoordinate;
|
||||
for (auto& connection : well->getConnections(episodeIdx)) {
|
||||
for (auto& connection : well.getConnections()) {
|
||||
|
||||
if (connection.state() == Opm::WellCompletion::SHUT)
|
||||
continue;
|
||||
@@ -495,7 +495,7 @@ protected:
|
||||
cartesianCoordinate[2] = connection.getK();
|
||||
const size_t cartIdx = simulator_.vanguard().cartesianIndex(cartesianCoordinate);
|
||||
const int I = cartToGlobal_[cartIdx];
|
||||
Scalar rate = simulator_.problem().wellModel().well(well->name())->volumetricSurfaceRateForConnection(I, tracerPhaseIdx_[tracerIdx]);
|
||||
Scalar rate = simulator_.problem().wellModel().well(well.name())->volumetricSurfaceRateForConnection(I, tracerPhaseIdx_[tracerIdx]);
|
||||
if (rate > 0)
|
||||
tracerResidual_[I][0] -= rate*wtracer;
|
||||
else if (rate < 0)
|
||||
|
||||
@@ -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/Well.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
|
||||
#include <opm/output/data/Wells.hpp>
|
||||
#include <opm/material/common/Exceptions.hpp>
|
||||
@@ -108,11 +108,11 @@ public:
|
||||
// create the wells which intersect with the current process' grid
|
||||
for (size_t deckWellIdx = 0; deckWellIdx < deckSchedule.numWells(); ++deckWellIdx)
|
||||
{
|
||||
const Opm::Well* deckWell = deckSchedule.getWells()[deckWellIdx];
|
||||
const std::string& wellName = deckWell->name();
|
||||
const Opm::Well2 deckWell = deckSchedule.getWells2atEnd()[deckWellIdx];
|
||||
const std::string& wellName = deckWell.name();
|
||||
Scalar wellTemperature = 273.15 + 15.56; // [K]
|
||||
if (deckWell->isInjector(/*timeStep=*/0))
|
||||
wellTemperature = deckWell->getInjectionProperties(/*timeStep=*/0).temperature;
|
||||
if (deckWell.isInjector())
|
||||
wellTemperature = deckWell.getInjectionProperties().temperature;
|
||||
|
||||
// set the name of the well but not much else. (i.e., if it is not completed,
|
||||
// the well primarily serves as a placeholder.) The big rest of the well is
|
||||
@@ -147,20 +147,18 @@ public:
|
||||
// linearized system of equations
|
||||
updateWellParameters_(episodeIdx, wellCompMap);
|
||||
|
||||
const std::vector<const Opm::Well*>& deckWells = deckSchedule.getWells(episodeIdx);
|
||||
const std::vector<Opm::Well2>& deckWells = deckSchedule.getWells2(episodeIdx);
|
||||
// set the injection data for the respective wells.
|
||||
for (size_t deckWellIdx = 0; deckWellIdx < deckWells.size(); ++deckWellIdx) {
|
||||
const Opm::Well* deckWell = deckWells[deckWellIdx];
|
||||
|
||||
if (!hasWell(deckWell->name()))
|
||||
for (const auto& deckWell : deckWells) {
|
||||
if (!hasWell(deckWell.name()))
|
||||
continue;
|
||||
|
||||
auto well = this->well(deckWell->name());
|
||||
auto well = this->well(deckWell.name());
|
||||
|
||||
if (deckWell->isInjector(episodeIdx))
|
||||
well->setTemperature(deckWell->getInjectionProperties(episodeIdx).temperature);
|
||||
if (deckWell.isInjector( ))
|
||||
well->setTemperature(deckWell.getInjectionProperties( ).temperature);
|
||||
|
||||
Opm::WellCommon::StatusEnum deckWellStatus = deckWell->getStatus(episodeIdx);
|
||||
Opm::WellCommon::StatusEnum deckWellStatus = deckWell.getStatus( );
|
||||
switch (deckWellStatus) {
|
||||
case Opm::WellCommon::AUTO:
|
||||
// TODO: for now, auto means open...
|
||||
@@ -178,14 +176,14 @@ public:
|
||||
// make sure that the well is either an injector or a
|
||||
// producer for the current episode. (it is not allowed to
|
||||
// be neither or to be both...)
|
||||
assert((deckWell->isInjector(episodeIdx)?1:0) +
|
||||
(deckWell->isProducer(episodeIdx)?1:0) == 1);
|
||||
assert((deckWell.isInjector( )?1:0) +
|
||||
(deckWell.isProducer( )?1:0) == 1);
|
||||
|
||||
if (deckWell->isInjector(episodeIdx)) {
|
||||
if (deckWell.isInjector( )) {
|
||||
well->setWellType(Well::Injector);
|
||||
|
||||
const Opm::WellInjectionProperties& injectProperties =
|
||||
deckWell->getInjectionProperties(episodeIdx);
|
||||
deckWell.getInjectionProperties( );
|
||||
|
||||
switch (injectProperties.injectorType) {
|
||||
case Opm::WellInjector::WATER:
|
||||
@@ -254,11 +252,11 @@ public:
|
||||
//well->setTargetTubingHeadPressure(injectProperties.THPLimit);
|
||||
}
|
||||
|
||||
if (deckWell->isProducer(episodeIdx)) {
|
||||
if (deckWell.isProducer( )) {
|
||||
well->setWellType(Well::Producer);
|
||||
|
||||
const Opm::WellProductionProperties& producerProperties =
|
||||
deckWell->getProductionProperties(episodeIdx);
|
||||
deckWell.getProductionProperties( );
|
||||
|
||||
switch (producerProperties.controlMode) {
|
||||
case Opm::WellProducer::ORAT:
|
||||
@@ -715,10 +713,9 @@ protected:
|
||||
|
||||
// compute the mapping from logically Cartesian indices to the well the
|
||||
// respective connection.
|
||||
const std::vector<const Opm::Well*>& deckWells = deckSchedule.getWells(reportStepIdx);
|
||||
for (size_t deckWellIdx = 0; deckWellIdx < deckWells.size(); ++deckWellIdx) {
|
||||
const Opm::Well* deckWell = deckWells[deckWellIdx];
|
||||
const std::string& wellName = deckWell->name();
|
||||
const auto deckWells = deckSchedule.getWells2(reportStepIdx);
|
||||
for (const auto& deckWell : deckWells) {
|
||||
const std::string& wellName = deckWell.name();
|
||||
|
||||
if (!hasWell(wellName))
|
||||
{
|
||||
@@ -735,7 +732,7 @@ protected:
|
||||
|
||||
std::array<int, 3> cartesianCoordinate;
|
||||
// set the well parameters defined by the current set of connections
|
||||
const auto& connectionSet = deckWell->getConnections(reportStepIdx);
|
||||
const auto& connectionSet = deckWell.getConnections();
|
||||
for (size_t connIdx = 0; connIdx < connectionSet.size(); connIdx ++) {
|
||||
const auto& connection = connectionSet.get(connIdx);
|
||||
cartesianCoordinate[ 0 ] = connection.getI();
|
||||
@@ -756,17 +753,16 @@ protected:
|
||||
void updateWellParameters_(unsigned reportStepIdx, const WellConnectionsMap& wellConnections)
|
||||
{
|
||||
const auto& deckSchedule = simulator_.vanguard().schedule();
|
||||
const std::vector<const Opm::Well*>& deckWells = deckSchedule.getWells(reportStepIdx);
|
||||
const auto deckWells = deckSchedule.getWells2(reportStepIdx);
|
||||
|
||||
// set the reference depth for all wells
|
||||
for (size_t deckWellIdx = 0; deckWellIdx < deckWells.size(); ++deckWellIdx) {
|
||||
const Opm::Well* deckWell = deckWells[deckWellIdx];
|
||||
const std::string& wellName = deckWell->name();
|
||||
for (const auto& deckWell : deckWells) {
|
||||
const std::string& wellName = deckWell.name();
|
||||
|
||||
if( hasWell( wellName ) )
|
||||
{
|
||||
wells_[wellIndex(wellName)]->clear();
|
||||
wells_[wellIndex(wellName)]->setReferenceDepth(deckWell->getRefDepth());
|
||||
wells_[wellIndex(wellName)]->setReferenceDepth(deckWell.getRefDepth());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,18 +30,16 @@
|
||||
namespace Opm
|
||||
{
|
||||
namespace SimFIBODetails {
|
||||
typedef std::unordered_map<std::string, const Well* > WellMap;
|
||||
typedef std::unordered_map<std::string, Well2 > WellMap;
|
||||
|
||||
inline WellMap
|
||||
mapWells(const std::vector< const Well* >& wells)
|
||||
mapWells(const std::vector< Well2 >& wells)
|
||||
{
|
||||
WellMap wmap;
|
||||
|
||||
for (std::vector< const Well* >::const_iterator
|
||||
w = wells.begin(), e = wells.end();
|
||||
w != e; ++w)
|
||||
for (const auto& w : wells)
|
||||
{
|
||||
wmap.insert(std::make_pair((*w)->name(), *w));
|
||||
wmap.insert(std::make_pair(w.name(), w));
|
||||
}
|
||||
|
||||
return wmap;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "config.h"
|
||||
#include <opm/core/wells/WellCollection.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Group.hpp>
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
@@ -68,22 +68,22 @@ namespace Opm
|
||||
child->setParent(parent);
|
||||
}
|
||||
|
||||
void WellCollection::addWell(const Well* wellChild, size_t timeStep, const PhaseUsage& phaseUsage) {
|
||||
if (wellChild->getStatus(timeStep) == WellCommon::SHUT) {
|
||||
void WellCollection::addWell(const Well2& wellChild, size_t timeStep, const PhaseUsage& phaseUsage) {
|
||||
if (wellChild.getStatus() == WellCommon::SHUT) {
|
||||
//SHUT wells are not added to the well collection
|
||||
return;
|
||||
}
|
||||
|
||||
WellsGroupInterface* parent = findNode(wellChild->getGroupName(timeStep));
|
||||
WellsGroupInterface* parent = findNode(wellChild.groupName());
|
||||
if (!parent) {
|
||||
OPM_THROW(std::runtime_error, "Trying to add well " << wellChild->name() << " Step: " << boost::lexical_cast<std::string>(timeStep) << " to group named " << wellChild->getGroupName(timeStep) << ", but this group does not exist in the WellCollection.");
|
||||
OPM_THROW(std::runtime_error, "Trying to add well " << wellChild.name() << " Step: " << boost::lexical_cast<std::string>(timeStep) << " to group named " << wellChild.groupName() << ", but this group does not exist in the WellCollection.");
|
||||
}
|
||||
|
||||
std::shared_ptr<WellsGroupInterface> child = createWellWellsGroup(wellChild, timeStep, phaseUsage);
|
||||
|
||||
WellsGroup* parent_as_group = static_cast<WellsGroup*> (parent);
|
||||
if (!parent_as_group) {
|
||||
OPM_THROW(std::runtime_error, "Trying to add well to group named " << wellChild->getGroupName(timeStep) << ", but it's not a group.");
|
||||
OPM_THROW(std::runtime_error, "Trying to add well to group named " << wellChild.groupName() << ", but it's not a group.");
|
||||
}
|
||||
parent_as_group->addChild(child);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <opm/grid/UnstructuredGrid.h>
|
||||
#include <opm/core/props/phaseUsageFromDeck.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Group.hpp>
|
||||
|
||||
namespace Opm
|
||||
@@ -38,7 +38,7 @@ namespace Opm
|
||||
|
||||
void addField(const Group& fieldGroup, size_t timeStep, const PhaseUsage& phaseUsage);
|
||||
|
||||
void addWell(const Well* wellChild, size_t timeStep, const PhaseUsage& phaseUsage);
|
||||
void addWell(const Well2& wellChild, size_t timeStep, const PhaseUsage& phaseUsage);
|
||||
|
||||
void addGroup(const Group& groupChild, std::string parent_name,
|
||||
size_t timeStep, const PhaseUsage& phaseUsage);
|
||||
|
||||
@@ -1588,12 +1588,12 @@ namespace Opm
|
||||
'CMODE_UNDEFINED' - we do not carry that over the specification
|
||||
objects here.
|
||||
*/
|
||||
std::shared_ptr<WellsGroupInterface> createWellWellsGroup(const Well* well, size_t timeStep, const PhaseUsage& phase_usage )
|
||||
std::shared_ptr<WellsGroupInterface> createWellWellsGroup(const Well2& well, size_t timeStep, const PhaseUsage& phase_usage )
|
||||
{
|
||||
InjectionSpecification injection_specification;
|
||||
ProductionSpecification production_specification;
|
||||
if (well->isInjector(timeStep)) {
|
||||
const WellInjectionProperties& properties = well->getInjectionProperties(timeStep);
|
||||
if (well.isInjector()) {
|
||||
const WellInjectionProperties& properties = well.getInjectionProperties();
|
||||
injection_specification.BHP_limit_ = properties.BHPLimit;
|
||||
injection_specification.injector_type_ = toInjectorType(WellInjector::Type2String(properties.injectorType));
|
||||
injection_specification.surface_flow_max_rate_ = properties.surfaceInjectionRate;
|
||||
@@ -1603,8 +1603,8 @@ namespace Opm
|
||||
injection_specification.control_mode_ = toInjectionControlMode(WellInjector::ControlMode2String(properties.controlMode));
|
||||
}
|
||||
}
|
||||
else if (well->isProducer(timeStep)) {
|
||||
const WellProductionProperties& properties = well->getProductionProperties(timeStep);
|
||||
else if (well.isProducer()) {
|
||||
const WellProductionProperties& properties = well.getProductionProperties();
|
||||
production_specification.BHP_limit_ = properties.BHPLimit;
|
||||
production_specification.reservoir_flow_max_rate_ = properties.ResVRate;
|
||||
production_specification.oil_max_rate_ = properties.OilRate;
|
||||
@@ -1615,8 +1615,8 @@ namespace Opm
|
||||
}
|
||||
}
|
||||
// Efficiency factor given specified with WEFAC
|
||||
const double efficiency_factor = well->getEfficiencyFactor(timeStep);
|
||||
std::shared_ptr<WellsGroupInterface> wells_group(new WellNode(well->name(), efficiency_factor, production_specification, injection_specification, phase_usage));
|
||||
const double efficiency_factor = well.getEfficiencyFactor();
|
||||
std::shared_ptr<WellsGroupInterface> wells_group(new WellNode(well.name(), efficiency_factor, production_specification, injection_specification, phase_usage));
|
||||
return wells_group;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <opm/grid/UnstructuredGrid.h>
|
||||
#include <opm/core/props/BlackoilPhases.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Group.hpp>
|
||||
|
||||
#include <string>
|
||||
@@ -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 Well* well, size_t timeStep,
|
||||
std::shared_ptr<WellsGroupInterface> createWellWellsGroup(const Well2& well, size_t timeStep,
|
||||
const PhaseUsage& phase_usage );
|
||||
|
||||
/// Creates the WellsGroupInterface for the given Group
|
||||
|
||||
@@ -291,34 +291,34 @@ namespace Opm
|
||||
|
||||
|
||||
|
||||
void WellsManager::setupWellControls(std::vector< const Well* >& wells, size_t timeStep,
|
||||
void WellsManager::setupWellControls(const std::vector<Well2>& wells, size_t timeStep,
|
||||
std::vector<std::string>& well_names, const PhaseUsage& phaseUsage,
|
||||
const std::vector<int>& wells_on_proc) {
|
||||
int well_index = 0;
|
||||
auto well_on_proc = wells_on_proc.begin();
|
||||
|
||||
for (auto wellIter= wells.begin(); wellIter != wells.end(); ++wellIter, ++well_on_proc) {
|
||||
for (auto wellIter = wells.begin(); wellIter != wells.end(); ++wellIter, ++well_on_proc) {
|
||||
if( ! *well_on_proc )
|
||||
{
|
||||
// Wells not stored on the process are not in the list
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto* well = (*wellIter);
|
||||
const auto& well = (*wellIter);
|
||||
|
||||
if (well->getStatus(timeStep) == WellCommon::SHUT) {
|
||||
if (well.getStatus() == WellCommon::SHUT) {
|
||||
//SHUT wells are not added to the well list
|
||||
continue;
|
||||
}
|
||||
|
||||
if (well->getStatus(timeStep) == WellCommon::STOP) {
|
||||
if (well.getStatus() == WellCommon::STOP) {
|
||||
// Stopped wells are kept in the well list but marked as stopped.
|
||||
well_controls_stop_well(w_->ctrls[well_index]);
|
||||
}
|
||||
|
||||
|
||||
if (well->isInjector(timeStep)) {
|
||||
const WellInjectionProperties& injectionProperties = well->getInjectionProperties(timeStep);
|
||||
if (well.isInjector()) {
|
||||
const WellInjectionProperties& injectionProperties = well.getInjectionProperties( );
|
||||
int ok = 1;
|
||||
int control_pos[5] = { -1, -1, -1, -1, -1 };
|
||||
|
||||
@@ -430,11 +430,11 @@ namespace Opm
|
||||
}
|
||||
}
|
||||
|
||||
if (well->isProducer(timeStep)) {
|
||||
if (well.isProducer( )) {
|
||||
// Add all controls that are present in well.
|
||||
// First we must clear existing controls, in case the
|
||||
// current WCONPROD line is modifying earlier controls.
|
||||
const WellProductionProperties& productionProperties = well->getProductionProperties(timeStep);
|
||||
const WellProductionProperties& productionProperties = well.getProductionProperties( );
|
||||
int control_pos[9] = { -1, -1, -1, -1, -1, -1, -1, -1, -1 };
|
||||
int ok = 1;
|
||||
|
||||
@@ -564,7 +564,7 @@ namespace Opm
|
||||
// Set well component fraction to match preferred phase for the well.
|
||||
double cf[3] = { 0.0, 0.0, 0.0 };
|
||||
{
|
||||
switch (well->getPreferredPhase()) {
|
||||
switch (well.getPreferredPhase()) {
|
||||
case Phase::WATER:
|
||||
if (!phaseUsage.phase_used[BlackoilPhases::Aqua]) {
|
||||
OPM_THROW(std::runtime_error, "Water phase not used, yet found water-preferring well.");
|
||||
@@ -584,7 +584,7 @@ namespace Opm
|
||||
cf[phaseUsage.phase_pos[BlackoilPhases::Vapour]] = 1.0;
|
||||
break;
|
||||
default:
|
||||
OPM_THROW(std::logic_error, "Unknown preferred phase: " << well->getPreferredPhase());
|
||||
OPM_THROW(std::logic_error, "Unknown preferred phase: " << well.getPreferredPhase());
|
||||
}
|
||||
std::copy(cf, cf + phaseUsage.num_phases, w_->comp_frac + well_index*phaseUsage.num_phases);
|
||||
}
|
||||
@@ -595,39 +595,39 @@ namespace Opm
|
||||
}
|
||||
|
||||
// only handle the guide rates from the keyword WGRUPCON
|
||||
void WellsManager::setupGuideRates(std::vector< const Well* >& wells, const size_t timeStep, std::vector<WellData>& well_data, std::map<std::string, int>& well_names_to_index)
|
||||
void WellsManager::setupGuideRates(const std::vector<Well2>& wells, const size_t timeStep, 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;
|
||||
const auto& well = *wellIter;
|
||||
|
||||
if (well->getStatus(timeStep) == WellCommon::SHUT) {
|
||||
if (well.getStatus() == WellCommon::SHUT) {
|
||||
//SHUT wells does not need guide rates
|
||||
continue;
|
||||
}
|
||||
|
||||
const int wix = well_names_to_index[well->name()];
|
||||
const int wix = well_names_to_index[well.name()];
|
||||
WellNode& wellnode = *well_collection_.getLeafNodes()[wix];
|
||||
|
||||
// TODO: looks like only handling OIL phase guide rate for producers
|
||||
if (well->getGuideRatePhase(timeStep) != GuideRate::UNDEFINED && well->getGuideRate(timeStep) >= 0.) {
|
||||
if (well.getGuideRatePhase() != GuideRate::UNDEFINED && well.getGuideRate() >= 0.) {
|
||||
if (well_data[wix].type == PRODUCER) {
|
||||
wellnode.prodSpec().guide_rate_ = well->getGuideRate(timeStep);
|
||||
if (well->getGuideRatePhase(timeStep) == GuideRate::OIL) {
|
||||
wellnode.prodSpec().guide_rate_ = well.getGuideRate();
|
||||
if (well.getGuideRatePhase() == GuideRate::OIL) {
|
||||
wellnode.prodSpec().guide_rate_type_ = ProductionSpecification::OIL;
|
||||
} else {
|
||||
OPM_THROW(std::runtime_error, "Guide rate type " << GuideRate::GuideRatePhaseEnum2String(well->getGuideRatePhase(timeStep)) << " specified for producer "
|
||||
<< well->name() << " in WGRUPCON, cannot handle.");
|
||||
OPM_THROW(std::runtime_error, "Guide rate type " << GuideRate::GuideRatePhaseEnum2String(well.getGuideRatePhase()) << " specified for producer "
|
||||
<< well.name() << " in WGRUPCON, cannot handle.");
|
||||
}
|
||||
} else if (well_data[wix].type == INJECTOR) {
|
||||
wellnode.injSpec().guide_rate_ = well->getGuideRate(timeStep);
|
||||
if (well->getGuideRatePhase(timeStep) == GuideRate::RAT) {
|
||||
wellnode.injSpec().guide_rate_ = well.getGuideRate();
|
||||
if (well.getGuideRatePhase() == GuideRate::RAT) {
|
||||
wellnode.injSpec().guide_rate_type_ = InjectionSpecification::RAT;
|
||||
} else {
|
||||
OPM_THROW(std::runtime_error, "Guide rate type " << GuideRate::GuideRatePhaseEnum2String(well->getGuideRatePhase(timeStep)) << " specified for injector "
|
||||
<< well->name() << " in WGRUPCON, cannot handle.");
|
||||
OPM_THROW(std::runtime_error, "Guide rate type " << GuideRate::GuideRatePhaseEnum2String(well.getGuideRatePhase()) << " specified for injector "
|
||||
<< well.name() << " in WGRUPCON, cannot handle.");
|
||||
}
|
||||
} else {
|
||||
OPM_THROW(std::runtime_error, "Unknown well type " << well_data[wix].type << " for well " << well->name());
|
||||
OPM_THROW(std::runtime_error, "Unknown well type " << well_data[wix].type << " for well " << well.name());
|
||||
}
|
||||
} else {
|
||||
wellnode.setIsGuideRateWellPotential(true);
|
||||
|
||||
@@ -167,12 +167,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(std::vector<const Well*>& wells, size_t timeStep,
|
||||
void setupWellControls(const std::vector<Well2>& wells, size_t timeStep,
|
||||
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( std::vector<const Well*>& wells, size_t timeStep,
|
||||
void createWellsFromSpecs( const std::vector<Well2>& wells, size_t timeStep,
|
||||
const C2F& cell_to_faces,
|
||||
const int* cart_dims,
|
||||
FC begin_face_centroids,
|
||||
@@ -188,7 +188,7 @@ namespace Opm
|
||||
std::vector<int>& wells_on_proc,
|
||||
const std::unordered_set<std::string>& deactivated_wells);
|
||||
|
||||
void setupGuideRates(std::vector<const Well*>& wells, const size_t timeStep, std::vector<WellData>& well_data, std::map<std::string, int>& well_names_to_index);
|
||||
void setupGuideRates(const std::vector<Well2>& wells, const size_t timeStep, std::vector<WellData>& well_data, std::map<std::string, int>& well_names_to_index);
|
||||
|
||||
// Data
|
||||
Wells* w_;
|
||||
|
||||
@@ -102,7 +102,7 @@ getCubeDim(const C2F& c2f,
|
||||
namespace Opm
|
||||
{
|
||||
template<class C2F, class FC, class NTG>
|
||||
void WellsManager::createWellsFromSpecs(std::vector<const Well*>& wells, size_t timeStep,
|
||||
void WellsManager::createWellsFromSpecs(const std::vector<Well2>& wells, size_t timeStep,
|
||||
const C2F& /* c2f */,
|
||||
const int* cart_dims,
|
||||
FC /* begin_face_centroids */,
|
||||
@@ -134,13 +134,13 @@ void WellsManager::createWellsFromSpecs(std::vector<const Well*>& wells, size_t
|
||||
// the index of the well according to the eclipse state
|
||||
int active_well_index = 0;
|
||||
for (auto wellIter= wells.begin(); wellIter != wells.end(); ++wellIter) {
|
||||
const auto* well = (*wellIter);
|
||||
const auto& well = (*wellIter);
|
||||
|
||||
if (well->getStatus(timeStep) == WellCommon::SHUT) {
|
||||
if (well.getStatus() == WellCommon::SHUT) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ignored_wells.find(well->name()) != ignored_wells.end() ) {
|
||||
if ( ignored_wells.find(well.name()) != ignored_wells.end() ) {
|
||||
wells_on_proc[ wellIter - wells.begin() ] = 0;
|
||||
continue;
|
||||
}
|
||||
@@ -148,7 +148,7 @@ void WellsManager::createWellsFromSpecs(std::vector<const Well*>& wells, size_t
|
||||
{ // COMPDAT handling
|
||||
// shut completions and open ones stored in this process will have 1 others 0.
|
||||
|
||||
for(const auto& completion : well->getConnections(timeStep)) {
|
||||
for(const auto& completion : well.getConnections()) {
|
||||
if (completion.state() == WellCompletion::OPEN) {
|
||||
const int i = completion.getI();
|
||||
const int j = completion.getJ();
|
||||
@@ -159,7 +159,7 @@ void WellsManager::createWellsFromSpecs(std::vector<const Well*>& wells, size_t
|
||||
const std::map<int, int>::const_iterator cgit = cartesian_to_compressed.find(cart_grid_indx);
|
||||
if (cgit == cartesian_to_compressed.end()) {
|
||||
const std::string msg = ("Cell with i,j,k indices " + std::to_string(i) + " " + std::to_string(j)
|
||||
+ " " + std::to_string(k) + " not found in grid (well = " + well->name() + ").");
|
||||
+ " " + std::to_string(k) + " not found in grid (well = " + well.name() + ").");
|
||||
OPM_THROW(std::runtime_error, msg);
|
||||
}
|
||||
else
|
||||
@@ -181,25 +181,25 @@ void WellsManager::createWellsFromSpecs(std::vector<const Well*>& wells, size_t
|
||||
|
||||
if (wellperf_data[active_well_index].empty()) {
|
||||
const std::string msg = " there is no perforations associated with the well "
|
||||
+ well->name() + ", the well is ignored for the report step "
|
||||
+ well.name() + ", the well is ignored for the report step "
|
||||
+ std::to_string(timeStep);
|
||||
OpmLog::warning(msg);
|
||||
wells_on_proc[wellIter - wells.begin()] = 0;
|
||||
continue;
|
||||
}
|
||||
{ // WELSPECS handling
|
||||
well_names_to_index[well->name()] = active_well_index;
|
||||
well_names.push_back(well->name());
|
||||
well_names_to_index[well.name()] = active_well_index;
|
||||
well_names.push_back(well.name());
|
||||
{
|
||||
WellData wd;
|
||||
wd.reference_bhp_depth = well->getRefDepth( timeStep );
|
||||
wd.reference_bhp_depth = well.getRefDepth( );
|
||||
wd.welspecsline = -1;
|
||||
if (well->isInjector( timeStep ))
|
||||
if (well.isInjector( ))
|
||||
wd.type = INJECTOR;
|
||||
else
|
||||
wd.type = PRODUCER;
|
||||
|
||||
wd.allowCrossFlow = well->getAllowCrossFlow();
|
||||
wd.allowCrossFlow = well.getAllowCrossFlow();
|
||||
well_data.push_back(wd);
|
||||
}
|
||||
}
|
||||
@@ -325,7 +325,7 @@ WellsManager::init(const Opm::EclipseState& eclipseState,
|
||||
// For easy lookup:
|
||||
std::map<std::string, int> well_names_to_index;
|
||||
|
||||
auto wells = schedule.getWells(timeStep);
|
||||
const auto wells = schedule.getWells2(timeStep);
|
||||
std::vector<int> wells_on_proc;
|
||||
|
||||
well_names.reserve(wells.size());
|
||||
@@ -349,7 +349,6 @@ WellsManager::init(const Opm::EclipseState& eclipseState,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::vector<double> interleavedPerm;
|
||||
RockFromDeck::extractInterleavedPermeability(eclipseState,
|
||||
number_of_cells,
|
||||
|
||||
@@ -268,7 +268,7 @@ namespace Opm {
|
||||
|
||||
Simulator& ebosSimulator_;
|
||||
std::unique_ptr<WellsManager> wells_manager_;
|
||||
std::vector< const Well* > wells_ecl_;
|
||||
std::vector< Well2 > wells_ecl_;
|
||||
|
||||
bool wells_active_;
|
||||
|
||||
@@ -422,7 +422,7 @@ namespace Opm {
|
||||
// whether there exists any multisegment well open on this process
|
||||
bool anyMSWellOpenLocal(const Wells* wells, const int report_step) const;
|
||||
|
||||
const Well* getWellEcl(const std::string& well_name) const;
|
||||
const Well2& getWellEcl(const std::string& well_name) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -83,16 +83,15 @@ namespace Opm {
|
||||
}
|
||||
|
||||
// Create cartesian to compressed mapping
|
||||
int last_time_step = schedule().getTimeMap().size() - 1;
|
||||
const auto& schedule_wells = schedule().getWells();
|
||||
const auto& schedule_wells = schedule().getWells2atEnd();
|
||||
const auto& cartesianSize = Opm::UgGridHelpers::cartDims(grid());
|
||||
|
||||
// initialize the additional cell connections introduced by wells.
|
||||
for (const auto well : schedule_wells)
|
||||
for (const auto& well : schedule_wells)
|
||||
{
|
||||
std::vector<int> wellCells;
|
||||
// All possible connections of the well
|
||||
const auto& connectionSet = well->getConnections(last_time_step);
|
||||
const auto& connectionSet = well.getConnections();
|
||||
wellCells.reserve(connectionSet.size());
|
||||
|
||||
for ( size_t c=0; c < connectionSet.size(); c++ )
|
||||
@@ -213,7 +212,7 @@ namespace Opm {
|
||||
const Grid& grid = ebosSimulator_.vanguard().grid();
|
||||
const auto& defunct_well_names = ebosSimulator_.vanguard().defunctWellNames();
|
||||
const auto& eclState = ebosSimulator_.vanguard().eclState();
|
||||
wells_ecl_ = schedule().getWells(timeStepIdx);
|
||||
wells_ecl_ = schedule().getWells2(timeStepIdx);
|
||||
|
||||
// Create wells and well state.
|
||||
wells_manager_.reset( new WellsManager (eclState,
|
||||
@@ -532,7 +531,7 @@ namespace Opm {
|
||||
const int nw_wells_ecl = wells_ecl_.size();
|
||||
int index_well = 0;
|
||||
for (; index_well < nw_wells_ecl; ++index_well) {
|
||||
if (well_name == wells_ecl_[index_well]->name()) {
|
||||
if (well_name == wells_ecl_[index_well].name()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -542,7 +541,7 @@ namespace Opm {
|
||||
OPM_DEFLOG_THROW(std::runtime_error, "Could not find well " + well_name + " in wells_ecl ", deferred_logger);
|
||||
}
|
||||
|
||||
const Well* well_ecl = wells_ecl_[index_well];
|
||||
const Well2& 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_.hasWell(well_name, WellTestConfig::Reason::PHYSICAL ) ) {
|
||||
@@ -565,7 +564,7 @@ namespace Opm {
|
||||
// something like wellTestState_.hasWell(well_name)?
|
||||
if ( wellTestState_.hasWell(well_name, WellTestConfig::Reason::ECONOMIC) ||
|
||||
wellTestState_.hasWell(well_name, WellTestConfig::Reason::PHYSICAL) ) {
|
||||
if( well_ecl->getAutomaticShutIn() ) {
|
||||
if( well_ecl.getAutomaticShutIn() ) {
|
||||
// shut wells are not added to the well container
|
||||
// TODO: make a function from well_state side to handle the following
|
||||
well_state_.thp()[w] = 0.;
|
||||
@@ -586,8 +585,8 @@ namespace Opm {
|
||||
const int well_cell_top = wells()->well_cells[wells()->well_connpos[w]];
|
||||
const int pvtreg = pvt_region_idx_[well_cell_top];
|
||||
|
||||
if ( !well_ecl->isMultiSegment(time_step) || !param_.use_multisegment_well_) {
|
||||
if ( GET_PROP_VALUE(TypeTag, EnablePolymerMW) && well_ecl->isInjector(time_step) ) {
|
||||
if ( !well_ecl.isMultiSegment() || !param_.use_multisegment_well_) {
|
||||
if ( GET_PROP_VALUE(TypeTag, EnablePolymerMW) && well_ecl.isInjector() ) {
|
||||
well_container.emplace_back(new StandardWellV<TypeTag>(well_ecl, time_step, wells(),
|
||||
param_, *rateConverter_, pvtreg, numComponents() ) );
|
||||
} else {
|
||||
@@ -619,7 +618,7 @@ namespace Opm {
|
||||
const int nw_wells_ecl = wells_ecl_.size();
|
||||
int index_well_ecl = 0;
|
||||
for (; index_well_ecl < nw_wells_ecl; ++index_well_ecl) {
|
||||
if (well_name == wells_ecl_[index_well_ecl]->name()) {
|
||||
if (well_name == wells_ecl_[index_well_ecl].name()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -628,7 +627,7 @@ namespace Opm {
|
||||
OPM_DEFLOG_THROW(std::logic_error, "Could not find well " << well_name << " in wells_ecl ", deferred_logger);
|
||||
}
|
||||
|
||||
const Well* well_ecl = wells_ecl_[index_well_ecl];
|
||||
const Well2& well_ecl = wells_ecl_[index_well_ecl];
|
||||
|
||||
// Finding the location of the well in wells struct.
|
||||
const int nw = numWells();
|
||||
@@ -648,7 +647,7 @@ namespace Opm {
|
||||
const int well_cell_top = wells()->well_cells[wells()->well_connpos[well_index_wells]];
|
||||
const int pvtreg = pvt_region_idx_[well_cell_top];
|
||||
|
||||
if ( !well_ecl->isMultiSegment(report_step) || !param_.use_multisegment_well_) {
|
||||
if ( !well_ecl.isMultiSegment() || !param_.use_multisegment_well_) {
|
||||
return WellInterfacePtr(new StandardWell<TypeTag>(well_ecl, report_step, wells(),
|
||||
param_, *rateConverter_, pvtreg, numComponents() ) );
|
||||
} else {
|
||||
@@ -1641,8 +1640,8 @@ namespace Opm {
|
||||
if (i == wmap.end()) {
|
||||
OPM_DEFLOG_THROW(std::logic_error, "Failed to find the well " << wells()->name[*rp] << " in wmap.", deferred_logger);
|
||||
}
|
||||
const auto* wp = i->second;
|
||||
const WellProductionProperties& production_properties = wp->getProductionProperties(step);
|
||||
const auto& wp = i->second;
|
||||
const WellProductionProperties& production_properties = wp.getProductionProperties();
|
||||
// historical phase rates
|
||||
std::vector<double> hrates(np);
|
||||
SimFIBODetails::historyRates(phase_usage_, production_properties, hrates);
|
||||
@@ -1730,10 +1729,9 @@ namespace Opm {
|
||||
if (handle_ms_well && !well.segments.empty()) {
|
||||
// we need the well_ecl_ information
|
||||
const std::string& well_name = wm.first;
|
||||
const Well* well_ecl = getWellEcl(well_name);
|
||||
assert(well_ecl);
|
||||
const Well2& well_ecl = getWellEcl(well_name);
|
||||
|
||||
const WellSegments& segment_set = well_ecl->getWellSegments(report_step);
|
||||
const WellSegments& segment_set = well_ecl.getSegments();
|
||||
|
||||
const int top_segment_index = state.topSegmentIndex(well_index);
|
||||
const auto& segments = well.segments;
|
||||
@@ -1771,9 +1769,9 @@ namespace Opm {
|
||||
for (int w = 0; w < nw; ++w) {
|
||||
const std::string well_name = std::string(wells->name[w]);
|
||||
|
||||
const Well* well_ecl = getWellEcl(well_name);
|
||||
const Well2& well_ecl = getWellEcl(well_name);
|
||||
|
||||
if (well_ecl->isMultiSegment(report_step) ) {
|
||||
if (well_ecl.isMultiSegment() ) {
|
||||
any_ms_well_open = true;
|
||||
break;
|
||||
}
|
||||
@@ -1786,15 +1784,15 @@ namespace Opm {
|
||||
|
||||
|
||||
template<typename TypeTag>
|
||||
const Well*
|
||||
const Well2&
|
||||
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 Well* elem)->bool {
|
||||
return elem->name() == well_name;
|
||||
[&well_name](const Well2& elem)->bool {
|
||||
return elem.name() == well_name;
|
||||
});
|
||||
|
||||
assert(well_ecl != wells_ecl_.end());
|
||||
|
||||
@@ -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 Well* well, const int time_step, const Wells* wells,
|
||||
MultisegmentWell(const Well2& well, const int time_step, const Wells* wells,
|
||||
const ModelParameters& param,
|
||||
const RateConverterType& rate_converter,
|
||||
const int pvtRegionIdx,
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Opm
|
||||
|
||||
template <typename TypeTag>
|
||||
MultisegmentWell<TypeTag>::
|
||||
MultisegmentWell(const Well* well, const int time_step, const Wells* wells,
|
||||
MultisegmentWell(const Well2& well, const int time_step, const Wells* wells,
|
||||
const ModelParameters& param,
|
||||
const RateConverterType& rate_converter,
|
||||
const int pvtRegionIdx,
|
||||
@@ -61,7 +61,7 @@ namespace Opm
|
||||
// for other facilities needed but not available from parser, we need to process them here
|
||||
|
||||
// initialize the segment_perforations_ and update perforation_segment_depth_diffs_
|
||||
const WellConnections& completion_set = well_ecl_->getConnections(current_step_);
|
||||
const WellConnections& completion_set = well_ecl_.getConnections();
|
||||
// index of the perforation within wells struct
|
||||
// there might be some perforations not active, which causes the number of the perforations in
|
||||
// well_ecl_ and wells struct different
|
||||
@@ -812,7 +812,7 @@ namespace Opm
|
||||
MultisegmentWell<TypeTag>::
|
||||
segmentSet() const
|
||||
{
|
||||
return well_ecl_->getWellSegments(current_step_);
|
||||
return well_ecl_.getSegments();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace Opm
|
||||
typedef Dune::FieldVector<Scalar, numWellEq> VectorBlockWellType;
|
||||
typedef Dune::BlockVector<VectorBlockWellType> BVectorWell;
|
||||
|
||||
// the matrix type for the diagonal matrix D
|
||||
// the matrix type for the diagonal matrix D l
|
||||
typedef Dune::FieldMatrix<Scalar, numWellEq, numWellEq > DiagMatrixBlockWellType;
|
||||
typedef Dune::BCRSMatrix <DiagMatrixBlockWellType> DiagMatWell;
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace Opm
|
||||
using Base::contiPolymerEqIdx;
|
||||
static const int contiEnergyEqIdx = Indices::contiEnergyEqIdx;
|
||||
|
||||
StandardWell(const Well* well, const int time_step, const Wells* wells,
|
||||
StandardWell(const Well2& well, const int time_step, const Wells* wells,
|
||||
const ModelParameters& param,
|
||||
const RateConverterType& rate_converter,
|
||||
const int pvtRegionIdx,
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace Opm
|
||||
using Base::contiPolymerEqIdx;
|
||||
static const int contiEnergyEqIdx = Indices::contiEnergyEqIdx;
|
||||
|
||||
StandardWellV(const Well* well, const int time_step, const Wells* wells,
|
||||
StandardWellV(const Well2& well, const int time_step, const Wells* wells,
|
||||
const ModelParameters& param,
|
||||
const RateConverterType& rate_converter,
|
||||
const int pvtRegionIdx,
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Opm
|
||||
|
||||
template<typename TypeTag>
|
||||
StandardWellV<TypeTag>::
|
||||
StandardWellV(const Well* well, const int time_step, const Wells* wells,
|
||||
StandardWellV(const Well2& well, const int time_step, const Wells* wells,
|
||||
const ModelParameters& param,
|
||||
const RateConverterType& rate_converter,
|
||||
const int pvtRegionIdx,
|
||||
@@ -572,8 +572,6 @@ namespace Opm
|
||||
if (has_energy) {
|
||||
|
||||
auto fs = intQuants.fluidState();
|
||||
const int reportStepIdx = ebosSimulator.episodeIndex();
|
||||
|
||||
for (unsigned phaseIdx = 0; phaseIdx < FluidSystem::numPhases; ++phaseIdx) {
|
||||
if (!FluidSystem::phaseIsActive(phaseIdx)) {
|
||||
continue;
|
||||
@@ -607,7 +605,7 @@ namespace Opm
|
||||
|
||||
// change temperature for injecting fluids
|
||||
if (well_type_ == INJECTOR && cq_s[activeCompIdx] > 0.0){
|
||||
const auto& injProps = this->well_ecl_->getInjectionProperties(reportStepIdx);
|
||||
const auto& injProps = this->well_ecl_.getInjectionProperties();
|
||||
fs.setTemperature(injProps.temperature);
|
||||
typedef typename std::decay<decltype(fs)>::type::Scalar FsScalar;
|
||||
typename FluidSystem::template ParameterCache<FsScalar> paramCache;
|
||||
@@ -752,7 +750,7 @@ namespace Opm
|
||||
const double target_rate = well_controls_get_current_target(well_controls_); // surface rate target
|
||||
if (well_type_ == INJECTOR) {
|
||||
// only handles single phase injection now
|
||||
assert(well_ecl_->getInjectionProperties(current_step_).injectorType != WellInjector::MULTI);
|
||||
assert(well_ecl_.getInjectionProperties().injectorType != WellInjector::MULTI);
|
||||
control_eq = getWQTotal() - target_rate;
|
||||
} else if (well_type_ == PRODUCER) {
|
||||
if (target_rate != 0.) {
|
||||
@@ -797,7 +795,7 @@ namespace Opm
|
||||
const double target_rate = well_controls_get_current_target(well_controls_); // reservoir rate target
|
||||
if (well_type_ == INJECTOR) {
|
||||
// only handles single phase injection now
|
||||
assert(well_ecl_->getInjectionProperties(current_step_).injectorType != WellInjector::MULTI);
|
||||
assert(well_ecl_.getInjectionProperties().injectorType != WellInjector::MULTI);
|
||||
const double* distr = well_controls_get_current_distr(well_controls_);
|
||||
for (int phase = 0; phase < number_of_phases_; ++phase) {
|
||||
if (distr[phase] > 0.0) {
|
||||
@@ -2625,15 +2623,15 @@ namespace Opm
|
||||
|
||||
double thp = 0.0;
|
||||
if (well_type_ == INJECTOR) {
|
||||
const int table_id = well_ecl_->getInjectionProperties(current_step_).VFPTableNumber;
|
||||
const int table_id = well_ecl_.getInjectionProperties().VFPTableNumber;
|
||||
const double vfp_ref_depth = vfp_properties_->getInj()->getTable(table_id)->getDatumDepth();
|
||||
const double dp = wellhelpers::computeHydrostaticCorrection(ref_depth_, vfp_ref_depth, rho, gravity_);
|
||||
|
||||
thp = vfp_properties_->getInj()->thp(table_id, aqua, liquid, vapour, bhp + dp);
|
||||
}
|
||||
else if (well_type_ == PRODUCER) {
|
||||
const int table_id = well_ecl_->getProductionProperties(current_step_).VFPTableNumber;
|
||||
const double alq = well_ecl_->getProductionProperties(current_step_).ALQValue;
|
||||
const int table_id = well_ecl_.getProductionProperties().VFPTableNumber;
|
||||
const double alq = well_ecl_.getProductionProperties().ALQValue;
|
||||
const double vfp_ref_depth = vfp_properties_->getProd()->getTable(table_id)->getDatumDepth();
|
||||
const double dp = wellhelpers::computeHydrostaticCorrection(ref_depth_, vfp_ref_depth, rho, gravity_);
|
||||
|
||||
@@ -2934,7 +2932,7 @@ namespace Opm
|
||||
OPM_DEFLOG_THROW(std::runtime_error, "Polymermw is not activated, "
|
||||
"while injecting skin pressure is requested for well " << name(), deferred_logger);
|
||||
}
|
||||
const int water_table_id = well_ecl_->getPolymerProperties(current_step_).m_skprwattable;
|
||||
const int water_table_id = well_ecl_.getPolymerProperties().m_skprwattable;
|
||||
if (water_table_id <= 0) {
|
||||
OPM_DEFLOG_THROW(std::runtime_error, "Unused SKPRWAT table id used for well " << name(), deferred_logger);
|
||||
}
|
||||
@@ -2967,7 +2965,7 @@ namespace Opm
|
||||
if (poly_inj_conc == 0.) {
|
||||
return sign * pskinwater(throughput, water_velocity_abs, deferred_logger);
|
||||
}
|
||||
const int polymer_table_id = well_ecl_->getPolymerProperties(current_step_).m_skprpolytable;
|
||||
const int polymer_table_id = well_ecl_.getPolymerProperties().m_skprpolytable;
|
||||
if (polymer_table_id <= 0) {
|
||||
OPM_DEFLOG_THROW(std::runtime_error, "Unavailable SKPRPOLY table id used for well " << name(), deferred_logger);
|
||||
}
|
||||
@@ -3001,7 +2999,7 @@ namespace Opm
|
||||
OPM_DEFLOG_THROW(std::runtime_error, "Polymermw is not activated, "
|
||||
"while injecting polymer molecular weight is requested for well " << name(), deferred_logger);
|
||||
}
|
||||
const int table_id = well_ecl_->getPolymerProperties(current_step_).m_plymwinjtable;
|
||||
const int table_id = well_ecl_.getPolymerProperties().m_plymwinjtable;
|
||||
const auto& table_func = PolymerModule::getPlymwinjTable(table_id);
|
||||
const EvalWell throughput_eval(numWellEq_ + numEq, throughput);
|
||||
EvalWell molecular_weight(numWellEq_ + numEq, 0.);
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Opm
|
||||
|
||||
template<typename TypeTag>
|
||||
StandardWell<TypeTag>::
|
||||
StandardWell(const Well* well, const int time_step, const Wells* wells,
|
||||
StandardWell(const Well2& well, const int time_step, const Wells* wells,
|
||||
const ModelParameters& param,
|
||||
const RateConverterType& rate_converter,
|
||||
const int pvtRegionIdx,
|
||||
@@ -531,8 +531,6 @@ namespace Opm
|
||||
if (has_energy) {
|
||||
|
||||
auto fs = intQuants.fluidState();
|
||||
const int reportStepIdx = ebosSimulator.episodeIndex();
|
||||
|
||||
for (unsigned phaseIdx = 0; phaseIdx < FluidSystem::numPhases; ++phaseIdx) {
|
||||
if (!FluidSystem::phaseIsActive(phaseIdx)) {
|
||||
continue;
|
||||
@@ -566,7 +564,7 @@ namespace Opm
|
||||
|
||||
// change temperature for injecting fluids
|
||||
if (well_type_ == INJECTOR && cq_s[activeCompIdx] > 0.0){
|
||||
const auto& injProps = this->well_ecl_->getInjectionProperties(reportStepIdx);
|
||||
const auto& injProps = this->well_ecl_.getInjectionProperties();
|
||||
fs.setTemperature(injProps.temperature);
|
||||
typedef typename std::decay<decltype(fs)>::type::Scalar FsScalar;
|
||||
typename FluidSystem::template ParameterCache<FsScalar> paramCache;
|
||||
@@ -698,7 +696,7 @@ namespace Opm
|
||||
const double target_rate = well_controls_get_current_target(well_controls_); // surface rate target
|
||||
if (well_type_ == INJECTOR) {
|
||||
// only handles single phase injection now
|
||||
assert(well_ecl_->getInjectionProperties(current_step_).injectorType != WellInjector::MULTI);
|
||||
assert(well_ecl_.getInjectionProperties().injectorType != WellInjector::MULTI);
|
||||
control_eq = getWQTotal() - target_rate;
|
||||
} else if (well_type_ == PRODUCER) {
|
||||
if (target_rate != 0.) {
|
||||
@@ -743,7 +741,7 @@ namespace Opm
|
||||
const double target_rate = well_controls_get_current_target(well_controls_); // reservoir rate target
|
||||
if (well_type_ == INJECTOR) {
|
||||
// only handles single phase injection now
|
||||
assert(well_ecl_->getInjectionProperties(current_step_).injectorType != WellInjector::MULTI);
|
||||
assert(well_ecl_.getInjectionProperties().injectorType != WellInjector::MULTI);
|
||||
const double* distr = well_controls_get_current_distr(well_controls_);
|
||||
for (int phase = 0; phase < number_of_phases_; ++phase) {
|
||||
if (distr[phase] > 0.0) {
|
||||
@@ -2521,15 +2519,15 @@ namespace Opm
|
||||
|
||||
double thp = 0.0;
|
||||
if (well_type_ == INJECTOR) {
|
||||
const int table_id = well_ecl_->getInjectionProperties(current_step_).VFPTableNumber;
|
||||
const int table_id = well_ecl_.getInjectionProperties().VFPTableNumber;
|
||||
const double vfp_ref_depth = vfp_properties_->getInj()->getTable(table_id)->getDatumDepth();
|
||||
const double dp = wellhelpers::computeHydrostaticCorrection(ref_depth_, vfp_ref_depth, rho, gravity_);
|
||||
|
||||
thp = vfp_properties_->getInj()->thp(table_id, aqua, liquid, vapour, bhp + dp);
|
||||
}
|
||||
else if (well_type_ == PRODUCER) {
|
||||
const int table_id = well_ecl_->getProductionProperties(current_step_).VFPTableNumber;
|
||||
const double alq = well_ecl_->getProductionProperties(current_step_).ALQValue;
|
||||
const int table_id = well_ecl_.getProductionProperties().VFPTableNumber;
|
||||
const double alq = well_ecl_.getProductionProperties().ALQValue;
|
||||
const double vfp_ref_depth = vfp_properties_->getProd()->getTable(table_id)->getDatumDepth();
|
||||
const double dp = wellhelpers::computeHydrostaticCorrection(ref_depth_, vfp_ref_depth, rho, gravity_);
|
||||
|
||||
|
||||
@@ -57,11 +57,11 @@ public:
|
||||
|
||||
for ( auto cell = begin, end= globalCell.end(); cell != end; ++cell )
|
||||
{
|
||||
cartesianToCompressed[ *cell ] = cell - begin;
|
||||
cartesianToCompressed[ *cell ] = cell - begin;
|
||||
}
|
||||
|
||||
int last_time_step = schedule.getTimeMap().size() - 1;
|
||||
const auto& schedule_wells = schedule.getWells();
|
||||
const auto& schedule_wells = schedule.getWells2atEnd();
|
||||
wells_.reserve(schedule_wells.size());
|
||||
|
||||
// initialize the additional cell connections introduced by wells.
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
{
|
||||
std::vector<int> compressed_well_perforations;
|
||||
// All possible completions of the well
|
||||
const auto& completionSet = well->getConnections(last_time_step);
|
||||
const auto& completionSet = well.getConnections();
|
||||
compressed_well_perforations.reserve(completionSet.size());
|
||||
|
||||
for ( size_t c=0; c < completionSet.size(); c++ )
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
#include <opm/common/Exceptions.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace Opm
|
||||
SurfaceToReservoirVoidage<FluidSystem, std::vector<int> >;
|
||||
|
||||
/// Constructor
|
||||
WellInterface(const Well* well, const int time_step, const Wells* wells,
|
||||
WellInterface(const Well2& well, const int time_step, const Wells* wells,
|
||||
const ModelParameters& param,
|
||||
const RateConverterType& rate_converter,
|
||||
const int pvtRegionIdx,
|
||||
@@ -231,11 +231,11 @@ namespace Opm
|
||||
|
||||
void closeCompletions(WellTestState& wellTestState);
|
||||
|
||||
const Well* wellEcl() const;
|
||||
const Well2* wellEcl() const;
|
||||
|
||||
// TODO: theoretically, it should be a const function
|
||||
// Simulator is not const is because that assembleWellEq is non-const Simulator
|
||||
void wellTesting(Simulator& simulator, const std::vector<double>& B_avg,
|
||||
void wellTesting(Simulator& simulator, const std::vector<double>& Bavg,
|
||||
const double simulation_time, const int report_step,
|
||||
const WellTestConfig::Reason testing_reason,
|
||||
/* const */ WellState& well_state, WellTestState& welltest_state,
|
||||
@@ -262,7 +262,7 @@ namespace Opm
|
||||
// to indicate a invalid completion
|
||||
static const int INVALIDCOMPLETION = INT_MAX;
|
||||
|
||||
const Well* well_ecl_;
|
||||
const Well2 well_ecl_;
|
||||
|
||||
const int current_step_;
|
||||
|
||||
|
||||
@@ -27,22 +27,18 @@ namespace Opm
|
||||
|
||||
template<typename TypeTag>
|
||||
WellInterface<TypeTag>::
|
||||
WellInterface(const Well* well, const int time_step, const Wells* wells,
|
||||
WellInterface(const Well2& well, const int time_step, const Wells* wells,
|
||||
const ModelParameters& param,
|
||||
const RateConverterType& rate_converter,
|
||||
const int pvtRegionIdx,
|
||||
const int num_components)
|
||||
: well_ecl_(well)
|
||||
, current_step_(time_step)
|
||||
, param_(param)
|
||||
, rateConverter_(rate_converter)
|
||||
, pvtRegionIdx_(pvtRegionIdx)
|
||||
, num_components_(num_components)
|
||||
: well_ecl_(well)
|
||||
, current_step_(time_step)
|
||||
, param_(param)
|
||||
, rateConverter_(rate_converter)
|
||||
, pvtRegionIdx_(pvtRegionIdx)
|
||||
, num_components_(num_components)
|
||||
{
|
||||
if (!well) {
|
||||
OPM_THROW(std::invalid_argument, "Null pointer of Well is used to construct WellInterface");
|
||||
}
|
||||
|
||||
if (time_step < 0) {
|
||||
OPM_THROW(std::invalid_argument, "Negtive time step is used to construct WellInterface");
|
||||
}
|
||||
@@ -51,7 +47,7 @@ namespace Opm
|
||||
OPM_THROW(std::invalid_argument, "Null pointer of Wells is used to construct WellInterface");
|
||||
}
|
||||
|
||||
const std::string& well_name = well->name();
|
||||
const std::string& well_name = well.name();
|
||||
|
||||
// looking for the location of the well in the wells struct
|
||||
int index_well;
|
||||
@@ -158,7 +154,7 @@ namespace Opm
|
||||
WellInterface<TypeTag>::
|
||||
name() const
|
||||
{
|
||||
return well_ecl_->name();
|
||||
return well_ecl_.name();
|
||||
}
|
||||
|
||||
|
||||
@@ -176,7 +172,6 @@ namespace Opm
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename TypeTag>
|
||||
WellControls*
|
||||
WellInterface<TypeTag>::
|
||||
@@ -203,7 +198,7 @@ namespace Opm
|
||||
WellInterface<TypeTag>::
|
||||
getAllowCrossFlow() const
|
||||
{
|
||||
return well_ecl_->getAllowCrossFlow();
|
||||
return well_ecl_.getAllowCrossFlow();
|
||||
}
|
||||
|
||||
|
||||
@@ -220,11 +215,11 @@ namespace Opm
|
||||
|
||||
|
||||
template<typename TypeTag>
|
||||
const Well*
|
||||
const Well2*
|
||||
WellInterface<TypeTag>::
|
||||
wellEcl() const
|
||||
{
|
||||
return well_ecl_;
|
||||
return std::addressof(well_ecl_);
|
||||
}
|
||||
|
||||
|
||||
@@ -289,9 +284,9 @@ namespace Opm
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
WellInjectionProperties injection = well_ecl_->getInjectionProperties(current_step_);
|
||||
WellInjectionProperties injection = well_ecl_.getInjectionProperties();
|
||||
if (injection.injectorType == WellInjector::GAS) {
|
||||
double solvent_fraction = well_ecl_->getSolventFraction(current_step_);
|
||||
double solvent_fraction = well_ecl_.getSolventFraction();
|
||||
return solvent_fraction;
|
||||
} else {
|
||||
// Not a gas injection well => no solvent.
|
||||
@@ -312,8 +307,8 @@ namespace Opm
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
WellInjectionProperties injection = well_ecl_->getInjectionProperties(current_step_);
|
||||
WellPolymerProperties polymer = well_ecl_->getPolymerProperties(current_step_);
|
||||
WellInjectionProperties injection = well_ecl_.getInjectionProperties();
|
||||
WellPolymerProperties polymer = well_ecl_.getPolymerProperties();
|
||||
|
||||
if (injection.injectorType == WellInjector::WATER) {
|
||||
const double polymer_injection_concentration = polymer.m_polymerConcentration;
|
||||
@@ -527,10 +522,10 @@ namespace Opm
|
||||
|
||||
switch( well_type_ ) {
|
||||
case PRODUCER:
|
||||
under_prediction_mode = well_ecl_->getProductionProperties(current_step_).predictionMode;
|
||||
under_prediction_mode = well_ecl_.getProductionProperties().predictionMode;
|
||||
break;
|
||||
case INJECTOR:
|
||||
under_prediction_mode = well_ecl_->getInjectionProperties(current_step_).predictionMode;
|
||||
under_prediction_mode = well_ecl_.getInjectionProperties().predictionMode;
|
||||
break;
|
||||
default:
|
||||
OPM_DEFLOG_THROW(std::logic_error, "Expected PRODUCER or INJECTOR type for well " << name(), deferred_logger);
|
||||
@@ -644,8 +639,8 @@ namespace Opm
|
||||
water_cut_perf[perf] = 0.;
|
||||
}
|
||||
}
|
||||
const auto& completions = well_ecl_->getCompletions(current_step_);
|
||||
const auto& connections = well_ecl_->getConnections(current_step_);
|
||||
const auto& completions = well_ecl_.getCompletions();
|
||||
const auto& connections = well_ecl_.getConnections();
|
||||
|
||||
int complnumIdx = 0;
|
||||
std::vector<double> water_cut_in_completions(completions.size(), 0.0);
|
||||
@@ -805,7 +800,7 @@ namespace Opm
|
||||
WellTestState& well_test_state,
|
||||
Opm::DeferredLogger& deferred_logger) const
|
||||
{
|
||||
const WellEconProductionLimits& econ_production_limits = well_ecl_->getEconProductionLimits(current_step_);
|
||||
const WellEconProductionLimits& econ_production_limits = well_ecl_.getEconLimits();
|
||||
|
||||
// if no limit is effective here, then continue to the next well
|
||||
if ( !econ_production_limits.onAnyEffectiveLimit() ) {
|
||||
@@ -843,7 +838,7 @@ namespace Opm
|
||||
|
||||
well_test_state.addClosedWell(name(), WellTestConfig::Reason::ECONOMIC, simulation_time);
|
||||
if (write_message_to_opmlog) {
|
||||
if (well_ecl_->getAutomaticShutIn()) {
|
||||
if (well_ecl_.getAutomaticShutIn()) {
|
||||
const std::string msg = std::string("well ") + name() + std::string(" will be shut due to rate economic limit");
|
||||
deferred_logger.info(msg);
|
||||
} else {
|
||||
@@ -885,7 +880,7 @@ namespace Opm
|
||||
}
|
||||
|
||||
bool allCompletionsClosed = true;
|
||||
const auto& connections = well_ecl_->getConnections(current_step_);
|
||||
const auto& connections = well_ecl_.getConnections();
|
||||
for (const auto& connection : connections) {
|
||||
if (!well_test_state.hasCompletion(name(), connection.complnum())) {
|
||||
allCompletionsClosed = false;
|
||||
@@ -895,7 +890,7 @@ namespace Opm
|
||||
if (allCompletionsClosed) {
|
||||
well_test_state.addClosedWell(name(), WellTestConfig::Reason::ECONOMIC, simulation_time);
|
||||
if (write_message_to_opmlog) {
|
||||
if (well_ecl_->getAutomaticShutIn()) {
|
||||
if (well_ecl_.getAutomaticShutIn()) {
|
||||
const std::string msg = name() + std::string(" will be shut due to last completion closed");
|
||||
deferred_logger.info(msg);
|
||||
} else {
|
||||
@@ -910,7 +905,7 @@ namespace Opm
|
||||
{
|
||||
well_test_state.addClosedWell(name(), WellTestConfig::Reason::ECONOMIC, 0);
|
||||
if (write_message_to_opmlog) {
|
||||
if (well_ecl_->getAutomaticShutIn()) {
|
||||
if (well_ecl_.getAutomaticShutIn()) {
|
||||
// tell the controll that the well is closed
|
||||
const std::string msg = name() + std::string(" will be shut due to ratio economic limit");
|
||||
deferred_logger.info(msg);
|
||||
@@ -1005,7 +1000,7 @@ namespace Opm
|
||||
deferred_logger.info(msg);
|
||||
|
||||
// also reopen completions
|
||||
for (auto& completion : well_ecl_->getCompletions(report_step)) {
|
||||
for (auto& completion : well_ecl_.getCompletions()) {
|
||||
if (!welltest_state_temp.hasCompletion(name(), completion.first)) {
|
||||
welltest_state.dropCompletion(name(), completion.first);
|
||||
}
|
||||
@@ -1040,7 +1035,7 @@ namespace Opm
|
||||
bore_diameters_.reserve(nperf);
|
||||
|
||||
// COMPDAT handling
|
||||
const auto& connectionSet = well_ecl_->getConnections(current_step_);
|
||||
const auto& connectionSet = well_ecl_.getConnections();
|
||||
for (size_t c=0; c<connectionSet.size(); c++) {
|
||||
const auto& connection = connectionSet.get(c);
|
||||
if (connection.state() == WellCompletion::OPEN) {
|
||||
@@ -1137,7 +1132,7 @@ namespace Opm
|
||||
// update THP value. However, it will only used for output purpose.
|
||||
|
||||
if (well_type_ == PRODUCER) { // producer
|
||||
const int table_id = well_ecl_->getProductionProperties(current_step_).VFPTableNumber;
|
||||
const int table_id = well_ecl_.getProductionProperties().VFPTableNumber;
|
||||
if (table_id <= 0) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -1150,7 +1145,7 @@ namespace Opm
|
||||
}
|
||||
|
||||
} else { // injector
|
||||
const int table_id = well_ecl_->getInjectionProperties(current_step_).VFPTableNumber;
|
||||
const int table_id = well_ecl_.getInjectionProperties().VFPTableNumber;
|
||||
if (table_id <= 0) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -1230,7 +1225,7 @@ namespace Opm
|
||||
void
|
||||
WellInterface<TypeTag>::closeCompletions(WellTestState& wellTestState)
|
||||
{
|
||||
const auto& connections = well_ecl_->getConnections(current_step_);
|
||||
const auto& connections = well_ecl_.getConnections();
|
||||
int perfIdx = 0;
|
||||
for (const auto& connection : connections) {
|
||||
if (wellTestState.hasCompletion(name(), connection.complnum())) {
|
||||
@@ -1264,8 +1259,8 @@ namespace Opm
|
||||
void
|
||||
WellInterface<TypeTag>::scaleProductivityIndex(const int perfIdx, double& productivity_index, const bool new_well, Opm::DeferredLogger& deferred_logger)
|
||||
{
|
||||
const auto& connection = well_ecl_->getConnections(current_step_)[perfIdx];
|
||||
if (well_ecl_->getDrainageRadius(current_step_) < 0) {
|
||||
const auto& connection = well_ecl_.getConnections()[perfIdx];
|
||||
if (well_ecl_.getDrainageRadius() < 0) {
|
||||
if (new_well && perfIdx == 0) {
|
||||
deferred_logger.warning("PRODUCTIVITY_INDEX_WARNING", "Negative drainage radius not supported. The productivity index is set to zero");
|
||||
}
|
||||
@@ -1273,7 +1268,7 @@ namespace Opm
|
||||
return;
|
||||
}
|
||||
|
||||
if (connection.r0() > well_ecl_->getDrainageRadius(current_step_)) {
|
||||
if (connection.r0() > well_ecl_.getDrainageRadius()) {
|
||||
if (new_well && well_productivity_index_logger_counter_ < 1) {
|
||||
deferred_logger.info("PRODUCTIVITY_INDEX_INFO", "The effective radius is larger than the well drainage radius for well " + name() +
|
||||
" They are set to equal in the well productivity index calculations");
|
||||
@@ -1283,7 +1278,7 @@ namespace Opm
|
||||
}
|
||||
|
||||
// For zero drainage radius the productivity index is just the transmissibility times the mobility
|
||||
if (well_ecl_->getDrainageRadius(current_step_) == 0) {
|
||||
if (well_ecl_.getDrainageRadius() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1291,7 +1286,7 @@ namespace Opm
|
||||
// Assumes steady radial flow only valied for horizontal wells
|
||||
productivity_index *=
|
||||
(std::log(connection.r0() / connection.rw()) + connection.skinFactor()) /
|
||||
(std::log(well_ecl_->getDrainageRadius(current_step_) / connection.rw()) + connection.skinFactor());
|
||||
(std::log(well_ecl_.getDrainageRadius() / connection.rw()) + connection.skinFactor());
|
||||
}
|
||||
|
||||
template<typename TypeTag>
|
||||
|
||||
@@ -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/Well.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp>
|
||||
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
|
||||
@@ -66,10 +66,13 @@ namespace Opm
|
||||
/// Allocate and initialize if wells is non-null. Also tries
|
||||
/// to give useful initial values to the bhp(), wellRates()
|
||||
/// and perfPhaseRates() fields, depending on controls
|
||||
void init(const Wells* wells, const std::vector<double>& cellPressures,
|
||||
void init(const Wells* wells,
|
||||
const std::vector<double>& cellPressures,
|
||||
const Schedule& schedule,
|
||||
const std::vector<const Well*>& wells_ecl, const int report_step,
|
||||
const WellStateFullyImplicitBlackoil* prevState, const PhaseUsage& pu)
|
||||
const std::vector<Well2>& wells_ecl,
|
||||
const int report_step,
|
||||
const WellStateFullyImplicitBlackoil* prevState,
|
||||
const PhaseUsage& pu)
|
||||
{
|
||||
// call init on base class
|
||||
BaseType :: init(wells, cellPressures);
|
||||
@@ -109,7 +112,7 @@ namespace Opm
|
||||
int index_well_ecl = 0;
|
||||
const std::string well_name(wells->name[w]);
|
||||
for (; index_well_ecl < nw_wells_ecl; ++index_well_ecl) {
|
||||
if (well_name == wells_ecl[index_well_ecl]->name()) {
|
||||
if (well_name == wells_ecl[index_well_ecl].name()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -293,7 +296,7 @@ namespace Opm
|
||||
}
|
||||
|
||||
|
||||
void resize(const Wells* wells, const std::vector<const Well*>& wells_ecl, const Schedule& schedule,
|
||||
void resize(const Wells* wells, const std::vector<Well2>& wells_ecl, const Schedule& schedule,
|
||||
const bool handle_ms_well, const int report_step, const size_t numCells,
|
||||
const PhaseUsage& pu)
|
||||
{
|
||||
@@ -605,7 +608,7 @@ namespace Opm
|
||||
|
||||
|
||||
/// init the MS well related.
|
||||
void initWellStateMSWell(const Wells* wells, const std::vector<const Well*>& wells_ecl,
|
||||
void initWellStateMSWell(const Wells* wells, const std::vector<Well2>& wells_ecl,
|
||||
const int time_step, const PhaseUsage& pu, const WellStateFullyImplicitBlackoil* prev_well_state)
|
||||
{
|
||||
// still using the order in wells
|
||||
@@ -630,7 +633,7 @@ namespace Opm
|
||||
int index_well_ecl = 0;
|
||||
const std::string well_name(wells->name[w]);
|
||||
for (; index_well_ecl < nw_wells_ecl; ++index_well_ecl) {
|
||||
if (well_name == wells_ecl[index_well_ecl]->name()) {
|
||||
if (well_name == wells_ecl[index_well_ecl].name()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -640,9 +643,9 @@ namespace Opm
|
||||
OPM_THROW(std::logic_error, "Could not find well " << well_name << " in wells_ecl ");
|
||||
}
|
||||
|
||||
const Well* well_ecl = wells_ecl[index_well_ecl];
|
||||
const auto& well_ecl = wells_ecl[index_well_ecl];
|
||||
top_segment_index_.push_back(nseg_);
|
||||
if ( !well_ecl->isMultiSegment(time_step) ) { // not multi-segment well
|
||||
if ( !well_ecl.isMultiSegment() ) { // not multi-segment well
|
||||
nseg_ += 1;
|
||||
seg_number_.push_back(1); // Assign single segment (top) as number 1.
|
||||
segpress_.push_back(bhp()[w]);
|
||||
@@ -651,9 +654,9 @@ namespace Opm
|
||||
segrates_.push_back(wellRates()[np * w + p]);
|
||||
}
|
||||
} else { // it is a multi-segment well
|
||||
const WellSegments& segment_set = well_ecl->getWellSegments(time_step);
|
||||
const WellSegments& segment_set = well_ecl.getSegments();
|
||||
// assuming the order of the perforations in well_ecl is the same with Wells
|
||||
const WellConnections& completion_set = well_ecl->getConnections(time_step);
|
||||
const WellConnections& completion_set = well_ecl.getConnections();
|
||||
// number of segment for this single well
|
||||
const int well_nseg = segment_set.size();
|
||||
// const int nperf = completion_set.size();
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#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/Well.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Group.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/GroupTree.hpp>
|
||||
@@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE(AddWellsAndGroupToCollection) {
|
||||
|
||||
// Add wells to WellCollection
|
||||
WellCollection wellCollection;
|
||||
auto wells = sched.getWells();
|
||||
const auto wells = sched.getWells2atEnd();
|
||||
for (size_t i=0; i<wells.size(); i++) {
|
||||
collection.addWell(wells[i], 2, pu);
|
||||
}
|
||||
@@ -98,7 +98,7 @@ BOOST_AUTO_TEST_CASE(EfficiencyFactor) {
|
||||
BOOST_CHECK_EQUAL(1.0, collection.findNode("G2")->getParent()->efficiencyFactor());
|
||||
|
||||
// Add wells to WellCollection
|
||||
auto wells1 = sched.getWells(timestep);
|
||||
const auto wells1 = sched.getWells2(timestep);
|
||||
for (size_t i=0; i<wells1.size(); i++) {
|
||||
collection.addWell(wells1[i], timestep, pu);
|
||||
}
|
||||
|
||||
@@ -134,9 +134,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->getWells(setup_test.current_timestep);
|
||||
const auto& wells_ecl = setup_test.schedule->getWells2(setup_test.current_timestep);
|
||||
BOOST_CHECK_EQUAL( wells_ecl.size(), 2);
|
||||
const Opm::Well* well = wells_ecl[1];
|
||||
const Opm::Well2& well = wells_ecl[1];
|
||||
const Opm::BlackoilModelParametersEbos<TTAG(EclFlowProblem) > param;
|
||||
|
||||
// For the conversion between the surface volume rate and resrevoir voidage rate
|
||||
@@ -154,7 +154,6 @@ BOOST_AUTO_TEST_CASE(TestStandardWellInput) {
|
||||
const int num_comp = wells->number_of_phases;
|
||||
|
||||
BOOST_CHECK_THROW( StandardWell( well, -1, wells, param, *rateConverter, pvtIdx, num_comp), std::invalid_argument);
|
||||
BOOST_CHECK_THROW( StandardWell( nullptr, 4, wells , param, *rateConverter, pvtIdx, num_comp), std::invalid_argument);
|
||||
BOOST_CHECK_THROW( StandardWell( well, 4, nullptr , param, *rateConverter, pvtIdx, num_comp), std::invalid_argument);
|
||||
}
|
||||
|
||||
@@ -162,7 +161,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->getWells(setup_test.current_timestep);
|
||||
const auto& wells_ecl = setup_test.schedule->getWells2(setup_test.current_timestep);
|
||||
const int current_timestep = setup_test.current_timestep;
|
||||
std::vector<std::unique_ptr<const StandardWell> > wells;
|
||||
|
||||
@@ -175,7 +174,7 @@ BOOST_AUTO_TEST_CASE(TestBehavoir) {
|
||||
|
||||
size_t index_well = 0;
|
||||
for (; index_well < wells_ecl.size(); ++index_well) {
|
||||
if (well_name == wells_ecl[index_well]->name()) {
|
||||
if (well_name == wells_ecl[index_well].name()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/GroupTree.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
|
||||
using namespace Opm;
|
||||
@@ -55,21 +55,21 @@ BOOST_AUTO_TEST_CASE(ConstructGroupFromWell) {
|
||||
|
||||
PhaseUsage pu = phaseUsageFromDeck(eclipseState);
|
||||
|
||||
auto wells = sched.getWells();
|
||||
auto wells = sched.getWells2atEnd();
|
||||
|
||||
for (size_t i=0; i<wells.size(); i++) {
|
||||
const auto* well = wells[i];
|
||||
const auto& well = wells[i];
|
||||
std::shared_ptr<WellsGroupInterface> wellsGroup = createWellWellsGroup(well, 2, pu);
|
||||
BOOST_CHECK_EQUAL(well->name(), wellsGroup->name());
|
||||
if (well->isInjector(2)) {
|
||||
const WellInjectionProperties& properties = well->getInjectionProperties(2);
|
||||
BOOST_CHECK_EQUAL(well.name(), wellsGroup->name());
|
||||
if (well.isInjector()) {
|
||||
const WellInjectionProperties& properties = well.getInjectionProperties();
|
||||
BOOST_CHECK_EQUAL(properties.surfaceInjectionRate, wellsGroup->injSpec().surface_flow_max_rate_);
|
||||
BOOST_CHECK_EQUAL(properties.BHPLimit, wellsGroup->injSpec().BHP_limit_);
|
||||
BOOST_CHECK_EQUAL(properties.reservoirInjectionRate, wellsGroup->injSpec().reservoir_flow_max_rate_);
|
||||
BOOST_CHECK_EQUAL(0.0, wellsGroup->prodSpec().guide_rate_);
|
||||
}
|
||||
if (well->isProducer(2)) {
|
||||
const WellProductionProperties& properties = well->getProductionProperties(2);
|
||||
if (well.isProducer()) {
|
||||
const WellProductionProperties& properties = well.getProductionProperties();
|
||||
BOOST_CHECK_EQUAL(properties.ResVRate, wellsGroup->prodSpec().reservoir_flow_max_rate_);
|
||||
BOOST_CHECK_EQUAL(properties.BHPLimit, wellsGroup->prodSpec().BHP_limit_);
|
||||
BOOST_CHECK_EQUAL(properties.OilRate, wellsGroup->prodSpec().oil_max_rate_);
|
||||
|
||||
@@ -74,18 +74,18 @@ namespace {
|
||||
};
|
||||
|
||||
state.init(wmgr.c_wells(), cpress, setup.sched,
|
||||
setup.sched.getWells(timeStep),
|
||||
setup.sched.getWells2(timeStep),
|
||||
timeStep, nullptr, setup.pu);
|
||||
|
||||
state.initWellStateMSWell(wmgr.c_wells(),
|
||||
setup.sched.getWells(timeStep),
|
||||
setup.sched.getWells2(timeStep),
|
||||
timeStep, setup.pu, nullptr);
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
void setSegPress(const std::vector<const Opm::Well*>& wells,
|
||||
void setSegPress(const std::vector<Opm::Well2>& wells,
|
||||
const std::size_t tstep,
|
||||
Opm::WellStateFullyImplicitBlackoil& wstate)
|
||||
{
|
||||
@@ -94,7 +94,7 @@ namespace {
|
||||
auto& segPress = wstate.segPress();
|
||||
|
||||
for (auto wellID = 0*nWell; wellID < nWell; ++wellID) {
|
||||
const auto* well = wells[wellID];
|
||||
const auto& well = wells[wellID];
|
||||
const auto topSegIx = wstate.topSegmentIndex(wellID);
|
||||
const auto pressTop = 100.0 * wellID;
|
||||
|
||||
@@ -102,11 +102,11 @@ namespace {
|
||||
|
||||
press[0] = pressTop;
|
||||
|
||||
if (! well->isMultiSegment(tstep)) {
|
||||
if (! well.isMultiSegment()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto& segSet = well->getWellSegments(tstep);
|
||||
const auto& segSet = well.getSegments();
|
||||
const auto nSeg = segSet.size();
|
||||
|
||||
for (auto segID = 0*nSeg + 1; segID < nSeg; ++segID) {
|
||||
@@ -118,7 +118,7 @@ namespace {
|
||||
}
|
||||
|
||||
|
||||
void setSegRates(const std::vector<const Opm::Well*>& wells,
|
||||
void setSegRates(const std::vector<Opm::Well2>& wells,
|
||||
const std::size_t tstep,
|
||||
const Opm::PhaseUsage& pu,
|
||||
Opm::WellStateFullyImplicitBlackoil& wstate)
|
||||
@@ -139,7 +139,7 @@ namespace {
|
||||
auto& segRates = wstate.segRates();
|
||||
|
||||
for (auto wellID = 0*nWell; wellID < nWell; ++wellID) {
|
||||
const auto* well = wells[wellID];
|
||||
const auto& well = wells[wellID];
|
||||
const auto topSegIx = wstate.topSegmentIndex(wellID);
|
||||
const auto rateTop = 1000.0 * wellID;
|
||||
|
||||
@@ -147,11 +147,11 @@ namespace {
|
||||
if (oil) { segRates[np*topSegIx + io] = rateTop; }
|
||||
if (gas) { segRates[np*topSegIx + ig] = rateTop; }
|
||||
|
||||
if (! well->isMultiSegment(tstep)) {
|
||||
if (! well.isMultiSegment()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto& segSet = well->getWellSegments(tstep);
|
||||
const auto& segSet = well.getSegments();
|
||||
const auto nSeg = segSet.size();
|
||||
|
||||
for (auto segID = 0*nSeg + 1; segID < nSeg; ++segID) {
|
||||
@@ -181,10 +181,10 @@ BOOST_AUTO_TEST_CASE(Linearisation)
|
||||
|
||||
BOOST_CHECK_EQUAL(wstate.numSegment(), 6 + 1);
|
||||
|
||||
const auto& wells = setup.sched.getWells(tstep);
|
||||
const auto& wells = setup.sched.getWells2atEnd();
|
||||
BOOST_CHECK_EQUAL(wells.size(), 2);
|
||||
|
||||
const auto prod01_first = wells[0]->name() == "PROD01";
|
||||
const auto prod01_first = wells[0].name() == "PROD01";
|
||||
|
||||
BOOST_CHECK_EQUAL(wstate.topSegmentIndex(0), 0);
|
||||
BOOST_CHECK_EQUAL(wstate.topSegmentIndex(1),
|
||||
@@ -200,8 +200,8 @@ BOOST_AUTO_TEST_CASE(Pressure)
|
||||
|
||||
auto wstate = buildWellState(setup, tstep);
|
||||
|
||||
const auto& wells = setup.sched.getWells(tstep);
|
||||
const auto prod01_first = wells[0]->name() == "PROD01";
|
||||
const auto& wells = setup.sched.getWells2(tstep);
|
||||
const auto prod01_first = wells[0].name() == "PROD01";
|
||||
|
||||
setSegPress(wells, tstep, wstate);
|
||||
|
||||
@@ -244,8 +244,8 @@ BOOST_AUTO_TEST_CASE(Rates)
|
||||
|
||||
auto wstate = buildWellState(setup, tstep);
|
||||
|
||||
const auto& wells = setup.sched.getWells(tstep);
|
||||
const auto prod01_first = wells[0]->name() == "PROD01";
|
||||
const auto wells = setup.sched.getWells2(tstep);
|
||||
const auto prod01_first = wells[0].name() == "PROD01";
|
||||
|
||||
const auto& pu = setup.pu;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user