Merge pull request #972 from joakim-hove/class-enum

Move Well status enum to Well2 class
This commit is contained in:
Joakim Hove
2019-09-04 16:29:18 +02:00
committed by GitHub
61 changed files with 2378 additions and 2564 deletions

View File

@@ -100,7 +100,6 @@ if(ENABLE_ECL_INPUT)
src/opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.cpp
src/opm/parser/eclipse/EclipseState/Schedule/RFTConfig.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp
src/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.cpp
src/opm/parser/eclipse/EclipseState/Schedule/SummaryState.cpp
src/opm/parser/eclipse/EclipseState/Schedule/TimeMap.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Tuning.cpp
@@ -562,7 +561,6 @@ if(ENABLE_ECL_INPUT)
opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateModel.hpp
opm/parser/eclipse/EclipseState/Schedule/MessageLimits.hpp
opm/parser/eclipse/EclipseState/Schedule/Events.hpp
opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp
opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp
opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp
opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.hpp

View File

@@ -25,7 +25,6 @@
#include <opm/parser/eclipse/Deck/UDAValue.hpp>
#include <opm/parser/eclipse/EclipseState/Util/IOrderSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
@@ -35,9 +34,76 @@ class SummaryState;
class Group2 {
public:
// A group can have both injection controls and production controls set at
// the same time, i.e. this enum is used as a bitmask.
enum class GroupType : unsigned {
NONE = 0,
PRODUCTION = 1,
INJECTION = 2,
MIXED = 3
};
enum class ExceedAction {
NONE = 0,
CON = 1,
CON_PLUS = 2, // String: "+CON"
WELL = 3,
PLUG = 4,
RATE = 5
};
static const std::string ExceedAction2String( ExceedAction enumValue );
static ExceedAction ExceedActionFromString( const std::string& stringValue );
enum class InjectionCMode : int {
NONE = 0,
RATE = 1,
RESV = 2,
REIN = 4,
VREP = 8,
FLD = 16
};
static const std::string InjectionCMode2String( InjectionCMode enumValue );
static InjectionCMode InjectionCModeFromString( const std::string& stringValue );
enum class ProductionCMode : int {
NONE = 0,
ORAT = 1,
WRAT = 2,
GRAT = 4,
LRAT = 8,
CRAT = 16,
RESV = 32,
PRBL = 64,
FLD = 128
};
static const std::string ProductionCMode2String( ProductionCMode enumValue );
static ProductionCMode ProductionCModeFromString( const std::string& stringValue );
enum class GuideRateTarget {
OIL = 0,
WAT = 1,
GAS = 2,
LIQ = 3,
COMB = 4,
WGA = 5,
CVAL = 6,
INJV = 7,
POTN = 8,
FORM = 9,
NO_GUIDE_RATE = 10
};
static GuideRateTarget GuideRateTargetFromString( const std::string& stringValue );
struct GroupInjectionProperties {
Phase phase = Phase::WATER;
GroupInjection::ControlEnum cmode = GroupInjection::NONE;
InjectionCMode cmode = InjectionCMode::NONE;
UDAValue surface_max_rate;
UDAValue resv_max_rate;
UDAValue target_reinj_fraction;
@@ -50,24 +116,24 @@ struct GroupInjectionProperties {
struct InjectionControls {
Phase phase;
GroupInjection::ControlEnum cmode;
InjectionCMode cmode;
double surface_max_rate;
double resv_max_rate;
double target_reinj_fraction;
double target_void_fraction;
int injection_controls = 0;
bool has_control(GroupInjection::ControlEnum control) const;
bool has_control(InjectionCMode control) const;
};
struct GroupProductionProperties {
GroupProduction::ControlEnum cmode = GroupProduction::NONE;
GroupProductionExceedLimit::ActionEnum exceed_action = GroupProductionExceedLimit::NONE;
ProductionCMode cmode = ProductionCMode::NONE;
ExceedAction exceed_action = ExceedAction::NONE;
UDAValue oil_target;
UDAValue water_target;
UDAValue gas_target;
UDAValue liquid_target;
double guide_rate;
GroupProduction::GuideRateDef guide_rate_def;
GuideRateTarget guide_rate_def;
double resv_target = 0;
int production_controls = 0;
@@ -76,19 +142,20 @@ struct GroupProductionProperties {
};
struct ProductionControls {
GroupProduction::ControlEnum cmode;
GroupProductionExceedLimit::ActionEnum exceed_action;
ProductionCMode cmode;
ExceedAction exceed_action;
double oil_target;
double water_target;
double gas_target;
double liquid_target;
double guide_rate;
GroupProduction::GuideRateDef guide_rate_def;
GuideRateTarget guide_rate_def;
double resv_target = 0;
int production_controls = 0;
bool has_control(GroupProduction::ControlEnum control) const;
bool has_control(ProductionCMode control) const;
};
Group2(const std::string& group_name, std::size_t insert_index_arg, std::size_t init_step_arg, double udq_undefined_arg, const UnitSystem& unit_system);
bool defined(std::size_t timeStep) const;
@@ -122,11 +189,11 @@ struct ProductionControls {
bool wellgroup() const;
ProductionControls productionControls(const SummaryState& st) const;
InjectionControls injectionControls(const SummaryState& st) const;
GroupProduction::ControlEnum production_cmode() const;
GroupInjection::ControlEnum injection_cmode() const;
ProductionCMode production_cmode() const;
InjectionCMode injection_cmode() const;
Phase injection_phase() const;
bool has_control(GroupProduction::ControlEnum control) const;
bool has_control(GroupInjection::ControlEnum control) const;
bool has_control(ProductionCMode control) const;
bool has_control(InjectionCMode control) const;
private:
bool hasType(GroupType gtype) const;
void addType(GroupType new_gtype);
@@ -151,6 +218,9 @@ private:
GroupProductionProperties production_properties{};
};
Group2::GroupType operator |(Group2::GroupType lhs, Group2::GroupType rhs);
Group2::GroupType operator &(Group2::GroupType lhs, Group2::GroupType rhs);
}
#endif

View File

@@ -20,14 +20,24 @@
#ifndef GUIDE_RATE_MODEL_HPP
#define GUIDE_RATE_MODEL_HPP
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
namespace Opm {
class GuideRateModel {
public:
enum class Target {
OIL = 0,
LIQ = 1,
GAS = 2,
RES = 3,
COMB = 4,
NONE = 5
};
static Target TargetFromString(const std::string& s);
GuideRateModel(double time_interval_arg,
GuideRateTarget phase_arg,
Target target_arg,
double A_arg,
double B_arg,
double C_arg,
@@ -50,7 +60,7 @@ private:
be evaluated, due to a division by zero problem.
*/
double time_interval = 0;
GuideRateTarget phase = GuideRateTarget::NONE;
Target target = Target::NONE;
double A = 0;
double B = 0;
double C = 0;

View File

@@ -23,7 +23,6 @@
#include <vector>
#include <map>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.hpp>
namespace Opm {
@@ -32,6 +31,31 @@ namespace Opm {
class WellSegments {
public:
enum class LengthDepth{
INC = 0,
ABS = 1
};
static const std::string LengthDepthToString(LengthDepth enumValue);
static LengthDepth LengthDepthFromString(const std::string& stringValue);
enum class CompPressureDrop {
HFA = 0,
HF_ = 1,
H__ = 2
};
static const std::string CompPressureDropToString(CompPressureDrop enumValue);
static CompPressureDrop CompPressureDropFromString(const std::string& stringValue);
enum class MultiPhaseModel {
HO = 0,
DF = 1
};
static const std::string MultiPhaseModelToString(MultiPhaseModel enumValue);
static MultiPhaseModel MultiPhaseModelFromString(const std::string& stringValue);
WellSegments() = default;
const std::string& wellName() const;
@@ -40,8 +64,8 @@ namespace Opm {
double lengthTopSegment() const;
double volumeTopSegment() const;
WellSegment::CompPressureDropEnum compPressureDrop() const;
WellSegment::MultiPhaseModelEnum multiPhaseModel() const;
CompPressureDrop compPressureDrop() const;
MultiPhaseModel multiPhaseModel() const;
// mapping the segment number to the index in the vector of segments
int segmentNumberToIndex(const int segment_number) const;
@@ -63,7 +87,6 @@ namespace Opm {
void processABS();
void processINC(const bool first_time);
// name of the well
std::string m_well_name;
// depth of the nodal point of the top segment
// it is taken as the BHP reference depth of the well
@@ -74,11 +97,11 @@ namespace Opm {
// effective wellbore volume of the top segment
double m_volume_top;
// type of the tubing length and depth information
WellSegment::LengthDepthEnum m_length_depth_type;
LengthDepth m_length_depth_type;
// components of the pressure drop to be included
WellSegment::CompPressureDropEnum m_comp_pressure_drop;
CompPressureDrop m_comp_pressure_drop;
// multi-phase flow model
WellSegment::MultiPhaseModelEnum m_multiphase_model;
MultiPhaseModel m_multiphase_model;
// There are X and Y cooridnate of the nodal point of the top segment
// Since they are not used for simulations and we are not supporting plotting,
// we are not handling them at the moment.

View File

@@ -23,8 +23,6 @@
#include <memory>
#include <vector>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
namespace Opm
{
/*
@@ -35,12 +33,19 @@ namespace Opm
*/
class OilVaporizationProperties {
public:
enum class OilVaporization {
UNDEF = 0,
VAPPARS = 1,
DRDT = 2 // DRSDT or DRVDT
};
explicit OilVaporizationProperties(const size_t numPvtReginIdx);
static void updateDRSDT(Opm::OilVaporizationProperties& ovp, const std::vector<double>& maxDRSDT, const std::vector<std::string>& option);
static void updateDRVDT(Opm::OilVaporizationProperties& ovp, const std::vector<double>& maxDRVDT);
static void updateVAPPARS(Opm::OilVaporizationProperties& ovp, const std::vector<double>& vap1, const std::vector<double>& vap2);
Opm::OilVaporizationEnum getType() const;
OilVaporization getType() const;
double getVap1(const size_t pvtRegionIdx) const;
double getVap2(const size_t pvtRegionIdx) const;
double getMaxDRSDT(const size_t pvtRegionIdx) const;
@@ -59,7 +64,7 @@ namespace Opm
bool operator!=( const OilVaporizationProperties& ) const;
private:
Opm::OilVaporizationEnum m_type = OilVaporizationEnum::UNDEF;
OilVaporization m_type = OilVaporization::UNDEF;
std::vector<double> m_vap1;
std::vector<double> m_vap2;
std::vector<double> m_maxDRSDT;

View File

@@ -23,7 +23,6 @@
#include <unordered_map>
#include <unordered_set>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp>
@@ -32,6 +31,26 @@ namespace Opm {
class TimeMap;
class RFTConfig {
public:
enum class RFT {
YES = 1,
REPT = 2,
TIMESTEP = 3,
FOPN = 4,
NO = 5
};
static std::string RFT2String(RFT enumValue);
static RFT RFTFromString(const std::string &stringValue);
enum class PLT {
YES = 1,
REPT = 2,
TIMESTEP = 3,
NO = 4
};
static std::string PLT2String(PLT enumValue);
static PLT PLTFromString( const std::string& stringValue);
explicit RFTConfig(const TimeMap& time_map);
bool rft(const std::string& well, std::size_t report_step) const;
bool plt(const std::string& well, std::size_t report_step) const;
@@ -41,16 +60,16 @@ public:
bool active(std::size_t report_step) const;
std::size_t firstRFTOutput() const;
void updateRFT(const std::string& well, std::size_t report_step, RFTConnections::RFTEnum value);
void updatePLT(const std::string& well, std::size_t report_step, PLTConnections::PLTEnum value);
void updateRFT(const std::string& well, std::size_t report_step, RFT value);
void updatePLT(const std::string& well, std::size_t report_step, PLT value);
void addWellOpen(const std::string& well, std::size_t report_step);
private:
const TimeMap& tm;
std::pair<bool, std::size_t> well_open_rft_time;
std::unordered_set<std::string> well_open_rft_name;
std::unordered_map<std::string, std::size_t> well_open;
std::unordered_map<std::string, DynamicState<std::pair<RFTConnections::RFTEnum, std::size_t>>> rft_config;
std::unordered_map<std::string, DynamicState<std::pair<PLTConnections::PLTEnum, std::size_t>>> plt_config;
std::unordered_map<std::string, DynamicState<std::pair<RFT, std::size_t>>> rft_config;
std::unordered_map<std::string, DynamicState<std::pair<PLT, std::size_t>>> plt_config;
};
}

View File

@@ -32,7 +32,6 @@
#include <opm/parser/eclipse/EclipseState/Schedule/Group/GTNode.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateModel.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Tuning.hpp>
#include <opm/parser/eclipse/EclipseState/Util/OrderedMap.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MessageLimits.hpp>
@@ -176,7 +175,7 @@ namespace Opm
std::vector<Well2> getWells2atEnd() const;
std::vector<const Group2*> getChildGroups2(const std::string& group_name, size_t timeStep) const;
std::vector<Well2> getChildWells2(const std::string& group_name, size_t timeStep, GroupWellQueryMode query_mode) const;
std::vector<Well2> getChildWells2(const std::string& group_name, size_t timeStep) const;
const OilVaporizationProperties& getOilVaporizationProperties(size_t timestep) const;
const UDQActive& udqActive(size_t timeStep) const;
@@ -234,19 +233,19 @@ namespace Opm
DynamicState<std::shared_ptr<UDQConfig>> udq_config;
DynamicState<std::shared_ptr<UDQActive>> udq_active;
DynamicState<std::shared_ptr<GuideRateModel>> guide_rate_model;
DynamicState<WellProducer::ControlModeEnum> global_whistctl_mode;
DynamicState<Well2::ProducerCMode> global_whistctl_mode;
DynamicState<std::shared_ptr<Action::Actions>> m_actions;
RFTConfig rft_config;
DynamicState<int> m_nupcol;
std::map<std::string,Events> well_events;
DynamicState<int> m_nupcol;
GTNode groupTree(const std::string& root_node, std::size_t report_step, const GTNode * parent) const;
void updateGroup(std::shared_ptr<Group2> group, size_t reportStep);
bool checkGroups(const ParseContext& parseContext, ErrorGuard& errors);
void updateUDQActive( std::size_t timeStep, std::shared_ptr<UDQActive> udq );
bool updateWellStatus( const std::string& well, size_t reportStep , WellCommon::StatusEnum status);
bool updateWellStatus( const std::string& well, size_t reportStep , Well2::Status status);
void addWellToGroup( const std::string& group_name, const std::string& well_name , size_t timeStep);
void iterateScheduleSection(const ParseContext& parseContext , ErrorGuard& errors, const SCHEDULESection& , const EclipseGrid& grid,
const Eclipse3DProperties& eclipseProperties);
@@ -254,7 +253,7 @@ namespace Opm
void addGroupToGroup( const std::string& parent_group, const std::string& child_group, size_t timeStep);
void addGroupToGroup( const std::string& parent_group, const Group2& child_group, size_t timeStep);
void addGroup(const std::string& groupName , size_t timeStep, const UnitSystem& unit_system);
void addWell(const std::string& wellName, const DeckRecord& record, size_t timeStep, WellCompletion::CompletionOrderEnum wellCompletionOrder, const UnitSystem& unit_system);
void addWell(const std::string& wellName, const DeckRecord& record, size_t timeStep, Connection::Order connection_order, const UnitSystem& unit_system);
void handleUDQ(const DeckKeyword& keyword, size_t currentStep);
void handleWLIST(const DeckKeyword& keyword, size_t currentStep);
void handleCOMPORD(const ParseContext& parseContext, ErrorGuard& errors, const DeckKeyword& compordKeyword, size_t currentStep);

View File

@@ -1,359 +0,0 @@
/*
Copyright 2013 Statoil ASA.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SCHEDULE_ENUMS_H
#define SCHEDULE_ENUMS_H
#include <string>
namespace Opm {
namespace WellCommon {
enum StatusEnum {
OPEN = 1,
STOP = 2,
SHUT = 3,
AUTO = 4
};
const std::string Status2String(StatusEnum enumValue);
StatusEnum StatusFromString(const std::string& stringValue);
}
namespace WellCompletion {
enum StateEnum {
OPEN = 1,
SHUT = 2,
AUTO = 3
};
enum DirectionEnum {
X = 1,
Y = 2,
Z = 3
};
enum CompletionOrderEnum{
DEPTH,
INPUT,
TRACK
};
std::string DirectionEnum2String(const DirectionEnum enumValue);
DirectionEnum DirectionEnumFromString(const std::string& stringValue);
const std::string StateEnum2String( StateEnum enumValue );
StateEnum StateEnumFromString( const std::string& stringValue );
const std::string CompletionOrderEnum2String( CompletionOrderEnum enumValue );
CompletionOrderEnum CompletionOrderEnumFromString(const std::string& comporderStringValue);
}
namespace WellTarget {
enum ControlModeEnum {
ORAT = 1,
WRAT = 2,
GRAT = 3,
LRAT = 4,
CRAT = 5, // Not supported
RESV = 6,
BHP = 7,
THP = 8,
VFP = 9,
LIFT = 10, // Not supported
GUID = 11
};
/*
There are unfortuntaley separate enums for production controls,
injection controls and also for WELTARG control arguments. Since the
WELTARG control arguments are *not* used to enumerate available
controls the numerical values are - conciously - not in 2^n range.
*/
ControlModeEnum ControlModeFromString(const std::string& string_value);
}
namespace WellInjector {
enum TypeEnum {
WATER = 1,
GAS = 2,
OIL = 3,
MULTI = 4
};
enum ControlModeEnum {
RATE = 1 ,
RESV = 2 ,
BHP = 4 ,
THP = 8 ,
GRUP = 16 ,
CMODE_UNDEFINED = 512
};
/*
The elements in this enum are used as bitmasks to keep track
of which controls are present, i.e. the 2^n structure must
be intact.
*/
const std::string ControlMode2String( ControlModeEnum enumValue );
ControlModeEnum ControlModeFromString( const std::string& stringValue );
const std::string Type2String( TypeEnum enumValue );
TypeEnum TypeFromString( const std::string& stringValue );
}
namespace WellProducer {
enum ControlModeEnum {
NONE = 0,
ORAT = 1,
WRAT = 2,
GRAT = 4,
LRAT = 8,
CRAT = 16,
RESV = 32,
BHP = 64,
THP = 128,
GRUP = 256,
CMODE_UNDEFINED = 1024
};
/*
The items BHP, THP and GRUP only apply in prediction mode:
WCONPROD. The elements in this enum are used as bitmasks to
keep track of which controls are present, i.e. the 2^n
structure must be intact.The NONE item is only used in WHISTCTL
to cancel its effect.
The properties are initialized with the CMODE_UNDEFINED
value, but the undefined value is never assigned apart from
that; and it is not part of the string conversion routines.
*/
const std::string ControlMode2String( ControlModeEnum enumValue );
ControlModeEnum ControlModeFromString( const std::string& stringValue );
}
namespace GroupInjection {
enum ControlEnum {
NONE = 0,
RATE = 1,
RESV = 2,
REIN = 4,
VREP = 8,
FLD = 16
};
const std::string ControlEnum2String( ControlEnum enumValue );
ControlEnum ControlEnumFromString( const std::string& stringValue );
}
namespace GroupProductionExceedLimit {
enum ActionEnum {
NONE = 0,
CON = 1,
CON_PLUS = 2, // String: "+CON"
WELL = 3,
PLUG = 4,
RATE = 5
};
const std::string ActionEnum2String( ActionEnum enumValue );
ActionEnum ActionEnumFromString( const std::string& stringValue );
}
// A group can have both injection controls and production controls set at
// the same time, i.e. this enum is used as a bitmask.
enum class GroupType : unsigned {
NONE = 0,
PRODUCTION = 1,
INJECTION = 2,
MIXED = 3
};
GroupType operator |(GroupType lhs, GroupType rhs);
GroupType operator &(GroupType lhs, GroupType rhs);
enum class GuideRateTarget {
OIL = 0,
LIQ = 1,
GAS = 2,
RES = 3,
COMB = 4,
NONE = 5
};
GuideRateTarget GuideRateTargetFromString(const std::string& s);
namespace GroupProduction {
enum ControlEnum {
NONE = 0,
ORAT = 1,
WRAT = 2,
GRAT = 4,
LRAT = 8,
CRAT = 16,
RESV = 32,
PRBL = 64,
FLD = 128
};
const std::string ControlEnum2String( GroupProduction::ControlEnum enumValue );
GroupProduction::ControlEnum ControlEnumFromString( const std::string& stringValue );
enum class GuideRateDef {
OIL = 0,
WAT = 1,
GAS = 2,
LIQ = 3,
COMB = 4,
WGA = 5,
CVAL = 6,
INJV = 7,
POTN = 8,
FORM = 9,
NO_GUIDE_RATE = 10
};
GroupProduction::GuideRateDef GetGuideRateFromString( const std::string& stringValue );
}
namespace GuideRate {
enum GuideRatePhaseEnum {
OIL = 0,
WAT = 1,
GAS = 2,
LIQ = 3,
COMB = 4,
WGA = 5,
CVAL = 6,
RAT = 7,
RES = 8,
UNDEFINED = 9
};
const std::string GuideRatePhaseEnum2String( GuideRatePhaseEnum enumValue );
GuideRatePhaseEnum GuideRatePhaseEnumFromString( const std::string& stringValue );
}
namespace RFTConnections {
enum RFTEnum {
YES = 1,
REPT = 2,
TIMESTEP = 3,
FOPN = 4,
NO = 5
};
const std::string RFTEnum2String(RFTEnum enumValue);
RFTEnum RFTEnumFromString(const std::string &stringValue);
}
namespace PLTConnections{
enum PLTEnum{
YES = 1,
REPT = 2,
TIMESTEP = 3,
NO = 4
};
const std::string PLTEnum2String( PLTEnum enumValue);
PLTEnum PLTEnumFromString( const std::string& stringValue);
}
enum OilVaporizationEnum{
UNDEF = 0,
VAPPARS = 1,
DRDT = 2 // DRSDT or DRVDT
};
namespace WellSegment{
enum LengthDepthEnum {
INC = 0,
ABS = 1
};
const std::string LengthDepthEnumToString(LengthDepthEnum enumValue);
LengthDepthEnum LengthDepthEnumFromString(const std::string& stringValue);
enum CompPressureDropEnum {
HFA = 0,
HF_ = 1,
H__ = 2
};
const std::string CompPressureDropEnumToString(CompPressureDropEnum enumValue);
CompPressureDropEnum CompPressureDropEnumFromString(const std::string& stringValue);
enum MultiPhaseModelEnum {
HO = 0,
DF = 1
};
const std::string MultiPhaseModelEnumToString(MultiPhaseModelEnum enumValue);
MultiPhaseModelEnum MultiPhaseModelEnumFromString(const std::string& stringValue);
}
namespace WellEcon {
enum WorkoverEnum {
NONE = 0,
CON = 1, // CON
CONP = 2, // +CON
WELL = 3,
PLUG = 4,
// the following two only related to workover action
// on exceeding secondary water cut limit
LAST = 5,
RED = 6
};
const std::string WorkoverEnumToString(WorkoverEnum enumValue);
WorkoverEnum WorkoverEnumFromString(const std::string& stringValue);
enum QuantityLimitEnum {
RATE = 0,
POTN = 1
};
const std::string QuantityLimitEnumToString(QuantityLimitEnum enumValue);
QuantityLimitEnum QuantityLimitEnumFromString(const std::string& stringValue);
}
enum class GroupWellQueryMode {
Immediate,
Recursive
};
}
#endif

View File

@@ -29,7 +29,6 @@
#include <vector>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Util/Value.hpp>
namespace Opm {
@@ -39,17 +38,48 @@ namespace Opm {
class Connection {
public:
enum class State {
OPEN = 1,
SHUT = 2,
AUTO = 3
};
static const std::string State2String( State enumValue );
static State StateFromString( const std::string& stringValue );
enum class Direction{
X = 1,
Y = 2,
Z = 3
};
static std::string Direction2String(const Direction enumValue);
static Direction DirectionFromString(const std::string& stringValue);
enum class Order {
DEPTH,
INPUT,
TRACK
};
static const std::string Order2String( Order enumValue );
static Order OrderFromString(const std::string& comporderStringValue);
Connection(int i, int j , int k ,
int complnum,
double depth,
WellCompletion::StateEnum state,
State state,
double CF,
double Kh,
double rw,
double r0,
double skin_factor,
const int satTableId,
const WellCompletion::DirectionEnum direction,
const Direction direction,
const std::size_t seqIndex,
const double segDistStart,
const double segDistEnd,
@@ -61,8 +91,8 @@ namespace Opm {
int getI() const;
int getJ() const;
int getK() const;
WellCompletion::StateEnum state() const;
WellCompletion::DirectionEnum dir() const;
State state() const;
Direction dir() const;
double depth() const;
int satTableId() const;
int complnum() const;
@@ -74,7 +104,7 @@ namespace Opm {
double skinFactor() const;
double wellPi() const;
void setState(WellCompletion::StateEnum state);
void setState(State state);
void setComplnum(int compnum);
void scaleWellPi(double wellPi);
void updateSegment(int segment_number, double center_depth, std::size_t seqIndex);
@@ -92,9 +122,9 @@ namespace Opm {
bool operator==( const Connection& ) const;
bool operator!=( const Connection& ) const;
private:
WellCompletion::DirectionEnum direction;
Direction direction;
double center_depth;
WellCompletion::StateEnum open_state;
State open_state;
int sat_tableId;
int m_complnum;
double m_CF;

View File

@@ -22,29 +22,5 @@
#define INJECTION_CONTROLS_HPP
namespace Opm {
struct InjectionControls {
public:
InjectionControls(int controls_arg) :
controls(controls_arg)
{}
double bhp_limit;
double thp_limit;
WellInjector::TypeEnum injector_type;
WellInjector::ControlModeEnum cmode;
double surface_rate;
double reservoir_rate;
double temperature;
int vfp_table_number;
bool prediction_mode;
bool hasControl(WellInjector::ControlModeEnum cmode_arg) const {
return (this->controls & cmode_arg) != 0;
}
private:
int controls;
};
}
#endif

View File

@@ -22,33 +22,5 @@
#define PRODUCTION_CONTROLS_HPP
namespace Opm {
struct ProductionControls {
public:
ProductionControls(int controls_arg) :
controls(controls_arg)
{
}
WellProducer::ControlModeEnum cmode;
double oil_rate;
double water_rate;
double gas_rate;
double liquid_rate;
double resv_rate;
double bhp_history;
double thp_history;
double bhp_limit;
double thp_limit;
double alq_value;
int vfp_table_number;
bool prediction_mode;
bool hasControl(WellProducer::ControlModeEnum cmode_arg) const {
return (this->controls & cmode_arg) != 0;
}
private:
int controls;
};
}
#endif

View File

@@ -24,7 +24,6 @@
#include <string>
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp>
@@ -45,17 +44,289 @@ class DeckKeyword;
struct WellInjectionProperties;
class WellProductionProperties;
class UDQActive;
struct WellGuideRate {
bool available;
double guide_rate;
GuideRate::GuideRatePhaseEnum guide_phase;
double scale_factor;
};
class UDQConfig;
class Well2 {
public:
enum class Status {
OPEN = 1,
STOP = 2,
SHUT = 3,
AUTO = 4
};
static std::string Status2String(Status enumValue);
static Status StatusFromString(const std::string& stringValue);
enum class InjectorType {
WATER = 1,
GAS = 2,
OIL = 3,
MULTI = 4
};
static const std::string InjectorType2String( InjectorType enumValue );
static InjectorType InjectorTypeFromString( const std::string& stringValue );
/*
The elements in this enum are used as bitmasks to keep track
of which controls are present, i.e. the 2^n structure must
be intact.
*/
enum class InjectorCMode : int{
RATE = 1 ,
RESV = 2 ,
BHP = 4 ,
THP = 8 ,
GRUP = 16 ,
CMODE_UNDEFINED = 512
};
static const std::string InjectorCMode2String( InjectorCMode enumValue );
static InjectorCMode InjectorCModeFromString( const std::string& stringValue );
/*
The items BHP, THP and GRUP only apply in prediction mode:
WCONPROD. The elements in this enum are used as bitmasks to
keep track of which controls are present, i.e. the 2^n
structure must be intact.The NONE item is only used in WHISTCTL
to cancel its effect.
The properties are initialized with the CMODE_UNDEFINED
value, but the undefined value is never assigned apart from
that; and it is not part of the string conversion routines.
*/
enum class ProducerCMode : int {
NONE = 0,
ORAT = 1,
WRAT = 2,
GRAT = 4,
LRAT = 8,
CRAT = 16,
RESV = 32,
BHP = 64,
THP = 128,
GRUP = 256,
CMODE_UNDEFINED = 1024
};
static const std::string ProducerCMode2String( ProducerCMode enumValue );
static ProducerCMode ProducerCModeFromString( const std::string& stringValue );
enum class WELTARGCMode {
ORAT = 1,
WRAT = 2,
GRAT = 3,
LRAT = 4,
CRAT = 5, // Not supported
RESV = 6,
BHP = 7,
THP = 8,
VFP = 9,
LIFT = 10, // Not supported
GUID = 11
};
static WELTARGCMode WELTARGCModeFromString(const std::string& stringValue);
enum class GuideRateTarget {
OIL = 0,
WAT = 1,
GAS = 2,
LIQ = 3,
COMB = 4,
WGA = 5,
CVAL = 6,
RAT = 7,
RES = 8,
UNDEFINED = 9
};
static const std::string GuideRateTarget2String( GuideRateTarget enumValue );
static GuideRateTarget GuideRateTargetFromString( const std::string& stringValue );
struct WellGuideRate {
bool available;
double guide_rate;
GuideRateTarget guide_phase;
double scale_factor;
};
struct InjectionControls {
public:
InjectionControls(int controls_arg) :
controls(controls_arg)
{}
double bhp_limit;
double thp_limit;
InjectorType injector_type;
InjectorCMode cmode;
double surface_rate;
double reservoir_rate;
double temperature;
int vfp_table_number;
bool prediction_mode;
bool hasControl(InjectorCMode cmode_arg) const {
return (this->controls & static_cast<int>(cmode_arg)) != 0;
}
private:
int controls;
};
struct WellInjectionProperties {
std::string name;
UDAValue surfaceInjectionRate;
UDAValue reservoirInjectionRate;
UDAValue BHPLimit;
UDAValue THPLimit;
double temperature;
double BHPH;
double THPH;
int VFPTableNumber;
bool predictionMode;
int injectionControls;
Well2::InjectorType injectorType;
InjectorCMode controlMode;
bool operator==(const WellInjectionProperties& other) const;
bool operator!=(const WellInjectionProperties& other) const;
WellInjectionProperties(const std::string& wname);
void handleWELTARG(WELTARGCMode cmode, double newValue, double siFactorG, double siFactorL, double siFactorP);
void handleWCONINJE(const DeckRecord& record, bool availableForGroupControl, const std::string& well_name);
void handleWCONINJH(const DeckRecord& record, bool is_producer, const std::string& well_name);
bool hasInjectionControl(InjectorCMode controlModeArg) const {
if (injectionControls & static_cast<int>(controlModeArg))
return true;
else
return false;
}
void dropInjectionControl(InjectorCMode controlModeArg) {
auto int_arg = static_cast<int>(controlModeArg);
if ((injectionControls & int_arg) != 0)
injectionControls -= int_arg;
}
void addInjectionControl(InjectorCMode controlModeArg) {
auto int_arg = static_cast<int>(controlModeArg);
if ((injectionControls & int_arg) == 0)
injectionControls += int_arg;
}
void resetDefaultHistoricalBHPLimit();
void setBHPLimit(const double limit);
InjectionControls controls(const UnitSystem& unit_system, const SummaryState& st, double udq_default) const;
bool updateUDQActive(const UDQConfig& udq_config, UDQActive& active) const;
};
struct ProductionControls {
public:
ProductionControls(int controls_arg) :
controls(controls_arg)
{
}
ProducerCMode cmode;
double oil_rate;
double water_rate;
double gas_rate;
double liquid_rate;
double resv_rate;
double bhp_history;
double thp_history;
double bhp_limit;
double thp_limit;
double alq_value;
int vfp_table_number;
bool prediction_mode;
bool hasControl(ProducerCMode cmode_arg) const {
return (this->controls & static_cast<int>(cmode_arg)) != 0;
}
private:
int controls;
};
class WellProductionProperties {
public:
// the rates serve as limits under prediction mode
// while they are observed rates under historical mode
std::string name;
UDAValue OilRate;
UDAValue WaterRate;
UDAValue GasRate;
UDAValue LiquidRate;
UDAValue ResVRate;
// BHP and THP limit
UDAValue BHPLimit;
UDAValue THPLimit;
// historical BHP and THP under historical mode
double BHPH = 0.0;
double THPH = 0.0;
int VFPTableNumber = 0;
double ALQValue = 0.0;
bool predictionMode = false;
ProducerCMode controlMode = ProducerCMode::CMODE_UNDEFINED;
ProducerCMode whistctl_cmode = ProducerCMode::CMODE_UNDEFINED;
bool operator==(const WellProductionProperties& other) const;
bool operator!=(const WellProductionProperties& other) const;
WellProductionProperties(const std::string& name_arg);
bool hasProductionControl(ProducerCMode controlModeArg) const {
return (m_productionControls & static_cast<int>(controlModeArg)) != 0;
}
void dropProductionControl(ProducerCMode controlModeArg) {
if (hasProductionControl(controlModeArg))
m_productionControls -= static_cast<int>(controlModeArg);
}
void addProductionControl(ProducerCMode controlModeArg) {
if (! hasProductionControl(controlModeArg))
m_productionControls += static_cast<int>(controlModeArg);
}
// this is used to check whether the specified control mode is an effective history matching production mode
static bool effectiveHistoryProductionControl(ProducerCMode cmode);
void handleWCONPROD( const std::string& well, const DeckRecord& record);
void handleWCONHIST( const DeckRecord& record);
void handleWELTARG( WELTARGCMode cmode, double newValue, double siFactorG, double siFactorL, double siFactorP);
void resetDefaultBHPLimit();
void clearControls();
ProductionControls controls(const SummaryState& st, double udq_default) const;
bool updateUDQActive(const UDQConfig& udq_config, UDQActive& active) const;
private:
int m_productionControls = 0;
void init_rates( const DeckRecord& record );
void init_history(const DeckRecord& record);
WellProductionProperties(const DeckRecord& record);
void setBHPLimit(const double limit);
double getBHPLimit() const;
};
Well2(const std::string& wname,
const std::string& gname,
std::size_t init_step,
@@ -64,15 +335,15 @@ public:
int headJ,
double ref_depth,
Phase phase,
WellProducer::ControlModeEnum whistctl_cmode,
WellCompletion::CompletionOrderEnum ordering,
ProducerCMode whistctl_cmode,
Connection::Order ordering,
const UnitSystem& unit_system,
double udq_undefined);
bool isMultiSegment() const;
bool isAvailableForGroupControl() const;
double getGuideRate() const;
GuideRate::GuideRatePhaseEnum getGuideRatePhase() const;
GuideRateTarget getGuideRatePhase() const;
double getGuideRateScalingFactor() const;
bool hasBeenDefined(size_t timeStep) const;
@@ -81,7 +352,7 @@ public:
bool canOpen() const;
bool isProducer() const;
bool isInjector() const;
WellInjector::TypeEnum injectorType() const;
InjectorType injectorType() const;
size_t seqIndex() const;
bool getAutomaticShutIn() const;
bool getAllowCrossFlow() const;
@@ -91,7 +362,7 @@ public:
double getRefDepth() const;
double getDrainageRadius() const;
double getEfficiencyFactor() const;
WellCompletion::CompletionOrderEnum getWellConnectionOrdering() const;
Connection::Order getWellConnectionOrdering() const;
const WellProductionProperties& getProductionProperties() const;
const WellInjectionProperties& getInjectionProperties() const;
const WellEconProductionLimits& getEconLimits() const;
@@ -101,7 +372,7 @@ public:
const WellConnections& getConnections() const;
const WellSegments& getSegments() const;
double getSolventFraction() const;
WellCommon::StatusEnum getStatus() const;
Status getStatus() const;
const std::string& groupName() const;
Phase getPreferredPhase() const;
/* The rate of a given phase under the following assumptions:
@@ -138,10 +409,10 @@ public:
bool updateRefDepth(double ref_dpeth);
bool updateDrainageRadius(double drainage_radius);
bool updateConnections(const std::shared_ptr<WellConnections> connections);
bool updateStatus(WellCommon::StatusEnum status);
bool updateStatus(Status status);
bool updateGroup(const std::string& group);
bool updateProducer(bool is_producer);
bool updateWellGuideRate(bool available, double guide_rate, GuideRate::GuideRatePhaseEnum guide_phase, double scale_factor);
bool updateWellGuideRate(bool available, double guide_rate, GuideRateTarget guide_phase, double scale_factor);
bool updateWellGuideRate(double guide_rate);
bool updateEfficiencyFactor(double efficiency_factor);
bool updateSolventFraction(double solvent_fraction);
@@ -154,7 +425,7 @@ public:
bool handleWELSEGS(const DeckKeyword& keyword);
bool handleCOMPSEGS(const DeckKeyword& keyword, const EclipseGrid& grid, const ParseContext& parseContext, ErrorGuard& errors);
bool handleWELOPEN(const DeckRecord& record, WellCompletion::StateEnum status);
bool handleWELOPEN(const DeckRecord& record, Connection::State status);
bool handleCOMPLUMP(const DeckRecord& record);
bool handleWPIMULT(const DeckRecord& record);
@@ -175,11 +446,11 @@ private:
int headJ;
double ref_depth;
Phase phase;
WellCompletion::CompletionOrderEnum ordering;
Connection::Order ordering;
UnitSystem unit_system;
double udq_undefined;
WellCommon::StatusEnum status;
Status status;
double drainage_radius;
bool allow_cross_flow;
bool automatic_shutin;
@@ -199,6 +470,9 @@ private:
std::shared_ptr<const WellSegments> segments;
};
std::ostream& operator<<( std::ostream&, const Well2::WellInjectionProperties& );
std::ostream& operator<<( std::ostream&, const WellProductionProperties& );
}

View File

@@ -28,19 +28,21 @@ namespace Opm {
class Eclipse3DProperties;
class WellConnections {
public:
WellConnections(int headI, int headJ);
// cppcheck-suppress noExplicitConstructor
WellConnections(const WellConnections& src, const EclipseGrid& grid);
void addConnection(int i, int j , int k ,
double depth,
WellCompletion::StateEnum state ,
Connection::State state ,
double CF,
double Kh,
double rw,
double r0,
double skin_factor,
const int satTableId,
const WellCompletion::DirectionEnum direction = WellCompletion::DirectionEnum::Z,
const Connection::Direction direction = Connection::Direction::Z,
const std::size_t seqIndex = 0,
const double segDistStart= 0.0,
const double segDistEnd= 0.0,
@@ -82,14 +84,14 @@ namespace Opm {
void addConnection(int i, int j , int k ,
int complnum,
double depth,
WellCompletion::StateEnum state ,
Connection::State state ,
double CF,
double Kh,
double rw,
double r0,
double skin_factor,
const int satTableId,
const WellCompletion::DirectionEnum direction = WellCompletion::DirectionEnum::Z,
const Connection::Direction direction = Connection::Direction::Z,
const std::size_t seqIndex = 0,
const double segDistStart= 0.0,
const double segDistEnd= 0.0,

View File

@@ -22,14 +22,37 @@
#include <string>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
namespace Opm {
class DeckRecord;
class WellEconProductionLimits{
class WellEconProductionLimits {
public:
enum class QuantityLimit {
RATE = 0,
POTN = 1
};
static const std::string QuantityLimit2String(QuantityLimit enumValue);
static QuantityLimit QuantityLimitFromString(const std::string& stringValue);
enum class EconWorkover {
NONE = 0,
CON = 1, // CON
CONP = 2, // +CON
WELL = 3,
PLUG = 4,
// the following two only related to workover action
// on exceeding secondary water cut limit
LAST = 5,
RED = 6
};
static std::string EconWorkover2String(EconWorkover enumValue);
static EconWorkover EconWorkoverFromString(const std::string& stringValue);
explicit WellEconProductionLimits(const DeckRecord& record);
WellEconProductionLimits();
@@ -37,128 +60,53 @@ namespace Opm {
// for the moment.
// limit switch on?
bool onAnyEffectiveLimit() const {
return (onAnyRatioLimit() ||
onAnyRateLimit());
};
bool onAnyRatioLimit() const {
return (onMaxWaterCut() ||
onMaxGasOilRatio() ||
onMaxWaterGasRatio() ||
onMaxGasLiquidRatio());
};
bool onAnyRateLimit() const {
return (onMinOilRate() ||
onMinGasRate() ||
onMinLiquidRate() ||
onMinReservoirFluidRate());
};
bool onMinOilRate() const {
return (m_min_oil_rate > 0.0);
};
bool onMinGasRate() const {
return (m_min_gas_rate > 0.0);
};
bool onMaxWaterCut() const {
return (m_max_water_cut > 0.0);
};
bool onMaxGasOilRatio() const {
return (m_max_gas_oil_ratio > 0.0);
};
bool onMaxWaterGasRatio() const {
return (m_max_water_gas_ratio > 0.0);
};
bool onSecondaryMaxWaterCut() const {
return (m_secondary_max_water_cut > 0.0);
};
bool onMaxGasLiquidRatio() const {
return (m_max_gas_oil_ratio > 0.0);
};
// assuming Celsius temperature is used internally
bool onMaxTemperature() const {
return (m_max_temperature > -273.15);
};
bool onMinLiquidRate() const {
return (m_min_liquid_rate > 0.0);
};
bool onMinReservoirFluidRate() const {
return (m_min_reservoir_fluid_rate > 0.0);
};
// not sure what will happen if the followon well is a well does not exist.
bool validFollowonWell() const {
return (m_followon_well != "'");
};
bool requireWorkover() const {
return (m_workover != WellEcon::NONE);
};
bool requireSecondaryWorkover() const {
return (m_workover_secondary != WellEcon::NONE);
}
bool endRun() const {
return m_end_run;
}
double minOilRate() const { return m_min_oil_rate; };
double minGasRate() const { return m_min_gas_rate; };
double maxWaterCut() const { return m_max_water_cut; };
double maxGasOilRatio() const { return m_max_gas_oil_ratio; };
double maxWaterGasRatio() const { return m_max_water_gas_ratio; };
WellEcon::WorkoverEnum workover() const { return m_workover; };
const std::string& followonWell() const { return m_followon_well; };
WellEcon::QuantityLimitEnum quantityLimit() const {return m_quantity_limit; };
double maxSecondaryMaxWaterCut() const { return m_secondary_max_water_cut; };
WellEcon::WorkoverEnum workoverSecondary() const { return m_workover_secondary; };
double maxGasLiquidRatio() const { return m_max_gas_liquid_ratio; };
double minLiquidRate() const { return m_min_liquid_rate; };
double maxTemperature() const { return m_max_temperature; };
double minReservoirFluidRate() const { return m_min_reservoir_fluid_rate; };
bool onAnyEffectiveLimit() const;
bool onAnyRatioLimit() const;
bool onAnyRateLimit() const;
bool onMinOilRate() const;
bool onMinGasRate() const;
bool onMaxWaterCut() const;
bool onMaxGasOilRatio() const;
bool onMaxWaterGasRatio() const;
bool onSecondaryMaxWaterCut() const;
bool onMaxGasLiquidRatio() const;
// assuming Celsius temperature is used internally;
bool onMaxTemperature() const;
bool onMinLiquidRate() const;
bool onMinReservoirFluidRate() const;
// not sure what will happen if the followon well is a well does not exist.;
bool validFollowonWell() const;
bool requireWorkover() const;
bool requireSecondaryWorkover() const;
bool endRun() const;
double minOilRate() const;
double minGasRate() const;
double maxWaterCut() const;
double maxGasOilRatio() const;
double maxWaterGasRatio() const;
EconWorkover workover() const;
const std::string& followonWell() const;
QuantityLimit quantityLimit() const;
double maxSecondaryMaxWaterCut() const;
EconWorkover workoverSecondary() const;
double maxGasLiquidRatio() const;
double minLiquidRate() const;
double maxTemperature() const;
double minReservoirFluidRate() const;
bool operator==(const WellEconProductionLimits& other) const;
bool operator!=(const WellEconProductionLimits& other) const;
private:
double m_min_oil_rate;
double m_min_gas_rate;
double m_max_water_cut;
double m_max_gas_oil_ratio;
double m_max_water_gas_ratio;
WellEcon::WorkoverEnum m_workover;
EconWorkover m_workover;
bool m_end_run;
std::string m_followon_well;
WellEcon::QuantityLimitEnum m_quantity_limit;
QuantityLimit m_quantity_limit;
double m_secondary_max_water_cut;
WellEcon::WorkoverEnum m_workover_secondary;
EconWorkover m_workover_secondary;
double m_max_gas_liquid_ratio;
double m_min_liquid_rate;
double m_max_temperature;

View File

@@ -20,11 +20,6 @@
#ifndef WELLINJECTIONPROPERTIES_HPP_HEADER_INCLUDED
#define WELLINJECTIONPROPERTIES_HPP_HEADER_INCLUDED
#include <iosfwd>
#include <opm/parser/eclipse/Deck/UDAValue.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/InjectionControls.hpp>
namespace Opm {
@@ -34,53 +29,6 @@ namespace Opm {
class UDQActive;
class UDQConfig;
struct WellInjectionProperties {
std::string name;
UDAValue surfaceInjectionRate;
UDAValue reservoirInjectionRate;
UDAValue BHPLimit;
UDAValue THPLimit;
double temperature;
double BHPH;
double THPH;
int VFPTableNumber;
bool predictionMode;
int injectionControls;
WellInjector::TypeEnum injectorType;
WellInjector::ControlModeEnum controlMode;
bool operator==(const WellInjectionProperties& other) const;
bool operator!=(const WellInjectionProperties& other) const;
WellInjectionProperties(const std::string& wname);
void handleWELTARG(WellTarget::ControlModeEnum cmode, double newValue, double siFactorG, double siFactorL, double siFactorP);
void handleWCONINJE(const DeckRecord& record, bool availableForGroupControl, const std::string& well_name);
void handleWCONINJH(const DeckRecord& record, bool is_producer, const std::string& well_name);
bool hasInjectionControl(WellInjector::ControlModeEnum controlModeArg) const {
if (injectionControls & controlModeArg)
return true;
else
return false;
}
void dropInjectionControl(WellInjector::ControlModeEnum controlModeArg) {
if ((injectionControls & controlModeArg) != 0)
injectionControls -= controlModeArg;
}
void addInjectionControl(WellInjector::ControlModeEnum controlModeArg) {
if ((injectionControls & controlModeArg) == 0)
injectionControls += controlModeArg;
}
void resetDefaultHistoricalBHPLimit();
void setBHPLimit(const double limit);
InjectionControls controls(const UnitSystem& unit_system, const SummaryState& st, double udq_default) const;
bool updateUDQActive(const UDQConfig& udq_config, UDQActive& active) const;
};
std::ostream& operator<<( std::ostream&, const WellInjectionProperties& );
}
#endif

View File

@@ -20,84 +20,13 @@
#ifndef WELLPRODUCTIONPROPERTIES_HPP_HEADER_INCLUDED
#define WELLPRODUCTIONPROPERTIES_HPP_HEADER_INCLUDED
#include <iosfwd>
#include <memory>
#include <opm/parser/eclipse/Deck/UDAValue.hpp>
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/ProductionControls.hpp>
namespace Opm {
class DeckRecord;
class SummaryState;
class UDQActive;
class WellProductionProperties {
public:
// the rates serve as limits under prediction mode
// while they are observed rates under historical mode
std::string name;
UDAValue OilRate;
UDAValue WaterRate;
UDAValue GasRate;
UDAValue LiquidRate;
UDAValue ResVRate;
// BHP and THP limit
UDAValue BHPLimit;
UDAValue THPLimit;
// historical BHP and THP under historical mode
double BHPH = 0.0;
double THPH = 0.0;
int VFPTableNumber = 0;
double ALQValue = 0.0;
bool predictionMode = false;
WellProducer::ControlModeEnum controlMode = WellProducer::CMODE_UNDEFINED;
WellProducer::ControlModeEnum whistctl_cmode = WellProducer::CMODE_UNDEFINED;
bool operator==(const WellProductionProperties& other) const;
bool operator!=(const WellProductionProperties& other) const;
WellProductionProperties(const std::string& name_arg);
}
bool hasProductionControl(WellProducer::ControlModeEnum controlModeArg) const {
return (m_productionControls & controlModeArg) != 0;
}
void dropProductionControl(WellProducer::ControlModeEnum controlModeArg) {
if (hasProductionControl(controlModeArg))
m_productionControls -= controlModeArg;
}
void addProductionControl(WellProducer::ControlModeEnum controlModeArg) {
if (! hasProductionControl(controlModeArg))
m_productionControls += controlModeArg;
}
// this is used to check whether the specified control mode is an effective history matching production mode
static bool effectiveHistoryProductionControl(const WellProducer::ControlModeEnum cmode);
void handleWCONPROD( const std::string& well, const DeckRecord& record);
void handleWCONHIST( const DeckRecord& record);
void handleWELTARG(WellTarget::ControlModeEnum cmode, double newValue, double siFactorG, double siFactorL, double siFactorP);
void resetDefaultBHPLimit();
void clearControls();
ProductionControls controls(const SummaryState& st, double udq_default) const;
bool updateUDQActive(const UDQConfig& udq_config, UDQActive& active) const;
private:
int m_productionControls = 0;
void init_rates( const DeckRecord& record );
void init_history(const DeckRecord& record);
WellProductionProperties(const DeckRecord& record);
void setBHPLimit(const double limit);
double getBHPLimit() const;
};
std::ostream& operator<<( std::ostream&, const WellProductionProperties& );
} // namespace Opm
#endif // WELLPRODUCTIONPROPERTIES_HPP_HEADER_INCLUDED
#endif

View File

@@ -30,7 +30,6 @@
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp> // Phase::PhaseEnum
#include <opm/parser/eclipse/EclipseState/Tables/PvtgTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PvtoTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/Rock2dTable.hpp>

View File

@@ -5,11 +5,11 @@
namespace {
std::string state( const Connection& c ) {
return WellCompletion::StateEnum2String( c.state() );
return Connection::State2String( c.state() );
}
std::string direction( const Connection& c ) {
return WellCompletion::DirectionEnum2String( c.dir() );
return Connection::Direction2String( c.dir() );
}
}

View File

@@ -11,7 +11,7 @@ namespace {
}
std::string status( const Well2& w ) {
return WellCommon::Status2String( w.getStatus() );
return Well2::Status2String( w.getStatus() );
}
std::string preferred_phase( const Well2& w ) {

View File

@@ -26,7 +26,6 @@
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
@@ -116,7 +115,7 @@ namespace {
const std::size_t connID,
IConnArray& iConn)
{
using ConnState = ::Opm::WellCompletion::StateEnum;
using ConnState = ::Opm::Connection::State;
using Ix = ::Opm::RestartIO::Helpers::VectorItems::IConn::index;
iConn[Ix::SeqIndex] = connID + 1;
@@ -139,7 +138,7 @@ namespace {
iConn[Ix::ComplNum] = std::abs(conn.complnum());
//iConn[Ix::ComplNum] = iConn[Ix::SeqIndex];
iConn[Ix::ConnDir] = conn.dir();
iConn[Ix::ConnDir] = static_cast<int>(conn.dir());
iConn[Ix::Segment] = conn.attachedToSegment()
? conn.segment() : 0;
}
@@ -298,12 +297,12 @@ captureDeclaredConnData(const Schedule& sched,
for (auto nConn = conns.size(), connID = 0*nConn; connID < nConn; connID++) {
//
// WellRates connections are only defined for OPEN connections
if ((conns[connID].state() == Opm::WellCompletion::StateEnum::OPEN) &&
if ((conns[connID].state() == Opm::Connection::State::OPEN) &&
(rCInd < xr->second.connections.size())) {
it->second[connID] = &(xr->second.connections[rCInd]);
rCInd+= 1;
}
else if ((conns[connID].state() == Opm::WellCompletion::StateEnum::OPEN) && (rCInd >= xr->second.connections.size())) {
else if ((conns[connID].state() == Opm::Connection::State::OPEN) && (rCInd >= xr->second.connections.size())) {
throw std::invalid_argument {
"Inconsistent number of open connections I in vector<Opm::data::Connection*> (" +
std::to_string(xr->second.connections.size()) + ") in Well " + wl.name()

View File

@@ -24,7 +24,6 @@
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/GTNode.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/Group2.hpp>

View File

@@ -24,7 +24,6 @@
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
@@ -195,7 +194,7 @@ namespace {
using M = ::Opm::UnitSystem::measure;
using R = ::Opm::data::Rates::opt;
for (auto nConn = welConns.size(), connID = 0*nConn; connID < nConn; connID++) {
if (welConns[connID].state() == Opm::WellCompletion::StateEnum::OPEN) openConnections.push_back(&welConns[connID]);
if (welConns[connID].state() == Opm::Connection::State::OPEN) openConnections.push_back(&welConns[connID]);
}
if (openConnections.size() != rateConns.size()) {
throw std::invalid_argument {

View File

@@ -29,7 +29,6 @@
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
#include <opm/parser/eclipse/Units/Units.hpp>
@@ -141,7 +140,7 @@ namespace {
return WTypeVal::Producer;
}
using IType = ::Opm::WellInjector::TypeEnum;
using IType = ::Opm::Well2::InjectorType;
const auto itype = well.injectionControls(st).injector_type;
@@ -172,8 +171,8 @@ namespace {
const auto wmctl = controls.cmode;
const auto wtype = controls.injector_type;
using CMode = ::Opm::WellInjector::ControlModeEnum;
using WType = ::Opm::WellInjector::TypeEnum;
using CMode = ::Opm::Well2::InjectorCMode;
using WType = ::Opm::Well2::InjectorType;
switch (wmctl) {
case CMode::RATE: {
@@ -195,7 +194,7 @@ namespace {
{
const auto stat = well.getStatus();
using WStat = ::Opm::WellCommon::StatusEnum;
using WStat = ::Opm::Well2::Status;
if (stat == WStat::SHUT) {
return WMCtrlVal::Shut;
@@ -207,7 +206,7 @@ namespace {
else if (well.isProducer()) {
const auto& controls = well.productionControls(st);
using CMode = ::Opm::WellProducer::ControlModeEnum;
using CMode = ::Opm::Well2::ProducerCMode;
switch (controls.cmode) {
case CMode::ORAT: return WMCtrlVal::OilRate;
@@ -224,7 +223,7 @@ namespace {
{
const auto stat = well.getStatus();
using WStat = ::Opm::WellCommon::StatusEnum;
using WStat = ::Opm::Well2::Status;
if (stat == WStat::SHUT) {
return WMCtrlVal::Shut;
@@ -239,7 +238,7 @@ namespace {
int compOrder(const Opm::Well2& well)
{
using WCO = ::Opm::WellCompletion::CompletionOrderEnum;
using WCO = ::Opm::Connection::Order;
using COVal = ::Opm::RestartIO::Helpers::
VectorItems::IWell::Value::CompOrder;
@@ -513,8 +512,8 @@ namespace {
else if (well.isInjector()) {
const auto& ic = well.injectionControls(smry);
using IP = ::Opm::WellInjector::ControlModeEnum;
using IT = ::Opm::WellInjector::TypeEnum;
using IP = ::Opm::Well2::InjectorCMode;
using IT = ::Opm::Well2::InjectorType;
if (ic.hasControl(IP::RATE)) {
if (ic.injector_type == IT::OIL) {
@@ -714,7 +713,7 @@ namespace {
assignProducer(well.name(), smry, xWell);
}
else if (well.isInjector()) {
using IType = ::Opm::WellInjector::TypeEnum;
using IType = ::Opm::Well2::InjectorType;
const auto itype = well.injectionControls(smry).injector_type;
switch (itype) {

View File

@@ -21,7 +21,6 @@
// Note: DynamicState.hpp and <map> are prerequisites of Tuning.hpp
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Tuning.hpp>
#include <opm/parser/eclipse/Units/Units.hpp>
@@ -617,7 +616,7 @@ Opm::RestartIO::DoubHEAD::drsdt(const Schedule& sched,
sched.getOilVaporizationProperties(lookup_step);
this->data_[dRsdt] =
(vappar.getType() == Opm::OilVaporizationEnum::DRDT)
(vappar.getType() == Opm::OilVaporizationProperties::OilVaporization::DRDT)
? vappar.getMaxDRSDT(0)*cnvT
: 1.0e+20;

View File

@@ -33,7 +33,6 @@
#include <opm/parser/eclipse/EclipseState/Grid/GridProperty.hpp>
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp>
#include <opm/parser/eclipse/Utility/Functional.hpp>

View File

@@ -775,7 +775,7 @@ namespace {
for (const auto& sc : sched_well.getConnections()) {
const auto i = sc.getI(), j = sc.getJ(), k = sc.getK();
if (!grid.cellActive(i, j, k) || sc.state() == Opm::WellCompletion::SHUT) {
if (!grid.cellActive(i, j, k) || sc.state() == Opm::Connection::State::SHUT) {
opm_xwel_data += Opm::data::Connection::restart_size + phases.size();
continue;
}

View File

@@ -113,7 +113,7 @@ namespace {
std::vector< double > xwel;
for (const auto& sched_well : sched_wells) {
if (wells.count(sched_well.name()) == 0 ||
sched_well.getStatus() == Opm::WellCommon::SHUT)
sched_well.getStatus() == Opm::Well2::Status::SHUT)
{
const auto elems = (sched_well.getConnections().size()
* (phases.size() + data::Connection::restart_size))
@@ -137,7 +137,7 @@ namespace {
const auto i = sc.getI(), j = sc.getJ(), k = sc.getK();
const auto rs_size = phases.size() + data::Connection::restart_size;
if (!grid.cellActive(i, j, k) || sc.state() == WellCompletion::SHUT) {
if (!grid.cellActive(i, j, k) || sc.state() == Connection::State::SHUT) {
xwel.insert(xwel.end(), rs_size, 0.0);
continue;
}

View File

@@ -1098,7 +1098,7 @@ inline std::vector<Well2> find_wells( const Schedule& schedule,
if( type == ECL_SMSPEC_GROUP_VAR ) {
if( !schedule.hasGroup( name ) ) return {};
return schedule.getChildWells2( name, sim_step, GroupWellQueryMode::Recursive);
return schedule.getChildWells2( name, sim_step);
}
if( type == ECL_SMSPEC_FIELD_VAR )

View File

@@ -38,7 +38,6 @@
#include <opm/parser/eclipse/EclipseState/Grid/TransMult.hpp>
#include <opm/parser/eclipse/EclipseState/InitConfig/InitConfig.hpp>
#include <opm/parser/eclipse/EclipseState/IOConfig/IOConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/TableManager.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>

View File

@@ -291,11 +291,11 @@ Group2::InjectionControls Group2::injectionControls(const SummaryState& st) cons
return ic;
}
GroupProduction::ControlEnum Group2::production_cmode() const {
Group2::ProductionCMode Group2::production_cmode() const {
return this->production_properties.cmode;
}
GroupInjection::ControlEnum Group2::injection_cmode() const {
Group2::InjectionCMode Group2::injection_cmode() const {
return this->injection_properties.cmode;
}
@@ -304,20 +304,182 @@ Phase Group2::injection_phase() const {
}
bool Group2::ProductionControls::has_control(GroupProduction::ControlEnum control) const {
return (this->production_controls & control) != 0;
bool Group2::ProductionControls::has_control(Group2::ProductionCMode control) const {
return (this->production_controls & static_cast<int>(control)) != 0;
}
bool Group2::InjectionControls::has_control(GroupInjection::ControlEnum control) const {
return (this->injection_controls & control) != 0;
bool Group2::InjectionControls::has_control(InjectionCMode cmode_arg) const {
return (this->injection_controls & static_cast<int>(cmode_arg)) != 0;
}
bool Group2::has_control(GroupProduction::ControlEnum control) const {
return (this->production_properties.production_controls & control) != 0;
bool Group2::has_control(Group2::ProductionCMode control) const {
return (this->production_properties.production_controls & static_cast<int>(control)) != 0;
}
bool Group2::has_control(GroupInjection::ControlEnum control) const {
return (this->injection_properties.injection_controls & control) != 0;
bool Group2::has_control(InjectionCMode control) const {
return (this->injection_properties.injection_controls & static_cast<int>(control)) != 0;
}
const std::string Group2::ExceedAction2String( ExceedAction enumValue ) {
switch(enumValue) {
case ExceedAction::NONE:
return "NONE";
case ExceedAction::CON:
return "CON";
case ExceedAction::CON_PLUS:
return "+CON";
case ExceedAction::WELL:
return "WELL";
case ExceedAction::PLUG:
return "PLUG";
case ExceedAction::RATE:
return "RATE";
default:
throw std::invalid_argument("unhandled enum value");
}
}
Group2::ExceedAction Group2::ExceedActionFromString( const std::string& stringValue ) {
if (stringValue == "NONE")
return ExceedAction::NONE;
else if (stringValue == "CON")
return ExceedAction::CON;
else if (stringValue == "+CON")
return ExceedAction::CON_PLUS;
else if (stringValue == "WELL")
return ExceedAction::WELL;
else if (stringValue == "PLUG")
return ExceedAction::PLUG;
else if (stringValue == "RATE")
return ExceedAction::RATE;
else
throw std::invalid_argument("Unknown enum state string: " + stringValue );
}
const std::string Group2::InjectionCMode2String( InjectionCMode enumValue ) {
switch( enumValue ) {
case InjectionCMode::NONE:
return "NONE";
case InjectionCMode::RATE:
return "RATE";
case InjectionCMode::RESV:
return "RESV";
case InjectionCMode::REIN:
return "REIN";
case InjectionCMode::VREP:
return "VREP";
case InjectionCMode::FLD:
return "FLD";
default:
throw std::invalid_argument("Unhandled enum value");
}
}
Group2::InjectionCMode Group2::InjectionCModeFromString( const std::string& stringValue ) {
if (stringValue == "NONE")
return InjectionCMode::NONE;
else if (stringValue == "RATE")
return InjectionCMode::RATE;
else if (stringValue == "RESV")
return InjectionCMode::RESV;
else if (stringValue == "REIN")
return InjectionCMode::REIN;
else if (stringValue == "VREP")
return InjectionCMode::VREP;
else if (stringValue == "FLD")
return InjectionCMode::FLD;
else
throw std::invalid_argument("Unknown enum state string: " + stringValue );
}
Group2::GroupType operator|(Group2::GroupType lhs, Group2::GroupType rhs) {
return static_cast<Group2::GroupType>(static_cast<std::underlying_type<Group2::GroupType>::type>(lhs) | static_cast<std::underlying_type<Group2::GroupType>::type>(rhs));
}
Group2::GroupType operator&(Group2::GroupType lhs, Group2::GroupType rhs) {
return static_cast<Group2::GroupType>(static_cast<std::underlying_type<Group2::GroupType>::type>(lhs) & static_cast<std::underlying_type<Group2::GroupType>::type>(rhs));
}
const std::string Group2::ProductionCMode2String( ProductionCMode enumValue ) {
switch( enumValue ) {
case ProductionCMode::NONE:
return "NONE";
case ProductionCMode::ORAT:
return "ORAT";
case ProductionCMode::WRAT:
return "WRAT";
case ProductionCMode::GRAT:
return "GRAT";
case ProductionCMode::LRAT:
return "LRAT";
case ProductionCMode::CRAT:
return "CRAT";
case ProductionCMode::RESV:
return "RESV";
case ProductionCMode::PRBL:
return "PRBL";
case ProductionCMode::FLD:
return "FLD";
default:
throw std::invalid_argument("Unhandled enum value");
}
}
Group2::ProductionCMode Group2::ProductionCModeFromString( const std::string& stringValue ) {
if (stringValue == "NONE")
return ProductionCMode::NONE;
else if (stringValue == "ORAT")
return ProductionCMode::ORAT;
else if (stringValue == "WRAT")
return ProductionCMode::WRAT;
else if (stringValue == "GRAT")
return ProductionCMode::GRAT;
else if (stringValue == "LRAT")
return ProductionCMode::LRAT;
else if (stringValue == "CRAT")
return ProductionCMode::CRAT;
else if (stringValue == "RESV")
return ProductionCMode::RESV;
else if (stringValue == "PRBL")
return ProductionCMode::PRBL;
else if (stringValue == "FLD")
return ProductionCMode::FLD;
else
throw std::invalid_argument("Unknown enum state string: " + stringValue );
}
Group2::GuideRateTarget Group2::GuideRateTargetFromString( const std::string& stringValue ) {
if (stringValue == "OIL")
return GuideRateTarget::OIL;
else if (stringValue == "WAT")
return GuideRateTarget::WAT;
else if (stringValue == "GAS")
return GuideRateTarget::GAS;
else if (stringValue == "LIQ")
return GuideRateTarget::LIQ;
else if (stringValue == "COMB")
return GuideRateTarget::COMB;
else if (stringValue == "WGA")
return GuideRateTarget::WGA;
else if (stringValue == "CVAL")
return GuideRateTarget::CVAL;
else if (stringValue == "INJV")
return GuideRateTarget::INJV;
else if (stringValue == "POTN")
return GuideRateTarget::POTN;
else if (stringValue == "FORM")
return GuideRateTarget::FORM;
else
return GuideRateTarget::NO_GUIDE_RATE;
}
}

View File

@@ -24,18 +24,18 @@
namespace Opm {
GuideRateModel::GuideRateModel(double time_interval_arg,
GuideRateTarget phase_arg,
double A_arg,
double B_arg,
double C_arg,
double D_arg,
double E_arg,
double F_arg,
bool allow_increase_arg,
double damping_factor_arg,
bool use_free_gas_arg) :
Target target_arg,
double A_arg,
double B_arg,
double C_arg,
double D_arg,
double E_arg,
double F_arg,
bool allow_increase_arg,
double damping_factor_arg,
bool use_free_gas_arg) :
time_interval(time_interval_arg),
phase(phase_arg),
target(target_arg),
A(A_arg),
B(B_arg),
C(C_arg),
@@ -84,7 +84,7 @@ double GuideRateModel::eval(double pot, double R1, double R2) const {
bool GuideRateModel::operator==(const GuideRateModel& other) const {
return (this->time_interval == other.time_interval) &&
(this->phase == other.phase) &&
(this->target == other.target) &&
(this->A == other.A) &&
(this->B == other.B) &&
(this->C == other.C) &&
@@ -100,4 +100,27 @@ bool GuideRateModel::operator!=(const GuideRateModel& other) const {
return !(*this == other);
}
GuideRateModel::Target GuideRateModel::TargetFromString(const std::string& s) {
if (s == "OIL")
return Target::OIL;
if (s == "LIQ")
return Target::LIQ;
if (s == "GAS")
return Target::GAS;
if (s == "RES")
return Target::RES;
if (s == "COMB")
return Target::COMB;
if (s == "NONE")
return Target::NONE;
throw std::invalid_argument("Could not convert: " + s + " to a valid Target enum value");
}
}

View File

@@ -29,7 +29,6 @@
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include "Compsegs.hpp"
@@ -37,7 +36,7 @@ namespace Opm {
Compsegs::Compsegs(int i_in, int j_in, int k_in, int branch_number_in, double distance_start_in, double distance_end_in,
WellCompletion::DirectionEnum dir_in, double center_depth_in, int segment_number_in, size_t seqIndex_in)
Connection::Direction dir_in, double center_depth_in, int segment_number_in, size_t seqIndex_in)
: m_i(i_in),
m_j(j_in),
m_k(k_in),
@@ -116,9 +115,9 @@ namespace Opm {
* Defaulted well connection. Must be non-defaulted if DISTANCE_END
* is set or a range is specified. If not this is effectively ignored.
*/
WellCompletion::DirectionEnum direction = WellCompletion::X;
auto direction = Connection::Direction::X;
if( record.getItem< ParserKeywords::COMPSEGS::DIRECTION >().hasValue( 0 ) ) {
direction = WellCompletion::DirectionEnumFromString(record.getItem<ParserKeywords::COMPSEGS::DIRECTION>().get< std::string >(0));
direction = Connection::DirectionFromString(record.getItem<ParserKeywords::COMPSEGS::DIRECTION>().get< std::string >(0));
}
double center_depth;

View File

@@ -24,8 +24,8 @@
#include <memory>
#include <string>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
namespace Opm {
@@ -45,8 +45,8 @@ namespace Opm {
int m_branch_number;
double m_distance_start;
double m_distance_end;
Connection::Direction m_dir;
WellCompletion::DirectionEnum m_dir;
double center_depth;
// we do not handle thermal length for the moment
// double m_thermal_length;
@@ -54,7 +54,7 @@ namespace Opm {
std::size_t m_seqIndex;
Compsegs(int i_in, int j_in, int k_in, int branch_number_in, double distance_start_in, double distance_end_in,
WellCompletion::DirectionEnum dir_in, double center_depth_in, int segment_number_in, std::size_t seqIndex_in);
Connection::Direction dir_in, double center_depth_in, int segment_number_in, std::size_t seqIndex_in);
void calculateCenterDepthWithSegments(const WellSegments& segment_set);
@@ -66,7 +66,7 @@ namespace Opm {
// update the segment related information for Connections
static void updateConnectionsWithSegment(const std::vector< Compsegs >& compsegs,
const EclipseGrid& grid,
const EclipseGrid& grid,
WellConnections& connection_set);
};

View File

@@ -57,11 +57,11 @@ namespace Opm {
}
WellSegment::CompPressureDropEnum WellSegments::compPressureDrop() const {
WellSegments::CompPressureDrop WellSegments::compPressureDrop() const {
return m_comp_pressure_drop;
}
WellSegment::MultiPhaseModelEnum WellSegments::multiPhaseModel() const {
WellSegments::MultiPhaseModel WellSegments::multiPhaseModel() const {
return m_multiphase_model;
}
@@ -105,19 +105,19 @@ namespace Opm {
m_depth_top = record1.getItem("DEPTH").getSIDouble(0);
m_length_top = record1.getItem("LENGTH").getSIDouble(0);
m_length_depth_type = WellSegment::LengthDepthEnumFromString(record1.getItem("INFO_TYPE").getTrimmedString(0));
m_length_depth_type = LengthDepthFromString(record1.getItem("INFO_TYPE").getTrimmedString(0));
m_volume_top = record1.getItem("WELLBORE_VOLUME").getSIDouble(0);
m_comp_pressure_drop = WellSegment::CompPressureDropEnumFromString(record1.getItem("PRESSURE_COMPONENTS").getTrimmedString(0));
m_multiphase_model = WellSegment::MultiPhaseModelEnumFromString(record1.getItem("FLOW_MODEL").getTrimmedString(0));
m_comp_pressure_drop = CompPressureDropFromString(record1.getItem("PRESSURE_COMPONENTS").getTrimmedString(0));
m_multiphase_model = MultiPhaseModelFromString(record1.getItem("FLOW_MODEL").getTrimmedString(0));
// the main branch is 1 instead of 0
// the segment number for top segment is also 1
if (m_length_depth_type == WellSegment::INC) {
if (m_length_depth_type == LengthDepth::INC) {
m_segments.emplace_back( 1, 1, 0, 0., 0.,
invalid_value, invalid_value, invalid_value,
m_volume_top, false );
} else if (m_length_depth_type == WellSegment::ABS) {
} else if (m_length_depth_type == LengthDepth::ABS) {
m_segments.emplace_back( 1, 1, 0, m_length_top, m_depth_top,
invalid_value, invalid_value, invalid_value,
m_volume_top, true );
@@ -160,7 +160,7 @@ namespace Opm {
double volume;
if (itemVolume.hasValue(0)) {
volume = itemVolume.getSIDouble(0);
} else if (m_length_depth_type == WellSegment::INC) {
} else if (m_length_depth_type == LengthDepth::INC) {
volume = area * segment_length;
} else {
volume = invalid_value; // A * L, while L is not determined yet
@@ -178,7 +178,7 @@ namespace Opm {
outlet_segment = i - 1;
}
if (m_length_depth_type == WellSegment::INC) {
if (m_length_depth_type == LengthDepth::INC) {
m_segments.emplace_back( i, branch, outlet_segment, segment_length, depth_change,
diameter, roughness, area, volume, false );
} else if (i == segment2) {
@@ -223,9 +223,9 @@ namespace Opm {
}
void WellSegments::process(bool first_time) {
if (this->m_length_depth_type == WellSegment::ABS)
if (this->m_length_depth_type == LengthDepth::ABS)
this->processABS();
else if (this->m_length_depth_type == WellSegment::INC)
else if (this->m_length_depth_type == LengthDepth::INC)
this->processINC(first_time);
else
throw std::logic_error("Invalid llength/depth/type in segment data structure");
@@ -429,4 +429,75 @@ namespace Opm {
" V: " << well_segments.volumeTopSegment() << " }}";
}
const std::string WellSegments::LengthDepthToString(LengthDepth enumValue) {
switch (enumValue) {
case LengthDepth::INC:
return "INC";
case LengthDepth::ABS:
return "ABS";
default:
throw std::invalid_argument("unhandled LengthDepth value");
}
}
WellSegments::LengthDepth WellSegments::LengthDepthFromString(const std::string& string_value ) {
if (string_value == "INC") {
return LengthDepth::INC;
} else if (string_value == "ABS") {
return LengthDepth::ABS;
} else {
throw std::invalid_argument("Unknown enum string_value: " + string_value + " for LengthDepth");
}
}
const std::string WellSegments::CompPressureDropToString(CompPressureDrop enumValue) {
switch (enumValue) {
case CompPressureDrop::HFA:
return "HFA";
case CompPressureDrop::HF_:
return "HF-";
case CompPressureDrop::H__:
return "H--";
default:
throw std::invalid_argument("unhandled CompPressureDrop value");
}
}
WellSegments::CompPressureDrop WellSegments::CompPressureDropFromString( const std::string& string_value ) {
if (string_value == "HFA") {
return CompPressureDrop::HFA;
} else if (string_value == "HF-") {
return CompPressureDrop::HF_;
} else if (string_value == "H--") {
return CompPressureDrop::H__;
} else {
throw std::invalid_argument("Unknown enum string_value: " + string_value + " for CompPressureDrop");
}
}
const std::string WellSegments::MultiPhaseModelToString(MultiPhaseModel enumValue) {
switch (enumValue) {
case MultiPhaseModel::HO:
return "HO";
case MultiPhaseModel::DF:
return "DF";
default:
throw std::invalid_argument("unhandled MultiPhaseModel value");
}
}
WellSegments::MultiPhaseModel WellSegments::MultiPhaseModelFromString(const std::string& string_value ) {
if ((string_value == "HO") || (string_value == "H0")) {
return MultiPhaseModel::HO;
} else if (string_value == "DF") {
return MultiPhaseModel::DF;
} else {
throw std::invalid_argument("Unknown enum string_value: " + string_value + " for MultiPhaseModel");
}
}
}

View File

@@ -52,12 +52,12 @@ namespace Opm {
}
}
Opm::OilVaporizationEnum OilVaporizationProperties::getType() const{
OilVaporizationProperties::OilVaporization OilVaporizationProperties::getType() const{
return m_type;
}
double OilVaporizationProperties::getVap1(const size_t pvtRegionIdx) const{
if (m_type == Opm::OilVaporizationEnum::VAPPARS){
if (m_type == OilVaporization::VAPPARS){
return m_vap1[pvtRegionIdx];
}else{
throw std::logic_error("Only valid if type is VAPPARS");
@@ -65,7 +65,7 @@ namespace Opm {
}
double OilVaporizationProperties::getVap2(const size_t pvtRegionIdx) const{
if (m_type == Opm::OilVaporizationEnum::VAPPARS){
if (m_type == OilVaporization::VAPPARS){
return m_vap2[pvtRegionIdx];
}else{
throw std::logic_error("Only valid if type is VAPPARS");
@@ -73,54 +73,54 @@ namespace Opm {
}
void OilVaporizationProperties::updateDRSDT(OilVaporizationProperties& ovp, const std::vector<double>& maximums, const std::vector<std::string>& options){
ovp.m_type = Opm::OilVaporizationEnum::DRDT;
ovp.m_type = OilVaporization::DRDT;
ovp.m_maxDRSDT = maximums;
for (size_t pvtRegionIdx = 0; pvtRegionIdx < options.size(); ++pvtRegionIdx) {
if (options[pvtRegionIdx] == "ALL"){
ovp.m_maxDRSDT_allCells[pvtRegionIdx] = true;
}else if (options[pvtRegionIdx] == "FREE") {
} else if (options[pvtRegionIdx] == "FREE") {
ovp.m_maxDRSDT_allCells[pvtRegionIdx] = false;
}else{
} else {
throw std::invalid_argument("Only ALL or FREE is allowed as option string");
}
}
}
void OilVaporizationProperties::updateDRVDT(OilVaporizationProperties& ovp, const std::vector<double>& maximums){
ovp.m_type = Opm::OilVaporizationEnum::DRDT;
ovp.m_type = OilVaporization::DRDT;
ovp.m_maxDRVDT = maximums;
}
void OilVaporizationProperties::updateVAPPARS(OilVaporizationProperties& ovp, const std::vector<double>& vap1, const std::vector<double>& vap2){
ovp.m_type = Opm::OilVaporizationEnum::VAPPARS;
ovp.m_type = OilVaporization::VAPPARS;
ovp.m_vap1 = vap1;
ovp.m_vap2 = vap2;
}
bool OilVaporizationProperties::defined() const {
return this->m_type != OilVaporizationEnum::UNDEF;
return this->m_type != OilVaporization::UNDEF;
}
bool OilVaporizationProperties::drsdtActive() const {
return (m_maxDRSDT[0] >= 0 && m_type == Opm::OilVaporizationEnum::DRDT);
return (m_maxDRSDT[0] >= 0 && m_type == OilVaporization::DRDT);
}
bool OilVaporizationProperties::drvdtActive() const {
return (m_maxDRVDT[0] >= 0 && m_type == Opm::OilVaporizationEnum::DRDT);
return (m_maxDRVDT[0] >= 0 && m_type == OilVaporization::DRDT);
}
bool OilVaporizationProperties::operator==( const OilVaporizationProperties& rhs ) const {
if( this->m_type == OilVaporizationEnum::UNDEF
|| rhs.m_type == OilVaporizationEnum::UNDEF
if( this->m_type == OilVaporization::UNDEF
|| rhs.m_type == OilVaporization::UNDEF
|| this->m_type != rhs.m_type ) return false;
switch( this->m_type ) {
case OilVaporizationEnum::DRDT:
case OilVaporization::DRDT:
return this->m_maxDRSDT == rhs.m_maxDRSDT
&& this->m_maxDRSDT_allCells == rhs.m_maxDRSDT_allCells
&& this->m_maxDRVDT == rhs.m_maxDRVDT;
case OilVaporizationEnum::VAPPARS:
case OilVaporization::VAPPARS:
return this->m_vap1 == rhs.m_vap1
&& this->m_vap2 == rhs.m_vap2;

View File

@@ -52,16 +52,16 @@ bool RFTConfig::rft(const std::string& well_name, std::size_t report_step) const
return false;
auto rft_pair = this->rft_config.at(well_name)[report_step];
if (rft_pair.first == RFTConnections::YES)
if (rft_pair.first == RFT::YES)
return (rft_pair.second == report_step);
if (rft_pair.first == RFTConnections::NO)
if (rft_pair.first == RFT::NO)
return false;
if (rft_pair.first == RFTConnections::REPT)
if (rft_pair.first == RFT::REPT)
return true;
if (rft_pair.first == RFTConnections::TIMESTEP)
if (rft_pair.first == RFT::TIMESTEP)
return true;
return false;
@@ -75,36 +75,36 @@ bool RFTConfig::plt(const std::string& well_name, std::size_t report_step) const
return false;
auto plt_pair = this->plt_config.at(well_name)[report_step];
if (plt_pair.first == PLTConnections::YES)
if (plt_pair.first == PLT::YES)
return (plt_pair.second == report_step);
if (plt_pair.first == PLTConnections::NO)
if (plt_pair.first == PLT::NO)
return false;
if (plt_pair.first == PLTConnections::REPT)
if (plt_pair.first == PLT::REPT)
return true;
if (plt_pair.first == PLTConnections::TIMESTEP)
if (plt_pair.first == PLT::TIMESTEP)
return true;
return false;
}
void RFTConfig::updateRFT(const std::string& well_name, std::size_t report_step, RFTConnections::RFTEnum value) {
if (value == RFTConnections::FOPN)
void RFTConfig::updateRFT(const std::string& well_name, std::size_t report_step, RFT value) {
if (value == RFT::FOPN)
this->setWellOpenRFT(well_name);
else {
if (this->rft_config.count(well_name) == 0) {
auto state = DynamicState<std::pair<RFTConnections::RFTEnum, std::size_t>>(this->tm, std::make_pair(RFTConnections::NO, 0));
auto state = DynamicState<std::pair<RFT, std::size_t>>(this->tm, std::make_pair(RFT::NO, 0));
this->rft_config.emplace( well_name, state );
}
this->rft_config.at(well_name).update(report_step, std::make_pair(value, report_step));
}
}
void RFTConfig::updatePLT(const std::string& well_name, std::size_t report_step, PLTConnections::PLTEnum value) {
void RFTConfig::updatePLT(const std::string& well_name, std::size_t report_step, PLT value) {
if (this->plt_config.count(well_name) == 0) {
auto state = DynamicState<std::pair<PLTConnections::PLTEnum, std::size_t>>(this->tm, std::make_pair(PLTConnections::NO, 0));
auto state = DynamicState<std::pair<PLT, std::size_t>>(this->tm, std::make_pair(PLT::NO, 0));
this->plt_config.emplace( well_name, state );
}
this->plt_config.at(well_name).update(report_step, std::make_pair(value, report_step));
@@ -154,7 +154,7 @@ std::size_t RFTConfig::firstRFTOutput() const {
We do not really output PLT, so this predictae will unconditionally
return false.
*/
auto pred = [] (const std::pair<PLTConnections::PLTEnum, std::size_t>& ) { return false; };
auto pred = [] (const std::pair<PLT, std::size_t>& ) { return false; };
int this_first_rft = dynamic_state.find_if(pred);
if (this_first_rft >= 0)
first_rft = std::min(first_rft, static_cast<std::size_t>(this_first_rft));
@@ -163,12 +163,12 @@ std::size_t RFTConfig::firstRFTOutput() const {
for (const auto& rft_pair : this->rft_config) {
const auto& dynamic_state = rft_pair.second;
auto pred = [] (const std::pair<RFTConnections::RFTEnum, std::size_t>& pred_arg) {
if (pred_arg.first == RFTConnections::RFTEnum::YES)
auto pred = [] (const std::pair<RFT, std::size_t>& pred_arg) {
if (pred_arg.first == RFT::YES)
return true;
if (pred_arg.first == RFTConnections::RFTEnum::REPT)
if (pred_arg.first == RFT::REPT)
return true;
if (pred_arg.first == RFTConnections::RFTEnum::TIMESTEP)
if (pred_arg.first == RFT::TIMESTEP)
return true;
return false;
};
@@ -194,4 +194,63 @@ bool RFTConfig::active(std::size_t report_step) const {
return false;
}
std::string RFTConfig::RFT2String(RFT enumValue) {
switch (enumValue) {
case RFT::YES:
return "YES";
case RFT::REPT:
return "REPT";
case RFT::TIMESTEP:
return "TIMESTEP";
case RFT::FOPN:
return "FOPN";
case RFT::NO:
return "NO";
default:
throw std::invalid_argument("unhandled enum value");
}
}
RFTConfig::RFT RFTConfig::RFTFromString(const std::string& stringValue) {
if (stringValue == "YES")
return RFT::YES;
else if (stringValue == "REPT")
return RFT::REPT;
else if (stringValue == "TIMESTEP")
return RFT::TIMESTEP;
else if (stringValue == "FOPN")
return RFT::FOPN;
else if (stringValue == "NO")
return RFT::NO;
else
throw std::invalid_argument("Unknown enum state string: " + stringValue);
}
std::string RFTConfig::PLT2String(PLT enumValue) {
switch (enumValue) {
case PLT::YES:
return "YES";
case PLT::REPT:
return "REPT";
case PLT::TIMESTEP:
return "TIMESTEP";
case PLT::NO:
return "NO";
default:
throw std::invalid_argument("unhandled enum value");
}
}
RFTConfig::PLT RFTConfig::PLTFromString( const std::string& stringValue ){
if (stringValue == "YES")
return PLT::YES;
else if (stringValue == "REPT")
return PLT::REPT;
else if (stringValue == "TIMESTEP")
return PLT::TIMESTEP;
else if (stringValue == "NO")
return PLT::NO;
else
throw std::invalid_argument("Unknown enum state string: " + stringValue );
}
}

View File

@@ -48,7 +48,6 @@
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/updatingConnectionsWithSegments.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQActive.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
@@ -122,7 +121,7 @@ namespace {
udq_config(this->m_timeMap, std::make_shared<UDQConfig>(deck)),
udq_active(this->m_timeMap, std::make_shared<UDQActive>()),
guide_rate_model(this->m_timeMap, std::make_shared<GuideRateModel>()),
global_whistctl_mode(this->m_timeMap, WellProducer::CMODE_UNDEFINED),
global_whistctl_mode(this->m_timeMap, Well2::ProducerCMode::CMODE_UNDEFINED),
m_actions(this->m_timeMap, std::make_shared<Action::Actions>()),
rft_config(this->m_timeMap),
m_nupcol(this->m_timeMap, 3)
@@ -471,10 +470,10 @@ namespace {
void Schedule::handleWHISTCTL(const DeckKeyword& keyword, std::size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors) {
const auto& record = keyword.getRecord(0);
const std::string& cmodeString = record.getItem("CMODE").getTrimmedString(0);
const WellProducer::ControlModeEnum controlMode = WellProducer::ControlModeFromString( cmodeString );
const auto controlMode = Well2::ProducerCModeFromString( cmodeString );
if (controlMode != WellProducer::NONE) {
if (!WellProductionProperties::effectiveHistoryProductionControl(controlMode) ) {
if (controlMode != Well2::ProducerCMode::NONE) {
if (!Well2::WellProductionProperties::effectiveHistoryProductionControl(controlMode) ) {
std::string msg = "The WHISTCTL keyword specifies an un-supported control mode " + cmodeString
+ ", which makes WHISTCTL keyword not affect the simulation at all";
OpmLog::warning(msg);
@@ -493,7 +492,7 @@ namespace {
for (auto& well_pair : this->wells_static) {
auto& dynamic_state = well_pair.second;
auto well2 = std::make_shared<Well2>(*dynamic_state[currentStep]);
auto prop = std::make_shared<WellProductionProperties>(well2->getProductionProperties());
auto prop = std::make_shared<Well2::WellProductionProperties>(well2->getProductionProperties());
if (prop->whistctl_cmode != controlMode) {
prop->whistctl_cmode = controlMode;
@@ -505,7 +504,7 @@ namespace {
for (auto& well_pair : this->wells_static) {
auto& dynamic_state = well_pair.second;
auto well2 = std::make_shared<Well2>(*dynamic_state[currentStep]);
auto prop = std::make_shared<WellProductionProperties>(well2->getProductionProperties());
auto prop = std::make_shared<Well2::WellProductionProperties>(well2->getProductionProperties());
if (prop->whistctl_cmode != controlMode) {
prop->whistctl_cmode = controlMode;
@@ -517,7 +516,7 @@ namespace {
for (auto& well_pair : this->wells_static) {
auto& dynamic_state = well_pair.second;
auto well2 = std::make_shared<Well2>(*dynamic_state[currentStep]);
auto prop = std::make_shared<WellProductionProperties>(well2->getProductionProperties());
auto prop = std::make_shared<Well2::WellProductionProperties>(well2->getProductionProperties());
if (prop->whistctl_cmode != controlMode) {
prop->whistctl_cmode = controlMode;
@@ -532,7 +531,7 @@ namespace {
this->m_nupcol.update(currentStep, nupcol);
}
/*
The COMPORD keyword is handled together with the WELSPECS keyword in the
@@ -606,7 +605,7 @@ namespace {
addGroup(groupName , currentStep, unit_system);
if (!hasWell(wellName)) {
WellCompletion::CompletionOrderEnum wellConnectionOrder = WellCompletion::TRACK;
auto wellConnectionOrder = Connection::Order::TRACK;
if( const auto* compordp = COMPORD_in_timestep() ) {
const auto& compord = *compordp;
@@ -617,7 +616,7 @@ namespace {
const std::string& wellNamePattern = compordRecord.getItem(0).getTrimmedString(0);
if (Well2::wellNameInWellNamePattern(wellName, wellNamePattern)) {
const std::string& compordString = compordRecord.getItem(1).getTrimmedString(0);
wellConnectionOrder = WellCompletion::CompletionOrderEnumFromString(compordString);
wellConnectionOrder = Connection::OrderFromString(compordString);
}
}
}
@@ -720,8 +719,7 @@ namespace {
const std::string& wellNamePattern =
record.getItem("WELL").getTrimmedString(0);
const WellCommon::StatusEnum status =
WellCommon::StatusFromString(record.getItem("STATUS").getTrimmedString(0));
const Well2::Status status = Well2::StatusFromString(record.getItem("STATUS").getTrimmedString(0));
auto well_names = this->wellNames(wellNamePattern, currentStep);
if (well_names.empty())
@@ -733,7 +731,7 @@ namespace {
auto& dynamic_state = this->wells_static.at(well_name);
auto well2 = std::make_shared<Well2>(*dynamic_state[currentStep]);
bool switching_from_injector = !well2->isProducer();
auto properties = std::make_shared<WellProductionProperties>(well2->getProductionProperties());
auto properties = std::make_shared<Well2::WellProductionProperties>(well2->getProductionProperties());
bool update_well = false;
properties->handleWCONHIST(record);
@@ -741,7 +739,7 @@ namespace {
properties->resetDefaultBHPLimit();
well2->updateProducer(true);
auto inj_props = std::make_shared<WellInjectionProperties>(well2->getInjectionProperties());
auto inj_props = std::make_shared<Well2::WellInjectionProperties>(well2->getInjectionProperties());
inj_props->setBHPLimit(0);
well2->updateInjection(inj_props);
}
@@ -771,7 +769,7 @@ namespace {
"Well " + well2->name() + " is a history matched well with zero rate where crossflow is banned. " +
"This well will be closed at " + std::to_string ( m_timeMap.getTimePassedUntil(currentStep) / (60*60*24) ) + " days";
OpmLog::note(msg);
updateWellStatus( well_name, currentStep, WellCommon::StatusEnum::SHUT );
updateWellStatus( well_name, currentStep, Well2::Status::SHUT );
}
}
}
@@ -785,9 +783,7 @@ namespace {
const std::string& wellNamePattern =
record.getItem("WELL").getTrimmedString(0);
const WellCommon::StatusEnum status =
WellCommon::StatusFromString(record.getItem("STATUS").getTrimmedString(0));
const Well2::Status status = Well2::StatusFromString(record.getItem("STATUS").getTrimmedString(0));
auto well_names = this->wellNames(wellNamePattern, currentStep);
if (well_names.empty())
invalidNamePattern(wellNamePattern, parseContext, errors, keyword);
@@ -799,11 +795,11 @@ namespace {
auto& dynamic_state = this->wells_static.at(well_name);
auto well2 = std::make_shared<Well2>(*dynamic_state[currentStep]);
bool switching_from_injector = !well2->isProducer();
auto properties = std::make_shared<WellProductionProperties>(well2->getProductionProperties());
auto properties = std::make_shared<Well2::WellProductionProperties>(well2->getProductionProperties());
bool update_well = switching_from_injector;
properties->clearControls();
if (well2->isAvailableForGroupControl())
properties->addProductionControl(WellProducer::GRUP);
properties->addProductionControl(Well2::ProducerCMode::GRUP);
properties->handleWCONPROD(well_name, record);
@@ -844,7 +840,7 @@ namespace {
Function is quite dangerous - because if this is called while holding a
Well2 pointer that will go stale and needs to be refreshed.
*/
bool Schedule::updateWellStatus( const std::string& well_name, size_t reportStep , WellCommon::StatusEnum status) {
bool Schedule::updateWellStatus( const std::string& well_name, size_t reportStep , Well2::Status status) {
bool update = false;
{
auto& dynamic_state = this->wells_static.at(well_name);
@@ -887,13 +883,13 @@ namespace {
invalidNamePattern(wellNamePattern, parseContext, errors, keyword);
for( const auto& well_name : well_names ) {
WellCommon::StatusEnum status = WellCommon::StatusFromString( record.getItem("STATUS").getTrimmedString(0));
Well2::Status status = Well2::StatusFromString( record.getItem("STATUS").getTrimmedString(0));
updateWellStatus( well_name , currentStep , status );
{
bool update_well = false;
auto& dynamic_state = this->wells_static.at(well_name);
auto well2 = std::make_shared<Well2>(*dynamic_state[currentStep]);
auto injection = std::make_shared<WellInjectionProperties>(well2->getInjectionProperties());
auto injection = std::make_shared<Well2::WellInjectionProperties>(well2->getInjectionProperties());
injection->handleWCONINJE(record, well2->isAvailableForGroupControl(), well_name);
if (well2->updateProducer(false))
@@ -919,16 +915,16 @@ namespace {
"This well will be closed at " + std::to_string ( m_timeMap.getTimePassedUntil(currentStep) / (60*60*24) ) + " days";
if (injection->surfaceInjectionRate.is<double>()) {
if (injection->hasInjectionControl(WellInjector::RATE) && injection->surfaceInjectionRate.get<double>() == 0) {
if (injection->hasInjectionControl(Well2::InjectorCMode::RATE) && injection->surfaceInjectionRate.get<double>() == 0) {
OpmLog::note(msg);
updateWellStatus( well_name, currentStep, WellCommon::StatusEnum::SHUT );
updateWellStatus( well_name, currentStep, Well2::Status::SHUT );
}
}
if (injection->reservoirInjectionRate.is<double>()) {
if (injection->hasInjectionControl(WellInjector::RESV) && injection->reservoirInjectionRate.get<double>() == 0) {
if (injection->hasInjectionControl(Well2::InjectorCMode::RESV) && injection->reservoirInjectionRate.get<double>() == 0) {
OpmLog::note(msg);
updateWellStatus( well_name, currentStep, WellCommon::StatusEnum::SHUT );
updateWellStatus( well_name, currentStep, Well2::Status::SHUT );
}
}
}
@@ -944,7 +940,7 @@ namespace {
void Schedule::handleWCONINJH(const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors) {
for( const auto& record : keyword ) {
const std::string& wellNamePattern = record.getItem("WELL").getTrimmedString(0);
WellCommon::StatusEnum status = WellCommon::StatusFromString( record.getItem("STATUS").getTrimmedString(0));
Well2::Status status = Well2::StatusFromString( record.getItem("STATUS").getTrimmedString(0));
const auto well_names = wellNames( wellNamePattern, currentStep );
if (well_names.empty())
@@ -956,7 +952,7 @@ namespace {
bool update_well = false;
auto& dynamic_state = this->wells_static.at(well_name);
auto well2 = std::make_shared<Well2>(*dynamic_state[currentStep]);
auto injection = std::make_shared<WellInjectionProperties>(well2->getInjectionProperties());
auto injection = std::make_shared<Well2::WellInjectionProperties>(well2->getInjectionProperties());
injection->handleWCONINJH(record, well2->isProducer(), well_name);
if (well2->updateProducer(false))
@@ -979,7 +975,7 @@ namespace {
"Well " + well_name + " is an injector with zero rate where crossflow is banned. " +
"This well will be closed at " + std::to_string ( m_timeMap.getTimePassedUntil(currentStep) / (60*60*24) ) + " days";
OpmLog::note(msg);
updateWellStatus( well_name, currentStep, WellCommon::StatusEnum::SHUT );
updateWellStatus( well_name, currentStep, Well2::Status::SHUT );
}
}
}
@@ -1208,7 +1204,7 @@ namespace {
{
const auto& well = this->getWell2(well_name, currentStep);
const auto& inj = well.getInjectionProperties();
if (!well.isProducer() && inj.injectorType == WellInjector::GAS) {
if (!well.isProducer() && inj.injectorType == Well2::InjectorType::GAS) {
if (well.getSolventFraction() != fraction) {
auto new_well = std::make_shared<Well2>(well);
new_well->updateSolventFraction(fraction);
@@ -1265,7 +1261,7 @@ namespace {
if (current_temp != temp && !well.isProducer()) {
auto& dynamic_state = this->wells_static.at(well_name);
auto well_ptr = std::make_shared<Well2>( *dynamic_state[currentStep] );
auto inj = std::make_shared<WellInjectionProperties>(well_ptr->getInjectionProperties());
auto inj = std::make_shared<Well2::WellInjectionProperties>(well_ptr->getInjectionProperties());
inj->temperature = temp;
well_ptr->updateInjection(inj);
this->updateWell(well_ptr, currentStep);
@@ -1299,7 +1295,7 @@ namespace {
if (current_temp != temp && !well.isProducer()) {
auto& dynamic_state = this->wells_static.at(well_name);
auto well_ptr = std::make_shared<Well2>( *dynamic_state[currentStep] );
auto inj = std::make_shared<WellInjectionProperties>(well_ptr->getInjectionProperties());
auto inj = std::make_shared<Well2::WellInjectionProperties>(well_ptr->getInjectionProperties());
inj->temperature = temp;
well_ptr->updateInjection(inj);
this->updateWell(well_ptr, currentStep);
@@ -1336,13 +1332,12 @@ namespace {
return std::all_of( rec.begin() + 2, rec.end(), defaulted );
};
constexpr auto open = WellCommon::StatusEnum::OPEN;
constexpr auto open = Well2::Status::OPEN;
for( const auto& record : keyword ) {
const auto& wellNamePattern = record.getItem( "WELL" ).getTrimmedString(0);
const auto& status_str = record.getItem( "STATUS" ).getTrimmedString( 0 );
const auto well_names = this->wellNames(wellNamePattern, currentStep, matching_wells);
if (well_names.empty())
invalidNamePattern( wellNamePattern, parseContext, errors, keyword);
@@ -1350,7 +1345,7 @@ namespace {
* well status is updated
*/
if( conn_defaulted( record ) ) {
const auto well_status = WellCommon::StatusFromString( status_str );
const auto well_status = Well2::StatusFromString( status_str );
for (const auto& wname : well_names) {
{
const auto& well = this->getWell2(wname, currentStep);
@@ -1373,7 +1368,7 @@ namespace {
}
for (const auto& wname : well_names) {
const auto comp_status = WellCompletion::StateEnumFromString( status_str );
const auto comp_status = Connection::StateFromString( status_str );
{
auto& dynamic_state = this->wells_static.at(wname);
auto well_ptr = std::make_shared<Well2>( *dynamic_state[currentStep] );
@@ -1410,7 +1405,7 @@ namespace {
for( const auto& record : keyword ) {
const std::string& wellNamePattern = record.getItem("WELL").getTrimmedString(0);
const auto cmode = WellTarget::ControlModeFromString(record.getItem("CMODE").getTrimmedString(0));
const auto cmode = Well2::WELTARGCModeFromString(record.getItem("CMODE").getTrimmedString(0));
double newValue = record.getItem("NEW_VALUE").get< double >(0);
const auto well_names = wellNames( wellNamePattern, currentStep );
@@ -1424,16 +1419,16 @@ namespace {
auto well2 = std::make_shared<Well2>(*dynamic_state[currentStep]);
bool update = false;
if (well2->isProducer()) {
auto prop = std::make_shared<WellProductionProperties>(well2->getProductionProperties());
auto prop = std::make_shared<Well2::WellProductionProperties>(well2->getProductionProperties());
prop->handleWELTARG(cmode, newValue, siFactorG, siFactorL, siFactorP);
update = well2->updateProduction(prop);
if (cmode == WellTarget::GUID)
if (cmode == Well2::WELTARGCMode::GUID)
update |= well2->updateWellGuideRate(newValue);
} else {
auto inj = std::make_shared<WellInjectionProperties>(well2->getInjectionProperties());
auto inj = std::make_shared<Well2::WellInjectionProperties>(well2->getInjectionProperties());
inj->handleWELTARG(cmode, newValue, siFactorG, siFactorL, siFactorP);
update = well2->updateInjection(inj);
if (cmode == WellTarget::GUID)
if (cmode == Well2::WELTARGCMode::GUID)
update |= well2->updateWellGuideRate(newValue);
}
if (update)
@@ -1452,7 +1447,7 @@ namespace {
invalidNamePattern(groupNamePattern, parseContext, errors, keyword);
for (const auto& group_name : group_names){
GroupInjection::ControlEnum controlMode = GroupInjection::ControlEnumFromString( record.getItem("CONTROL_MODE").getTrimmedString(0) );
Group2::InjectionCMode controlMode = Group2::InjectionCModeFromString( record.getItem("CONTROL_MODE").getTrimmedString(0) );
Phase phase = get_phase( record.getItem("PHASE").getTrimmedString(0));
auto surfaceInjectionRate = record.getItem("SURFACE_TARGET").get< UDAValue >(0);
auto reservoirInjectionRate = record.getItem("RESV_TARGET").get<UDAValue>(0);
@@ -1472,16 +1467,16 @@ namespace {
injection.injection_controls = 0;
if (!record.getItem("SURFACE_TARGET").defaultApplied(0))
injection.injection_controls += GroupInjection::RATE;
injection.injection_controls += static_cast<int>(Group2::InjectionCMode::RATE);
if (!record.getItem("RESV_TARGET").defaultApplied(0))
injection.injection_controls += GroupInjection::RESV;
injection.injection_controls += static_cast<int>(Group2::InjectionCMode::RESV);
if (!record.getItem("REINJ_TARGET").defaultApplied(0))
injection.injection_controls += GroupInjection::REIN;
injection.injection_controls += static_cast<int>(Group2::InjectionCMode::REIN);
if (!record.getItem("VOIDAGE_TARGET").defaultApplied(0))
injection.injection_controls += GroupInjection::VREP;
injection.injection_controls += static_cast<int>(Group2::InjectionCMode::VREP);
if (group_ptr->updateInjection(injection))
this->updateGroup(std::move(group_ptr), currentStep);
@@ -1490,6 +1485,7 @@ namespace {
}
}
void Schedule::handleGCONPROD( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors) {
for( const auto& record : keyword ) {
const std::string& groupNamePattern = record.getItem("GROUP").getTrimmedString(0);
@@ -1499,27 +1495,27 @@ namespace {
invalidNamePattern(groupNamePattern, parseContext, errors, keyword);
for (const auto& group_name : group_names){
GroupProduction::ControlEnum controlMode = GroupProduction::ControlEnumFromString( record.getItem("CONTROL_MODE").getTrimmedString(0) );
GroupProductionExceedLimit::ActionEnum exceedAction = GroupProductionExceedLimit::ActionEnumFromString(record.getItem("EXCEED_PROC").getTrimmedString(0) );
Group2::ProductionCMode controlMode = Group2::ProductionCModeFromString( record.getItem("CONTROL_MODE").getTrimmedString(0) );
Group2::ExceedAction exceedAction = Group2::ExceedActionFromString(record.getItem("EXCEED_PROC").getTrimmedString(0) );
auto oil_target = record.getItem("OIL_TARGET").get<UDAValue>(0);
auto gas_target = record.getItem("GAS_TARGET").get<UDAValue>(0);
auto water_target = record.getItem("WATER_TARGET").get<UDAValue>(0);
auto liquid_target = record.getItem("LIQUID_TARGET").get<UDAValue>(0);
auto guide_rate_def = Group2::GuideRateTarget::NO_GUIDE_RATE;
double guide_rate = 0;
GroupProduction::GuideRateDef guide_rate_def = GroupProduction::GuideRateDef::NO_GUIDE_RATE;
if (group_name != "FIELD") {
if (record.getItem("GUIDE_RATE_DEF").hasValue(0)) {
if (record.getItem("GUIDE_RATE_DEF").hasValue(0)) {
std::string guide_rate_str = record.getItem("GUIDE_RATE_DEF").getTrimmedString(0);
guide_rate_def = GroupProduction::GetGuideRateFromString( guide_rate_str );
guide_rate_def = Group2::GuideRateTargetFromString( guide_rate_str );
if ((guide_rate_str == "INJ" || guide_rate_str == "POTN" || guide_rate_str == "FORM")) {
std::string msg = "The supplied guide_rate value will be ignored";
parseContext.handleError(ParseContext::SCHEDULE_IGNORED_GUIDE_RATE, msg, errors);
}
parseContext.handleError(ParseContext::SCHEDULE_IGNORED_GUIDE_RATE, msg, errors);
}
else {
guide_rate = record.getItem("GUIDE_RATE").get<double>(0);
if (guide_rate == 0)
guide_rate_def = GroupProduction::GuideRateDef::POTN;
guide_rate_def = Group2::GuideRateTarget::POTN;
}
}
}
@@ -1535,30 +1531,30 @@ namespace {
production.guide_rate = guide_rate;
production.guide_rate_def = guide_rate_def;
production.resv_target = resv_target;
if ((production.cmode == GroupProduction::ORAT) ||
(production.cmode == GroupProduction::WRAT) ||
(production.cmode == GroupProduction::GRAT) ||
(production.cmode == GroupProduction::LRAT))
production.exceed_action = GroupProductionExceedLimit::RATE;
if ((production.cmode == Group2::ProductionCMode::ORAT) ||
(production.cmode == Group2::ProductionCMode::WRAT) ||
(production.cmode == Group2::ProductionCMode::GRAT) ||
(production.cmode == Group2::ProductionCMode::LRAT))
production.exceed_action = Group2::ExceedAction::RATE;
else
production.exceed_action = exceedAction;
production.production_controls = 0;
if (!record.getItem("OIL_TARGET").defaultApplied(0))
production.production_controls += GroupProduction::ORAT;
production.production_controls += static_cast<int>(Group2::ProductionCMode::ORAT);
if (!record.getItem("GAS_TARGET").defaultApplied(0))
production.production_controls += GroupProduction::GRAT;
production.production_controls += static_cast<int>(Group2::ProductionCMode::GRAT);
if (!record.getItem("WATER_TARGET").defaultApplied(0))
production.production_controls += GroupProduction::WRAT;
production.production_controls += static_cast<int>(Group2::ProductionCMode::WRAT);
if (!record.getItem("LIQUID_TARGET").defaultApplied(0))
production.production_controls += GroupProduction::LRAT;
production.production_controls += static_cast<int>(Group2::ProductionCMode::LRAT);
if (!record.getItem("RESERVOIR_FLUID_TARGET").defaultApplied(0))
production.production_controls += GroupProduction::RESV;
production.production_controls += static_cast<int>(Group2::ProductionCMode::RESV);
if (group_ptr->updateProduction(production))
this->updateGroup(std::move(group_ptr), currentStep);
@@ -1592,7 +1588,7 @@ namespace {
const auto& record = keyword.getRecord(0);
double min_calc_delay = record.getItem<ParserKeywords::GUIDERAT::MIN_CALC_TIME>().getSIDouble(0);
auto phase = GuideRateTargetFromString(record.getItem<ParserKeywords::GUIDERAT::NOMINATED_PHASE>().getTrimmedString(0));
auto phase = GuideRateModel::TargetFromString(record.getItem<ParserKeywords::GUIDERAT::NOMINATED_PHASE>().getTrimmedString(0));
double A = record.getItem<ParserKeywords::GUIDERAT::A>().get<double>(0);
double B = record.getItem<ParserKeywords::GUIDERAT::B>().get<double>(0);
double C = record.getItem<ParserKeywords::GUIDERAT::C>().get<double>(0);
@@ -1806,7 +1802,7 @@ namespace {
if (well2->updateConnections(connections))
this->updateWell(well2, currentStep);
if (well2->getStatus() == WellCommon::StatusEnum::SHUT) {
if (well2->getStatus() == Well2::Status::SHUT) {
std::string msg =
"All completions in well " + well2->name() + " is shut at " + std::to_string ( m_timeMap.getTimePassedUntil(currentStep) / (60*60*24) ) + " days. \n" +
"The well is therefore also shut.";
@@ -1855,10 +1851,10 @@ namespace {
bool availableForGroupControl = DeckItem::to_bool(record.getItem("GROUP_CONTROLLED").getTrimmedString(0));
double guide_rate = record.getItem("GUIDE_RATE").get< double >(0);
double scaling_factor = record.getItem("SCALING_FACTOR").get< double >(0);
GuideRate::GuideRatePhaseEnum phase = GuideRate::UNDEFINED;
auto phase = Well2::GuideRateTarget::UNDEFINED;
if (!record.getItem("PHASE").defaultApplied(0)) {
std::string guideRatePhase = record.getItem("PHASE").getTrimmedString(0);
phase = GuideRate::GuideRatePhaseEnumFromString(guideRatePhase);
phase = Well2::GuideRateTargetFromString(guideRatePhase);
}
{
@@ -1914,7 +1910,7 @@ void Schedule::handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep, c
const std::string& wellNamePattern = record.getItem("WELL").getTrimmedString(0);
const auto well_names = wellNames(wellNamePattern, currentStep);
for(const auto& well_name : well_names)
this->rft_config.updateRFT(well_name, currentStep, RFTConnections::RFTEnum::YES);
this->rft_config.updateRFT(well_name, currentStep, RFTConfig::RFT::YES);
}
@@ -1926,8 +1922,8 @@ void Schedule::handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep, c
const std::string& wellNamePattern = record.getItem("WELL").getTrimmedString(0);
RFTConnections::RFTEnum RFTKey = RFTConnections::RFTEnumFromString(record.getItem("OUTPUT_RFT").getTrimmedString(0));
PLTConnections::PLTEnum PLTKey = PLTConnections::PLTEnumFromString(record.getItem("OUTPUT_PLT").getTrimmedString(0));
RFTConfig::RFT RFTKey = RFTConfig::RFTFromString(record.getItem("OUTPUT_RFT").getTrimmedString(0));
RFTConfig::PLT PLTKey = RFTConfig::PLTFromString(record.getItem("OUTPUT_PLT").getTrimmedString(0));
const auto well_names = wellNames(wellNamePattern, currentStep);
for(const auto& well_name : well_names) {
this->rft_config.updateRFT(well_name, currentStep, RFTKey);
@@ -1980,7 +1976,7 @@ void Schedule::handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep, c
void Schedule::addWell(const std::string& wellName,
const DeckRecord& record,
size_t timeStep,
WellCompletion::CompletionOrderEnum wellConnectionOrder,
Connection::Order wellConnectionOrder,
const UnitSystem& unit_system) {
// We change from eclipse's 1 - n, to a 0 - n-1 solution
@@ -2085,7 +2081,7 @@ void Schedule::handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep, c
}
std::vector< Well2 > Schedule::getChildWells2(const std::string& group_name, size_t timeStep, GroupWellQueryMode query_mode) const {
std::vector< Well2 > Schedule::getChildWells2(const std::string& group_name, size_t timeStep) const {
if (!hasGroup(group_name))
throw std::invalid_argument("No such group: '" + group_name + "'");
{
@@ -2094,9 +2090,9 @@ void Schedule::handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep, c
if (group_ptr) {
std::vector<Well2> wells;
if (group_ptr->groups().size() && query_mode == GroupWellQueryMode::Recursive) {
if (group_ptr->groups().size()) {
for (const auto& child_name : group_ptr->groups()) {
const auto& child_wells = getChildWells2( child_name, timeStep, query_mode );
const auto& child_wells = getChildWells2( child_name, timeStep);
wells.insert( wells.end() , child_wells.begin() , child_wells.end());
}
} else {
@@ -2444,7 +2440,7 @@ void Schedule::handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep, c
const auto& well = this->getWell2(wname, timeStep);
const auto& connections = well.getConnections();
if (connections.allConnectionsShut())
this->updateWellStatus( well.name(), timeStep, WellCommon::StatusEnum::SHUT);
this->updateWellStatus( well.name(), timeStep, Well2::Status::SHUT);
}
}

View File

@@ -1,784 +0,0 @@
/*
Copyright 2013 Statoil ASA.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string>
#include <stdexcept>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
namespace Opm {
namespace WellCompletion {
std::string
DirectionEnum2String(const DirectionEnum enumValue)
{
std::string stringValue;
switch (enumValue) {
case DirectionEnum::X:
stringValue = "X";
break;
case DirectionEnum::Y:
stringValue = "Y";
break;
case DirectionEnum::Z:
stringValue = "Z";
break;
}
return stringValue;
}
DirectionEnum
DirectionEnumFromString(const std::string& s )
{
DirectionEnum direction;
if (s == "X") { direction = DirectionEnum::X; }
else if (s == "Y") { direction = DirectionEnum::Y; }
else if (s == "Z") { direction = DirectionEnum::Z; }
else {
std::string msg = "Unsupported completion direction " + s;
throw std::invalid_argument(msg);
}
return direction;
}
const std::string StateEnum2String( StateEnum enumValue ) {
switch( enumValue ) {
case OPEN:
return "OPEN";
case AUTO:
return "AUTO";
case SHUT:
return "SHUT";
default:
throw std::invalid_argument("Unhandled enum value");
}
}
StateEnum StateEnumFromString( const std::string& stringValue ) {
if (stringValue == "OPEN")
return OPEN;
else if (stringValue == "SHUT")
return SHUT;
else if (stringValue == "STOP")
return SHUT;
else if (stringValue == "AUTO")
return AUTO;
else
throw std::invalid_argument("Unknown enum state string: " + stringValue );
}
const std::string CompletionOrderEnum2String( CompletionOrderEnum enumValue ) {
switch( enumValue ) {
case DEPTH:
return "DEPTH";
case INPUT:
return "INPUT";
case TRACK:
return "TRACK";
default:
throw std::invalid_argument("Unhandled enum value");
}
}
CompletionOrderEnum CompletionOrderEnumFromString(const std::string& stringValue ) {
if (stringValue == "DEPTH")
return DEPTH;
else if (stringValue == "INPUT")
return INPUT;
else if (stringValue == "TRACK")
return TRACK;
else
throw std::invalid_argument("Unknown enum state string: " + stringValue );
}
}
/*****************************************************************/
namespace GroupInjection {
const std::string ControlEnum2String( ControlEnum enumValue ) {
switch( enumValue ) {
case NONE:
return "NONE";
case RATE:
return "RATE";
case RESV:
return "RESV";
case REIN:
return "REIN";
case VREP:
return "VREP";
case FLD:
return "FLD";
default:
throw std::invalid_argument("Unhandled enum value");
}
}
ControlEnum ControlEnumFromString( const std::string& stringValue ) {
if (stringValue == "NONE")
return NONE;
else if (stringValue == "RATE")
return RATE;
else if (stringValue == "RESV")
return RESV;
else if (stringValue == "REIN")
return REIN;
else if (stringValue == "VREP")
return VREP;
else if (stringValue == "FLD")
return FLD;
else
throw std::invalid_argument("Unknown enum state string: " + stringValue );
}
}
/*****************************************************************/
namespace GroupProduction {
const std::string ControlEnum2String( ControlEnum enumValue ) {
switch( enumValue ) {
case NONE:
return "NONE";
case ORAT:
return "ORAT";
case WRAT:
return "WRAT";
case GRAT:
return "GRAT";
case LRAT:
return "LRAT";
case CRAT:
return "CRAT";
case RESV:
return "RESV";
case PRBL:
return "PRBL";
case FLD:
return "FLD";
default:
throw std::invalid_argument("Unhandled enum value");
}
}
ControlEnum ControlEnumFromString( const std::string& stringValue ) {
if (stringValue == "NONE")
return NONE;
else if (stringValue == "ORAT")
return ORAT;
else if (stringValue == "WRAT")
return WRAT;
else if (stringValue == "GRAT")
return GRAT;
else if (stringValue == "LRAT")
return LRAT;
else if (stringValue == "CRAT")
return CRAT;
else if (stringValue == "RESV")
return RESV;
else if (stringValue == "PRBL")
return PRBL;
else if (stringValue == "FLD")
return FLD;
else
throw std::invalid_argument("Unknown enum state string: " + stringValue );
}
GuideRateDef GetGuideRateFromString( const std::string& stringValue ) {
if (stringValue == "OIL")
return GuideRateDef::OIL;
else if (stringValue == "WAT")
return GuideRateDef::WAT;
else if (stringValue == "GAS")
return GuideRateDef::GAS;
else if (stringValue == "LIQ")
return GuideRateDef::LIQ;
else if (stringValue == "COMB")
return GuideRateDef::COMB;
else if (stringValue == "WGA")
return GuideRateDef::WGA;
else if (stringValue == "CVAL")
return GuideRateDef::CVAL;
else if (stringValue == "INJV")
return GuideRateDef::INJV;
else if (stringValue == "POTN")
return GuideRateDef::POTN;
else if (stringValue == "FORM")
return GuideRateDef::FORM;
else
return GuideRateDef::NO_GUIDE_RATE;
}
}
/*****************************************************************/
namespace GroupProductionExceedLimit {
const std::string ActionEnum2String( ActionEnum enumValue ) {
switch(enumValue) {
case NONE:
return "NONE";
case CON:
return "CON";
case CON_PLUS:
return "+CON";
case WELL:
return "WELL";
case PLUG:
return "PLUG";
case RATE:
return "RATE";
default:
throw std::invalid_argument("unhandled enum value");
}
}
ActionEnum ActionEnumFromString( const std::string& stringValue ) {
if (stringValue == "NONE")
return NONE;
else if (stringValue == "CON")
return CON;
else if (stringValue == "+CON")
return CON_PLUS;
else if (stringValue == "WELL")
return WELL;
else if (stringValue == "PLUG")
return PLUG;
else if (stringValue == "RATE")
return RATE;
else
throw std::invalid_argument("Unknown enum state string: " + stringValue );
}
}
/*****************************************************************/
namespace WellProducer {
const std::string ControlMode2String( ControlModeEnum enumValue ) {
switch( enumValue ) {
case ORAT:
return "ORAT";
case WRAT:
return "WRAT";
case GRAT:
return "GRAT";
case LRAT:
return "LRAT";
case CRAT:
return "CRAT";
case RESV:
return "RESV";
case BHP:
return "BHP";
case THP:
return "THP";
case GRUP:
return "GRUP";
default:
throw std::invalid_argument("unhandled enum value");
}
}
ControlModeEnum ControlModeFromString( const std::string& stringValue ) {
if (stringValue == "ORAT")
return ORAT;
else if (stringValue == "WRAT")
return WRAT;
else if (stringValue == "GRAT")
return GRAT;
else if (stringValue == "LRAT")
return LRAT;
else if (stringValue == "CRAT")
return CRAT;
else if (stringValue == "RESV")
return RESV;
else if (stringValue == "BHP")
return BHP;
else if (stringValue == "THP")
return THP;
else if (stringValue == "GRUP")
return GRUP;
else if (stringValue == "NONE")
return NONE;
else
throw std::invalid_argument("Unknown enum state string: " + stringValue );
}
}
namespace WellInjector {
const std::string Type2String( TypeEnum enumValue ) {
switch( enumValue ) {
case OIL:
return "OIL";
case GAS:
return "GAS";
case WATER:
return "WATER";
case MULTI:
return "MULTI";
default:
throw std::invalid_argument("unhandled enum value");
}
}
TypeEnum TypeFromString( const std::string& stringValue ) {
if (stringValue == "OIL")
return OIL;
else if (stringValue == "WATER")
return WATER;
else if (stringValue == "WAT")
return WATER;
else if (stringValue == "GAS")
return GAS;
else if (stringValue == "MULTI")
return MULTI;
else
throw std::invalid_argument("Unknown enum state string: " + stringValue );
}
/*****************************************************************/
const std::string ControlMode2String( ControlModeEnum enumValue ) {
switch( enumValue ) {
case RESV:
return "RESV";
case RATE:
return "RATE";
case BHP:
return "BHP";
case THP:
return "THP";
case GRUP:
return "GRUP";
default:
throw std::invalid_argument("unhandled enum value");
}
}
ControlModeEnum ControlModeFromString( const std::string& stringValue ) {
if (stringValue == "RATE")
return RATE;
else if (stringValue == "RESV")
return RESV;
else if (stringValue == "BHP")
return BHP;
else if (stringValue == "THP")
return THP;
else if (stringValue == "GRUP")
return GRUP;
else
throw std::invalid_argument("Unknown enum state string: " + stringValue );
}
}
namespace WellCommon {
const std::string Status2String(StatusEnum enumValue) {
switch( enumValue ) {
case OPEN:
return "OPEN";
case SHUT:
return "SHUT";
case AUTO:
return "AUTO";
case STOP:
return "STOP";
default:
throw std::invalid_argument("unhandled enum value");
}
}
StatusEnum StatusFromString(const std::string& stringValue) {
if (stringValue == "OPEN")
return OPEN;
else if (stringValue == "SHUT")
return SHUT;
else if (stringValue == "STOP")
return STOP;
else if (stringValue == "AUTO")
return AUTO;
else
throw std::invalid_argument("Unknown enum state string: " + stringValue );
}
}
namespace GuideRate {
const std::string GuideRatePhaseEnum2String( GuideRatePhaseEnum enumValue ) {
switch( enumValue ) {
case OIL:
return "OIL";
case WAT:
return "WAT";
case GAS:
return "GAS";
case LIQ:
return "LIQ";
case COMB:
return "COMB";
case WGA:
return "WGA";
case CVAL:
return "CVAL";
case RAT:
return "RAT";
case RES:
return "RES";
case UNDEFINED:
return "UNDEFINED";
default:
throw std::invalid_argument("unhandled enum value");
}
}
GuideRatePhaseEnum GuideRatePhaseEnumFromString( const std::string& stringValue ) {
if (stringValue == "OIL")
return OIL;
else if (stringValue == "WAT")
return WAT;
else if (stringValue == "GAS")
return GAS;
else if (stringValue == "LIQ")
return LIQ;
else if (stringValue == "COMB")
return COMB;
else if (stringValue == "WGA")
return WGA;
else if (stringValue == "CVAL")
return CVAL;
else if (stringValue == "RAT")
return RAT;
else if (stringValue == "RES")
return RES;
else if (stringValue == "UNDEFINED")
return UNDEFINED;
else
throw std::invalid_argument("Unknown enum state string: " + stringValue );
}
}
namespace RFTConnections {
const std::string RFTEnum2String(RFTEnum enumValue) {
switch (enumValue) {
case YES:
return "YES";
case REPT:
return "REPT";
case TIMESTEP:
return "TIMESTEP";
case FOPN:
return "FOPN";
case NO:
return "NO";
default:
throw std::invalid_argument("unhandled enum value");
}
}
RFTEnum RFTEnumFromString(const std::string& stringValue) {
if (stringValue == "YES")
return YES;
else if (stringValue == "REPT")
return REPT;
else if (stringValue == "TIMESTEP")
return TIMESTEP;
else if (stringValue == "FOPN")
return FOPN;
else if (stringValue == "NO")
return NO;
else
throw std::invalid_argument("Unknown enum state string: " + stringValue);
}
}
namespace PLTConnections {
const std::string PLTEnum2String(PLTEnum enumValue) {
switch (enumValue) {
case YES:
return "YES";
case REPT:
return "REPT";
case TIMESTEP:
return "TIMESTEP";
case NO:
return "NO";
default:
throw std::invalid_argument("unhandled enum value");
}
}
PLTEnum PLTEnumFromString( const std::string& stringValue ){
if (stringValue == "YES")
return YES;
else if (stringValue == "REPT")
return REPT;
else if (stringValue == "TIMESTEP")
return TIMESTEP;
else if (stringValue == "NO")
return NO;
else
throw std::invalid_argument("Unknown enum state string: " + stringValue );
}
}
namespace WellSegment{
const std::string LengthDepthEnumToString(LengthDepthEnum enumValue) {
switch (enumValue) {
case INC:
return "INC";
case ABS:
return "ABS";
default:
throw std::invalid_argument("unhandled LengthDepthEnum value");
}
}
LengthDepthEnum LengthDepthEnumFromString(const std::string& string ) {
if (string == "INC") {
return INC;
} else if (string == "ABS") {
return ABS;
} else {
throw std::invalid_argument("Unknown enum string: " + string + " for LengthDepthEnum");
}
}
const std::string CompPressureDropEnumToString(CompPressureDropEnum enumValue) {
switch (enumValue) {
case HFA:
return "HFA";
case HF_:
return "HF-";
case H__:
return "H--";
default:
throw std::invalid_argument("unhandled CompPressureDropEnum value");
}
}
CompPressureDropEnum CompPressureDropEnumFromString( const std::string& string ) {
if (string == "HFA") {
return HFA;
} else if (string == "HF-") {
return HF_;
} else if (string == "H--") {
return H__;
} else {
throw std::invalid_argument("Unknown enum string: " + string + " for CompPressureDropEnum");
}
}
const std::string MultiPhaseModelEnumToString(MultiPhaseModelEnum enumValue) {
switch (enumValue) {
case HO:
return "HO";
case DF:
return "DF";
default:
throw std::invalid_argument("unhandled MultiPhaseModelEnum value");
}
}
MultiPhaseModelEnum MultiPhaseModelEnumFromString(const std::string& string ) {
if ((string == "HO") || (string == "H0")) {
return HO;
} else if (string == "DF") {
return DF;
} else {
throw std::invalid_argument("Unknown enum string: " + string + " for MultiPhaseModelEnum");
}
}
}
namespace WellTarget {
ControlModeEnum ControlModeFromString(const std::string& string_value) {
if (string_value == "ORAT")
return ORAT;
if (string_value == "WRAT")
return WRAT;
if (string_value == "GRAT")
return GRAT;
if (string_value == "LRAT")
return LRAT;
if (string_value == "CRAT")
return CRAT;
if (string_value == "RESV")
return RESV;
if (string_value == "BHP")
return BHP;
if (string_value == "THP")
return THP;
if (string_value == "VFP")
return VFP;
if (string_value == "LIFT")
return LIFT;
if (string_value == "GUID")
return GUID;
throw std::invalid_argument("WELTARG control mode: " + string_value + " not recognized.");
}
}
namespace WellEcon {
const std::string WorkoverEnumToString(WorkoverEnum enumValue) {
switch(enumValue) {
case NONE:
return "NONE";
case CON:
return "CON";
case CONP:
return "+CON";
case WELL:
return "WELL";
case PLUG:
return "PLUG";
case LAST:
return "LAST";
case RED:
return "RED";
default:
throw std::invalid_argument("unhandled WorkoverEnum value");
}
}
WorkoverEnum WorkoverEnumFromString( const std::string& string ) {
if (string == "NONE") {
return NONE;
} else if (string == "CON") {
return CON;
} else if (string == "+CON") {
return CONP;
} else if (string == "WELL") {
return WELL;
} else if (string == "PLUG") {
return PLUG;
} else if (string == "LAST") {
return LAST;
} else if (string == "RED") {
return RED;
} else {
throw std::invalid_argument("Unknown enum string: " + string + " for WorkoverEnum");
}
}
const std::string QuantityLimitEnumToString(QuantityLimitEnum enumValue) {
switch(enumValue) {
case RATE:
return "RATE";
case POTN:
return "POTN";
default:
throw std::invalid_argument("unhandled QuantityLimitvalue");
}
}
QuantityLimitEnum QuantityLimitEnumFromString(const std::string& string ) {
if (string == "RATE") {
return RATE;
} else if (string == "POTN") {
return POTN;
} else {
throw std::invalid_argument("Unknown enum string: " + string + " for QuantityLimitEnum");
}
}
}
GroupType operator|(GroupType lhs, GroupType rhs) {
return static_cast<GroupType>(static_cast<std::underlying_type<GroupType>::type>(lhs) | static_cast<std::underlying_type<GroupType>::type>(rhs));
}
GroupType operator&(GroupType lhs, GroupType rhs) {
return static_cast<GroupType>(static_cast<std::underlying_type<GroupType>::type>(lhs) & static_cast<std::underlying_type<GroupType>::type>(rhs));
}
GuideRateTarget GuideRateTargetFromString(const std::string& s) {
if (s == "OIL")
return GuideRateTarget::OIL;
if (s == "LIQ")
return GuideRateTarget::LIQ;
if (s == "GAS")
return GuideRateTarget::GAS;
if (s == "RES")
return GuideRateTarget::RES;
if (s == "COMB")
return GuideRateTarget::COMB;
if (s == "NONE")
return GuideRateTarget::NONE;
throw std::invalid_argument("Could not convert: " + s + " to a valid GuideRateTarget enum value");
}
}

View File

@@ -29,7 +29,6 @@
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/EclipseState/Eclipse3DProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Util/Value.hpp>
@@ -40,19 +39,18 @@ namespace Opm {
Connection::Connection(int i, int j , int k ,
int compnum,
double depth,
WellCompletion::StateEnum stateArg ,
State stateArg ,
double CF,
double Kh,
double rw,
double r0,
double skin_factor,
const int satTableId,
const WellCompletion::DirectionEnum directionArg,
const Direction directionArg,
const std::size_t seqIndex,
const double segDistStart,
const double segDistEnd,
const bool defaultSatTabId
)
const bool defaultSatTabId)
: direction(directionArg),
center_depth(depth),
open_state(stateArg),
@@ -70,14 +68,6 @@ namespace Opm {
m_defaultSatTabId(defaultSatTabId)
{}
/*bool Connection::sameCoordinate(const Connection& other) const {
if ((m_i == other.m_i) &&
(m_j == other.m_j) &&
(m_k == other.m_k))
return true;
else
return false;
}*/
bool Connection::sameCoordinate(const int i, const int j, const int k) const {
if ((ijk[0] == i) && (ijk[1] == j) && (ijk[2] == k)) {
@@ -87,8 +77,6 @@ namespace Opm {
}
}
int Connection::getI() const {
return ijk[0];
}
@@ -117,7 +105,7 @@ namespace Opm {
return m_compSeg_seqIndex;
}
WellCompletion::DirectionEnum Connection::dir() const {
Connection::Direction Connection::dir() const {
return this->direction;
}
@@ -150,7 +138,7 @@ namespace Opm {
return this->center_depth;
}
WellCompletion::StateEnum Connection::state() const {
Connection::State Connection::state() const {
return this->open_state;
}
@@ -186,7 +174,7 @@ namespace Opm {
return this->m_skin_factor;
}
void Connection::setState(WellCompletion::StateEnum state) {
void Connection::setState(State state) {
this->open_state = state;
}
@@ -221,8 +209,8 @@ namespace Opm {
ss << "wPi " << this->wPi << std::endl;
ss << "kh " << this->m_Kh << std::endl;
ss << "sat_tableId " << this->sat_tableId << std::endl;
ss << "open_state " << this->open_state << std::endl;
ss << "direction " << this->direction << std::endl;
ss << "open_state " << Connection::State2String(this->open_state) << std::endl;
ss << "direction " << Connection::Direction2String(this->direction) << std::endl;
ss << "segment_nr " << this->segment_number << std::endl;
ss << "center_depth " << this->center_depth << std::endl;
ss << "seqIndex " << this->m_seqIndex << std::endl;
@@ -254,4 +242,101 @@ namespace Opm {
bool Connection::operator!=( const Connection& rhs ) const {
return !( *this == rhs );
}
const std::string Connection::State2String( State enumValue ) {
switch( enumValue ) {
case State::OPEN:
return "OPEN";
case State::AUTO:
return "AUTO";
case State::SHUT:
return "SHUT";
default:
throw std::invalid_argument("Unhandled enum value");
}
}
Connection::State Connection::StateFromString( const std::string& stringValue ) {
if (stringValue == "OPEN")
return State::OPEN;
else if (stringValue == "SHUT")
return State::SHUT;
else if (stringValue == "STOP")
return State::SHUT;
else if (stringValue == "AUTO")
return State::AUTO;
else
throw std::invalid_argument("Unknown enum state string: " + stringValue );
}
std::string Connection::Direction2String(const Direction enumValue)
{
std::string stringValue;
switch (enumValue) {
case Direction::X:
stringValue = "X";
break;
case Direction::Y:
stringValue = "Y";
break;
case Direction::Z:
stringValue = "Z";
break;
}
return stringValue;
}
Connection::Direction Connection::DirectionFromString(const std::string& s )
{
Direction direction;
if (s == "X") { direction = Direction::X; }
else if (s == "Y") { direction = Direction::Y; }
else if (s == "Z") { direction = Direction::Z; }
else {
std::string msg = "Unsupported completion direction " + s;
throw std::invalid_argument(msg);
}
return direction;
}
const std::string Connection::Order2String( Order enumValue ) {
switch( enumValue ) {
case Order::DEPTH:
return "DEPTH";
case Order::INPUT:
return "INPUT";
case Order::TRACK:
return "TRACK";
default:
throw std::invalid_argument("Unhandled enum value");
}
}
Connection::Order Connection::OrderFromString(const std::string& stringValue ) {
if (stringValue == "DEPTH")
return Order::DEPTH;
else if (stringValue == "INPUT")
return Order::INPUT;
else if (stringValue == "TRACK")
return Order::TRACK;
else
throw std::invalid_argument("Unknown enum state string: " + stringValue );
}
}

View File

@@ -80,8 +80,8 @@ Well2::Well2(const std::string& wname_arg,
int headJ_arg,
double ref_depth_arg,
Phase phase_arg,
WellProducer::ControlModeEnum whistctl_cmode,
WellCompletion::CompletionOrderEnum ordering_arg,
ProducerCMode whistctl_cmode,
Connection::Order ordering_arg,
const UnitSystem& unit_system_arg,
double udq_undefined_arg) :
wname(wname_arg),
@@ -95,12 +95,12 @@ Well2::Well2(const std::string& wname_arg,
ordering(ordering_arg),
unit_system(unit_system_arg),
udq_undefined(udq_undefined_arg),
status(WellCommon::SHUT),
status(Status::SHUT),
drainage_radius(ParserKeywords::WELSPECS::D_RADIUS::defaultValue),
allow_cross_flow(DeckItem::to_bool(ParserKeywords::WELSPECS::CROSSFLOW::defaultValue)),
automatic_shutin( ParserKeywords::WELSPECS::CROSSFLOW::defaultValue == "SHUT"),
producer(true),
guide_rate({true, -1, GuideRate::UNDEFINED,ParserKeywords::WGRUPCON::SCALING_FACTOR::defaultValue}),
guide_rate({true, -1, Well2::GuideRateTarget::UNDEFINED,ParserKeywords::WGRUPCON::SCALING_FACTOR::defaultValue}),
efficiency_factor(1.0),
solvent_fraction(0.0),
econ_limits(std::make_shared<WellEconProductionLimits>()),
@@ -176,7 +176,7 @@ void Well2::switchToProducer() {
auto p = std::make_shared<WellInjectionProperties>(this->getInjectionProperties());
p->BHPLimit.reset( 0 );
p->dropInjectionControl( Opm::WellInjector::BHP );
p->dropInjectionControl( Opm::Well2::InjectorCMode::BHP );
this->updateInjection( p );
this->updateProducer(true);
}
@@ -187,7 +187,7 @@ void Well2::switchToInjector() {
p->BHPLimit.assert_numeric();
p->BHPLimit.reset(0);
p->dropProductionControl( Opm::WellProducer::BHP );
p->dropProductionControl( ProducerCMode::BHP );
this->updateProduction( p );
this->updateProducer( false );
}
@@ -225,7 +225,7 @@ bool Well2::updateTracer(std::shared_ptr<WellTracerProperties> tracer_properties
return false;
}
bool Well2::updateWellGuideRate(bool available, double guide_rate_arg, GuideRate::GuideRatePhaseEnum guide_phase, double scale_factor) {
bool Well2::updateWellGuideRate(bool available, double guide_rate_arg, GuideRateTarget guide_phase, double scale_factor) {
bool update = false;
if (this->guide_rate.available != available) {
this->guide_rate.available = available;
@@ -285,7 +285,7 @@ bool Well2::updateHead(int I, int J) {
}
bool Well2::updateStatus(WellCommon::StatusEnum status_arg) {
bool Well2::updateStatus(Status status_arg) {
if (this->status != status_arg) {
this->status = status_arg;
return true;
@@ -334,7 +334,7 @@ bool Well2::updateAutoShutin(bool auto_shutin) {
bool Well2::updateConnections(const std::shared_ptr<WellConnections> connections_arg) {
if( this->ordering == WellCompletion::TRACK)
if( this->ordering == Connection::Order::TRACK)
connections_arg->orderConnections( this->headI, this->headJ );
if (*this->connections != *connections_arg) {
@@ -386,7 +386,7 @@ bool Well2::isInjector() const {
}
WellInjector::TypeEnum Well2::injectorType() const {
Well2::InjectorType Well2::injectorType() const {
if (this->producer)
throw std::runtime_error("Can not access injectorType attribute of a producer");
@@ -403,7 +403,7 @@ double Well2::getGuideRate() const {
return this->guide_rate.guide_rate;
}
GuideRate::GuideRatePhaseEnum Well2::getGuideRatePhase() const {
Well2::GuideRateTarget Well2::getGuideRatePhase() const {
return this->guide_rate.guide_phase;
}
@@ -487,7 +487,7 @@ const WellEconProductionLimits& Well2::getEconLimits() const {
return *this->econ_limits;
}
const WellProductionProperties& Well2::getProductionProperties() const {
const Well2::WellProductionProperties& Well2::getProductionProperties() const {
return *this->production;
}
@@ -498,11 +498,11 @@ const WellSegments& Well2::getSegments() const {
throw std::logic_error("Asked for segment information in not MSW well: " + this->name());
}
const WellInjectionProperties& Well2::getInjectionProperties() const {
const Well2::WellInjectionProperties& Well2::getInjectionProperties() const {
return *this->injection;
}
WellCommon::StatusEnum Well2::getStatus() const {
Well2::Status Well2::getStatus() const {
return this->status;
}
@@ -526,7 +526,7 @@ Phase Well2::getPreferredPhase() const {
return this->phase;
}
bool Well2::handleWELOPEN(const DeckRecord& record, WellCompletion::StateEnum status_arg) {
bool Well2::handleWELOPEN(const DeckRecord& record, Connection::State state_arg) {
auto match = [=]( const Connection &c) -> bool {
if (!match_eq(c.getI(), record, "I" , -1)) return false;
@@ -542,7 +542,7 @@ bool Well2::handleWELOPEN(const DeckRecord& record, WellCompletion::StateEnum st
for (auto c : *this->connections) {
if (match(c))
c.setState( status_arg );
c.setState( state_arg );
new_connections->add(c);
}
@@ -681,7 +681,7 @@ bool Well2::updatePrediction(bool prediction_mode_arg) {
}
WellCompletion::CompletionOrderEnum Well2::getWellConnectionOrdering() const {
Connection::Order Well2::getWellConnectionOrdering() const {
return this->ordering;
}
@@ -716,9 +716,9 @@ double Well2::injection_rate(const SummaryState& st, Phase phase_arg) const {
const auto type = controls.injector_type;
if( phase_arg == Phase::WATER && type != WellInjector::WATER ) return 0.0;
if( phase_arg == Phase::OIL && type != WellInjector::OIL ) return 0.0;
if( phase_arg == Phase::GAS && type != WellInjector::GAS ) return 0.0;
if( phase_arg == Phase::WATER && type != Well2::InjectorType::WATER ) return 0.0;
if( phase_arg == Phase::OIL && type != Well2::InjectorType::OIL ) return 0.0;
if( phase_arg == Phase::GAS && type != Well2::InjectorType::GAS ) return 0.0;
return controls.surface_rate;
}
@@ -733,7 +733,7 @@ bool Well2::wellNameInWellNamePattern(const std::string& wellName, const std::st
}
ProductionControls Well2::productionControls(const SummaryState& st) const {
Well2::ProductionControls Well2::productionControls(const SummaryState& st) const {
if (this->isProducer()) {
auto controls = this->production->controls(st, this->udq_undefined);
controls.prediction_mode = this->predictionMode();
@@ -742,7 +742,7 @@ ProductionControls Well2::productionControls(const SummaryState& st) const {
throw std::logic_error("Trying to get production data from an injector");
}
InjectionControls Well2::injectionControls(const SummaryState& st) const {
Well2::InjectionControls Well2::injectionControls(const SummaryState& st) const {
if (!this->isProducer()) {
auto controls = this->injection->controls(this->unit_system, st, this->udq_undefined);
controls.prediction_mode = this->predictionMode();
@@ -781,4 +781,238 @@ double Well2::temperature() const {
throw std::runtime_error("Can not ask for temperature in a producer");
}
std::string Well2::Status2String(Well2::Status enumValue) {
switch( enumValue ) {
case Status::OPEN:
return "OPEN";
case Status::SHUT:
return "SHUT";
case Status::AUTO:
return "AUTO";
case Status::STOP:
return "STOP";
default:
throw std::invalid_argument("unhandled enum value");
}
}
Well2::Status Well2::StatusFromString(const std::string& stringValue) {
if (stringValue == "OPEN")
return Status::OPEN;
else if (stringValue == "SHUT")
return Status::SHUT;
else if (stringValue == "STOP")
return Status::STOP;
else if (stringValue == "AUTO")
return Status::AUTO;
else
throw std::invalid_argument("Unknown enum state string: " + stringValue );
}
const std::string Well2::InjectorType2String( Well2::InjectorType enumValue ) {
switch( enumValue ) {
case InjectorType::OIL:
return "OIL";
case InjectorType::GAS:
return "GAS";
case InjectorType::WATER:
return "WATER";
case InjectorType::MULTI:
return "MULTI";
default:
throw std::invalid_argument("unhandled enum value");
}
}
Well2::InjectorType Well2::InjectorTypeFromString( const std::string& stringValue ) {
if (stringValue == "OIL")
return InjectorType::OIL;
else if (stringValue == "WATER")
return InjectorType::WATER;
else if (stringValue == "WAT")
return InjectorType::WATER;
else if (stringValue == "GAS")
return InjectorType::GAS;
else if (stringValue == "MULTI")
return InjectorType::MULTI;
else
throw std::invalid_argument("Unknown enum state string: " + stringValue );
}
const std::string Well2::InjectorCMode2String( InjectorCMode enumValue ) {
switch( enumValue ) {
case InjectorCMode::RESV:
return "RESV";
case InjectorCMode::RATE:
return "RATE";
case InjectorCMode::BHP:
return "BHP";
case InjectorCMode::THP:
return "THP";
case InjectorCMode::GRUP:
return "GRUP";
default:
throw std::invalid_argument("unhandled enum value");
}
}
Well2::InjectorCMode Well2::InjectorCModeFromString(const std::string &stringValue) {
if (stringValue == "RATE")
return InjectorCMode::RATE;
else if (stringValue == "RESV")
return InjectorCMode::RESV;
else if (stringValue == "BHP")
return InjectorCMode::BHP;
else if (stringValue == "THP")
return InjectorCMode::THP;
else if (stringValue == "GRUP")
return InjectorCMode::GRUP;
else
throw std::invalid_argument("Unknown enum state string: " + stringValue);
}
Well2::WELTARGCMode Well2::WELTARGCModeFromString(const std::string& string_value) {
if (string_value == "ORAT")
return WELTARGCMode::ORAT;
if (string_value == "WRAT")
return WELTARGCMode::WRAT;
if (string_value == "GRAT")
return WELTARGCMode::GRAT;
if (string_value == "LRAT")
return WELTARGCMode::LRAT;
if (string_value == "CRAT")
return WELTARGCMode::CRAT;
if (string_value == "RESV")
return WELTARGCMode::RESV;
if (string_value == "BHP")
return WELTARGCMode::BHP;
if (string_value == "THP")
return WELTARGCMode::THP;
if (string_value == "VFP")
return WELTARGCMode::VFP;
if (string_value == "LIFT")
return WELTARGCMode::LIFT;
if (string_value == "GUID")
return WELTARGCMode::GUID;
throw std::invalid_argument("WELTARG control mode: " + string_value + " not recognized.");
}
const std::string Well2::ProducerCMode2String( ProducerCMode enumValue ) {
switch( enumValue ) {
case ProducerCMode::ORAT:
return "ORAT";
case ProducerCMode::WRAT:
return "WRAT";
case ProducerCMode::GRAT:
return "GRAT";
case ProducerCMode::LRAT:
return "LRAT";
case ProducerCMode::CRAT:
return "CRAT";
case ProducerCMode::RESV:
return "RESV";
case ProducerCMode::BHP:
return "BHP";
case ProducerCMode::THP:
return "THP";
case ProducerCMode::GRUP:
return "GRUP";
default:
throw std::invalid_argument("unhandled enum value");
}
}
Well2::ProducerCMode Well2::ProducerCModeFromString( const std::string& stringValue ) {
if (stringValue == "ORAT")
return ProducerCMode::ORAT;
else if (stringValue == "WRAT")
return ProducerCMode::WRAT;
else if (stringValue == "GRAT")
return ProducerCMode::GRAT;
else if (stringValue == "LRAT")
return ProducerCMode::LRAT;
else if (stringValue == "CRAT")
return ProducerCMode::CRAT;
else if (stringValue == "RESV")
return ProducerCMode::RESV;
else if (stringValue == "BHP")
return ProducerCMode::BHP;
else if (stringValue == "THP")
return ProducerCMode::THP;
else if (stringValue == "GRUP")
return ProducerCMode::GRUP;
else if (stringValue == "NONE")
return ProducerCMode::NONE;
else
throw std::invalid_argument("Unknown enum state string: " + stringValue );
}
const std::string Well2::GuideRateTarget2String( GuideRateTarget enumValue ) {
switch( enumValue ) {
case GuideRateTarget::OIL:
return "OIL";
case GuideRateTarget::WAT:
return "WAT";
case GuideRateTarget::GAS:
return "GAS";
case GuideRateTarget::LIQ:
return "LIQ";
case GuideRateTarget::COMB:
return "COMB";
case GuideRateTarget::WGA:
return "WGA";
case GuideRateTarget::CVAL:
return "CVAL";
case GuideRateTarget::RAT:
return "RAT";
case GuideRateTarget::RES:
return "RES";
case GuideRateTarget::UNDEFINED:
return "UNDEFINED";
default:
throw std::invalid_argument("unhandled enum value");
}
}
Well2::GuideRateTarget Well2::GuideRateTargetFromString( const std::string& stringValue ) {
if (stringValue == "OIL")
return GuideRateTarget::OIL;
else if (stringValue == "WAT")
return GuideRateTarget::WAT;
else if (stringValue == "GAS")
return GuideRateTarget::GAS;
else if (stringValue == "LIQ")
return GuideRateTarget::LIQ;
else if (stringValue == "COMB")
return GuideRateTarget::COMB;
else if (stringValue == "WGA")
return GuideRateTarget::WGA;
else if (stringValue == "CVAL")
return GuideRateTarget::CVAL;
else if (stringValue == "RAT")
return GuideRateTarget::RAT;
else if (stringValue == "RES")
return GuideRateTarget::RES;
else if (stringValue == "UNDEFINED")
return GuideRateTarget::UNDEFINED;
else
throw std::invalid_argument("Unknown enum state string: " + stringValue );
}
}

View File

@@ -25,7 +25,6 @@
#include <opm/parser/eclipse/Units/Units.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Eclipse3DProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp>
@@ -37,16 +36,16 @@ namespace {
// direction. First two elements of return value are directions
// perpendicular to completion while last element is direction
// along completion.
inline std::array< size_t, 3> directionIndices(const Opm::WellCompletion::DirectionEnum direction)
inline std::array< size_t, 3> directionIndices(const Opm::Connection::Direction direction)
{
switch (direction) {
case Opm::WellCompletion::DirectionEnum::X:
case Opm::Connection::Direction::X:
return {{ 1,2,0 }};
case Opm::WellCompletion::DirectionEnum::Y:
case Opm::Connection::Direction::Y:
return {{ 2,0,1}};
case Opm::WellCompletion::DirectionEnum::Z:
case Opm::Connection::Direction::Z:
return {{ 0,1,2 }};
}
// All enum values should be handled above. Therefore
@@ -59,7 +58,7 @@ namespace {
// Permute (diagonal) permeability components according to
// completion's direction.
inline std::array<double,3>
permComponents(const Opm::WellCompletion::DirectionEnum direction,
permComponents(const Opm::Connection::Direction direction,
const std::array<double,3>& perm)
{
const auto p = directionIndices(direction);
@@ -75,9 +74,9 @@ namespace {
// Note: 'extent' is intentionally accepted by modifiable value
// rather than reference-to-const to support NTG manipulation.
inline std::array<double,3>
effectiveExtent(const Opm::WellCompletion::DirectionEnum direction,
const double ntg,
std::array<double,3> extent)
effectiveExtent(const Opm::Connection::Direction direction,
const double ntg,
std::array<double,3> extent)
{
// Vertical extent affected by net-to-gross ratio.
extent[2] *= ntg;
@@ -136,14 +135,14 @@ namespace {
void WellConnections::addConnection(int i, int j , int k ,
int complnum,
double depth,
WellCompletion::StateEnum state,
Connection::State state,
double CF,
double Kh,
double rw,
double r0,
double skin_factor,
const int satTableId,
const WellCompletion::DirectionEnum direction,
const Connection::Direction direction,
const std::size_t seqIndex,
const double segDistStart,
const double segDistEnd,
@@ -159,14 +158,14 @@ namespace {
void WellConnections::addConnection(int i, int j , int k ,
double depth,
WellCompletion::StateEnum state ,
Connection::State state ,
double CF,
double Kh,
double rw,
double r0,
double skin_factor,
const int satTableId,
const WellCompletion::DirectionEnum direction,
const Connection::Direction direction,
const std::size_t seqIndex,
const double segDistStart,
const double segDistEnd,
@@ -208,7 +207,7 @@ namespace {
int K1 = record.getItem("K1").get< int >(0) - 1;
int K2 = record.getItem("K2").get< int >(0) - 1;
WellCompletion::StateEnum state = WellCompletion::StateEnumFromString( record.getItem("STATE").getTrimmedString(0) );
Connection::State state = Connection::StateFromString( record.getItem("STATE").getTrimmedString(0) );
const auto& satnum = eclipseProperties.getIntGridProperty("SATNUM");
int satTableId = -1;
@@ -218,7 +217,7 @@ namespace {
const auto& KhItem = record.getItem("Kh");
const auto& satTableIdItem = record.getItem("SAT_TABLE");
const auto& r0Item = record.getItem("PR");
const WellCompletion::DirectionEnum direction = WellCompletion::DirectionEnumFromString(record.getItem("DIR").getTrimmedString(0));
const auto direction = Connection::DirectionFromString(record.getItem("DIR").getTrimmedString(0));
double skin_factor = record.getItem("SKIN").getSIDouble(0);
double rw;
double r0=0.0;
@@ -388,7 +387,7 @@ namespace {
auto shut = []( const Connection& c ) {
return c.state() == WellCompletion::StateEnum::SHUT;
return c.state() == Connection::State::SHUT;
};
return std::all_of( this->m_connections.begin(),

View File

@@ -34,10 +34,10 @@ namespace Opm {
, m_max_water_cut(0.0)
, m_max_gas_oil_ratio(0.0)
, m_max_water_gas_ratio(0.0)
, m_workover(WellEcon::NONE)
, m_workover(EconWorkover::NONE)
, m_end_run(false)
, m_followon_well("'")
, m_quantity_limit(WellEcon::RATE)
, m_quantity_limit(QuantityLimit::RATE)
, m_secondary_max_water_cut(0.0)
, m_workover_secondary(m_workover)
, m_max_gas_liquid_ratio(0.0)
@@ -55,17 +55,17 @@ namespace Opm {
, m_max_water_cut(record.getItem("MAX_WATER_CUT").get<UDAValue>(0).get<double>())
, m_max_gas_oil_ratio(record.getItem("MAX_GAS_OIL_RATIO").get<UDAValue>(0).get<double>())
, m_max_water_gas_ratio(record.getItem("MAX_WATER_GAS_RATIO").get<UDAValue>(0).get<double>())
, m_workover(WellEcon::WorkoverEnumFromString(record.getItem("WORKOVER_RATIO_LIMIT").getTrimmedString(0)))
, m_workover(EconWorkoverFromString(record.getItem("WORKOVER_RATIO_LIMIT").getTrimmedString(0)))
, m_end_run(false)
, m_followon_well(record.getItem("FOLLOW_ON_WELL").getTrimmedString(0))
, m_quantity_limit(WellEcon::QuantityLimitEnumFromString(record.getItem("LIMITED_QUANTITY").getTrimmedString(0)))
, m_quantity_limit(QuantityLimitFromString(record.getItem("LIMITED_QUANTITY").getTrimmedString(0)))
, m_secondary_max_water_cut(record.getItem("SECOND_MAX_WATER_CUT").get<double>(0))
, m_max_gas_liquid_ratio(record.getItem("MAX_GAS_LIQUID_RATIO").get<double>(0))
, m_min_liquid_rate(record.getItem("MIN_LIQUID_PRODCUTION_RATE").getSIDouble(0))
, m_min_reservoir_fluid_rate(record.getItem("MIN_RES_FLUID_RATE").getSIDouble(0))
{
assert(m_workover != WellEcon::LAST);
assert(m_workover != WellEcon::RED);
assert(m_workover != EconWorkover::LAST);
assert(m_workover != EconWorkover::RED);
if (record.getItem("MAX_TEMP").hasValue(0)) {
m_max_temperature = record.getItem("MAX_TEMP").getSIDouble(0);
@@ -76,7 +76,7 @@ namespace Opm {
if (record.getItem("WORKOVER_SECOND_WATER_CUT_LIMIT").hasValue(0)) {
const std::string string_workover = record.getItem("WORKOVER_SECOND_WATER_CUT_LIMIT").getTrimmedString(0);
m_workover_secondary = WellEcon::WorkoverEnumFromString(string_workover);
m_workover_secondary = EconWorkoverFromString(string_workover);
} else {
m_workover_secondary = m_workover;
}
@@ -116,8 +116,159 @@ namespace Opm {
}
bool WellEconProductionLimits::operator!=(const WellEconProductionLimits& other) const {
return (!(*this == other));
bool WellEconProductionLimits::operator!=(const WellEconProductionLimits& other) const {
return (!(*this == other));
}
// limit switch on?
bool WellEconProductionLimits::onAnyEffectiveLimit() const {
return (onAnyRatioLimit() || onAnyRateLimit());
};
bool WellEconProductionLimits::onAnyRatioLimit() const {
return (onMaxWaterCut() || onMaxGasOilRatio() || onMaxWaterGasRatio() ||
onMaxGasLiquidRatio());
};
bool WellEconProductionLimits::onAnyRateLimit() const {
return (onMinOilRate() || onMinGasRate() || onMinLiquidRate() ||
onMinReservoirFluidRate());
};
bool WellEconProductionLimits::onMinOilRate() const { return (m_min_oil_rate > 0.0); };
bool WellEconProductionLimits::onMinGasRate() const { return (m_min_gas_rate > 0.0); };
bool WellEconProductionLimits::onMaxWaterCut() const { return (m_max_water_cut > 0.0); };
bool WellEconProductionLimits::onMaxGasOilRatio() const { return (m_max_gas_oil_ratio > 0.0); };
bool WellEconProductionLimits::onMaxWaterGasRatio() const { return (m_max_water_gas_ratio > 0.0); };
bool WellEconProductionLimits::onSecondaryMaxWaterCut() const {
return (m_secondary_max_water_cut > 0.0);
};
bool WellEconProductionLimits::onMaxGasLiquidRatio() const { return (m_max_gas_oil_ratio > 0.0); };
// assuming Celsius temperature is used internally
bool WellEconProductionLimits::onMaxTemperature() const { return (m_max_temperature > -273.15); };
bool WellEconProductionLimits::onMinLiquidRate() const { return (m_min_liquid_rate > 0.0); };
bool WellEconProductionLimits::onMinReservoirFluidRate() const {
return (m_min_reservoir_fluid_rate > 0.0);
};
// not sure what will happen if the followon well is a well does not exist.
bool WellEconProductionLimits::validFollowonWell() const { return (m_followon_well != "'"); };
bool WellEconProductionLimits::requireWorkover() const {
return (m_workover != EconWorkover::NONE);
};
bool WellEconProductionLimits::requireSecondaryWorkover() const {
return (m_workover_secondary != EconWorkover::NONE);
}
bool WellEconProductionLimits::endRun() const { return m_end_run; }
double WellEconProductionLimits::minOilRate() const { return m_min_oil_rate; };
double WellEconProductionLimits::minGasRate() const { return m_min_gas_rate; };
double WellEconProductionLimits::maxWaterCut() const { return m_max_water_cut; };
double WellEconProductionLimits::maxGasOilRatio() const { return m_max_gas_oil_ratio; };
double WellEconProductionLimits::maxWaterGasRatio() const { return m_max_water_gas_ratio; };
double WellEconProductionLimits::maxGasLiquidRatio() const { return m_max_gas_liquid_ratio; };
double WellEconProductionLimits::minLiquidRate() const { return m_min_liquid_rate; };
double WellEconProductionLimits::maxTemperature() const { return m_max_temperature; };
double WellEconProductionLimits::minReservoirFluidRate() const { return m_min_reservoir_fluid_rate; };
WellEconProductionLimits::EconWorkover WellEconProductionLimits::workover() const { return m_workover; };
const std::string& WellEconProductionLimits::followonWell() const { return m_followon_well; };
WellEconProductionLimits::QuantityLimit WellEconProductionLimits::quantityLimit() const {
return m_quantity_limit;
};
double WellEconProductionLimits::maxSecondaryMaxWaterCut() const {
return m_secondary_max_water_cut;
};
WellEconProductionLimits::EconWorkover WellEconProductionLimits::workoverSecondary() const {
return m_workover_secondary;
};
std::string WellEconProductionLimits::EconWorkover2String(EconWorkover enumValue) {
switch(enumValue) {
case EconWorkover::NONE:
return "NONE";
case EconWorkover::CON:
return "CON";
case EconWorkover::CONP:
return "+CON";
case EconWorkover::WELL:
return "WELL";
case EconWorkover::PLUG:
return "PLUG";
case EconWorkover::LAST:
return "LAST";
case EconWorkover::RED:
return "RED";
default:
throw std::invalid_argument("unhandled WorkoverEnum value");
}
}
WellEconProductionLimits::EconWorkover WellEconProductionLimits::EconWorkoverFromString(const std::string& stringValue) {
if (stringValue == "NONE")
return EconWorkover::NONE;
else if (stringValue == "CON")
return EconWorkover::CON;
else if (stringValue == "+CON")
return EconWorkover::CONP;
else if (stringValue == "WELL")
return EconWorkover::WELL;
else if (stringValue == "PLUG")
return EconWorkover::PLUG;
else if (stringValue == "LAST")
return EconWorkover::LAST;
else if (stringValue == "RED")
return EconWorkover::RED;
else
throw std::invalid_argument("Unknown enum stringValue: " + stringValue +
" for WorkoverEnum");
}
const std::string WellEconProductionLimits::QuantityLimit2String(QuantityLimit enumValue) {
switch(enumValue) {
case QuantityLimit::RATE:
return "RATE";
case QuantityLimit::POTN:
return "POTN";
default:
throw std::invalid_argument("unhandled QuantityLimitvalue");
}
}
WellEconProductionLimits::QuantityLimit WellEconProductionLimits::QuantityLimitFromString(const std::string& string ) {
if (string == "RATE") {
return QuantityLimit::RATE;
} else if (string == "POTN") {
return QuantityLimit::POTN;
} else {
throw std::invalid_argument("Unknown enum string: " + string + " for QuantityLimitEnum");
}
}
} // namespace Opm

View File

@@ -27,6 +27,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQActive.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp>
#include "injection.hpp"
#include "../eval_uda.hpp"
@@ -34,10 +35,10 @@
namespace Opm {
WellInjectionProperties::WellInjectionProperties(const std::string& wname)
Well2::WellInjectionProperties::WellInjectionProperties(const std::string& wname)
: name(wname),
injectorType(WellInjector::WATER),
controlMode(WellInjector::CMODE_UNDEFINED)
injectorType(InjectorType::WATER),
controlMode(InjectorCMode::CMODE_UNDEFINED)
{
temperature=
Metric::TemperatureOffset
@@ -50,29 +51,29 @@ namespace Opm {
}
void WellInjectionProperties::handleWCONINJE(const DeckRecord& record, bool availableForGroupControl, const std::string& well_name) {
this->injectorType = WellInjector::TypeFromString( record.getItem("TYPE").getTrimmedString(0) );
void Well2::WellInjectionProperties::handleWCONINJE(const DeckRecord& record, bool availableForGroupControl, const std::string& well_name) {
this->injectorType = Well2::InjectorTypeFromString( record.getItem("TYPE").getTrimmedString(0) );
this->predictionMode = true;
if (!record.getItem("RATE").defaultApplied(0)) {
this->surfaceInjectionRate = record.getItem("RATE").get<UDAValue>(0);
this->addInjectionControl(WellInjector::RATE);
this->addInjectionControl(InjectorCMode::RATE);
} else
this->dropInjectionControl(WellInjector::RATE);
this->dropInjectionControl(InjectorCMode::RATE);
if (!record.getItem("RESV").defaultApplied(0)) {
this->reservoirInjectionRate = record.getItem("RESV").get<UDAValue>(0);
this->addInjectionControl(WellInjector::RESV);
this->addInjectionControl(InjectorCMode::RESV);
} else
this->dropInjectionControl(WellInjector::RESV);
this->dropInjectionControl(InjectorCMode::RESV);
if (!record.getItem("THP").defaultApplied(0)) {
this->THPLimit = record.getItem("THP").get<UDAValue>(0);
this->addInjectionControl(WellInjector::THP);
this->addInjectionControl(InjectorCMode::THP);
} else
this->dropInjectionControl(WellInjector::THP);
this->dropInjectionControl(InjectorCMode::THP);
this->VFPTableNumber = record.getItem("VFP_TABLE").get< int >(0);
@@ -85,15 +86,15 @@ namespace Opm {
*/
this->setBHPLimit(record.getItem("BHP").get<UDAValue>(0).get<double>());
// BHP control should always be there.
this->addInjectionControl(WellInjector::BHP);
this->addInjectionControl(InjectorCMode::BHP);
if (availableForGroupControl)
this->addInjectionControl(WellInjector::GRUP);
this->addInjectionControl(InjectorCMode::GRUP);
else
this->dropInjectionControl(WellInjector::GRUP);
this->dropInjectionControl(InjectorCMode::GRUP);
{
const std::string& cmodeString = record.getItem("CMODE").getTrimmedString(0);
WellInjector::ControlModeEnum controlModeArg = WellInjector::ControlModeFromString( cmodeString );
InjectorCMode controlModeArg = InjectorCModeFromString( cmodeString );
if (this->hasInjectionControl( controlModeArg))
this->controlMode = controlModeArg;
else {
@@ -104,53 +105,53 @@ namespace Opm {
void WellInjectionProperties::handleWELTARG(WellTarget::ControlModeEnum cmode, double newValue, double siFactorG, double siFactorL, double siFactorP) {
if (cmode == WellTarget::BHP){
void Well2::WellInjectionProperties::handleWELTARG(WELTARGCMode cmode, double newValue, double siFactorG, double siFactorL, double siFactorP) {
if (cmode == Well2::WELTARGCMode::BHP){
this->BHPLimit.reset( newValue * siFactorP );
}
else if (cmode == WellTarget::ORAT){
if(this->injectorType == WellInjector::TypeEnum::OIL){
else if (cmode == WELTARGCMode::ORAT){
if(this->injectorType == Well2::InjectorType::OIL){
this->surfaceInjectionRate.reset( newValue * siFactorL );
}else{
std::invalid_argument("Well type must be OIL to set the oil rate");
}
}
else if (cmode == WellTarget::WRAT){
if(this->injectorType == WellInjector::TypeEnum::WATER)
else if (cmode == WELTARGCMode::WRAT){
if(this->injectorType == Well2::InjectorType::WATER)
this->surfaceInjectionRate.reset( newValue * siFactorL );
else
std::invalid_argument("Well type must be WATER to set the water rate");
}
else if (cmode == WellTarget::GRAT){
if(this->injectorType == WellInjector::TypeEnum::GAS){
else if (cmode == WELTARGCMode::GRAT){
if(this->injectorType == Well2::InjectorType::GAS){
this->surfaceInjectionRate.reset( newValue * siFactorG );
}else{
std::invalid_argument("Well type must be GAS to set the gas rate");
}
}
else if (cmode == WellTarget::THP){
else if (cmode == WELTARGCMode::THP){
this->THPLimit.reset( newValue * siFactorP );
}
else if (cmode == WellTarget::VFP){
else if (cmode == WELTARGCMode::VFP){
this->VFPTableNumber = static_cast<int> (newValue);
}
else if (cmode == WellTarget::RESV){
else if (cmode == WELTARGCMode::RESV){
this->reservoirInjectionRate.reset( newValue * siFactorL );
}
else if (cmode != WellTarget::GUID){
else if (cmode != WELTARGCMode::GUID){
throw std::invalid_argument("Invalid keyword (MODE) supplied");
}
}
void WellInjectionProperties::handleWCONINJH(const DeckRecord& record, bool is_producer, const std::string& well_name) {
void Well2::WellInjectionProperties::handleWCONINJH(const DeckRecord& record, bool is_producer, const std::string& well_name) {
// convert injection rates to SI
const auto& typeItem = record.getItem("TYPE");
if (typeItem.defaultApplied(0)) {
const std::string msg = "Injection type can not be defaulted for keyword WCONINJH";
throw std::invalid_argument(msg);
}
this->injectorType = WellInjector::TypeFromString( typeItem.getTrimmedString(0));
this->injectorType = Well2::InjectorTypeFromString( typeItem.getTrimmedString(0));
if (!record.getItem("RATE").defaultApplied(0)) {
double injectionRate = record.getItem("RATE").get<double>(0);
@@ -162,20 +163,20 @@ namespace Opm {
this->THPH = record.getItem("THP").getSIDouble(0);
const std::string& cmodeString = record.getItem("CMODE").getTrimmedString(0);
const WellInjector::ControlModeEnum newControlMode = WellInjector::ControlModeFromString( cmodeString );
const InjectorCMode newControlMode = InjectorCModeFromString( cmodeString );
if ( !(newControlMode == WellInjector::RATE || newControlMode == WellInjector::BHP) ) {
if ( !(newControlMode == InjectorCMode::RATE || newControlMode == InjectorCMode::BHP) ) {
const std::string msg = "Only RATE and BHP control are allowed for WCONINJH for well " + well_name;
throw std::invalid_argument(msg);
}
// when well is under BHP control, we use its historical BHP value as BHP limit
if (newControlMode == WellInjector::BHP) {
if (newControlMode == InjectorCMode::BHP) {
this->setBHPLimit(this->BHPH);
} else {
const bool switching_from_producer = is_producer;
const bool switching_from_prediction = this->predictionMode;
const bool switching_from_BHP_control = (this->controlMode == WellInjector::BHP);
const bool switching_from_BHP_control = (this->controlMode == InjectorCMode::BHP);
if (switching_from_prediction ||
switching_from_BHP_control ||
switching_from_producer) {
@@ -184,7 +185,7 @@ namespace Opm {
// otherwise, we keep its previous BHP limit
}
this->addInjectionControl(WellInjector::BHP);
this->addInjectionControl(InjectorCMode::BHP);
this->addInjectionControl(newControlMode);
this->controlMode = newControlMode;
this->predictionMode = false;
@@ -195,7 +196,7 @@ namespace Opm {
}
}
bool WellInjectionProperties::operator==(const WellInjectionProperties& other) const {
bool Well2::WellInjectionProperties::operator==(const Well2::WellInjectionProperties& other) const {
if ((surfaceInjectionRate == other.surfaceInjectionRate) &&
(reservoirInjectionRate == other.reservoirInjectionRate) &&
(temperature == other.temperature) &&
@@ -213,24 +214,24 @@ namespace Opm {
return false;
}
bool WellInjectionProperties::operator!=(const WellInjectionProperties& other) const {
bool Well2::WellInjectionProperties::operator!=(const Well2::WellInjectionProperties& other) const {
return !(*this == other);
}
void WellInjectionProperties::resetDefaultHistoricalBHPLimit() {
void Well2::WellInjectionProperties::resetDefaultHistoricalBHPLimit() {
// this default BHP value is from simulation result,
// without finding any related document
BHPLimit.reset( 6891.2 * unit::barsa );
}
void WellInjectionProperties::setBHPLimit(const double limit) {
void Well2::WellInjectionProperties::setBHPLimit(const double limit) {
BHPLimit.reset( limit );
}
std::ostream& operator<<( std::ostream& stream,
const WellInjectionProperties& wp ) {
const Well2::WellInjectionProperties& wp ) {
return stream
<< "WellInjectionProperties { "
<< "Well2::WellInjectionProperties { "
<< "surfacerate: " << wp.surfaceInjectionRate << ", "
<< "reservoir rate " << wp.reservoirInjectionRate << ", "
<< "temperature: " << wp.temperature << ", "
@@ -241,12 +242,12 @@ namespace Opm {
<< "VFP table: " << wp.VFPTableNumber << ", "
<< "prediction mode: " << wp.predictionMode << ", "
<< "injection ctrl: " << wp.injectionControls << ", "
<< "injector type: " << wp.injectorType << ", "
<< "control mode: " << wp.controlMode << " }";
<< "injector type: " << Well2::InjectorType2String(wp.injectorType) << ", "
<< "control mode: " << Well2::InjectorCMode2String(wp.controlMode) << " }";
}
InjectionControls WellInjectionProperties::controls(const UnitSystem& unit_system, const SummaryState& st, double udq_default) const {
Well2::InjectionControls Well2::WellInjectionProperties::controls(const UnitSystem& unit_system, const SummaryState& st, double udq_default) const {
InjectionControls controls(this->injectionControls);
controls.surface_rate = UDA::eval_well_uda_rate(this->surfaceInjectionRate, this->name, st, udq_default, this->injectorType, unit_system);
@@ -263,7 +264,7 @@ namespace Opm {
return controls;
}
bool WellInjectionProperties::updateUDQActive(const UDQConfig& udq_config, UDQActive& active) const {
bool Well2::WellInjectionProperties::updateUDQActive(const UDQConfig& udq_config, UDQActive& active) const {
int update_count = 0;
update_count += active.update(udq_config, this->surfaceInjectionRate, this->name, UDAControl::WCONINJE_RATE);

View File

@@ -26,7 +26,6 @@
#include <opm/parser/eclipse/Deck/UDAValue.hpp>
#include <opm/parser/eclipse/Units/Units.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQActive.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.hpp>
@@ -34,20 +33,20 @@
namespace Opm {
WellProductionProperties::WellProductionProperties(const std::string& name_arg) :
Well2::WellProductionProperties::WellProductionProperties(const std::string& name_arg) :
name(name_arg),
predictionMode( true )
{}
void WellProductionProperties::init_rates( const DeckRecord& record ) {
void Well2::WellProductionProperties::init_rates( const DeckRecord& record ) {
this->OilRate = record.getItem("ORAT").get<UDAValue>(0);
this->WaterRate = record.getItem("WRAT").get<UDAValue>(0);
this->GasRate = record.getItem("GRAT").get<UDAValue>(0);
}
void WellProductionProperties::init_history(const DeckRecord& record)
void Well2::WellProductionProperties::init_history(const DeckRecord& record)
{
this->predictionMode = false;
// update LiquidRate
@@ -64,13 +63,12 @@ namespace Opm {
throw std::invalid_argument(msg);
}
namespace wp = WellProducer;
auto cmode = wp::CMODE_UNDEFINED;
auto cmode = ProducerCMode::CMODE_UNDEFINED;
if (effectiveHistoryProductionControl(this->whistctl_cmode) )
cmode = this->whistctl_cmode;
else
cmode = wp::ControlModeFromString( cmodeItem.getTrimmedString( 0 ) );
cmode = ProducerCModeFromString( cmodeItem.getTrimmedString( 0 ) );
// clearing the existing targets/limits
clearControls();
@@ -86,10 +84,10 @@ namespace Opm {
// always have a BHP control/limit, while the limit value needs to be determined
// the control mode added above can be a BHP control or a type of RATE control
if ( !this->hasProductionControl( wp::BHP ) )
this->addProductionControl( wp::BHP );
if ( !this->hasProductionControl( ProducerCMode::BHP ) )
this->addProductionControl( ProducerCMode::BHP );
if (cmode == wp::BHP)
if (cmode == ProducerCMode::BHP)
this->setBHPLimit(this->BHPH);
const auto vfp_table = record.getItem("VFPTable").get< int >(0);
@@ -103,7 +101,7 @@ namespace Opm {
void WellProductionProperties::handleWCONPROD( const std::string& /* well */, const DeckRecord& record)
void Well2::WellProductionProperties::handleWCONPROD( const std::string& /* well */, const DeckRecord& record)
{
this->predictionMode = true;
@@ -114,11 +112,10 @@ namespace Opm {
this->LiquidRate = record.getItem("LRAT").get<UDAValue>(0);
this->ResVRate = record.getItem("RESV").get<UDAValue>(0);
namespace wp = WellProducer;
using mode = std::pair< const std::string, wp::ControlModeEnum >;
using mode = std::pair< const std::string, ProducerCMode >;
static const mode modes[] = {
{ "ORAT", wp::ORAT }, { "WRAT", wp::WRAT }, { "GRAT", wp::GRAT },
{ "LRAT", wp::LRAT }, { "RESV", wp::RESV }, { "THP", wp::THP }
{ "ORAT", ProducerCMode::ORAT }, { "WRAT", ProducerCMode::WRAT }, { "GRAT", ProducerCMode::GRAT },
{ "LRAT", ProducerCMode::LRAT }, { "RESV", ProducerCMode::RESV }, { "THP", ProducerCMode::THP }
};
@@ -136,11 +133,11 @@ namespace Opm {
}
// There is always a BHP constraint, when not specified, will use the default value
this->addProductionControl( wp::BHP );
this->addProductionControl( ProducerCMode::BHP );
{
const auto& cmodeItem = record.getItem("CMODE");
if (cmodeItem.hasValue(0)) {
const WellProducer::ControlModeEnum cmode = WellProducer::ControlModeFromString( cmodeItem.getTrimmedString(0) );
auto cmode = Well2::ProducerCModeFromString( cmodeItem.getTrimmedString(0) );
if (this->hasProductionControl( cmode ))
this->controlMode = cmode;
@@ -155,7 +152,7 @@ namespace Opm {
originate from the WCONHIST keyword. Predictions are handled with the
default constructor and the handleWCONPROD() method.
*/
void WellProductionProperties::handleWCONHIST(const DeckRecord& record)
void Well2::WellProductionProperties::handleWCONHIST(const DeckRecord& record)
{
this->init_rates(record);
this->LiquidRate.reset(0);
@@ -168,7 +165,7 @@ namespace Opm {
if (this->predictionMode)
this->resetDefaultBHPLimit();
if (this->controlMode == WellProducer::BHP)
if (this->controlMode == ProducerCMode::BHP)
this->resetDefaultBHPLimit();
this->init_history(record);
@@ -176,44 +173,44 @@ namespace Opm {
void WellProductionProperties::handleWELTARG(WellTarget::ControlModeEnum cmode, double newValue, double siFactorG, double siFactorL, double siFactorP) {
if (cmode == WellTarget::ORAT){
void Well2::WellProductionProperties::handleWELTARG(Well2::WELTARGCMode cmode, double newValue, double siFactorG, double siFactorL, double siFactorP) {
if (cmode == WELTARGCMode::ORAT){
this->OilRate.assert_numeric("Can not combine UDA and WELTARG");
this->OilRate.reset( newValue * siFactorL );
}
else if (cmode == WellTarget::WRAT){
else if (cmode == WELTARGCMode::WRAT){
this->WaterRate.assert_numeric("Can not combine UDA and WELTARG");
this->WaterRate.reset( newValue * siFactorL );
}
else if (cmode == WellTarget::GRAT){
else if (cmode == WELTARGCMode::GRAT){
this->GasRate.assert_numeric("Can not combine UDA and WELTARG");
this->GasRate.reset( newValue * siFactorG );
}
else if (cmode == WellTarget::LRAT){
else if (cmode == WELTARGCMode::LRAT){
this->LiquidRate.assert_numeric("Can not combine UDA and WELTARG");
this->LiquidRate.reset( newValue * siFactorL );
}
else if (cmode == WellTarget::RESV){
else if (cmode == WELTARGCMode::RESV){
this->ResVRate.assert_numeric("Can not combine UDA and WELTARG");
this->ResVRate.reset( newValue * siFactorL );
}
else if (cmode == WellTarget::BHP){
else if (cmode == WELTARGCMode::BHP){
this->BHPLimit.assert_numeric("Can not combine UDA and WELTARG");
this->BHPLimit.reset( newValue * siFactorP );
}
else if (cmode == WellTarget::THP){
else if (cmode == WELTARGCMode::THP){
this->THPLimit.assert_numeric("Can not combine UDA and WELTARG");
this->THPLimit.reset(newValue * siFactorP);
}
else if (cmode == WellTarget::VFP)
else if (cmode == WELTARGCMode::VFP)
this->VFPTableNumber = static_cast<int> (newValue);
else if (cmode != WellTarget::GUID)
else if (cmode != WELTARGCMode::GUID)
throw std::invalid_argument("Invalid keyword (MODE) supplied");
}
bool WellProductionProperties::operator==(const WellProductionProperties& other) const {
bool Well2::WellProductionProperties::operator==(const Well2::WellProductionProperties& other) const {
return OilRate == other.OilRate
&& WaterRate == other.WaterRate
&& GasRate == other.GasRate
@@ -231,14 +228,14 @@ namespace Opm {
}
bool WellProductionProperties::operator!=(const WellProductionProperties& other) const {
bool Well2::WellProductionProperties::operator!=(const Well2::WellProductionProperties& other) const {
return !(*this == other);
}
std::ostream& operator<<( std::ostream& stream, const WellProductionProperties& wp ) {
std::ostream& operator<<( std::ostream& stream, const Well2::WellProductionProperties& wp ) {
return stream
<< "WellProductionProperties { "
<< "Well2::WellProductionProperties { "
<< "oil rate: " << wp.OilRate << ", "
<< "water rate: " << wp.WaterRate << ", "
<< "gas rate: " << wp.GasRate << ", "
@@ -250,36 +247,35 @@ namespace Opm {
<< "THPH: " << wp.THPH << ", "
<< "VFP table: " << wp.VFPTableNumber << ", "
<< "ALQ: " << wp.ALQValue << ", "
<< "WHISTCTL: " << wp.whistctl_cmode << ", "
<< "WHISTCTL: " << Well2::ProducerCMode2String(wp.whistctl_cmode) << ", "
<< "prediction: " << wp.predictionMode << " }";
}
bool WellProductionProperties::effectiveHistoryProductionControl(const WellProducer::ControlModeEnum cmode) {
bool Well2::WellProductionProperties::effectiveHistoryProductionControl(const Well2::ProducerCMode cmode) {
// Note, not handling CRAT for now
namespace wp = WellProducer;
return ( (cmode == wp::LRAT || cmode == wp::RESV || cmode == wp::ORAT ||
cmode == wp::WRAT || cmode == wp::GRAT || cmode == wp::BHP) );
return ( (cmode == ProducerCMode::LRAT || cmode == ProducerCMode::RESV || cmode == ProducerCMode::ORAT ||
cmode == ProducerCMode::WRAT || cmode == ProducerCMode::GRAT || cmode == ProducerCMode::BHP) );
}
void WellProductionProperties::resetDefaultBHPLimit() {
void Well2::WellProductionProperties::resetDefaultBHPLimit() {
BHPLimit = UDAValue( 1. * unit::atm );
}
void WellProductionProperties::clearControls() {
void Well2::WellProductionProperties::clearControls() {
m_productionControls = 0;
}
void WellProductionProperties::setBHPLimit(const double limit) {
void Well2::WellProductionProperties::setBHPLimit(const double limit) {
BHPLimit = UDAValue( limit );
}
double WellProductionProperties::getBHPLimit() const {
double Well2::WellProductionProperties::getBHPLimit() const {
return BHPLimit.get<double>();
}
ProductionControls WellProductionProperties::controls(const SummaryState& st, double udq_undefined) const {
ProductionControls controls(this->m_productionControls);
Well2::ProductionControls Well2::WellProductionProperties::controls(const SummaryState& st, double udq_undefined) const {
Well2::ProductionControls controls(this->m_productionControls);
controls.oil_rate = UDA::eval_well_uda(this->OilRate, this->name, st, udq_undefined);
controls.water_rate = UDA::eval_well_uda(this->WaterRate, this->name, st, udq_undefined);
@@ -298,7 +294,7 @@ namespace Opm {
return controls;
}
bool WellProductionProperties::updateUDQActive(const UDQConfig& udq_config, UDQActive& active) const {
bool Well2::WellProductionProperties::updateUDQActive(const UDQConfig& udq_config, UDQActive& active) const {
int update_count = 0;
update_count += active.update(udq_config, this->OilRate, this->name, UDAControl::WCONPROD_ORAT);

View File

@@ -119,7 +119,7 @@ namespace Opm {
throw std::runtime_error("No well named " + well.name + " is found in wells_ecl.");
// if the well is SHUT, we do not consider to test it
if (well_ecl->getStatus() != WellCommon::OPEN)
if (well_ecl->getStatus() != Well2::Status::OPEN)
continue;
if (well.closed && config.has(well.name, well.reason)) {

View File

@@ -22,27 +22,27 @@
#include <stdexcept>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp>
#include "injection.hpp"
namespace Opm {
namespace injection {
double rateToSI(double rawRate, WellInjector::TypeEnum wellType, const Opm::UnitSystem &unitSystem) {
double rateToSI(double rawRate, Well2::InjectorType wellType, const Opm::UnitSystem &unitSystem) {
switch (wellType) {
case WellInjector::MULTI:
case Well2::InjectorType::MULTI:
// multi-phase controlled injectors are a really funny
// construct in Eclipse: the quantity controlled for is
// not physically meaningful, i.e. Eclipse adds up
// MCFT/day and STB/day.
throw std::logic_error("There is no generic way to handle multi-phase injectors at this level!");
case WellInjector::OIL:
case WellInjector::WATER:
case Well2::InjectorType::OIL:
case Well2::InjectorType::WATER:
return unitSystem.to_si( UnitSystem::measure::liquid_surface_rate, rawRate );
case WellInjector::GAS:
case Well2::InjectorType::GAS:
return unitSystem.to_si( UnitSystem::measure::gas_surface_rate, rawRate );
default:

View File

@@ -20,13 +20,13 @@
#ifndef INJECTION_HPP
#define INJECTION_HPP
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp>
namespace Opm {
namespace injection {
double rateToSI(double rawRate, WellInjector::TypeEnum wellType, const Opm::UnitSystem &unitSystem);
double rateToSI(double rawRate, Well2::InjectorType wellType, const Opm::UnitSystem &unitSystem);
double rateToSI(double rawRate, Phase wellPhase, const Opm::UnitSystem& unitSystem);
}

View File

@@ -46,7 +46,7 @@ namespace UDA {
}
double eval_well_uda_rate(const UDAValue& value, const std::string& well, const SummaryState& st, double udq_default, WellInjector::TypeEnum wellType, const UnitSystem& unitSystem) {
double eval_well_uda_rate(const UDAValue& value, const std::string& well, const SummaryState& st, double udq_default, Well2::InjectorType wellType, const UnitSystem& unitSystem) {
double raw_rate = eval_well_uda(value, well, st, udq_default);
return injection::rateToSI(raw_rate, wellType, unitSystem);
}

View File

@@ -22,7 +22,7 @@
#include <string>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp>
namespace Opm {
class UDAvalue;
@@ -32,7 +32,7 @@ class UnitSystem;
namespace UDA {
double eval_well_uda(const UDAValue& value, const std::string& name, const SummaryState& st, double udq_undefined);
double eval_well_uda_rate(const UDAValue& value, const std::string& name, const SummaryState& st, double udq_undefined, WellInjector::TypeEnum wellType, const UnitSystem& unitSystem);
double eval_well_uda_rate(const UDAValue& value, const std::string& name, const SummaryState& st, double udq_undefined, Well2::InjectorType wellType, const UnitSystem& unitSystem);
double eval_group_uda(const UDAValue& value, const std::string& name, const SummaryState& st, double udq_undefined);
double eval_group_uda_rate(const UDAValue& value, const std::string& name, const SummaryState& st, double udq_undefined, Phase phase, const UnitSystem& unitSystem);

View File

@@ -36,7 +36,6 @@
#include <opm/parser/eclipse/Parser/ParserKeywords/A.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/S.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp> // Phase::PhaseEnum
#include <opm/parser/eclipse/EclipseState/Tables/EnkrvdTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/EnptvdTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/GasvisctTable.hpp>

View File

@@ -142,14 +142,14 @@ BOOST_AUTO_TEST_CASE(UDQ_SORTA_EXAMPLE) {
{
const auto& w1 = td.schedule.getWell2("P1", 1);
const auto& w4 = td.schedule.getWell2("P4", 1);
BOOST_CHECK_EQUAL(w1.getStatus(), WellCommon::StatusEnum::OPEN );
BOOST_CHECK_EQUAL(w4.getStatus(), WellCommon::StatusEnum::OPEN );
BOOST_CHECK(w1.getStatus() == Well2::Status::OPEN );
BOOST_CHECK(w4.getStatus() == Well2::Status::OPEN );
}
{
const auto& w1 = td.schedule.getWell2atEnd("P1");
const auto& w4 = td.schedule.getWell2atEnd("P4");
BOOST_CHECK_EQUAL(w1.getStatus(), WellCommon::StatusEnum::OPEN );
BOOST_CHECK_EQUAL(w4.getStatus(), WellCommon::StatusEnum::SHUT );
BOOST_CHECK(w1.getStatus() == Well2::Status::OPEN );
BOOST_CHECK(w4.getStatus() == Well2::Status::SHUT );
}
test_work_area_free(work_area);
@@ -182,10 +182,10 @@ BOOST_AUTO_TEST_CASE(WELL_CLOSE_EXAMPLE) {
const auto& w3 = td.schedule.getWell2("P3", 15);
const auto& w4 = td.schedule.getWell2("P4", 15);
BOOST_CHECK_EQUAL(w1.getStatus(), WellCommon::StatusEnum::OPEN );
BOOST_CHECK_EQUAL(w2.getStatus(), WellCommon::StatusEnum::OPEN );
BOOST_CHECK_EQUAL(w3.getStatus(), WellCommon::StatusEnum::OPEN );
BOOST_CHECK_EQUAL(w4.getStatus(), WellCommon::StatusEnum::OPEN );
BOOST_CHECK(w1.getStatus() == Well2::Status::OPEN );
BOOST_CHECK(w2.getStatus() == Well2::Status::OPEN );
BOOST_CHECK(w3.getStatus() == Well2::Status::OPEN );
BOOST_CHECK(w4.getStatus() == Well2::Status::OPEN );
}
@@ -193,20 +193,20 @@ BOOST_AUTO_TEST_CASE(WELL_CLOSE_EXAMPLE) {
{
const auto& w1 = td.schedule.getWell2("P1", 15);
const auto& w3 = td.schedule.getWell2("P3", 15);
BOOST_CHECK_EQUAL(w1.getStatus(), WellCommon::StatusEnum::OPEN );
BOOST_CHECK_EQUAL(w3.getStatus(), WellCommon::StatusEnum::OPEN );
BOOST_CHECK(w1.getStatus() == Well2::Status::OPEN );
BOOST_CHECK(w3.getStatus() == Well2::Status::OPEN );
}
{
const auto& w2_5 = td.schedule.getWell2("P2", 5);
const auto& w2_6 = td.schedule.getWell2("P2", 6);
BOOST_CHECK_EQUAL(w2_5.getStatus(), WellCommon::StatusEnum::OPEN );
BOOST_CHECK_EQUAL(w2_6.getStatus(), WellCommon::StatusEnum::SHUT );
BOOST_CHECK(w2_5.getStatus() == Well2::Status::OPEN );
BOOST_CHECK(w2_6.getStatus() == Well2::Status::SHUT );
}
{
const auto& w4_10 = td.schedule.getWell2("P4", 10);
const auto& w4_11 = td.schedule.getWell2("P4", 11);
BOOST_CHECK_EQUAL(w4_10.getStatus(), WellCommon::StatusEnum::OPEN );
BOOST_CHECK_EQUAL(w4_11.getStatus(), WellCommon::StatusEnum::SHUT );
BOOST_CHECK(w4_10.getStatus() == Well2::Status::OPEN );
BOOST_CHECK(w4_11.getStatus() == Well2::Status::SHUT );
}
test_work_area_free(work_area);

View File

@@ -34,7 +34,6 @@
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Eclipse3DProperties.hpp>
@@ -67,10 +66,10 @@ BOOST_AUTO_TEST_CASE(CreateWellConnectionsOK) {
BOOST_AUTO_TEST_CASE(AddCompletionSizeCorrect) {
Opm::WellCompletion::DirectionEnum dir = Opm::WellCompletion::DirectionEnum::Z;
auto dir = Opm::Connection::Direction::Z;
Opm::WellConnections completionSet(1,1);
Opm::Connection completion1( 10,10,10, 1, 0.0, Opm::WellCompletion::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true);
Opm::Connection completion2( 10,10,11, 1, 0.0, Opm::WellCompletion::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true);
Opm::Connection completion1( 10,10,10, 1, 0.0, Opm::Connection::State::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true);
Opm::Connection completion2( 10,10,11, 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true);
completionSet.add( completion1 );
BOOST_CHECK_EQUAL( 1U , completionSet.size() );
@@ -82,9 +81,9 @@ BOOST_AUTO_TEST_CASE(AddCompletionSizeCorrect) {
BOOST_AUTO_TEST_CASE(WellConnectionsGetOutOfRangeThrows) {
Opm::WellCompletion::DirectionEnum dir = Opm::WellCompletion::DirectionEnum::Z;
Opm::Connection completion1( 10,10,10, 1, 0.0, Opm::WellCompletion::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
Opm::Connection completion2( 10,10,11, 1, 0.0, Opm::WellCompletion::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
auto dir = Opm::Connection::Direction::Z;
Opm::Connection completion1( 10,10,10, 1, 0.0, Opm::Connection::State::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
Opm::Connection completion2( 10,10,11, 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
Opm::WellConnections completionSet(1,1);
completionSet.add( completion1 );
BOOST_CHECK_EQUAL( 1U , completionSet.size() );
@@ -100,12 +99,12 @@ BOOST_AUTO_TEST_CASE(WellConnectionsGetOutOfRangeThrows) {
BOOST_AUTO_TEST_CASE(AddCompletionCopy) {
Opm::WellConnections completionSet(10,10);
Opm::WellCompletion::DirectionEnum dir = Opm::WellCompletion::DirectionEnum::Z;
Opm::WellConnections completionSet(10,10);
auto dir = Opm::Connection::Direction::Z;
Opm::Connection completion1( 10,10,10, 1, 0.0, Opm::WellCompletion::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
Opm::Connection completion2( 10,10,11, 1, 0.0, Opm::WellCompletion::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
Opm::Connection completion3( 10,10,12, 1, 0.0, Opm::WellCompletion::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
Opm::Connection completion1( 10,10,10, 1, 0.0, Opm::Connection::State::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
Opm::Connection completion2( 10,10,11, 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
Opm::Connection completion3( 10,10,12, 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
completionSet.add( completion1 );
completionSet.add( completion2 );
@@ -123,11 +122,11 @@ BOOST_AUTO_TEST_CASE(AddCompletionCopy) {
BOOST_AUTO_TEST_CASE(ActiveCompletions) {
Opm::EclipseGrid grid(10,20,20);
Opm::WellCompletion::DirectionEnum dir = Opm::WellCompletion::DirectionEnum::Z;
auto dir = Opm::Connection::Direction::Z;
Opm::WellConnections completions(10,10);
Opm::Connection completion1( 0,0,0, 1, 0.0, Opm::WellCompletion::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
Opm::Connection completion2( 0,0,1, 1, 0.0, Opm::WellCompletion::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
Opm::Connection completion3( 0,0,2, 1, 0.0, Opm::WellCompletion::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
Opm::Connection completion1( 0,0,0, 1, 0.0, Opm::Connection::State::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
Opm::Connection completion2( 0,0,1, 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
Opm::Connection completion3( 0,0,2, 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
completions.add( completion1 );
completions.add( completion2 );

View File

@@ -28,7 +28,6 @@ along with OPM. If not, see <http://www.gnu.org/licenses/>.
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp>
#include <opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Eclipse3DProperties.hpp>

View File

@@ -75,8 +75,8 @@ BOOST_AUTO_TEST_CASE(CreateGroup_SetInjectorProducer_CorrectStatusSet) {
BOOST_AUTO_TEST_CASE(ControlModeOK) {
Opm::Group2 group("G1" , 1, 0, 0, UnitSystem::newMETRIC());
Opm::SummaryState st;
const auto& prod = group.productionControls(st);
BOOST_CHECK_EQUAL( Opm::GroupInjection::NONE , prod.cmode);
const auto& inj = group.injectionControls(st);
BOOST_CHECK( Opm::Group2::InjectionCMode::NONE == inj.cmode);
}
@@ -183,12 +183,12 @@ BOOST_AUTO_TEST_CASE(createDeckWithWGRUPCONandWCONPROD) {
Runspec runspec (deck );
Opm::Schedule schedule(deck, grid, eclipseProperties, runspec);
const auto& currentWell = schedule.getWell2("B-37T2", 0);
const Opm::WellProductionProperties& wellProductionProperties = currentWell.getProductionProperties();
BOOST_CHECK_EQUAL(wellProductionProperties.controlMode, Opm::WellProducer::ControlModeEnum::GRUP);
const Opm::Well2::WellProductionProperties& wellProductionProperties = currentWell.getProductionProperties();
BOOST_CHECK(wellProductionProperties.controlMode == Opm::Well2::ProducerCMode::GRUP);
BOOST_CHECK_EQUAL(currentWell.isAvailableForGroupControl(), true);
BOOST_CHECK_EQUAL(currentWell.getGuideRate(), 30);
BOOST_CHECK_EQUAL(currentWell.getGuideRatePhase(), Opm::GuideRate::OIL);
BOOST_CHECK(currentWell.getGuideRatePhase() == Opm::Well2::GuideRateTarget::OIL);
BOOST_CHECK_EQUAL(currentWell.getGuideRateScalingFactor(), 1.0);
@@ -292,16 +292,16 @@ BOOST_AUTO_TEST_CASE(createDeckWithGCONPROD) {
auto ctrl1 = group1.productionControls(st);
auto ctrl2 = group2.productionControls(st);
BOOST_CHECK_EQUAL(ctrl1.exceed_action, GroupProductionExceedLimit::RATE);
BOOST_CHECK_EQUAL(ctrl2.exceed_action, GroupProductionExceedLimit::CON);
BOOST_CHECK(ctrl1.exceed_action == Group2::ExceedAction::RATE);
BOOST_CHECK(ctrl2.exceed_action == Group2::ExceedAction::CON);
}
BOOST_AUTO_TEST_CASE(TESTGuideRateModel) {
Opm::GuideRateModel grc_default;
BOOST_CHECK_THROW(Opm::GuideRateModel(0.0,GuideRateTarget::NONE, -5,0,0,0,0,0,true,1,true), std::invalid_argument);
BOOST_CHECK_THROW(Opm::GuideRateModel(0.0,GuideRateModel::Target::NONE, -5,0,0,0,0,0,true,1,true), std::invalid_argument);
BOOST_CHECK_THROW(grc_default.eval(1,0.50,0.50), std::invalid_argument);
Opm::GuideRateModel grc_delay(10, GuideRateTarget::NONE, 1,1,0,0,0,0,true,1,true);
Opm::GuideRateModel grc_delay(10, GuideRateModel::Target::NONE, 1,1,0,0,0,0,true,1,true);
BOOST_CHECK_NO_THROW(grc_delay.eval(1.0, 0.5, 0.5));
}

View File

@@ -34,24 +34,23 @@
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/updatingConnectionsWithSegments.hpp>
BOOST_AUTO_TEST_CASE(MultisegmentWellTest) {
Opm::WellCompletion::DirectionEnum dir = Opm::WellCompletion::DirectionEnum::Z;
auto dir = Opm::Connection::Direction::Z;
Opm::WellConnections connection_set(10,10);
Opm::EclipseGrid grid(20,20,20);
connection_set.add(Opm::Connection( 19, 0, 0, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 2, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 0, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 2, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 18, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 17, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 16, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 15, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 18, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::Connection::Direction::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 17, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::Connection::Direction::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 16, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::Connection::Direction::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 15, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::Connection::Direction::X,0, 0., 0., true) );
BOOST_CHECK_EQUAL( 7U , connection_set.size() );
@@ -129,17 +128,17 @@ BOOST_AUTO_TEST_CASE(MultisegmentWellTest) {
}
BOOST_AUTO_TEST_CASE(WrongDistanceCOMPSEGS) {
Opm::WellCompletion::DirectionEnum dir = Opm::WellCompletion::DirectionEnum::Z;
auto dir = Opm::Connection::Direction::Z;
Opm::WellConnections connection_set(10,10);
Opm::EclipseGrid grid(20,20,20);
connection_set.add(Opm::Connection( 19, 0, 0, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 2, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 0, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 2, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 18, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 17, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 16, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 15, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 18, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::Connection::Direction::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 17, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::Connection::Direction::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 16, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::Connection::Direction::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 15, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::Connection::Direction::X,0, 0., 0., true) );
BOOST_CHECK_EQUAL( 7U , connection_set.size() );
@@ -186,17 +185,17 @@ BOOST_AUTO_TEST_CASE(WrongDistanceCOMPSEGS) {
}
BOOST_AUTO_TEST_CASE(NegativeDepthCOMPSEGS) {
Opm::WellCompletion::DirectionEnum dir = Opm::WellCompletion::DirectionEnum::Z;
auto dir = Opm::Connection::Direction::Z;
Opm::WellConnections connection_set(10,10);
Opm::EclipseGrid grid(20,20,20);
connection_set.add(Opm::Connection( 19, 0, 0, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 2, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 0, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 2, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 18, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 17, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 16, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 15, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 18, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::Connection::Direction::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 17, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::Connection::Direction::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 16, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::Connection::Direction::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 15, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::Connection::Direction::X,0, 0., 0., true) );
BOOST_CHECK_EQUAL( 7U , connection_set.size() );

File diff suppressed because it is too large Load Diff

View File

@@ -27,7 +27,6 @@
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp>
@@ -77,17 +76,17 @@ BOOST_AUTO_TEST_CASE(WTEST_STATE2) {
const UnitSystem us{};
std::vector<Well2> wells;
wells.emplace_back("WELL_NAME", "A", 0, 0, 1, 1, 200., Phase::OIL, WellProducer::NONE, WellCompletion::TRACK, us, 0.);
wells.emplace_back("WELL_NAME", "A", 0, 0, 1, 1, 200., Phase::OIL, Well2::ProducerCMode::NONE, Connection::Order::TRACK, us, 0.);
{
wells[0].updateStatus(WellCommon::SHUT);
auto shut_wells = st.updateWells(wc, wells, 5000);
BOOST_CHECK_EQUAL(shut_wells.size(), 0);
wells[0].updateStatus(Well2::Status::SHUT);
auto shut_wells = st.updateWells(wc, wells, 5000);
BOOST_CHECK_EQUAL(shut_wells.size(), 0);
}
{
wells[0].updateStatus(WellCommon::OPEN);
auto shut_wells = st.updateWells(wc, wells, 5000);
BOOST_CHECK_EQUAL( shut_wells.size(), 1);
wells[0].updateStatus(Well2::Status::OPEN);
auto shut_wells = st.updateWells(wc, wells, 5000);
BOOST_CHECK_EQUAL( shut_wells.size(), 1);
}
}
@@ -111,17 +110,17 @@ BOOST_AUTO_TEST_CASE(WTEST_STATE) {
const UnitSystem us{};
std::vector<Well2> wells;
wells.emplace_back("WELL_NAME", "A", 0, 0, 1, 1, 200., Phase::OIL, WellProducer::NONE, WellCompletion::TRACK, us, 0.);
wells.emplace_back("WELLX", "A", 0, 0, 2, 2, 200., Phase::OIL, WellProducer::NONE, WellCompletion::TRACK, us, 0.);
wells.emplace_back("WELL_NAME", "A", 0, 0, 1, 1, 200., Phase::OIL, Well2::ProducerCMode::NONE, Connection::Order::TRACK, us, 0.);
wells.emplace_back("WELLX", "A", 0, 0, 2, 2, 200., Phase::OIL, Well2::ProducerCMode::NONE, Connection::Order::TRACK, us, 0.);
WellTestConfig wc;
{
wells[0].updateStatus(WellCommon::SHUT);
wells[0].updateStatus(Well2::Status::SHUT);
auto shut_wells = st.updateWells(wc, wells, 110. * day);
BOOST_CHECK_EQUAL(shut_wells.size(), 0);
}
{
wells[0].updateStatus(WellCommon::OPEN);
wells[0].updateStatus(Well2::Status::OPEN);
auto shut_wells = st.updateWells(wc, wells, 110. * day);
BOOST_CHECK_EQUAL(shut_wells.size(), 0);
}
@@ -152,10 +151,10 @@ BOOST_AUTO_TEST_CASE(WTEST_STATE) {
wc.add_well("WELL_NAME", WellTestConfig::Reason::PHYSICAL, 1000. * day, 3, 0, 5);
wells[0].updateStatus(WellCommon::SHUT);
wells[0].updateStatus(Well2::Status::SHUT);
BOOST_CHECK_EQUAL( st.updateWells(wc, wells, 4100. * day).size(), 0);
wells[0].updateStatus(WellCommon::OPEN);
wells[0].updateStatus(Well2::Status::OPEN);
BOOST_CHECK_EQUAL( st.updateWells(wc, wells, 4100. * day).size(), 1);
BOOST_CHECK_EQUAL( st.updateWells(wc, wells, 5200. * day).size(), 1);
@@ -182,10 +181,10 @@ BOOST_AUTO_TEST_CASE(WTEST_STATE_COMPLETIONS) {
const UnitSystem us{};
std::vector<Well2> wells;
wells.emplace_back("WELL_NAME", "A", 0, 0, 1, 1, 200., Phase::OIL, WellProducer::NONE, WellCompletion::TRACK, us, 0.);
wells[0].updateStatus(WellCommon::OPEN);
wells.emplace_back("WELLX", "A", 0, 0, 2, 2, 200., Phase::OIL, WellProducer::NONE, WellCompletion::TRACK, us, 0.);
wells[1].updateStatus(WellCommon::OPEN);
wells.emplace_back("WELL_NAME", "A", 0, 0, 1, 1, 200., Phase::OIL, Well2::ProducerCMode::NONE, Connection::Order::TRACK, us, 0.);
wells[0].updateStatus(Well2::Status::OPEN);
wells.emplace_back("WELLX", "A", 0, 0, 2, 2, 200., Phase::OIL, Well2::ProducerCMode::NONE, Connection::Order::TRACK, us, 0.);
wells[1].updateStatus(Well2::Status::OPEN);
auto closed_completions = st.updateWells(wc, wells, 5000);
BOOST_CHECK_EQUAL( closed_completions.size(), 0);

View File

@@ -36,7 +36,6 @@
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQActive.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
@@ -191,7 +190,7 @@ BOOST_AUTO_TEST_CASE(WellCOMPDATtestINPUT) {
}
BOOST_AUTO_TEST_CASE(NewWellZeroCompletions) {
Opm::Well2 well("WELL1", "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0);
Opm::Well2 well("WELL1", "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0);
BOOST_CHECK_EQUAL( 0U , well.getConnections( ).size() );
}
@@ -200,7 +199,7 @@ BOOST_AUTO_TEST_CASE(isProducerCorrectlySet) {
// HACK: This test checks correctly setting of isProducer/isInjector. This property depends on which of
// WellProductionProperties/WellInjectionProperties is set last, independent of actual values.
{
Opm::Well2 well("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0);
Opm::Well2 well("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0);
/* 1: Well is created as producer */
@@ -208,7 +207,7 @@ BOOST_AUTO_TEST_CASE(isProducerCorrectlySet) {
BOOST_CHECK_EQUAL( true , well.isProducer());
/* Set a surface injection rate => Well becomes an Injector */
auto injectionProps1 = std::make_shared<Opm::WellInjectionProperties>(well.getInjectionProperties());
auto injectionProps1 = std::make_shared<Opm::Well2::WellInjectionProperties>(well.getInjectionProperties());
injectionProps1->surfaceInjectionRate.reset(100);
well.updateInjection(injectionProps1);
BOOST_CHECK_EQUAL( true , well.isInjector());
@@ -218,10 +217,10 @@ BOOST_AUTO_TEST_CASE(isProducerCorrectlySet) {
{
Opm::Well2 well("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0);
Opm::Well2 well("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0);
/* Set a reservoir injection rate => Well becomes an Injector */
auto injectionProps2 = std::make_shared<Opm::WellInjectionProperties>(well.getInjectionProperties());
auto injectionProps2 = std::make_shared<Opm::Well2::WellInjectionProperties>(well.getInjectionProperties());
injectionProps2->reservoirInjectionRate.reset(200);
well.updateInjection(injectionProps2);
BOOST_CHECK_EQUAL( false , well.isProducer());
@@ -229,13 +228,13 @@ BOOST_AUTO_TEST_CASE(isProducerCorrectlySet) {
}
{
Opm::Well2 well("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0);
Opm::Well2 well("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0);
/* Set rates => Well becomes a producer; injection rate should be set to 0. */
auto injectionProps3 = std::make_shared<Opm::WellInjectionProperties>(well.getInjectionProperties());
auto injectionProps3 = std::make_shared<Opm::Well2::WellInjectionProperties>(well.getInjectionProperties());
well.updateInjection(injectionProps3);
auto properties = std::make_shared<Opm::WellProductionProperties>( well.getProductionProperties() );
auto properties = std::make_shared<Opm::Well2::WellProductionProperties>( well.getProductionProperties() );
properties->OilRate.reset(100);
properties->GasRate.reset(200);
properties->WaterRate.reset(300);
@@ -252,7 +251,7 @@ BOOST_AUTO_TEST_CASE(isProducerCorrectlySet) {
}
BOOST_AUTO_TEST_CASE(GroupnameCorretlySet) {
Opm::Well2 well("WELL1" , "G1", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0);
Opm::Well2 well("WELL1" , "G1", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0);
BOOST_CHECK_EQUAL("G1" , well.groupName());
well.updateGroup( "GROUP2");
@@ -261,7 +260,7 @@ BOOST_AUTO_TEST_CASE(GroupnameCorretlySet) {
BOOST_AUTO_TEST_CASE(addWELSPECS_setData_dataSet) {
Opm::Well2 well("WELL1", "GROUP", 0, 1, 23, 42, 2334.32, Opm::Phase::WATER, WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0);
Opm::Well2 well("WELL1", "GROUP", 0, 1, 23, 42, 2334.32, Opm::Phase::WATER, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0);
BOOST_CHECK_EQUAL(23, well.getHeadI());
BOOST_CHECK_EQUAL(42, well.getHeadJ());
@@ -271,34 +270,34 @@ BOOST_AUTO_TEST_CASE(addWELSPECS_setData_dataSet) {
BOOST_AUTO_TEST_CASE(XHPLimitDefault) {
Opm::Well2 well("WELL1", "GROUP", 0, 1, 23, 42, 2334.32, Opm::Phase::WATER, WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0);
Opm::Well2 well("WELL1", "GROUP", 0, 1, 23, 42, 2334.32, Opm::Phase::WATER, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0);
auto productionProps = std::make_shared<Opm::WellProductionProperties>(well.getProductionProperties());
auto productionProps = std::make_shared<Opm::Well2::WellProductionProperties>(well.getProductionProperties());
productionProps->BHPLimit.reset(100);
productionProps->addProductionControl(Opm::WellProducer::BHP);
productionProps->addProductionControl(Opm::Well2::ProducerCMode::BHP);
well.updateProduction(productionProps);
BOOST_CHECK_EQUAL( 100 , well.getProductionProperties().BHPLimit.get<double>());
BOOST_CHECK_EQUAL( true, well.getProductionProperties().hasProductionControl( Opm::WellProducer::BHP ));
BOOST_CHECK_EQUAL( true, well.getProductionProperties().hasProductionControl( Opm::Well2::ProducerCMode::BHP ));
auto injProps = std::make_shared<Opm::WellInjectionProperties>(well.getInjectionProperties());
auto injProps = std::make_shared<Opm::Well2::WellInjectionProperties>(well.getInjectionProperties());
injProps->THPLimit.reset(200);
well.updateInjection(injProps);
BOOST_CHECK_EQUAL( 200 , well.getInjectionProperties().THPLimit.get<double>());
BOOST_CHECK( !well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::THP ));
BOOST_CHECK( !well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::THP ));
}
BOOST_AUTO_TEST_CASE(InjectorType) {
Opm::Well2 well("WELL1", "GROUP", 0, 1, 23, 42, 2334.32, Opm::Phase::WATER, WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0);
Opm::Well2 well("WELL1", "GROUP", 0, 1, 23, 42, 2334.32, Opm::Phase::WATER, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0);
auto injectionProps = std::make_shared<Opm::WellInjectionProperties>(well.getInjectionProperties());
injectionProps->injectorType = Opm::WellInjector::WATER;
auto injectionProps = std::make_shared<Opm::Well2::WellInjectionProperties>(well.getInjectionProperties());
injectionProps->injectorType = Opm::Well2::InjectorType::WATER;
well.updateInjection(injectionProps);
// TODO: Should we test for something other than wate here, as long as
// the default value for InjectorType is WellInjector::WATER?
BOOST_CHECK_EQUAL( Opm::WellInjector::WATER , well.getInjectionProperties().injectorType);
BOOST_CHECK( Opm::Well2::InjectorType::WATER == well.getInjectionProperties().injectorType);
}
@@ -307,26 +306,26 @@ BOOST_AUTO_TEST_CASE(InjectorType) {
BOOST_AUTO_TEST_CASE(WellHaveProductionControlLimit) {
Opm::Well2 well("WELL1", "GROUP", 0, 1, 23, 42, 2334.32, Opm::Phase::WATER, WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0);
Opm::Well2 well("WELL1", "GROUP", 0, 1, 23, 42, 2334.32, Opm::Phase::WATER, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0);
BOOST_CHECK( !well.getProductionProperties().hasProductionControl( Opm::WellProducer::ORAT ));
BOOST_CHECK( !well.getProductionProperties().hasProductionControl( Opm::WellProducer::RESV ));
BOOST_CHECK( !well.getProductionProperties().hasProductionControl( Opm::Well2::ProducerCMode::ORAT ));
BOOST_CHECK( !well.getProductionProperties().hasProductionControl( Opm::Well2::ProducerCMode::RESV ));
auto properties1 = std::make_shared<Opm::WellProductionProperties>(well.getProductionProperties());
auto properties1 = std::make_shared<Opm::Well2::WellProductionProperties>(well.getProductionProperties());
properties1->OilRate.reset(100);
properties1->addProductionControl(Opm::WellProducer::ORAT);
properties1->addProductionControl(Opm::Well2::ProducerCMode::ORAT);
well.updateProduction(properties1);
BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::WellProducer::ORAT ));
BOOST_CHECK( !well.getProductionProperties().hasProductionControl( Opm::WellProducer::RESV ));
BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::Well2::ProducerCMode::ORAT ));
BOOST_CHECK( !well.getProductionProperties().hasProductionControl( Opm::Well2::ProducerCMode::RESV ));
auto properties2 = std::make_shared<Opm::WellProductionProperties>(well.getProductionProperties());
auto properties2 = std::make_shared<Opm::Well2::WellProductionProperties>(well.getProductionProperties());
properties2->ResVRate.reset( 100 );
properties2->addProductionControl(Opm::WellProducer::RESV);
properties2->addProductionControl(Opm::Well2::ProducerCMode::RESV);
well.updateProduction(properties2);
BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::WellProducer::RESV ));
BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::Well2::ProducerCMode::RESV ));
auto properties3 = std::make_shared<Opm::WellProductionProperties>(well.getProductionProperties());
auto properties3 = std::make_shared<Opm::Well2::WellProductionProperties>(well.getProductionProperties());
properties3->OilRate.reset(100);
properties3->WaterRate.reset(100);
properties3->GasRate.reset(100);
@@ -334,80 +333,80 @@ BOOST_AUTO_TEST_CASE(WellHaveProductionControlLimit) {
properties3->ResVRate.reset(100);
properties3->BHPLimit.reset(100);
properties3->THPLimit.reset(100);
properties3->addProductionControl(Opm::WellProducer::ORAT);
properties3->addProductionControl(Opm::WellProducer::LRAT);
properties3->addProductionControl(Opm::WellProducer::BHP);
properties3->addProductionControl(Opm::Well2::ProducerCMode::ORAT);
properties3->addProductionControl(Opm::Well2::ProducerCMode::LRAT);
properties3->addProductionControl(Opm::Well2::ProducerCMode::BHP);
well.updateProduction(properties3);
BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::WellProducer::ORAT ));
BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::WellProducer::LRAT ));
BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::WellProducer::BHP ));
BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::Well2::ProducerCMode::ORAT ));
BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::Well2::ProducerCMode::LRAT ));
BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::Well2::ProducerCMode::BHP ));
auto properties4 = std::make_shared<Opm::WellProductionProperties>(well.getProductionProperties());
properties4->dropProductionControl( Opm::WellProducer::LRAT );
auto properties4 = std::make_shared<Opm::Well2::WellProductionProperties>(well.getProductionProperties());
properties4->dropProductionControl( Opm::Well2::ProducerCMode::LRAT );
well.updateProduction(properties4);
BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::WellProducer::ORAT ));
BOOST_CHECK(!well.getProductionProperties().hasProductionControl( Opm::WellProducer::LRAT ));
BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::WellProducer::BHP ));
BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::Well2::ProducerCMode::ORAT ));
BOOST_CHECK(!well.getProductionProperties().hasProductionControl( Opm::Well2::ProducerCMode::LRAT ));
BOOST_CHECK( well.getProductionProperties().hasProductionControl( Opm::Well2::ProducerCMode::BHP ));
}
BOOST_AUTO_TEST_CASE(WellHaveInjectionControlLimit) {
Opm::Well2 well("WELL1", "GROUP", 0, 1, 23, 42, 2334.32, Opm::Phase::WATER, WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0);
Opm::Well2 well("WELL1", "GROUP", 0, 1, 23, 42, 2334.32, Opm::Phase::WATER, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0);
BOOST_CHECK( !well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::RATE ));
BOOST_CHECK( !well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::RESV ));
BOOST_CHECK( !well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::RATE ));
BOOST_CHECK( !well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::RESV ));
auto injProps1 = std::make_shared<Opm::WellInjectionProperties>(well.getInjectionProperties());
auto injProps1 = std::make_shared<Opm::Well2::WellInjectionProperties>(well.getInjectionProperties());
injProps1->surfaceInjectionRate.reset(100);
injProps1->addInjectionControl(Opm::WellInjector::RATE);
injProps1->addInjectionControl(Opm::Well2::InjectorCMode::RATE);
well.updateInjection(injProps1);
BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::RATE ));
BOOST_CHECK( !well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::RESV ));
BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::RATE ));
BOOST_CHECK( !well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::RESV ));
auto injProps2 = std::make_shared<Opm::WellInjectionProperties>(well.getInjectionProperties());
auto injProps2 = std::make_shared<Opm::Well2::WellInjectionProperties>(well.getInjectionProperties());
injProps2->reservoirInjectionRate.reset(100);
injProps2->addInjectionControl(Opm::WellInjector::RESV);
injProps2->addInjectionControl(Opm::Well2::InjectorCMode::RESV);
well.updateInjection(injProps2);
BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::RESV ));
BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::RESV ));
auto injProps3 = std::make_shared<Opm::WellInjectionProperties>(well.getInjectionProperties());
auto injProps3 = std::make_shared<Opm::Well2::WellInjectionProperties>(well.getInjectionProperties());
injProps3->BHPLimit.reset(100);
injProps3->addInjectionControl(Opm::WellInjector::BHP);
injProps3->addInjectionControl(Opm::Well2::InjectorCMode::BHP);
injProps3->THPLimit.reset(100);
injProps3->addInjectionControl(Opm::WellInjector::THP);
injProps3->addInjectionControl(Opm::Well2::InjectorCMode::THP);
well.updateInjection(injProps3);
BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::RATE ));
BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::RESV ));
BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::THP ));
BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::BHP ));
BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::RATE ));
BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::RESV ));
BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::THP ));
BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::BHP ));
auto injProps4 = std::make_shared<Opm::WellInjectionProperties>(well.getInjectionProperties());
injProps4->dropInjectionControl( Opm::WellInjector::RESV );
auto injProps4 = std::make_shared<Opm::Well2::WellInjectionProperties>(well.getInjectionProperties());
injProps4->dropInjectionControl( Opm::Well2::InjectorCMode::RESV );
well.updateInjection(injProps4);
BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::RATE ));
BOOST_CHECK( !well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::RESV ));
BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::THP ));
BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::WellInjector::BHP ));
BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::RATE ));
BOOST_CHECK( !well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::RESV ));
BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::THP ));
BOOST_CHECK( well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::BHP ));
}
/*********************************************************************/
BOOST_AUTO_TEST_CASE(WellGuideRatePhase_GuideRatePhaseSet) {
Opm::Well2 well("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0);
Opm::Well2 well("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0);
BOOST_CHECK_EQUAL(Opm::GuideRate::UNDEFINED, well.getGuideRatePhase());
BOOST_CHECK(Opm::Well2::GuideRateTarget::UNDEFINED == well.getGuideRatePhase());
BOOST_CHECK(well.updateWellGuideRate(true, 100, Opm::GuideRate::RAT, 66.0));
BOOST_CHECK_EQUAL(Opm::GuideRate::RAT, well.getGuideRatePhase());
BOOST_CHECK(well.updateWellGuideRate(true, 100, Opm::Well2::GuideRateTarget::RAT, 66.0));
BOOST_CHECK(Opm::Well2::GuideRateTarget::RAT == well.getGuideRatePhase());
BOOST_CHECK_EQUAL(100, well.getGuideRate());
BOOST_CHECK_EQUAL(66.0, well.getGuideRateScalingFactor());
}
BOOST_AUTO_TEST_CASE(WellEfficiencyFactorSet) {
Opm::Well2 well("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0);
Opm::Well2 well("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0);
BOOST_CHECK_EQUAL(1.0, well.getEfficiencyFactor());
BOOST_CHECK( well.updateEfficiencyFactor(0.9));
@@ -487,12 +486,12 @@ namespace {
}
Opm::WellProductionProperties properties(const std::string& input) {
Opm::Well2::WellProductionProperties properties(const std::string& input) {
Opm::Parser parser;
auto deck = parser.parseString(input);
const auto& record = deck.getKeyword("WCONHIST").getRecord(0);
Opm::WellProductionProperties hist("W");
Opm::Well2::WellProductionProperties hist("W");
hist.handleWCONHIST(record);
@@ -539,13 +538,13 @@ namespace {
}
Opm::WellProductionProperties properties(const std::string& input)
Opm::Well2::WellProductionProperties properties(const std::string& input)
{
Opm::Parser parser;
auto deck = parser.parseString(input);
const auto& kwd = deck.getKeyword("WCONPROD");
const auto& record = kwd.getRecord(0);
Opm::WellProductionProperties pred("W");
Opm::Well2::WellProductionProperties pred("W");
pred.handleWCONPROD("WELL", record);
return pred;
@@ -556,100 +555,100 @@ namespace {
BOOST_AUTO_TEST_CASE(WCH_All_Specified_BHP_Defaulted)
{
const Opm::WellProductionProperties& p =
const Opm::Well2::WellProductionProperties& p =
WCONHIST::properties(WCONHIST::all_specified());
BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::ORAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::WRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::GRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::LRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::RESV));
BOOST_CHECK(p.hasProductionControl(Opm::Well2::ProducerCMode::ORAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::WRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::GRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::LRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::RESV));
BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::ORAT);
BOOST_CHECK(p.controlMode == Opm::Well2::ProducerCMode::ORAT);
BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::BHP));
BOOST_CHECK(p.hasProductionControl(Opm::Well2::ProducerCMode::BHP));
BOOST_CHECK_EQUAL(p.BHPLimit.get<double>(), 101325.);
}
BOOST_AUTO_TEST_CASE(WCH_ORAT_Defaulted_BHP_Defaulted)
{
const Opm::WellProductionProperties& p =
const Opm::Well2::WellProductionProperties& p =
WCONHIST::properties(WCONHIST::orat_defaulted());
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::ORAT));
BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::WRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::GRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::LRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::RESV));
BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::WRAT);
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::ORAT));
BOOST_CHECK(p.hasProductionControl(Opm::Well2::ProducerCMode::WRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::GRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::LRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::RESV));
BOOST_CHECK(p.controlMode == Opm::Well2::ProducerCMode::WRAT);
BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::BHP));
BOOST_CHECK(p.hasProductionControl(Opm::Well2::ProducerCMode::BHP));
BOOST_CHECK_EQUAL(p.BHPLimit.get<double>(), 101325.);
}
BOOST_AUTO_TEST_CASE(WCH_OWRAT_Defaulted_BHP_Defaulted)
{
const Opm::WellProductionProperties& p =
const Opm::Well2::WellProductionProperties& p =
WCONHIST::properties(WCONHIST::owrat_defaulted());
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::ORAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::WRAT));
BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::GRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::LRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::RESV));
BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::GRAT);
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::ORAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::WRAT));
BOOST_CHECK(p.hasProductionControl(Opm::Well2::ProducerCMode::GRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::LRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::RESV));
BOOST_CHECK(p.controlMode == Opm::Well2::ProducerCMode::GRAT);
BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::BHP));
BOOST_CHECK(p.hasProductionControl(Opm::Well2::ProducerCMode::BHP));
BOOST_CHECK_EQUAL(p.BHPLimit.get<double>(), 101325.);
}
BOOST_AUTO_TEST_CASE(WCH_Rates_Defaulted_BHP_Defaulted)
{
const Opm::WellProductionProperties& p =
const Opm::Well2::WellProductionProperties& p =
WCONHIST::properties(WCONHIST::all_defaulted());
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::ORAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::WRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::GRAT));
BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::LRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::RESV));
BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::LRAT);
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::ORAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::WRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::GRAT));
BOOST_CHECK(p.hasProductionControl(Opm::Well2::ProducerCMode::LRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::RESV));
BOOST_CHECK(p.controlMode == Opm::Well2::ProducerCMode::LRAT);
BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::BHP));
BOOST_CHECK(p.hasProductionControl(Opm::Well2::ProducerCMode::BHP));
BOOST_CHECK_EQUAL(p.BHPLimit.get<double>(), 101325.);
}
BOOST_AUTO_TEST_CASE(WCH_Rates_Defaulted_BHP_Specified)
{
const Opm::WellProductionProperties& p =
const Opm::Well2::WellProductionProperties& p =
WCONHIST::properties(WCONHIST::all_defaulted_with_bhp());
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::ORAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::WRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::GRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::LRAT));
BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::RESV));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::ORAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::WRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::GRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::LRAT));
BOOST_CHECK(p.hasProductionControl(Opm::Well2::ProducerCMode::RESV));
BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::RESV);
BOOST_CHECK(p.controlMode == Opm::Well2::ProducerCMode::RESV);
BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::WellProducer::BHP));
BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::Well2::ProducerCMode::BHP));
BOOST_CHECK_EQUAL(p.BHPLimit.get<double>(), 101325.);
}
BOOST_AUTO_TEST_CASE(WCH_Rates_NON_Defaulted_VFP)
{
const Opm::WellProductionProperties& p =
const Opm::Well2::WellProductionProperties& p =
WCONHIST::properties(WCONHIST::all_defaulted_with_bhp_vfp_table());
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::ORAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::WRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::GRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::LRAT));
BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::RESV));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::ORAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::WRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::GRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::LRAT));
BOOST_CHECK(p.hasProductionControl(Opm::Well2::ProducerCMode::RESV));
BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::RESV);
BOOST_CHECK(p.controlMode == Opm::Well2::ProducerCMode::RESV);
BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::WellProducer::BHP));
BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::Well2::ProducerCMode::BHP));
BOOST_CHECK_EQUAL(p.VFPTableNumber, 3);
BOOST_CHECK_EQUAL(p.ALQValue, 10.);
BOOST_CHECK_EQUAL(p.BHPLimit.get<double>(), 101325.);
@@ -657,36 +656,36 @@ BOOST_AUTO_TEST_CASE(WCH_Rates_NON_Defaulted_VFP)
BOOST_AUTO_TEST_CASE(WCH_BHP_Specified)
{
const Opm::WellProductionProperties& p =
const Opm::Well2::WellProductionProperties& p =
WCONHIST::properties(WCONHIST::bhp_defaulted());
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::ORAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::WRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::GRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::LRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::RESV));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::ORAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::WRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::GRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::LRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::RESV));
BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::BHP);
BOOST_CHECK(p.controlMode == Opm::Well2::ProducerCMode::BHP);
BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::WellProducer::BHP));
BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::Well2::ProducerCMode::BHP));
BOOST_CHECK_EQUAL(p.BHPLimit.get<double>(), 5.e7); // 500 barsa
}
BOOST_AUTO_TEST_CASE(WCONPROD_ORAT_CMode)
{
const Opm::WellProductionProperties& p = WCONPROD::properties(WCONPROD::orat_CMODE_other_defaulted());
const Opm::Well2::WellProductionProperties& p = WCONPROD::properties(WCONPROD::orat_CMODE_other_defaulted());
BOOST_CHECK( p.hasProductionControl(Opm::WellProducer::ORAT));
BOOST_CHECK( p.hasProductionControl(Opm::WellProducer::WRAT));
BOOST_CHECK( p.hasProductionControl(Opm::WellProducer::GRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::LRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::RESV));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::THP));
BOOST_CHECK( p.hasProductionControl(Opm::Well2::ProducerCMode::ORAT));
BOOST_CHECK( p.hasProductionControl(Opm::Well2::ProducerCMode::WRAT));
BOOST_CHECK( p.hasProductionControl(Opm::Well2::ProducerCMode::GRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::LRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::RESV));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::THP));
BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::ORAT);
BOOST_CHECK(p.controlMode == Opm::Well2::ProducerCMode::ORAT);
BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::WellProducer::BHP));
BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::Well2::ProducerCMode::BHP));
BOOST_CHECK_EQUAL(p.VFPTableNumber, 0);
BOOST_CHECK_EQUAL(p.ALQValue, 0.);
@@ -694,19 +693,19 @@ BOOST_AUTO_TEST_CASE(WCONPROD_ORAT_CMode)
BOOST_AUTO_TEST_CASE(WCONPROD_THP_CMode)
{
const Opm::WellProductionProperties& p =
const Opm::Well2::WellProductionProperties& p =
WCONPROD::properties(WCONPROD::thp_CMODE());
BOOST_CHECK( p.hasProductionControl(Opm::WellProducer::ORAT));
BOOST_CHECK( p.hasProductionControl(Opm::WellProducer::WRAT));
BOOST_CHECK( p.hasProductionControl(Opm::WellProducer::GRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::LRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::RESV));
BOOST_CHECK( p.hasProductionControl(Opm::WellProducer::THP));
BOOST_CHECK( p.hasProductionControl(Opm::Well2::ProducerCMode::ORAT));
BOOST_CHECK( p.hasProductionControl(Opm::Well2::ProducerCMode::WRAT));
BOOST_CHECK( p.hasProductionControl(Opm::Well2::ProducerCMode::GRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::LRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::RESV));
BOOST_CHECK( p.hasProductionControl(Opm::Well2::ProducerCMode::THP));
BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::THP);
BOOST_CHECK(p.controlMode == Opm::Well2::ProducerCMode::THP);
BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::WellProducer::BHP));
BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::Well2::ProducerCMode::BHP));
BOOST_CHECK_EQUAL(p.VFPTableNumber, 8);
BOOST_CHECK_EQUAL(p.ALQValue, 13.);
@@ -716,19 +715,19 @@ BOOST_AUTO_TEST_CASE(WCONPROD_THP_CMode)
BOOST_AUTO_TEST_CASE(WCONPROD_BHP_CMode)
{
const Opm::WellProductionProperties& p =
const Opm::Well2::WellProductionProperties& p =
WCONPROD::properties(WCONPROD::bhp_CMODE());
BOOST_CHECK( p.hasProductionControl(Opm::WellProducer::ORAT));
BOOST_CHECK( p.hasProductionControl(Opm::WellProducer::WRAT));
BOOST_CHECK( p.hasProductionControl(Opm::WellProducer::GRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::LRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::WellProducer::RESV));
BOOST_CHECK( p.hasProductionControl(Opm::WellProducer::THP));
BOOST_CHECK( p.hasProductionControl(Opm::Well2::ProducerCMode::ORAT));
BOOST_CHECK( p.hasProductionControl(Opm::Well2::ProducerCMode::WRAT));
BOOST_CHECK( p.hasProductionControl(Opm::Well2::ProducerCMode::GRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::LRAT));
BOOST_CHECK( !p.hasProductionControl(Opm::Well2::ProducerCMode::RESV));
BOOST_CHECK( p.hasProductionControl(Opm::Well2::ProducerCMode::THP));
BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::BHP);
BOOST_CHECK(p.controlMode == Opm::Well2::ProducerCMode::BHP);
BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::WellProducer::BHP));
BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::Well2::ProducerCMode::BHP));
BOOST_CHECK_EQUAL(p.VFPTableNumber, 8);
BOOST_CHECK_EQUAL(p.ALQValue, 13.);
@@ -747,19 +746,19 @@ BOOST_AUTO_TEST_CASE(BHP_CMODE)
BOOST_AUTO_TEST_CASE(CMODE_DEFAULT) {
const Opm::WellProductionProperties Pproperties("W");
const Opm::WellInjectionProperties Iproperties("W");
const Opm::Well2::WellProductionProperties Pproperties("W");
const Opm::Well2::WellInjectionProperties Iproperties("W");
BOOST_CHECK_EQUAL( Pproperties.controlMode , Opm::WellProducer::CMODE_UNDEFINED );
BOOST_CHECK_EQUAL( Iproperties.controlMode , Opm::WellInjector::CMODE_UNDEFINED );
BOOST_CHECK( Pproperties.controlMode == Opm::Well2::ProducerCMode::CMODE_UNDEFINED );
BOOST_CHECK( Iproperties.controlMode == Opm::Well2::InjectorCMode::CMODE_UNDEFINED );
}
BOOST_AUTO_TEST_CASE(WELL_CONTROLS) {
Opm::Well2 well("WELL", "GROUP", 0, 0, 0, 0, 1000, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, Opm::WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0);
Opm::WellProductionProperties prod("OP1");
Opm::Well2 well("WELL", "GROUP", 0, 0, 0, 0, 1000, Opm::Phase::OIL, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Opm::Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0);
Opm::Well2::WellProductionProperties prod("OP1");
Opm::SummaryState st;
well.productionControls(st);
@@ -779,14 +778,14 @@ BOOST_AUTO_TEST_CASE(WELL_CONTROLS) {
BOOST_AUTO_TEST_CASE(ExtraAccessors) {
Opm::Well2 inj("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0);
Opm::Well2 prod("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, WellCompletion::DEPTH, UnitSystem::newMETRIC(), 0);
Opm::Well2 inj("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0);
Opm::Well2 prod("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0);
auto inj_props= std::make_shared<Opm::WellInjectionProperties>(inj.getInjectionProperties());
auto inj_props= std::make_shared<Opm::Well2::WellInjectionProperties>(inj.getInjectionProperties());
inj_props->VFPTableNumber = 100;
inj.updateInjection(inj_props);
auto prod_props = std::make_shared<Opm::WellProductionProperties>( prod.getProductionProperties() );
auto prod_props = std::make_shared<Opm::Well2::WellProductionProperties>( prod.getProductionProperties() );
prod_props->VFPTableNumber = 200;
prod.updateProduction(prod_props);

View File

@@ -465,19 +465,19 @@ BOOST_AUTO_TEST_CASE( MULTISEGMENT_ABS ) {
const double depth_top = rec1.getItem("DEPTH").get< double >(0);
const double length_top = rec1.getItem("LENGTH").get< double >(0);
const double volume_top = rec1.getItem("WELLBORE_VOLUME").get< double >(0);
const WellSegment::LengthDepthEnum length_depth_type = WellSegment::LengthDepthEnumFromString(rec1.getItem("INFO_TYPE").getTrimmedString(0));
const WellSegment::CompPressureDropEnum comp_pressure_drop = WellSegment::CompPressureDropEnumFromString(rec1.getItem("PRESSURE_COMPONENTS").getTrimmedString(0));
const WellSegment::MultiPhaseModelEnum multiphase_model = WellSegment::MultiPhaseModelEnumFromString(rec1.getItem("FLOW_MODEL").getTrimmedString(0));
const WellSegments::LengthDepth length_depth_type = WellSegments::LengthDepthFromString(rec1.getItem("INFO_TYPE").getTrimmedString(0));
const WellSegments::CompPressureDrop comp_pressure_drop = WellSegments::CompPressureDropFromString(rec1.getItem("PRESSURE_COMPONENTS").getTrimmedString(0));
const WellSegments::MultiPhaseModel multiphase_model = WellSegments::MultiPhaseModelFromString(rec1.getItem("FLOW_MODEL").getTrimmedString(0));
BOOST_CHECK_EQUAL( "PROD01", well_name );
BOOST_CHECK_EQUAL( 2512.5, depth_top );
BOOST_CHECK_EQUAL( 2512.5, length_top );
BOOST_CHECK_EQUAL( 1.0e-5, volume_top );
const std::string length_depth_type_string = WellSegment::LengthDepthEnumToString(length_depth_type);
const std::string length_depth_type_string = WellSegments::LengthDepthToString(length_depth_type);
BOOST_CHECK_EQUAL( length_depth_type_string, "ABS" );
const std::string comp_pressure_drop_string = WellSegment::CompPressureDropEnumToString(comp_pressure_drop);
const std::string comp_pressure_drop_string = WellSegments::CompPressureDropToString(comp_pressure_drop);
BOOST_CHECK_EQUAL( comp_pressure_drop_string, "H--" );
const std::string multiphase_model_string = WellSegment::MultiPhaseModelEnumToString(multiphase_model);
const std::string multiphase_model_string = WellSegments::MultiPhaseModelToString(multiphase_model);
BOOST_CHECK_EQUAL( multiphase_model_string, "HO" );
}

View File

@@ -29,7 +29,6 @@
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Events.hpp>
#include <opm/parser/eclipse/Units/Units.hpp>
@@ -111,10 +110,8 @@ BOOST_AUTO_TEST_CASE(WellTestRefDepth) {
EclipseGrid grid(40,60,30);
TableManager table ( deck );
Eclipse3DProperties eclipseProperties ( deck , table, grid);
BOOST_CHECK_EQUAL(3, 3);
Runspec runspec (deck);
Schedule sched(deck , grid , eclipseProperties, runspec);
BOOST_CHECK_EQUAL(4, 4);
const auto& well1 = sched.getWell2atEnd("W_1");
const auto& well2 = sched.getWell2atEnd("W_2");
@@ -146,7 +143,7 @@ BOOST_AUTO_TEST_CASE(WellTesting) {
BOOST_CHECK_CLOSE( 777/Metric::Time , sched.getWell2("W_2", 7).getProductionProperties().ResVRate.get<double>() , 0.0001);
BOOST_CHECK_EQUAL( 0 , sched.getWell2("W_2", 8).getProductionProperties().ResVRate.get<double>());
BOOST_CHECK_EQUAL( WellCommon::SHUT , sched.getWell2("W_2", 3).getStatus());
BOOST_CHECK( Well2::Status::SHUT == sched.getWell2("W_2", 3).getStatus());
{
const auto& rft_config = sched.rftConfig();
@@ -157,19 +154,19 @@ BOOST_AUTO_TEST_CASE(WellTesting) {
BOOST_CHECK( rft_config.rft("W_1", 3));
}
{
const WellProductionProperties& prop3 = sched.getWell2("W_2", 3).getProductionProperties();
BOOST_CHECK_EQUAL( WellProducer::ORAT , prop3.controlMode);
BOOST_CHECK( prop3.hasProductionControl(WellProducer::ORAT));
BOOST_CHECK( !prop3.hasProductionControl(WellProducer::GRAT));
BOOST_CHECK( !prop3.hasProductionControl(WellProducer::WRAT));
const auto & prop3 = sched.getWell2("W_2", 3).getProductionProperties();
BOOST_CHECK( Well2::ProducerCMode::ORAT == prop3.controlMode);
BOOST_CHECK( prop3.hasProductionControl(Well2::ProducerCMode::ORAT));
BOOST_CHECK( !prop3.hasProductionControl(Well2::ProducerCMode::GRAT));
BOOST_CHECK( !prop3.hasProductionControl(Well2::ProducerCMode::WRAT));
}
BOOST_CHECK_EQUAL( WellCommon::AUTO, sched.getWell2("W_3", 3).getStatus());
BOOST_CHECK( Well2::Status::AUTO == sched.getWell2("W_3", 3).getStatus());
{
const WellProductionProperties& prop7 = sched.getWell2("W_3", 7).getProductionProperties();
const auto& prop7 = sched.getWell2("W_3", 7).getProductionProperties();
BOOST_CHECK_CLOSE( 999/Metric::Time , prop7.LiquidRate.get<double>() , 0.001);
BOOST_CHECK_EQUAL( WellProducer::RESV, prop7.controlMode);
BOOST_CHECK( Well2::ProducerCMode::RESV == prop7.controlMode);
}
BOOST_CHECK_CLOSE( 8000./Metric::Time , sched.getWell2("W_3", 3).getProductionProperties().LiquidRate.get<double>(), 1.e-12);
BOOST_CHECK_CLOSE( 18000./Metric::Time, sched.getWell2("W_3", 8).getProductionProperties().LiquidRate.get<double>(), 1.e-12);
@@ -214,25 +211,25 @@ BOOST_AUTO_TEST_CASE(WellTesting) {
BOOST_CHECK_CLOSE(200000/Metric::Time , controls.reservoir_rate, 0.001);
BOOST_CHECK_CLOSE(6895 * Metric::Pressure , controls.bhp_limit, 0.001);
BOOST_CHECK_CLOSE(0 , controls.thp_limit , 0.001);
BOOST_CHECK_EQUAL( WellInjector::RESV , controls.cmode);
BOOST_CHECK( controls.hasControl(WellInjector::RATE ));
BOOST_CHECK( controls.hasControl(WellInjector::RESV ));
BOOST_CHECK( !controls.hasControl(WellInjector::THP));
BOOST_CHECK( controls.hasControl(WellInjector::BHP));
BOOST_CHECK( Well2::InjectorCMode::RESV == controls.cmode);
BOOST_CHECK( controls.hasControl(Well2::InjectorCMode::RATE ));
BOOST_CHECK( controls.hasControl(Well2::InjectorCMode::RESV ));
BOOST_CHECK( !controls.hasControl(Well2::InjectorCMode::THP));
BOOST_CHECK( controls.hasControl(Well2::InjectorCMode::BHP));
}
BOOST_CHECK_EQUAL( WellCommon::OPEN, sched.getWell2("W_1", 11).getStatus( ));
BOOST_CHECK_EQUAL( WellCommon::OPEN, sched.getWell2("W_1", 12).getStatus( ));
BOOST_CHECK_EQUAL( WellCommon::SHUT, sched.getWell2("W_1", 13).getStatus( ));
BOOST_CHECK_EQUAL( WellCommon::OPEN, sched.getWell2("W_1", 14).getStatus( ));
BOOST_CHECK( Well2::Status::OPEN == sched.getWell2("W_1", 11).getStatus( ));
BOOST_CHECK( Well2::Status::OPEN == sched.getWell2("W_1", 12).getStatus( ));
BOOST_CHECK( Well2::Status::SHUT == sched.getWell2("W_1", 13).getStatus( ));
BOOST_CHECK( Well2::Status::OPEN == sched.getWell2("W_1", 14).getStatus( ));
{
SummaryState st;
const auto controls = sched.getWell2("W_1", 12).injectionControls(st);
BOOST_CHECK( controls.hasControl(WellInjector::RATE ));
BOOST_CHECK( !controls.hasControl(WellInjector::RESV));
BOOST_CHECK( controls.hasControl(WellInjector::THP ));
BOOST_CHECK( controls.hasControl(WellInjector::BHP ));
BOOST_CHECK( controls.hasControl(Well2::InjectorCMode::RATE ));
BOOST_CHECK( !controls.hasControl(Well2::InjectorCMode::RESV));
BOOST_CHECK( controls.hasControl(Well2::InjectorCMode::THP ));
BOOST_CHECK( controls.hasControl(Well2::InjectorCMode::BHP ));
}
}
}
@@ -270,13 +267,13 @@ BOOST_AUTO_TEST_CASE(WellTestCOMPDAT) {
const auto& connections = sched.getWell2("W_1", 3).getConnections();
BOOST_CHECK_EQUAL(4U, connections.size());
BOOST_CHECK_EQUAL(WellCompletion::OPEN, connections.get(3).state());
BOOST_CHECK(Connection::State::OPEN == connections.get(3).state());
BOOST_CHECK_EQUAL(2.2836805555555556e-12 , connections.get(3).CF());
}
{
const auto& connections = sched.getWell2("W_1", 7).getConnections();
BOOST_CHECK_EQUAL(4U, connections.size() );
BOOST_CHECK_EQUAL(WellCompletion::SHUT, connections.get( 3 ).state() );
BOOST_CHECK(Connection::State::SHUT == connections.get( 3 ).state() );
}
}
}
@@ -346,7 +343,7 @@ BOOST_AUTO_TEST_CASE( WellTestGroups ) {
auto& group = sched.getGroup2("INJ", 3);
const auto& injection = group.injectionControls(st);
BOOST_CHECK_EQUAL( Phase::WATER , injection.phase);
BOOST_CHECK_EQUAL( GroupInjection::VREP , injection.cmode);
BOOST_CHECK( Group2::InjectionCMode::VREP == injection.cmode);
BOOST_CHECK_CLOSE( 10/Metric::Time , injection.surface_max_rate, 0.001);
BOOST_CHECK_CLOSE( 20/Metric::Time , injection.resv_max_rate, 0.001);
BOOST_CHECK_EQUAL( 0.75 , injection.target_reinj_fraction);
@@ -357,7 +354,7 @@ BOOST_AUTO_TEST_CASE( WellTestGroups ) {
auto& group = sched.getGroup2("INJ", 6);
const auto& injection = group.injectionControls(st);
BOOST_CHECK_EQUAL( Phase::OIL , injection.phase);
BOOST_CHECK_EQUAL( GroupInjection::RATE , injection.cmode);
BOOST_CHECK( Group2::InjectionCMode::RATE == injection.cmode);
BOOST_CHECK_CLOSE( 1000/Metric::Time , injection.surface_max_rate, 0.0001);
BOOST_CHECK(group.isInjectionGroup());
}
@@ -365,7 +362,7 @@ BOOST_AUTO_TEST_CASE( WellTestGroups ) {
{
auto& group = sched.getGroup2("OP", 3);
const auto& production = group.productionControls(st);
BOOST_CHECK_EQUAL( GroupProduction::ORAT , production.cmode);
BOOST_CHECK( Group2::ProductionCMode::ORAT == production.cmode);
BOOST_CHECK_CLOSE( 10/Metric::Time , production.oil_target , 0.001);
BOOST_CHECK_CLOSE( 20/Metric::Time , production.water_target , 0.001);
BOOST_CHECK_CLOSE( 30/Metric::Time , production.gas_target , 0.001);
@@ -451,19 +448,19 @@ BOOST_AUTO_TEST_CASE(WellTestWGRUPCONWellPropertiesSet) {
const auto& well1 = sched.getWell2("W_1", 0);
BOOST_CHECK(well1.isAvailableForGroupControl( ));
BOOST_CHECK_EQUAL(-1, well1.getGuideRate( ));
BOOST_CHECK_EQUAL(GuideRate::OIL, well1.getGuideRatePhase( ));
BOOST_CHECK(Well2::GuideRateTarget::OIL == well1.getGuideRatePhase( ));
BOOST_CHECK_EQUAL(1.0, well1.getGuideRateScalingFactor( ));
const auto& well2 = sched.getWell2("W_2", 0);
BOOST_CHECK(!well2.isAvailableForGroupControl( ));
BOOST_CHECK_EQUAL(-1, well2.getGuideRate( ));
BOOST_CHECK_EQUAL(GuideRate::UNDEFINED, well2.getGuideRatePhase( ));
BOOST_CHECK(Well2::GuideRateTarget::UNDEFINED == well2.getGuideRatePhase( ));
BOOST_CHECK_EQUAL(1.0, well2.getGuideRateScalingFactor( ));
const auto& well3 = sched.getWell2("W_3", 0);
BOOST_CHECK(well3.isAvailableForGroupControl( ));
BOOST_CHECK_EQUAL(100, well3.getGuideRate( ));
BOOST_CHECK_EQUAL(GuideRate::RAT, well3.getGuideRatePhase( ));
BOOST_CHECK(Well2::GuideRateTarget::RAT == well3.getGuideRatePhase( ));
BOOST_CHECK_EQUAL(0.5, well3.getGuideRateScalingFactor( ));
}
@@ -533,17 +530,17 @@ BOOST_AUTO_TEST_CASE(WELLS_SHUT) {
const auto& well1 = sched.getWell2("W1", 1);
const auto& well2 = sched.getWell2("W2", 1);
const auto& well3 = sched.getWell2("W3", 1);
BOOST_CHECK_EQUAL( WellCommon::StatusEnum::OPEN , well1.getStatus());
BOOST_CHECK_EQUAL( WellCommon::StatusEnum::OPEN , well2.getStatus());
BOOST_CHECK_EQUAL( WellCommon::StatusEnum::OPEN , well3.getStatus());
BOOST_CHECK( Well2::Status::OPEN == well1.getStatus());
BOOST_CHECK( Well2::Status::OPEN == well2.getStatus());
BOOST_CHECK( Well2::Status::OPEN == well3.getStatus());
}
{
const auto& well1 = sched.getWell2("W1", 2);
const auto& well2 = sched.getWell2("W2", 2);
const auto& well3 = sched.getWell2("W3", 2);
BOOST_CHECK_EQUAL( WellCommon::StatusEnum::SHUT , well1.getStatus());
BOOST_CHECK_EQUAL( WellCommon::StatusEnum::SHUT , well2.getStatus());
BOOST_CHECK_EQUAL( WellCommon::StatusEnum::SHUT , well3.getStatus());
BOOST_CHECK( Well2::Status::SHUT == well1.getStatus());
BOOST_CHECK( Well2::Status::SHUT == well2.getStatus());
BOOST_CHECK( Well2::Status::SHUT == well3.getStatus());
}
}
@@ -709,9 +706,9 @@ BOOST_AUTO_TEST_CASE(WellTestWECON) {
BOOST_CHECK_EQUAL(econ_limit1.maxGasOilRatio(), 0.0);
BOOST_CHECK_EQUAL(econ_limit1.endRun(), false);
BOOST_CHECK_EQUAL(econ_limit1.followonWell(), "'");
BOOST_CHECK_EQUAL(econ_limit1.quantityLimit(), WellEcon::RATE);
BOOST_CHECK_EQUAL(econ_limit1.workover(), WellEcon::CON);
BOOST_CHECK_EQUAL(econ_limit1.workoverSecondary(), WellEcon::CON);
BOOST_CHECK(econ_limit1.quantityLimit() == WellEconProductionLimits::QuantityLimit::RATE);
BOOST_CHECK(econ_limit1.workover() == WellEconProductionLimits::EconWorkover::CON);
BOOST_CHECK(econ_limit1.workoverSecondary() == WellEconProductionLimits::EconWorkover::CON);
BOOST_CHECK(econ_limit1.requireWorkover());
BOOST_CHECK(econ_limit1.requireSecondaryWorkover());
BOOST_CHECK(!(econ_limit1.validFollowonWell()));
@@ -731,9 +728,9 @@ BOOST_AUTO_TEST_CASE(WellTestWECON) {
BOOST_CHECK_EQUAL(econ_limit2.maxGasOilRatio(), 0.0);
BOOST_CHECK_EQUAL(econ_limit2.endRun(), false);
BOOST_CHECK_EQUAL(econ_limit2.followonWell(), "'");
BOOST_CHECK_EQUAL(econ_limit2.quantityLimit(), WellEcon::RATE);
BOOST_CHECK_EQUAL(econ_limit2.workover(), WellEcon::CON);
BOOST_CHECK_EQUAL(econ_limit2.workoverSecondary(), WellEcon::CON);
BOOST_CHECK(econ_limit2.quantityLimit() == WellEconProductionLimits::QuantityLimit::RATE);
BOOST_CHECK(econ_limit2.workover() == WellEconProductionLimits::EconWorkover::CON);
BOOST_CHECK(econ_limit2.workoverSecondary() == WellEconProductionLimits::EconWorkover::CON);
BOOST_CHECK(econ_limit2.requireWorkover());
BOOST_CHECK(econ_limit2.requireSecondaryWorkover());
BOOST_CHECK(!(econ_limit2.validFollowonWell()));
@@ -755,9 +752,9 @@ BOOST_AUTO_TEST_CASE(WellTestWECON) {
BOOST_CHECK_EQUAL(econ_limit1.maxGasOilRatio(), 0.0);
BOOST_CHECK_EQUAL(econ_limit1.endRun(), false);
BOOST_CHECK_EQUAL(econ_limit1.followonWell(), "'");
BOOST_CHECK_EQUAL(econ_limit1.quantityLimit(), WellEcon::RATE);
BOOST_CHECK_EQUAL(econ_limit1.workover(), WellEcon::NONE);
BOOST_CHECK_EQUAL(econ_limit1.workoverSecondary(), WellEcon::NONE);
BOOST_CHECK(econ_limit1.quantityLimit() == WellEconProductionLimits::QuantityLimit::RATE);
BOOST_CHECK(econ_limit1.workover() == WellEconProductionLimits::EconWorkover::NONE);
BOOST_CHECK(econ_limit1.workoverSecondary() == WellEconProductionLimits::EconWorkover::NONE);
BOOST_CHECK(!(econ_limit1.requireWorkover()));
BOOST_CHECK(!(econ_limit1.requireSecondaryWorkover()));
BOOST_CHECK(!(econ_limit1.validFollowonWell()));
@@ -777,9 +774,9 @@ BOOST_AUTO_TEST_CASE(WellTestWECON) {
BOOST_CHECK_EQUAL(econ_limit2.maxGasOilRatio(), 0.0);
BOOST_CHECK_EQUAL(econ_limit2.endRun(), false);
BOOST_CHECK_EQUAL(econ_limit2.followonWell(), "'");
BOOST_CHECK_EQUAL(econ_limit2.quantityLimit(), WellEcon::RATE);
BOOST_CHECK_EQUAL(econ_limit2.workover(), WellEcon::CON);
BOOST_CHECK_EQUAL(econ_limit2.workoverSecondary(), WellEcon::CON);
BOOST_CHECK(econ_limit2.quantityLimit() == WellEconProductionLimits::QuantityLimit::RATE);
BOOST_CHECK(econ_limit2.workover() == WellEconProductionLimits::EconWorkover::CON);
BOOST_CHECK(econ_limit2.workoverSecondary() == WellEconProductionLimits::EconWorkover::CON);
BOOST_CHECK(econ_limit2.requireWorkover());
BOOST_CHECK(econ_limit2.requireSecondaryWorkover());
BOOST_CHECK(!(econ_limit2.validFollowonWell()));

View File

@@ -89,17 +89,17 @@ void verifyWellState(const std::string& rst_filename,
}
else {
switch( well.getInjectionProperties( ).injectorType ) {
case WellInjector::WATER:
well_type = ERT_WATER_INJECTOR;
break;
case WellInjector::GAS:
well_type = ERT_GAS_INJECTOR;
break;
case WellInjector::OIL:
well_type = ERT_OIL_INJECTOR;
break;
default:
break;
case Well2::InjectorType::WATER:
well_type = ERT_WATER_INJECTOR;
break;
case Well2::InjectorType::GAS:
well_type = ERT_GAS_INJECTOR;
break;
case Well2::InjectorType::OIL:
well_type = ERT_OIL_INJECTOR;
break;
default:
break;
}
}
@@ -108,7 +108,7 @@ void verifyWellState(const std::string& rst_filename,
//Verify wellstatus
int ert_well_status = well_state_is_open(well_state) ? 1 : 0;
int wellstatus = well.getStatus( ) == WellCommon::OPEN ? 1 : 0;
int wellstatus = well.getStatus( ) == Well2::Status::OPEN ? 1 : 0;
BOOST_CHECK_EQUAL(ert_well_status, wellstatus);