Merge pull request #711 from joakim-hove/prod-properties-refactor

Refactor WellProductionProperties construction
This commit is contained in:
Joakim Hove 2019-04-09 18:27:04 +02:00 committed by GitHub
commit ebedc9b0b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 115 additions and 161 deletions

View File

@ -194,7 +194,6 @@ namespace Opm
DynamicState<std::shared_ptr<UDQInput>> udq_config; DynamicState<std::shared_ptr<UDQInput>> udq_config;
RFTConfig rft_config; RFTConfig rft_config;
WellProducer::ControlModeEnum m_controlModeWHISTCTL;
Actions m_actions; Actions m_actions;
std::vector< Well* > getWells(const std::string& wellNamePattern, const std::vector<std::string>& matching_wells = {}); std::vector< Well* > getWells(const std::string& wellNamePattern, const std::vector<std::string>& matching_wells = {});
@ -248,7 +247,7 @@ namespace Opm
void handleDRVDTR( const DeckKeyword& keyword, size_t currentStep); void handleDRVDTR( const DeckKeyword& keyword, size_t currentStep);
void handleVAPPARS( const DeckKeyword& keyword, size_t currentStep); void handleVAPPARS( const DeckKeyword& keyword, size_t currentStep);
void handleWECON( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors); void handleWECON( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
void handleWHISTCTL(const ParseContext& parseContext, ErrorGuard& errors, const DeckKeyword& keyword); void handleWHISTCTL(const DeckKeyword& keyword, std::size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
void handleMESSAGES(const DeckKeyword& keyword, size_t currentStep); void handleMESSAGES(const DeckKeyword& keyword, size_t currentStep);
void handleVFPPROD(const DeckKeyword& vfpprodKeyword, const UnitSystem& unit_system, size_t currentStep); void handleVFPPROD(const DeckKeyword& vfpprodKeyword, const UnitSystem& unit_system, size_t currentStep);
void handleVFPINJ(const DeckKeyword& vfpprodKeyword, const UnitSystem& unit_system, size_t currentStep); void handleVFPINJ(const DeckKeyword& vfpprodKeyword, const UnitSystem& unit_system, size_t currentStep);

View File

@ -48,19 +48,12 @@ namespace Opm {
int VFPTableNumber = 0; int VFPTableNumber = 0;
double ALQValue = 0.0; double ALQValue = 0.0;
bool predictionMode = false; bool predictionMode = false;
WellProducer::ControlModeEnum controlMode = WellProducer::CMODE_UNDEFINED; 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;
bool operator!=(const WellProductionProperties& other) const; bool operator!=(const WellProductionProperties& other) const;
WellProductionProperties(); WellProductionProperties();
WellProductionProperties (const DeckRecord& record,
bool prediction_mode,
const WellProductionProperties& prev_properties,
WellProducer::ControlModeEnum controlModeWHISTCTL,
bool switching_from_injector,
bool addGrupProductionControl);
bool hasProductionControl(WellProducer::ControlModeEnum controlModeArg) const { bool hasProductionControl(WellProducer::ControlModeEnum controlModeArg) const {
return (m_productionControls & controlModeArg) != 0; return (m_productionControls & controlModeArg) != 0;
@ -78,21 +71,18 @@ namespace Opm {
// this is used to check whether the specified control mode is an effective history matching production mode // this is used to check whether the specified control mode is an effective history matching production mode
static bool effectiveHistoryProductionControl(const WellProducer::ControlModeEnum cmode); static bool effectiveHistoryProductionControl(const WellProducer::ControlModeEnum cmode);
void handleWCONPROD( const DeckRecord& record);
void handleWCONHIST( const DeckRecord& record);
void resetDefaultBHPLimit();
private: private:
int m_productionControls = 0; int m_productionControls = 0;
void init_rates( const DeckRecord& record ); void init_rates( const DeckRecord& record );
void init_history(const WellProductionProperties& prevProperties, void init_history(const DeckRecord& record);
const DeckRecord& record,
const WellProducer::ControlModeEnum controlModeWHISTCL,
const bool switching_from_injector);
void init_prediction( const DeckRecord& record, bool addGroupProductionControl );
WellProductionProperties(const DeckRecord& record); WellProductionProperties(const DeckRecord& record);
void resetDefaultBHPLimit();
void setBHPLimit(const double limit); void setBHPLimit(const double limit);
double getBHPLimit() const; double getBHPLimit() const;

View File

@ -89,7 +89,6 @@ namespace Opm {
udq_config(this->m_timeMap, std::make_shared<UDQInput>(deck)), udq_config(this->m_timeMap, std::make_shared<UDQInput>(deck)),
rft_config(this->m_timeMap) rft_config(this->m_timeMap)
{ {
m_controlModeWHISTCTL = WellProducer::CMODE_UNDEFINED;
addGroup( "FIELD", 0 ); addGroup( "FIELD", 0 );
/* /*
@ -230,7 +229,7 @@ namespace Opm {
handleWELSPECS( section, keywordIdx, currentStep ); handleWELSPECS( section, keywordIdx, currentStep );
else if (keyword.name() == "WHISTCTL") else if (keyword.name() == "WHISTCTL")
handleWHISTCTL(parseContext, errors, keyword); handleWHISTCTL(keyword, currentStep, parseContext, errors);
else if (keyword.name() == "WCONHIST") else if (keyword.name() == "WCONHIST")
handleWCONHIST(keyword, currentStep, parseContext, errors); handleWCONHIST(keyword, currentStep, parseContext, errors);
@ -426,8 +425,9 @@ namespace Opm {
return true; return true;
} }
void Schedule::handleWHISTCTL(const ParseContext& parseContext, ErrorGuard& errors, const DeckKeyword& keyword) {
for( const auto& record : keyword ) { 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 std::string& cmodeString = record.getItem("CMODE").getTrimmedString(0);
const WellProducer::ControlModeEnum controlMode = WellProducer::ControlModeFromString( cmodeString ); const WellProducer::ControlModeEnum controlMode = WellProducer::ControlModeFromString( cmodeString );
@ -439,7 +439,6 @@ namespace Opm {
} }
} }
m_controlModeWHISTCTL = controlMode;
const std::string bhp_terminate = record.getItem("BPH_TERMINATE").getTrimmedString(0); const std::string bhp_terminate = record.getItem("BPH_TERMINATE").getTrimmedString(0);
if (bhp_terminate == "YES") { if (bhp_terminate == "YES") {
std::string msg = "The WHISTCTL keyword does not handle 'YES'. i.e. to terminate the run"; std::string msg = "The WHISTCTL keyword does not handle 'YES'. i.e. to terminate the run";
@ -447,6 +446,15 @@ namespace Opm {
parseContext.handleError( ParseContext::UNSUPPORTED_TERMINATE_IF_BHP , msg, errors ); parseContext.handleError( ParseContext::UNSUPPORTED_TERMINATE_IF_BHP , msg, errors );
} }
for (auto& well_pair : this->m_wells) {
auto& well = well_pair.second;
const WellProductionProperties& properties(well.getProductionProperties(currentStep));
if (properties.whistctl_cmode != controlMode) {
WellProductionProperties new_properties( properties );
new_properties.whistctl_cmode = controlMode;
well.setProductionProperties(currentStep, new_properties);
}
} }
} }
@ -659,16 +667,34 @@ namespace Opm {
for( const auto& well_name : well_names) { for( const auto& well_name : well_names) {
auto& well = this->m_wells.at(well_name); auto& well = this->m_wells.at(well_name);
bool addGrupProductionControl = well.isAvailableForGroupControl(currentStep);
bool switching_from_injector = !well.isProducer(currentStep);
const WellProductionProperties& prev_properties = well.getProductionProperties(currentStep);
WellProductionProperties properties(record, isPredictionMode, prev_properties, m_controlModeWHISTCTL, switching_from_injector, addGrupProductionControl);
updateWellStatus( well , currentStep , status ); updateWellStatus( well , currentStep , status );
if (isPredictionMode) {
bool addGrupProductionControl = well.isAvailableForGroupControl(currentStep);
WellProductionProperties properties;
if (addGrupProductionControl)
properties.addProductionControl(WellProducer::GRUP);
properties.handleWCONPROD(record);
if (well.setProductionProperties(currentStep, properties)) { if (well.setProductionProperties(currentStep, properties)) {
m_events.addEvent( ScheduleEvents::PRODUCTION_UPDATE , currentStep); m_events.addEvent( ScheduleEvents::PRODUCTION_UPDATE , currentStep);
this->addWellEvent( well.name(), ScheduleEvents::PRODUCTION_UPDATE, currentStep); this->addWellEvent( well.name(), ScheduleEvents::PRODUCTION_UPDATE, currentStep);
} }
} else {
bool switching_from_injector = !well.isProducer(currentStep);
WellProductionProperties properties(well.getProductionProperties(currentStep));
properties.handleWCONHIST(record);
if (switching_from_injector)
properties.resetDefaultBHPLimit();
if (well.setProductionProperties(currentStep, properties)) {
m_events.addEvent( ScheduleEvents::PRODUCTION_UPDATE , currentStep);
this->addWellEvent( well.name(), ScheduleEvents::PRODUCTION_UPDATE, currentStep);
}
if ( !well.getAllowCrossFlow() && !isPredictionMode && (properties.OilRate + properties.WaterRate + properties.GasRate) == 0 ) { if ( !well.getAllowCrossFlow() && !isPredictionMode && (properties.OilRate + properties.WaterRate + properties.GasRate) == 0 ) {
std::string msg = std::string msg =
@ -680,6 +706,7 @@ namespace Opm {
} }
} }
} }
}
void Schedule::updateWellStatus( Well& well, size_t reportStep , WellCommon::StatusEnum status) { void Schedule::updateWellStatus( Well& well, size_t reportStep , WellCommon::StatusEnum status) {
if( well.setStatus( reportStep, status ) ) { if( well.setStatus( reportStep, status ) ) {

View File

@ -36,16 +36,13 @@ namespace Opm {
void WellProductionProperties::init_rates( const DeckRecord& record ) { void WellProductionProperties::init_rates( const DeckRecord& record ) {
this->OilRate = ( record.getItem( "ORAT" ).getSIDouble( 0 ) ); this->OilRate = record.getItem("ORAT").getSIDouble(0);
this->WaterRate = ( record.getItem( "WRAT" ).getSIDouble( 0 ) ); this->WaterRate = record.getItem("WRAT").getSIDouble(0);
this->GasRate = ( record.getItem( "GRAT" ).getSIDouble( 0 ) ); this->GasRate = record.getItem("GRAT").getSIDouble(0);
} }
void WellProductionProperties::init_history(const WellProductionProperties& prev_properties, void WellProductionProperties::init_history(const DeckRecord& record)
const DeckRecord& record,
const WellProducer::ControlModeEnum controlModeWHISTCL,
const bool switching_from_injector)
{ {
this->predictionMode = false; this->predictionMode = false;
// update LiquidRate // update LiquidRate
@ -63,14 +60,14 @@ namespace Opm {
} }
namespace wp = WellProducer; namespace wp = WellProducer;
auto cmode = wp::ControlModeFromString( cmodeItem.getTrimmedString( 0 ) ); auto cmode = wp::CMODE_UNDEFINED;
// when there is an effective control mode specified by WHISTCL, we always use this control mode if (effectiveHistoryProductionControl(this->whistctl_cmode) )
if (effectiveHistoryProductionControl(controlModeWHISTCL) ) { cmode = this->whistctl_cmode;
cmode = controlModeWHISTCL; else
} cmode = wp::ControlModeFromString( cmodeItem.getTrimmedString( 0 ) );
if (effectiveHistoryProductionControl(cmode) ) { if (effectiveHistoryProductionControl(cmode)) {
this->addProductionControl( cmode ); this->addProductionControl( cmode );
this->controlMode = cmode; this->controlMode = cmode;
} else { } else {
@ -84,44 +81,30 @@ namespace Opm {
if ( !this->hasProductionControl( wp::BHP ) ) if ( !this->hasProductionControl( wp::BHP ) )
this->addProductionControl( wp::BHP ); this->addProductionControl( wp::BHP );
if (cmode == wp::BHP) { if (cmode == wp::BHP)
this->setBHPLimit(this->BHPH); this->setBHPLimit(this->BHPH);
} else {
// when the well is switching to history matching producer from prediction mode
// or switching from injector to producer
// or switching from BHP control to RATE control (under history matching mode)
// we use the defaulted BHP limit, otherwise, we use the previous BHP limit
if ( prev_properties.predictionMode || switching_from_injector
|| prev_properties.controlMode == wp::BHP ) {
this->resetDefaultBHPLimit();
} else {
this->setBHPLimit(prev_properties.getBHPLimit());
}
}
this->VFPTableNumber = record.getItem("VFPTable").get< int >(0); const auto vfp_table = record.getItem("VFPTable").get< int >(0);
if (vfp_table != 0)
this->VFPTableNumber = vfp_table;
if (this->VFPTableNumber == 0) auto alq_value = record.getItem("Lift").get< double >(0); //NOTE: Unit of ALQ is never touched
this->VFPTableNumber = prev_properties.VFPTableNumber; if (alq_value != 0.)
this->ALQValue = alq_value;
this->ALQValue = record.getItem("Lift").get< double >(0); //NOTE: Unit of ALQ is never touched
if (this->ALQValue == 0.)
this->ALQValue = prev_properties.ALQValue;
} }
void WellProductionProperties::init_prediction( const DeckRecord& record, bool addGroupProductionControl) void WellProductionProperties::handleWCONPROD( const DeckRecord& record )
{ {
this->predictionMode = true; this->predictionMode = true;
this->LiquidRate = record.getItem("LRAT" ).getSIDouble(0);
this->ResVRate = record.getItem("RESV" ).getSIDouble(0);
this->BHPLimit = record.getItem("BHP" ).getSIDouble(0); this->BHPLimit = record.getItem("BHP" ).getSIDouble(0);
this->THPLimit = record.getItem("THP" ).getSIDouble(0); this->THPLimit = record.getItem("THP" ).getSIDouble(0);
this->ALQValue = record.getItem("ALQ" ).get< double >(0); //NOTE: Unit of ALQ is never touched this->ALQValue = record.getItem("ALQ" ).get< double >(0); //NOTE: Unit of ALQ is never touched
this->VFPTableNumber = record.getItem("VFP_TABLE").get< int >(0); this->VFPTableNumber = record.getItem("VFP_TABLE").get< int >(0);
this->LiquidRate = record.getItem("LRAT").getSIDouble(0);
this->ResVRate = record.getItem("RESV").getSIDouble(0);
namespace wp = WellProducer; namespace wp = WellProducer;
using mode = std::pair< const std::string, wp::ControlModeEnum >; using mode = std::pair< const std::string, wp::ControlModeEnum >;
@ -130,6 +113,8 @@ namespace Opm {
{ "LRAT", wp::LRAT }, { "RESV", wp::RESV }, { "THP", wp::THP } { "LRAT", wp::LRAT }, { "RESV", wp::RESV }, { "THP", wp::THP }
}; };
this->init_rates(record);
for( const auto& cmode : modes ) { for( const auto& cmode : modes ) {
if( !record.getItem( cmode.first ).defaultApplied( 0 ) ) { if( !record.getItem( cmode.first ).defaultApplied( 0 ) ) {
@ -143,12 +128,6 @@ namespace Opm {
// There is always a BHP constraint, when not specified, will use the default value // There is always a BHP constraint, when not specified, will use the default value
this->addProductionControl( wp::BHP ); this->addProductionControl( wp::BHP );
if (addGroupProductionControl) {
this->addProductionControl(WellProducer::GRUP);
}
{ {
const auto& cmodeItem = record.getItem("CMODE"); const auto& cmodeItem = record.getItem("CMODE");
if (cmodeItem.hasValue(0)) { if (cmodeItem.hasValue(0)) {
@ -157,26 +136,37 @@ namespace Opm {
if (this->hasProductionControl( cmode )) if (this->hasProductionControl( cmode ))
this->controlMode = cmode; this->controlMode = cmode;
else else
throw std::invalid_argument("Setting CMODE to unspecified control"); throw std::invalid_argument("Trying to set CMODE to: " + cmodeItem.getTrimmedString(0) + " - no value has been specified for this control");
} }
} }
} }
WellProductionProperties::WellProductionProperties(const DeckRecord& record, /*
bool prediction_mode, This is now purely "history" constructor - i.e. the record should
const WellProductionProperties& prev_properties, originate from the WCONHIST keyword. Predictions are handled with the
WellProducer::ControlModeEnum controlModeWHISTCTL, default constructor and the handleWCONPROD() method.
bool switching_from_injector, */
bool addGrupProductionControl) void WellProductionProperties::handleWCONHIST(const DeckRecord& record)
{ {
this->init_rates(record); this->init_rates(record);
if (prediction_mode) this->LiquidRate = 0;
this->init_prediction(record, addGrupProductionControl); this->ResVRate = 0;
else
this->init_history(prev_properties, record, controlModeWHISTCTL, switching_from_injector); // when the well is switching to history matching producer from prediction mode
// or switching from injector to producer
// or switching from BHP control to RATE control (under history matching mode)
// we use the defaulted BHP limit, otherwise, we use the previous BHP limit
if (this->predictionMode)
this->resetDefaultBHPLimit();
if (this->controlMode == WellProducer::BHP)
this->resetDefaultBHPLimit();
this->init_history(record);
} }
bool WellProductionProperties::operator==(const WellProductionProperties& other) const { bool WellProductionProperties::operator==(const WellProductionProperties& other) const {
return OilRate == other.OilRate return OilRate == other.OilRate
&& WaterRate == other.WaterRate && WaterRate == other.WaterRate
@ -190,6 +180,7 @@ namespace Opm {
&& VFPTableNumber == other.VFPTableNumber && VFPTableNumber == other.VFPTableNumber
&& controlMode == other.controlMode && controlMode == other.controlMode
&& m_productionControls == other.m_productionControls && m_productionControls == other.m_productionControls
&& whistctl_cmode == other.whistctl_cmode
&& this->predictionMode == other.predictionMode; && this->predictionMode == other.predictionMode;
} }

View File

@ -745,33 +745,15 @@ namespace {
return input; return input;
} }
std::string whistctl() {
const std::string input =
"WHISTCTL\n"
"ORAT /\n"
"WCONHIST\n"
"-- 1 2 3 4-6 7 8 9 10\n"
" 'P' 'OPEN' 'RESV' 3* 3 10. 1* 500/\n/\n";
return input;
}
Opm::WellProductionProperties properties(const std::string& input) { Opm::WellProductionProperties properties(const std::string& input) {
Opm::Parser parser; Opm::Parser parser;
auto deck = parser.parseString(input); auto deck = parser.parseString(input);
const auto& record = deck.getKeyword("WCONHIST").getRecord(0); const auto& record = deck.getKeyword("WCONHIST").getRecord(0);
Opm::WellProductionProperties prev_p; Opm::WellProductionProperties hist;
prev_p.BHPLimit = 100.; hist.handleWCONHIST(record);
prev_p.VFPTableNumber = 12;
prev_p.ALQValue = 18.;
Opm::WellProducer::ControlModeEnum whistctl_cmode = Opm::WellProducer::NONE;
if (deck.hasKeyword("WHISTCTL") ) {
const auto& whistctl_record = deck.getKeyword("WHISTCTL").getRecord(0);
const std::string& cmode_string = whistctl_record.getItem("CMODE").getTrimmedString(0);
whistctl_cmode = Opm::WellProducer::ControlModeFromString(cmode_string);
}
Opm::WellProductionProperties hist(record, false, prev_p, whistctl_cmode, false, false);
return hist; return hist;
} }
@ -823,9 +805,8 @@ namespace {
auto deck = parser.parseString(input); auto deck = parser.parseString(input);
const auto& kwd = deck.getKeyword("WCONPROD"); const auto& kwd = deck.getKeyword("WCONPROD");
const auto& record = kwd.getRecord(0); const auto& record = kwd.getRecord(0);
Opm::WellProducer::ControlModeEnum whistctl_cmode = Opm::WellProducer::NONE; Opm::WellProductionProperties pred;
Opm::WellProductionProperties prev_properties; pred.handleWCONPROD(record);
Opm::WellProductionProperties pred( record, true, prev_properties, whistctl_cmode, false, false );
return pred; return pred;
} }
@ -847,8 +828,6 @@ BOOST_AUTO_TEST_CASE(WCH_All_Specified_BHP_Defaulted)
BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::ORAT); BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::ORAT);
BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::BHP)); BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::BHP));
BOOST_CHECK_EQUAL(p.VFPTableNumber, 12);
BOOST_CHECK_EQUAL(p.ALQValue, 18.);
BOOST_CHECK_EQUAL(p.BHPLimit, 101325.); BOOST_CHECK_EQUAL(p.BHPLimit, 101325.);
} }
@ -865,8 +844,6 @@ BOOST_AUTO_TEST_CASE(WCH_ORAT_Defaulted_BHP_Defaulted)
BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::WRAT); BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::WRAT);
BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::BHP)); BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::BHP));
BOOST_CHECK_EQUAL(p.VFPTableNumber, 12);
BOOST_CHECK_EQUAL(p.ALQValue, 18.);
BOOST_CHECK_EQUAL(p.BHPLimit, 101325.); BOOST_CHECK_EQUAL(p.BHPLimit, 101325.);
} }
@ -883,8 +860,6 @@ BOOST_AUTO_TEST_CASE(WCH_OWRAT_Defaulted_BHP_Defaulted)
BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::GRAT); BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::GRAT);
BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::BHP)); BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::BHP));
BOOST_CHECK_EQUAL(p.VFPTableNumber, 12);
BOOST_CHECK_EQUAL(p.ALQValue, 18.);
BOOST_CHECK_EQUAL(p.BHPLimit, 101325.); BOOST_CHECK_EQUAL(p.BHPLimit, 101325.);
} }
@ -901,8 +876,6 @@ BOOST_AUTO_TEST_CASE(WCH_Rates_Defaulted_BHP_Defaulted)
BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::LRAT); BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::LRAT);
BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::BHP)); BOOST_CHECK(p.hasProductionControl(Opm::WellProducer::BHP));
BOOST_CHECK_EQUAL(p.VFPTableNumber, 12);
BOOST_CHECK_EQUAL(p.ALQValue, 18.);
BOOST_CHECK_EQUAL(p.BHPLimit, 101325.); BOOST_CHECK_EQUAL(p.BHPLimit, 101325.);
} }
@ -920,8 +893,6 @@ BOOST_AUTO_TEST_CASE(WCH_Rates_Defaulted_BHP_Specified)
BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::RESV); BOOST_CHECK_EQUAL(p.controlMode , Opm::WellProducer::RESV);
BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::WellProducer::BHP)); BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::WellProducer::BHP));
BOOST_CHECK_EQUAL(p.VFPTableNumber, 12);
BOOST_CHECK_EQUAL(p.ALQValue, 18.);
BOOST_CHECK_EQUAL(p.BHPLimit, 101325.); BOOST_CHECK_EQUAL(p.BHPLimit, 101325.);
} }
@ -944,27 +915,6 @@ BOOST_AUTO_TEST_CASE(WCH_Rates_NON_Defaulted_VFP)
BOOST_CHECK_EQUAL(p.BHPLimit, 101325.); BOOST_CHECK_EQUAL(p.BHPLimit, 101325.);
} }
BOOST_AUTO_TEST_CASE(WCH_Whistctl)
{
const Opm::WellProductionProperties& p =
WCONHIST::properties(WCONHIST::whistctl());
// the original RESV contorl in WCONHIST should be overwritten by
// ORAT specified with WHISCTL now.
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::ORAT);
BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::WellProducer::BHP));
BOOST_CHECK_EQUAL(p.VFPTableNumber, 3);
BOOST_CHECK_EQUAL(p.ALQValue, 10.);
BOOST_CHECK_EQUAL(p.BHPLimit, 101325.);
}
BOOST_AUTO_TEST_CASE(WCH_BHP_Specified) BOOST_AUTO_TEST_CASE(WCH_BHP_Specified)
{ {
const Opm::WellProductionProperties& p = const Opm::WellProductionProperties& p =
@ -980,15 +930,12 @@ BOOST_AUTO_TEST_CASE(WCH_BHP_Specified)
BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::WellProducer::BHP)); BOOST_CHECK_EQUAL(true, p.hasProductionControl(Opm::WellProducer::BHP));
BOOST_CHECK_EQUAL(p.VFPTableNumber, 12);
BOOST_CHECK_EQUAL(p.ALQValue, 18.);
BOOST_CHECK_EQUAL(p.BHPLimit, 5.e7); // 500 barsa BOOST_CHECK_EQUAL(p.BHPLimit, 5.e7); // 500 barsa
} }
BOOST_AUTO_TEST_CASE(WCONPROD_ORAT_CMode) BOOST_AUTO_TEST_CASE(WCONPROD_ORAT_CMode)
{ {
const Opm::WellProductionProperties& p = const Opm::WellProductionProperties& p = WCONPROD::properties(WCONPROD::orat_CMODE_other_defaulted());
WCONPROD::properties(WCONPROD::orat_CMODE_other_defaulted());
BOOST_CHECK( p.hasProductionControl(Opm::WellProducer::ORAT)); BOOST_CHECK( p.hasProductionControl(Opm::WellProducer::ORAT));
BOOST_CHECK( p.hasProductionControl(Opm::WellProducer::WRAT)); BOOST_CHECK( p.hasProductionControl(Opm::WellProducer::WRAT));