Move well production control enum to Well2

This commit is contained in:
Joakim Hove 2019-08-29 17:05:00 +02:00
parent a2fc480e16
commit 9e6f8bd1c1
16 changed files with 533 additions and 550 deletions

View File

@ -234,13 +234,13 @@ 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);

View File

@ -26,65 +26,6 @@ namespace Opm {
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 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 {

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

@ -95,6 +95,51 @@ public:
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);
struct InjectionControls {
public:
@ -143,7 +188,7 @@ public:
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 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 {
@ -172,6 +217,98 @@ public:
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,
@ -181,7 +318,7 @@ public:
int headJ,
double ref_depth,
Phase phase,
WellProducer::ControlModeEnum whistctl_cmode,
ProducerCMode whistctl_cmode,
Connection::Order ordering,
const UnitSystem& unit_system,
double udq_undefined);
@ -317,6 +454,7 @@ private:
};
std::ostream& operator<<( std::ostream&, const Well2::WellInjectionProperties& );
std::ostream& operator<<( std::ostream&, const WellProductionProperties& );
}

View File

@ -34,69 +34,6 @@ namespace Opm {
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

View File

@ -207,7 +207,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;

View File

@ -122,7 +122,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 +471,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 +493,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 +505,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 +517,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;
@ -732,7 +732,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);
@ -796,11 +796,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);
@ -1406,7 +1406,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 );
@ -1420,16 +1420,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<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)

View File

@ -195,56 +195,6 @@ namespace Opm {
/*****************************************************************/
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 );
}
}
@ -452,45 +402,6 @@ namespace Opm {
}
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.");
}
}

View File

@ -80,7 +80,7 @@ Well2::Well2(const std::string& wname_arg,
int headJ_arg,
double ref_depth_arg,
Phase phase_arg,
WellProducer::ControlModeEnum whistctl_cmode,
ProducerCMode whistctl_cmode,
Connection::Order ordering_arg,
const UnitSystem& unit_system_arg,
double udq_undefined_arg) :
@ -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 );
}
@ -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;
}
@ -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();
@ -875,4 +875,91 @@ Well2::InjectorCMode Well2::InjectorCModeFromString(const std::string &stringVal
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 );
}
}

View File

@ -105,40 +105,40 @@ namespace Opm {
void Well2::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){
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){
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){
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");
}
}

View File

@ -34,20 +34,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 +64,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 +85,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 +102,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 +113,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 +134,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 +153,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 +166,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 +174,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 +229,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 +248,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 +295,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

@ -183,8 +183,8 @@ 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);

View File

@ -1460,7 +1460,7 @@ BOOST_AUTO_TEST_CASE(changeBhpLimitInHistoryModeWithWeltarg) {
// The well is producer for timestep 3 and the injection properties BHPLimit should be set to zero.
BOOST_CHECK(sched.getWell2("I", 3).isProducer());
BOOST_CHECK_EQUAL(sched.getWell2("I", 3).getInjectionProperties().BHPLimit.get<double>(), 0); // 3
BOOST_CHECK_EQUAL(sched.getWell2("I", 3).getProductionProperties().hasProductionControl(Opm::WellProducer::BHP), true );
BOOST_CHECK_EQUAL(sched.getWell2("I", 3).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::BHP), true );
BOOST_CHECK_EQUAL(sched.getWell2("I", 4).getInjectionProperties().hasInjectionControl(Opm::Well2::InjectorCMode::BHP), true );
BOOST_CHECK_EQUAL(sched.getWell2("I", 4).getInjectionProperties().BHPLimit.get<double>(), 6891.2 * 1e5); // 4
}
@ -1538,20 +1538,20 @@ BOOST_AUTO_TEST_CASE(changeModeWithWHISTCTL) {
BOOST_CHECK_THROW(schedule.getWell2("P2", 0), std::invalid_argument);
//10 OKT 2008
BOOST_CHECK_EQUAL(schedule.getWell2("P1", 1).getProductionProperties().controlMode, Opm::WellProducer::ORAT);
BOOST_CHECK_EQUAL(schedule.getWell2("P2", 1).getProductionProperties().controlMode, Opm::WellProducer::ORAT);
BOOST_CHECK(schedule.getWell2("P1", 1).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::ORAT);
BOOST_CHECK(schedule.getWell2("P2", 1).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::ORAT);
//15 OKT 2008
{
const auto& props1 = schedule.getWell2("P1", 2).getProductionProperties();
const auto& props2 = schedule.getWell2("P2", 2).getProductionProperties();
BOOST_CHECK_EQUAL(props1.controlMode, Opm::WellProducer::RESV);
BOOST_CHECK_EQUAL(props2.controlMode, Opm::WellProducer::RESV);
BOOST_CHECK(props1.controlMode == Opm::Well2::ProducerCMode::RESV);
BOOST_CHECK(props2.controlMode == Opm::Well2::ProducerCMode::RESV);
// under history mode, a producing well should have only one rate target/limit or have no rate target/limit.
// the rate target/limit from previous report step should not be kept.
BOOST_CHECK( !props1.hasProductionControl(Opm::WellProducer::ORAT) );
BOOST_CHECK( !props2.hasProductionControl(Opm::WellProducer::ORAT) );
BOOST_CHECK( !props1.hasProductionControl(Opm::Well2::ProducerCMode::ORAT) );
BOOST_CHECK( !props2.hasProductionControl(Opm::Well2::ProducerCMode::ORAT) );
}
//18 OKT 2008
@ -1559,11 +1559,11 @@ BOOST_AUTO_TEST_CASE(changeModeWithWHISTCTL) {
const auto& props1 = schedule.getWell2("P1", 3).getProductionProperties();
const auto& props2 = schedule.getWell2("P2", 3).getProductionProperties();
BOOST_CHECK_EQUAL(props1.controlMode, Opm::WellProducer::RESV);
BOOST_CHECK_EQUAL(props2.controlMode, Opm::WellProducer::RESV);
BOOST_CHECK(props1.controlMode == Opm::Well2::ProducerCMode::RESV);
BOOST_CHECK(props2.controlMode == Opm::Well2::ProducerCMode::RESV);
BOOST_CHECK( !props1.hasProductionControl(Opm::WellProducer::ORAT) );
BOOST_CHECK( !props2.hasProductionControl(Opm::WellProducer::ORAT) );
BOOST_CHECK( !props1.hasProductionControl(Opm::Well2::ProducerCMode::ORAT) );
BOOST_CHECK( !props2.hasProductionControl(Opm::Well2::ProducerCMode::ORAT) );
}
// 20 OKT 2008
@ -1571,13 +1571,13 @@ BOOST_AUTO_TEST_CASE(changeModeWithWHISTCTL) {
const auto& props1 = schedule.getWell2("P1", 4).getProductionProperties();
const auto& props2 = schedule.getWell2("P2", 4).getProductionProperties();
BOOST_CHECK_EQUAL(props1.controlMode, Opm::WellProducer::LRAT);
BOOST_CHECK_EQUAL(props2.controlMode, Opm::WellProducer::LRAT);
BOOST_CHECK(props1.controlMode == Opm::Well2::ProducerCMode::LRAT);
BOOST_CHECK(props2.controlMode == Opm::Well2::ProducerCMode::LRAT);
BOOST_CHECK( !props1.hasProductionControl(Opm::WellProducer::ORAT) );
BOOST_CHECK( !props2.hasProductionControl(Opm::WellProducer::ORAT) );
BOOST_CHECK( !props1.hasProductionControl(Opm::WellProducer::RESV) );
BOOST_CHECK( !props2.hasProductionControl(Opm::WellProducer::RESV) );
BOOST_CHECK( !props1.hasProductionControl(Opm::Well2::ProducerCMode::ORAT) );
BOOST_CHECK( !props2.hasProductionControl(Opm::Well2::ProducerCMode::ORAT) );
BOOST_CHECK( !props1.hasProductionControl(Opm::Well2::ProducerCMode::RESV) );
BOOST_CHECK( !props2.hasProductionControl(Opm::Well2::ProducerCMode::RESV) );
}
// 25 OKT 2008
@ -1585,13 +1585,13 @@ BOOST_AUTO_TEST_CASE(changeModeWithWHISTCTL) {
const auto& props1 = schedule.getWell2("P1", 5).getProductionProperties();
const auto& props2 = schedule.getWell2("P2", 5).getProductionProperties();
BOOST_CHECK_EQUAL(props1.controlMode, Opm::WellProducer::ORAT);
BOOST_CHECK_EQUAL(props2.controlMode, Opm::WellProducer::ORAT);
BOOST_CHECK(props1.controlMode == Opm::Well2::ProducerCMode::ORAT);
BOOST_CHECK(props2.controlMode == Opm::Well2::ProducerCMode::ORAT);
BOOST_CHECK( !props1.hasProductionControl(Opm::WellProducer::LRAT) );
BOOST_CHECK( !props2.hasProductionControl(Opm::WellProducer::LRAT) );
BOOST_CHECK( !props1.hasProductionControl(Opm::WellProducer::RESV) );
BOOST_CHECK( !props2.hasProductionControl(Opm::WellProducer::RESV) );
BOOST_CHECK( !props1.hasProductionControl(Opm::Well2::ProducerCMode::LRAT) );
BOOST_CHECK( !props2.hasProductionControl(Opm::Well2::ProducerCMode::LRAT) );
BOOST_CHECK( !props1.hasProductionControl(Opm::Well2::ProducerCMode::RESV) );
BOOST_CHECK( !props2.hasProductionControl(Opm::Well2::ProducerCMode::RESV) );
}
}
@ -1644,17 +1644,17 @@ BOOST_AUTO_TEST_CASE(fromWCONHISTtoWCONPROD) {
BOOST_CHECK_THROW(schedule.getWell2("P2", 0), std::invalid_argument);
//10 OKT 2008
BOOST_CHECK_EQUAL(schedule.getWell2("P1", 1).getProductionProperties().controlMode, Opm::WellProducer::ORAT);
BOOST_CHECK_EQUAL(schedule.getWell2("P2", 1).getProductionProperties().controlMode, Opm::WellProducer::ORAT);
BOOST_CHECK(schedule.getWell2("P1", 1).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::ORAT);
BOOST_CHECK(schedule.getWell2("P2", 1).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::ORAT);
//15 OKT 2008
BOOST_CHECK_EQUAL(schedule.getWell2("P1", 2).getProductionProperties().controlMode, Opm::WellProducer::GRAT);
BOOST_CHECK(schedule.getWell2("P1", 2).getProductionProperties().hasProductionControl(Opm::WellProducer::WRAT) );
BOOST_CHECK_EQUAL(schedule.getWell2("P2", 2).getProductionProperties().controlMode, Opm::WellProducer::WRAT);
BOOST_CHECK(schedule.getWell2("P2", 2).getProductionProperties().hasProductionControl(Opm::WellProducer::GRAT) );
BOOST_CHECK(schedule.getWell2("P1", 2).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::GRAT);
BOOST_CHECK(schedule.getWell2("P1", 2).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::WRAT) );
BOOST_CHECK(schedule.getWell2("P2", 2).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::WRAT);
BOOST_CHECK(schedule.getWell2("P2", 2).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::GRAT) );
// the previous control limits/targets should not stay
BOOST_CHECK( !schedule.getWell2("P1", 2).getProductionProperties().hasProductionControl(Opm::WellProducer::ORAT) );
BOOST_CHECK( !schedule.getWell2("P2", 2).getProductionProperties().hasProductionControl(Opm::WellProducer::ORAT) );
BOOST_CHECK( !schedule.getWell2("P1", 2).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::ORAT) );
BOOST_CHECK( !schedule.getWell2("P2", 2).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::ORAT) );
}
BOOST_AUTO_TEST_CASE(WHISTCTL_NEW_WELL) {
@ -1728,38 +1728,38 @@ BOOST_AUTO_TEST_CASE(WHISTCTL_NEW_WELL) {
Schedule schedule(deck, grid , eclipseProperties, runspec);
//10 OKT 2008
BOOST_CHECK_EQUAL(schedule.getWell2("P1", 1).getProductionProperties().controlMode, Opm::WellProducer::GRAT);
BOOST_CHECK_EQUAL(schedule.getWell2("P2", 1).getProductionProperties().controlMode, Opm::WellProducer::GRAT);
BOOST_CHECK(schedule.getWell2("P1", 1).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::GRAT);
BOOST_CHECK(schedule.getWell2("P2", 1).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::GRAT);
//15 OKT 2008
BOOST_CHECK_EQUAL(schedule.getWell2("P1", 2).getProductionProperties().controlMode, Opm::WellProducer::RESV);
BOOST_CHECK_EQUAL(schedule.getWell2("P2", 2).getProductionProperties().controlMode, Opm::WellProducer::RESV);
BOOST_CHECK(schedule.getWell2("P1", 2).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::RESV);
BOOST_CHECK(schedule.getWell2("P2", 2).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::RESV);
// under history mode, a producing well should have only one rate target/limit or have no rate target/limit.
// the rate target/limit from previous report step should not be kept.
BOOST_CHECK( !schedule.getWell2("P1", 2).getProductionProperties().hasProductionControl(Opm::WellProducer::ORAT) );
BOOST_CHECK( !schedule.getWell2("P2", 2).getProductionProperties().hasProductionControl(Opm::WellProducer::ORAT) );
BOOST_CHECK( !schedule.getWell2("P1", 2).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::ORAT) );
BOOST_CHECK( !schedule.getWell2("P2", 2).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::ORAT) );
//18 OKT 2008
BOOST_CHECK_EQUAL(schedule.getWell2("P1", 3).getProductionProperties().controlMode, Opm::WellProducer::RESV);
BOOST_CHECK_EQUAL(schedule.getWell2("P2", 3).getProductionProperties().controlMode, Opm::WellProducer::RESV);
BOOST_CHECK( !schedule.getWell2("P1", 3).getProductionProperties().hasProductionControl(Opm::WellProducer::ORAT) );
BOOST_CHECK( !schedule.getWell2("P2", 3).getProductionProperties().hasProductionControl(Opm::WellProducer::ORAT) );
BOOST_CHECK(schedule.getWell2("P1", 3).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::RESV);
BOOST_CHECK(schedule.getWell2("P2", 3).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::RESV);
BOOST_CHECK( !schedule.getWell2("P1", 3).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::ORAT) );
BOOST_CHECK( !schedule.getWell2("P2", 3).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::ORAT) );
// 20 OKT 2008
BOOST_CHECK_EQUAL(schedule.getWell2("P1", 4).getProductionProperties().controlMode, Opm::WellProducer::LRAT);
BOOST_CHECK_EQUAL(schedule.getWell2("P2", 4).getProductionProperties().controlMode, Opm::WellProducer::LRAT);
BOOST_CHECK( !schedule.getWell2("P1", 4).getProductionProperties().hasProductionControl(Opm::WellProducer::ORAT) );
BOOST_CHECK( !schedule.getWell2("P2", 4).getProductionProperties().hasProductionControl(Opm::WellProducer::ORAT) );
BOOST_CHECK( !schedule.getWell2("P1", 4).getProductionProperties().hasProductionControl(Opm::WellProducer::RESV) );
BOOST_CHECK( !schedule.getWell2("P2", 4).getProductionProperties().hasProductionControl(Opm::WellProducer::RESV) );
BOOST_CHECK(schedule.getWell2("P1", 4).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::LRAT);
BOOST_CHECK(schedule.getWell2("P2", 4).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::LRAT);
BOOST_CHECK( !schedule.getWell2("P1", 4).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::ORAT) );
BOOST_CHECK( !schedule.getWell2("P2", 4).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::ORAT) );
BOOST_CHECK( !schedule.getWell2("P1", 4).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::RESV) );
BOOST_CHECK( !schedule.getWell2("P2", 4).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::RESV) );
// 25 OKT 2008
BOOST_CHECK_EQUAL(schedule.getWell2("P1", 5).getProductionProperties().controlMode, Opm::WellProducer::ORAT);
BOOST_CHECK_EQUAL(schedule.getWell2("P2", 5).getProductionProperties().controlMode, Opm::WellProducer::ORAT);
BOOST_CHECK( !schedule.getWell2("P1", 5).getProductionProperties().hasProductionControl(Opm::WellProducer::RESV) );
BOOST_CHECK( !schedule.getWell2("P2", 5).getProductionProperties().hasProductionControl(Opm::WellProducer::RESV) );
BOOST_CHECK( !schedule.getWell2("P1", 5).getProductionProperties().hasProductionControl(Opm::WellProducer::LRAT) );
BOOST_CHECK( !schedule.getWell2("P2", 5).getProductionProperties().hasProductionControl(Opm::WellProducer::LRAT) );
BOOST_CHECK(schedule.getWell2("P1", 5).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::ORAT);
BOOST_CHECK(schedule.getWell2("P2", 5).getProductionProperties().controlMode == Opm::Well2::ProducerCMode::ORAT);
BOOST_CHECK( !schedule.getWell2("P1", 5).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::RESV) );
BOOST_CHECK( !schedule.getWell2("P2", 5).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::RESV) );
BOOST_CHECK( !schedule.getWell2("P1", 5).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::LRAT) );
BOOST_CHECK( !schedule.getWell2("P2", 5).getProductionProperties().hasProductionControl(Opm::Well2::ProducerCMode::LRAT) );
}
@ -2617,53 +2617,53 @@ BOOST_AUTO_TEST_CASE(InjectorStatusEnumLoop) {
/*****************************************************************/
BOOST_AUTO_TEST_CASE(ProducerCOntrolMopdeEnum2String) {
BOOST_CHECK_EQUAL( "ORAT" , WellProducer::ControlMode2String(WellProducer::ORAT));
BOOST_CHECK_EQUAL( "WRAT" , WellProducer::ControlMode2String(WellProducer::WRAT));
BOOST_CHECK_EQUAL( "GRAT" , WellProducer::ControlMode2String(WellProducer::GRAT));
BOOST_CHECK_EQUAL( "LRAT" , WellProducer::ControlMode2String(WellProducer::LRAT));
BOOST_CHECK_EQUAL( "CRAT" , WellProducer::ControlMode2String(WellProducer::CRAT));
BOOST_CHECK_EQUAL( "RESV" , WellProducer::ControlMode2String(WellProducer::RESV));
BOOST_CHECK_EQUAL( "BHP" , WellProducer::ControlMode2String(WellProducer::BHP));
BOOST_CHECK_EQUAL( "THP" , WellProducer::ControlMode2String(WellProducer::THP));
BOOST_CHECK_EQUAL( "GRUP" , WellProducer::ControlMode2String(WellProducer::GRUP));
BOOST_CHECK_EQUAL( "ORAT" , Well2::ProducerCMode2String(Well2::ProducerCMode::ORAT));
BOOST_CHECK_EQUAL( "WRAT" , Well2::ProducerCMode2String(Well2::ProducerCMode::WRAT));
BOOST_CHECK_EQUAL( "GRAT" , Well2::ProducerCMode2String(Well2::ProducerCMode::GRAT));
BOOST_CHECK_EQUAL( "LRAT" , Well2::ProducerCMode2String(Well2::ProducerCMode::LRAT));
BOOST_CHECK_EQUAL( "CRAT" , Well2::ProducerCMode2String(Well2::ProducerCMode::CRAT));
BOOST_CHECK_EQUAL( "RESV" , Well2::ProducerCMode2String(Well2::ProducerCMode::RESV));
BOOST_CHECK_EQUAL( "BHP" , Well2::ProducerCMode2String(Well2::ProducerCMode::BHP));
BOOST_CHECK_EQUAL( "THP" , Well2::ProducerCMode2String(Well2::ProducerCMode::THP));
BOOST_CHECK_EQUAL( "GRUP" , Well2::ProducerCMode2String(Well2::ProducerCMode::GRUP));
}
BOOST_AUTO_TEST_CASE(ProducerControlModeEnumFromString) {
BOOST_CHECK_THROW( WellProducer::ControlModeFromString("XRAT") , std::invalid_argument );
BOOST_CHECK_EQUAL( WellProducer::ORAT , WellProducer::ControlModeFromString("ORAT"));
BOOST_CHECK_EQUAL( WellProducer::WRAT , WellProducer::ControlModeFromString("WRAT"));
BOOST_CHECK_EQUAL( WellProducer::GRAT , WellProducer::ControlModeFromString("GRAT"));
BOOST_CHECK_EQUAL( WellProducer::LRAT , WellProducer::ControlModeFromString("LRAT"));
BOOST_CHECK_EQUAL( WellProducer::CRAT , WellProducer::ControlModeFromString("CRAT"));
BOOST_CHECK_EQUAL( WellProducer::RESV , WellProducer::ControlModeFromString("RESV"));
BOOST_CHECK_EQUAL( WellProducer::BHP , WellProducer::ControlModeFromString("BHP" ));
BOOST_CHECK_EQUAL( WellProducer::THP , WellProducer::ControlModeFromString("THP" ));
BOOST_CHECK_EQUAL( WellProducer::GRUP , WellProducer::ControlModeFromString("GRUP"));
BOOST_CHECK_THROW( Well2::ProducerCModeFromString("XRAT") , std::invalid_argument );
BOOST_CHECK( Well2::ProducerCMode::ORAT == Well2::ProducerCModeFromString("ORAT"));
BOOST_CHECK( Well2::ProducerCMode::WRAT == Well2::ProducerCModeFromString("WRAT"));
BOOST_CHECK( Well2::ProducerCMode::GRAT == Well2::ProducerCModeFromString("GRAT"));
BOOST_CHECK( Well2::ProducerCMode::LRAT == Well2::ProducerCModeFromString("LRAT"));
BOOST_CHECK( Well2::ProducerCMode::CRAT == Well2::ProducerCModeFromString("CRAT"));
BOOST_CHECK( Well2::ProducerCMode::RESV == Well2::ProducerCModeFromString("RESV"));
BOOST_CHECK( Well2::ProducerCMode::BHP == Well2::ProducerCModeFromString("BHP" ));
BOOST_CHECK( Well2::ProducerCMode::THP == Well2::ProducerCModeFromString("THP" ));
BOOST_CHECK( Well2::ProducerCMode::GRUP == Well2::ProducerCModeFromString("GRUP"));
}
BOOST_AUTO_TEST_CASE(ProducerControlModeEnumLoop) {
BOOST_CHECK_EQUAL( WellProducer::ORAT , WellProducer::ControlModeFromString( WellProducer::ControlMode2String( WellProducer::ORAT ) ));
BOOST_CHECK_EQUAL( WellProducer::WRAT , WellProducer::ControlModeFromString( WellProducer::ControlMode2String( WellProducer::WRAT ) ));
BOOST_CHECK_EQUAL( WellProducer::GRAT , WellProducer::ControlModeFromString( WellProducer::ControlMode2String( WellProducer::GRAT ) ));
BOOST_CHECK_EQUAL( WellProducer::LRAT , WellProducer::ControlModeFromString( WellProducer::ControlMode2String( WellProducer::LRAT ) ));
BOOST_CHECK_EQUAL( WellProducer::CRAT , WellProducer::ControlModeFromString( WellProducer::ControlMode2String( WellProducer::CRAT ) ));
BOOST_CHECK_EQUAL( WellProducer::RESV , WellProducer::ControlModeFromString( WellProducer::ControlMode2String( WellProducer::RESV ) ));
BOOST_CHECK_EQUAL( WellProducer::BHP , WellProducer::ControlModeFromString( WellProducer::ControlMode2String( WellProducer::BHP ) ));
BOOST_CHECK_EQUAL( WellProducer::THP , WellProducer::ControlModeFromString( WellProducer::ControlMode2String( WellProducer::THP ) ));
BOOST_CHECK_EQUAL( WellProducer::GRUP , WellProducer::ControlModeFromString( WellProducer::ControlMode2String( WellProducer::GRUP ) ));
BOOST_CHECK( Well2::ProducerCMode::ORAT == Well2::ProducerCModeFromString( Well2::ProducerCMode2String( Well2::ProducerCMode::ORAT ) ));
BOOST_CHECK( Well2::ProducerCMode::WRAT == Well2::ProducerCModeFromString( Well2::ProducerCMode2String( Well2::ProducerCMode::WRAT ) ));
BOOST_CHECK( Well2::ProducerCMode::GRAT == Well2::ProducerCModeFromString( Well2::ProducerCMode2String( Well2::ProducerCMode::GRAT ) ));
BOOST_CHECK( Well2::ProducerCMode::LRAT == Well2::ProducerCModeFromString( Well2::ProducerCMode2String( Well2::ProducerCMode::LRAT ) ));
BOOST_CHECK( Well2::ProducerCMode::CRAT == Well2::ProducerCModeFromString( Well2::ProducerCMode2String( Well2::ProducerCMode::CRAT ) ));
BOOST_CHECK( Well2::ProducerCMode::RESV == Well2::ProducerCModeFromString( Well2::ProducerCMode2String( Well2::ProducerCMode::RESV ) ));
BOOST_CHECK( Well2::ProducerCMode::BHP == Well2::ProducerCModeFromString( Well2::ProducerCMode2String( Well2::ProducerCMode::BHP ) ));
BOOST_CHECK( Well2::ProducerCMode::THP == Well2::ProducerCModeFromString( Well2::ProducerCMode2String( Well2::ProducerCMode::THP ) ));
BOOST_CHECK( Well2::ProducerCMode::GRUP == Well2::ProducerCModeFromString( Well2::ProducerCMode2String( Well2::ProducerCMode::GRUP ) ));
BOOST_CHECK_EQUAL( "ORAT" , WellProducer::ControlMode2String(WellProducer::ControlModeFromString( "ORAT" ) ));
BOOST_CHECK_EQUAL( "WRAT" , WellProducer::ControlMode2String(WellProducer::ControlModeFromString( "WRAT" ) ));
BOOST_CHECK_EQUAL( "GRAT" , WellProducer::ControlMode2String(WellProducer::ControlModeFromString( "GRAT" ) ));
BOOST_CHECK_EQUAL( "LRAT" , WellProducer::ControlMode2String(WellProducer::ControlModeFromString( "LRAT" ) ));
BOOST_CHECK_EQUAL( "CRAT" , WellProducer::ControlMode2String(WellProducer::ControlModeFromString( "CRAT" ) ));
BOOST_CHECK_EQUAL( "RESV" , WellProducer::ControlMode2String(WellProducer::ControlModeFromString( "RESV" ) ));
BOOST_CHECK_EQUAL( "BHP" , WellProducer::ControlMode2String(WellProducer::ControlModeFromString( "BHP" ) ));
BOOST_CHECK_EQUAL( "THP" , WellProducer::ControlMode2String(WellProducer::ControlModeFromString( "THP" ) ));
BOOST_CHECK_EQUAL( "GRUP" , WellProducer::ControlMode2String(WellProducer::ControlModeFromString( "GRUP" ) ));
BOOST_CHECK_EQUAL( "ORAT" , Well2::ProducerCMode2String(Well2::ProducerCModeFromString( "ORAT" ) ));
BOOST_CHECK_EQUAL( "WRAT" , Well2::ProducerCMode2String(Well2::ProducerCModeFromString( "WRAT" ) ));
BOOST_CHECK_EQUAL( "GRAT" , Well2::ProducerCMode2String(Well2::ProducerCModeFromString( "GRAT" ) ));
BOOST_CHECK_EQUAL( "LRAT" , Well2::ProducerCMode2String(Well2::ProducerCModeFromString( "LRAT" ) ));
BOOST_CHECK_EQUAL( "CRAT" , Well2::ProducerCMode2String(Well2::ProducerCModeFromString( "CRAT" ) ));
BOOST_CHECK_EQUAL( "RESV" , Well2::ProducerCMode2String(Well2::ProducerCModeFromString( "RESV" ) ));
BOOST_CHECK_EQUAL( "BHP" , Well2::ProducerCMode2String(Well2::ProducerCModeFromString( "BHP" ) ));
BOOST_CHECK_EQUAL( "THP" , Well2::ProducerCMode2String(Well2::ProducerCModeFromString( "THP" ) ));
BOOST_CHECK_EQUAL( "GRUP" , Well2::ProducerCMode2String(Well2::ProducerCModeFromString( "GRUP" ) ));
}
/*******************************************************************/

View File

@ -77,7 +77,7 @@ 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, Connection::Order::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(Well2::Status::SHUT);
auto shut_wells = st.updateWells(wc, wells, 5000);
@ -111,8 +111,8 @@ 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, Connection::Order::TRACK, us, 0.);
wells.emplace_back("WELLX", "A", 0, 0, 2, 2, 200., Phase::OIL, WellProducer::NONE, Connection::Order::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;
{
@ -182,9 +182,9 @@ 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, Connection::Order::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(Well2::Status::OPEN);
wells.emplace_back("WELLX", "A", 0, 0, 2, 2, 200., Phase::OIL, WellProducer::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.);
wells[1].updateStatus(Well2::Status::OPEN);
auto closed_completions = st.updateWells(wc, wells, 5000);

View File

@ -191,7 +191,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, Connection::Order::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 +200,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, Connection::Order::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 */
@ -218,7 +218,7 @@ BOOST_AUTO_TEST_CASE(isProducerCorrectlySet) {
{
Opm::Well2 well("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, Connection::Order::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::Well2::WellInjectionProperties>(well.getInjectionProperties());
@ -229,13 +229,13 @@ BOOST_AUTO_TEST_CASE(isProducerCorrectlySet) {
}
{
Opm::Well2 well("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, Connection::Order::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::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 +252,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, Connection::Order::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 +261,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, Connection::Order::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,15 +271,15 @@ 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, Connection::Order::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::Well2::WellInjectionProperties>(well.getInjectionProperties());
injProps->THPLimit.reset(200);
@ -291,7 +291,7 @@ BOOST_AUTO_TEST_CASE(XHPLimitDefault) {
BOOST_AUTO_TEST_CASE(InjectorType) {
Opm::Well2 well("WELL1", "GROUP", 0, 1, 23, 42, 2334.32, Opm::Phase::WATER, WellProducer::CMODE_UNDEFINED, Connection::Order::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::Well2::WellInjectionProperties>(well.getInjectionProperties());
injectionProps->injectorType = Opm::Well2::InjectorType::WATER;
@ -307,26 +307,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, Connection::Order::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,27 +334,27 @@ 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, Connection::Order::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::Well2::InjectorCMode::RATE ));
BOOST_CHECK( !well.getInjectionProperties().hasInjectionControl( Opm::Well2::InjectorCMode::RESV ));
@ -396,7 +396,7 @@ BOOST_AUTO_TEST_CASE(WellHaveInjectionControlLimit) {
/*********************************************************************/
BOOST_AUTO_TEST_CASE(WellGuideRatePhase_GuideRatePhaseSet) {
Opm::Well2 well("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, Connection::Order::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());
@ -407,7 +407,7 @@ BOOST_AUTO_TEST_CASE(WellGuideRatePhase_GuideRatePhaseSet) {
}
BOOST_AUTO_TEST_CASE(WellEfficiencyFactorSet) {
Opm::Well2 well("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, Connection::Order::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 +487,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 +539,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 +556,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 +657,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 +694,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 +716,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,10 +747,10 @@ BOOST_AUTO_TEST_CASE(BHP_CMODE)
BOOST_AUTO_TEST_CASE(CMODE_DEFAULT) {
const Opm::WellProductionProperties Pproperties("W");
const Opm::Well2::WellProductionProperties Pproperties("W");
const Opm::Well2::WellInjectionProperties Iproperties("W");
BOOST_CHECK_EQUAL( Pproperties.controlMode , Opm::WellProducer::CMODE_UNDEFINED );
BOOST_CHECK( Pproperties.controlMode == Opm::Well2::ProducerCMode::CMODE_UNDEFINED );
BOOST_CHECK( Iproperties.controlMode == Opm::Well2::InjectorCMode::CMODE_UNDEFINED );
}
@ -758,8 +758,8 @@ BOOST_AUTO_TEST_CASE(CMODE_DEFAULT) {
BOOST_AUTO_TEST_CASE(WELL_CONTROLS) {
Opm::Well2 well("WELL", "GROUP", 0, 0, 0, 0, 1000, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, Opm::Connection::Order::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 +779,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, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0);
Opm::Well2 prod("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, Connection::Order::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::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

@ -155,19 +155,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( 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);