Added flag injectionControls to keep track of available injection controls.
This commit is contained in:
@@ -189,31 +189,37 @@ namespace Opm {
|
||||
resVRate = record->getItem("RESV")->getSIDouble(0);
|
||||
BHPLimit = record->getItem("BHP")->getSIDouble(0);
|
||||
THPLimit = record->getItem("THP")->getSIDouble(0);
|
||||
|
||||
if (record->getItem("LRAT")->defaultApplied())
|
||||
well->dropProductionControl( currentStep , WellProducer::LRAT );
|
||||
|
||||
if (record->getItem("RESV")->defaultApplied())
|
||||
well->dropProductionControl( currentStep , WellProducer::RESV );
|
||||
|
||||
if (record->getItem("BHP")->defaultApplied())
|
||||
well->dropProductionControl( currentStep , WellProducer::BHP );
|
||||
|
||||
if (record->getItem("THP")->defaultApplied())
|
||||
well->dropProductionControl( currentStep , WellProducer::THP );
|
||||
}
|
||||
|
||||
well->setLiquidRate( currentStep , liquidRate );
|
||||
well->setResVRate( currentStep , resVRate );
|
||||
well->setBHPLimit(currentStep, BHPLimit , true);
|
||||
well->setTHPLimit(currentStep, THPLimit , true);
|
||||
}
|
||||
|
||||
if (isPredictionMode) {
|
||||
if (record->getItem("LRAT")->defaultApplied())
|
||||
well->dropProductionControl( currentStep , WellProducer::LRAT );
|
||||
|
||||
if (record->getItem("RESV")->defaultApplied())
|
||||
well->dropProductionControl( currentStep , WellProducer::RESV );
|
||||
|
||||
if (record->getItem("BHP")->defaultApplied())
|
||||
well->dropProductionControl( currentStep , WellProducer::BHP );
|
||||
|
||||
if (record->getItem("THP")->defaultApplied())
|
||||
well->dropProductionControl( currentStep , WellProducer::THP );
|
||||
} else {
|
||||
well->dropProductionControl( currentStep , WellProducer::LRAT );
|
||||
well->dropProductionControl( currentStep , WellProducer::RESV );
|
||||
well->dropProductionControl( currentStep , WellProducer::BHP );
|
||||
well->dropProductionControl( currentStep , WellProducer::THP );
|
||||
}
|
||||
}
|
||||
|
||||
if (record->getItem("ORAT")->defaultApplied())
|
||||
well->dropProductionControl( currentStep , WellProducer::ORAT );
|
||||
|
||||
if (record->getItem("GRAT")->defaultApplied()) {
|
||||
std::cout << "Defaulted GRAT identified " << std::endl;
|
||||
well->dropProductionControl( currentStep , WellProducer::GRAT );
|
||||
}
|
||||
|
||||
@@ -235,10 +241,10 @@ namespace Opm {
|
||||
DeckRecordConstPtr record = keyword->getRecord(recordNr);
|
||||
const std::string& wellName = record->getItem("WELL")->getString(0);
|
||||
WellPtr well = getWell(wellName);
|
||||
double surfaceInjectionRate = record->getItem("SURFACE_FLOW_TARGET")->getSIDouble(0);
|
||||
double reservoirInjectionRate = record->getItem("RESV_FLOW_TARGET")->getSIDouble(0);
|
||||
double BHPLimit = record->getItem("BHP_TARGET")->getSIDouble(0);
|
||||
double THPLimit = record->getItem("THP_TARGET")->getSIDouble(0);
|
||||
double surfaceInjectionRate = record->getItem("RATE")->getSIDouble(0);
|
||||
double reservoirInjectionRate = record->getItem("RESV")->getSIDouble(0);
|
||||
double BHPLimit = record->getItem("BHP")->getSIDouble(0);
|
||||
double THPLimit = record->getItem("THP")->getSIDouble(0);
|
||||
WellInjector::ControlModeEnum controlMode = WellInjector::ControlModeFromString( record->getItem("CMODE")->getString(0));
|
||||
WellCommon::StatusEnum status = WellCommon::StatusFromString( record->getItem("STATUS")->getString(0));
|
||||
WellInjector::TypeEnum injectorType = WellInjector::TypeFromString( record->getItem("TYPE")->getString(0) );
|
||||
@@ -251,6 +257,19 @@ namespace Opm {
|
||||
well->setInjectorControlMode(currentStep , controlMode );
|
||||
well->setInjectorType( currentStep , injectorType );
|
||||
well->setInPredictionMode(currentStep, true);
|
||||
|
||||
if (record->getItem("RATE")->defaultApplied())
|
||||
well->dropInjectionControl( currentStep , WellInjector::RATE );
|
||||
|
||||
if (record->getItem("RESV")->defaultApplied())
|
||||
well->dropInjectionControl( currentStep , WellInjector::RESV );
|
||||
|
||||
if (record->getItem("THP")->defaultApplied())
|
||||
well->dropInjectionControl( currentStep , WellInjector::THP );
|
||||
|
||||
if (record->getItem("BHP")->defaultApplied())
|
||||
well->dropInjectionControl( currentStep , WellInjector::BHP );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -103,6 +103,7 @@ namespace Opm {
|
||||
THP = 128,
|
||||
GRUP = 256
|
||||
};
|
||||
|
||||
/*
|
||||
The items BHP, THP and GRUP only apply in prediction mode:
|
||||
WCONPROD. The elements in this enum are used as bitmasks to
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Opm {
|
||||
m_producerControlMode(new DynamicState<WellProducer::ControlModeEnum>(timeMap, WellProducer::ORAT)),
|
||||
m_status(new DynamicState<WellCommon::StatusEnum>(timeMap, WellCommon::OPEN)),
|
||||
m_productionControls(new DynamicState<int>(timeMap, 0)),
|
||||
m_injectorControls(new DynamicState<int>(timeMap, 0)),
|
||||
m_injectionControls(new DynamicState<int>(timeMap, 0)),
|
||||
m_inPredictionMode(new DynamicState<bool>(timeMap, true)),
|
||||
m_isProducer(new DynamicState<bool>(timeMap, true)) ,
|
||||
m_completions( new DynamicState<CompletionSetConstPtr>( timeMap , CompletionSetConstPtr( new CompletionSet()) )),
|
||||
@@ -84,8 +84,11 @@ namespace Opm {
|
||||
m_BHPLimit->add(timeStep, BHPLimit);
|
||||
if (producer)
|
||||
addProductionControl( timeStep , WellProducer::BHP);
|
||||
else
|
||||
addInjectionControl( timeStep , WellInjector::BHP );
|
||||
}
|
||||
|
||||
|
||||
double Well::getTHPLimit(size_t timeStep) const {
|
||||
return m_THPLimit->get(timeStep);
|
||||
}
|
||||
@@ -94,6 +97,8 @@ namespace Opm {
|
||||
m_THPLimit->add(timeStep, THPLimit);
|
||||
if (producer)
|
||||
addProductionControl( timeStep , WellProducer::THP);
|
||||
else
|
||||
addInjectionControl( timeStep , WellInjector::THP );
|
||||
}
|
||||
|
||||
WellInjector::TypeEnum Well::getInjectorType(size_t timeStep) const {
|
||||
@@ -179,6 +184,7 @@ namespace Opm {
|
||||
void Well::setSurfaceInjectionRate(size_t timeStep, double injectionRate) {
|
||||
m_surfaceInjectionRate->add(timeStep, injectionRate);
|
||||
switch2Injector( timeStep );
|
||||
addInjectionControl( timeStep , WellInjector::RATE );
|
||||
}
|
||||
|
||||
double Well::getReservoirInjectionRate(size_t timeStep) const {
|
||||
@@ -188,6 +194,7 @@ namespace Opm {
|
||||
void Well::setReservoirInjectionRate(size_t timeStep, double injectionRate) {
|
||||
m_reservoirInjectionRate->add(timeStep, injectionRate);
|
||||
switch2Injector( timeStep );
|
||||
addInjectionControl( timeStep , WellInjector::RESV );
|
||||
}
|
||||
|
||||
|
||||
@@ -220,6 +227,7 @@ namespace Opm {
|
||||
m_inPredictionMode->add(timeStep, inPredictionMode);
|
||||
}
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
bool Well::hasProductionControl(size_t timeStep , WellProducer::ControlModeEnum controlMode) const {
|
||||
int controls = m_productionControls->get( timeStep );
|
||||
@@ -248,10 +256,33 @@ namespace Opm {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
bool hasInjectorControl(size_t timeStep , WellInjector::ControlModeEnum controlMode) const;
|
||||
void addInjectorControl(size_t timeStep , WellInjector::ControlModeEnum controlMode);
|
||||
*/
|
||||
bool Well::hasInjectionControl(size_t timeStep , WellInjector::ControlModeEnum controlMode) const {
|
||||
int controls = m_injectionControls->get( timeStep );
|
||||
if (controls & controlMode)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void Well::addInjectionControl(size_t timeStep , WellInjector::ControlModeEnum controlMode) {
|
||||
int controls = m_injectionControls->get( timeStep );
|
||||
if ((controls & controlMode) == 0) {
|
||||
controls += controlMode;
|
||||
m_injectionControls->add(timeStep , controls );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Well::dropInjectionControl(size_t timeStep , WellInjector::ControlModeEnum controlMode) {
|
||||
int controls = m_injectionControls->get( timeStep );
|
||||
if ((controls & controlMode) != 0) {
|
||||
controls -= controlMode;
|
||||
m_injectionControls->add(timeStep , controls );
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
|
||||
// WELSPECS
|
||||
|
||||
@@ -68,8 +68,10 @@ namespace Opm {
|
||||
void setStatus(size_t timeStep, WellCommon::StatusEnum Status);
|
||||
|
||||
bool hasProductionControl(size_t timeStep , WellProducer::ControlModeEnum controlMode) const;
|
||||
bool hasInjectorControl(size_t timeStep , WellInjector::ControlModeEnum controlMode) const;
|
||||
void dropProductionControl(size_t timeStep , WellProducer::ControlModeEnum controlMode);
|
||||
|
||||
bool hasInjectionControl(size_t timeStep , WellInjector::ControlModeEnum controlMode) const;
|
||||
void dropInjectionControl(size_t timeStep , WellInjector::ControlModeEnum controlMode);
|
||||
|
||||
|
||||
int getHeadI() const;
|
||||
@@ -88,7 +90,7 @@ namespace Opm {
|
||||
void switch2Producer(size_t timeStep );
|
||||
void switch2Injector(size_t timeStep );
|
||||
|
||||
void addInjectorControl(size_t timeStep , WellInjector::ControlModeEnum controlMode);
|
||||
void addInjectionControl(size_t timeStep , WellInjector::ControlModeEnum controlMode);
|
||||
void addProductionControl(size_t timeStep , WellProducer::ControlModeEnum controlMode);
|
||||
|
||||
|
||||
@@ -108,7 +110,7 @@ namespace Opm {
|
||||
std::shared_ptr<DynamicState<WellProducer::ControlModeEnum> > m_producerControlMode;
|
||||
std::shared_ptr<DynamicState<WellCommon::StatusEnum> > m_status;
|
||||
std::shared_ptr<DynamicState<int> > m_productionControls;
|
||||
std::shared_ptr<DynamicState<int> > m_injectorControls;
|
||||
std::shared_ptr<DynamicState<int> > m_injectionControls;
|
||||
|
||||
std::shared_ptr<DynamicState<bool> > m_inPredictionMode;
|
||||
std::shared_ptr<DynamicState<bool> > m_isProducer;
|
||||
|
||||
@@ -345,3 +345,37 @@ BOOST_AUTO_TEST_CASE(WellHaveProductionControlLimit) {
|
||||
BOOST_CHECK( well.hasProductionControl( 11 , Opm::WellProducer::BHP ));
|
||||
BOOST_CHECK( well.hasProductionControl( 11 , Opm::WellProducer::THP ));
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(WellHaveInjectionControlLimit) {
|
||||
|
||||
Opm::TimeMapPtr timeMap = createXDaysTimeMap(20);
|
||||
Opm::Well well("WELL1", 1, 2, 2334.32, timeMap, 0);
|
||||
|
||||
|
||||
BOOST_CHECK( !well.hasInjectionControl( 1 , Opm::WellInjector::RATE ));
|
||||
BOOST_CHECK( !well.hasInjectionControl( 1 , Opm::WellInjector::RESV ));
|
||||
|
||||
well.setSurfaceInjectionRate( 2 , 100 );
|
||||
BOOST_CHECK( well.hasInjectionControl( 2, Opm::WellInjector::RATE ));
|
||||
BOOST_CHECK( !well.hasInjectionControl( 2 , Opm::WellInjector::RESV ));
|
||||
|
||||
well.setReservoirInjectionRate( 2 , 100 );
|
||||
BOOST_CHECK( well.hasInjectionControl( 2 , Opm::WellInjector::RESV ));
|
||||
|
||||
well.setBHPLimit( 10 , 100 , false);
|
||||
well.setTHPLimit( 10 , 100 , false);
|
||||
|
||||
BOOST_CHECK( well.hasInjectionControl( 10 , Opm::WellInjector::RATE ));
|
||||
BOOST_CHECK( well.hasInjectionControl( 10 , Opm::WellInjector::RESV ));
|
||||
BOOST_CHECK( well.hasInjectionControl( 10 , Opm::WellInjector::THP ));
|
||||
BOOST_CHECK( well.hasInjectionControl( 10 , Opm::WellInjector::BHP ));
|
||||
|
||||
well.dropInjectionControl( 11 , Opm::WellInjector::RESV );
|
||||
|
||||
BOOST_CHECK( well.hasInjectionControl( 11 , Opm::WellInjector::RATE ));
|
||||
BOOST_CHECK( !well.hasInjectionControl( 11 , Opm::WellInjector::RESV ));
|
||||
BOOST_CHECK( well.hasInjectionControl( 11 , Opm::WellInjector::THP ));
|
||||
BOOST_CHECK( well.hasInjectionControl( 11 , Opm::WellInjector::BHP ));
|
||||
}
|
||||
|
||||
@@ -142,6 +142,17 @@ BOOST_AUTO_TEST_CASE(WellTesting) {
|
||||
BOOST_CHECK_EQUAL( WellInjector::RATE , well1->getInjectorControlMode( 11 ));
|
||||
BOOST_CHECK_EQUAL( WellCommon::OPEN , well1->getStatus( 11 ));
|
||||
BOOST_CHECK_EQUAL( WellCommon::SHUT , well1->getStatus( 12 ));
|
||||
|
||||
BOOST_CHECK( well1->hasInjectionControl( 9 , WellInjector::RATE ));
|
||||
BOOST_CHECK( well1->hasInjectionControl( 9 , WellInjector::RESV ));
|
||||
BOOST_CHECK( !well1->hasInjectionControl( 9 , WellInjector::THP ));
|
||||
BOOST_CHECK( !well1->hasInjectionControl( 9 , WellInjector::BHP ));
|
||||
|
||||
BOOST_CHECK( well1->hasInjectionControl( 12 , WellInjector::RATE ));
|
||||
BOOST_CHECK( !well1->hasInjectionControl( 12 , WellInjector::RESV ));
|
||||
BOOST_CHECK( well1->hasInjectionControl( 12 , WellInjector::THP ));
|
||||
BOOST_CHECK( well1->hasInjectionControl( 12 , WellInjector::BHP ));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
{"name" : "TYPE" , "value_type" : "STRING" },
|
||||
{"name" : "STATUS" , "value_type" : "STRING" , "default" : "OPEN"},
|
||||
{"name" : "CMODE" , "value_type" : "STRING" },
|
||||
{"name" : "SURFACE_FLOW_TARGET" , "value_type" : "FLOAT" , "dimension" : "FlowVolume/t"},
|
||||
{"name" : "RESV_FLOW_TARGET" , "value_type" : "FLOAT" , "dimension" : "FlowVolume/t"},
|
||||
{"name" : "BHP_TARGET" , "value_type" : "FLOAT" , "dimension" : "P" , "default" : 6891},
|
||||
{"name" : "THP_TARGET" , "value_type" : "FLOAT" , "dimension" : "P"},
|
||||
{"name" : "RATE" , "value_type" : "FLOAT" , "dimension" : "FlowVolume/t"},
|
||||
{"name" : "RESV" , "value_type" : "FLOAT" , "dimension" : "FlowVolume/t"},
|
||||
{"name" : "BHP" , "value_type" : "FLOAT" , "dimension" : "P" , "default" : 6891},
|
||||
{"name" : "THP" , "value_type" : "FLOAT" , "dimension" : "P"},
|
||||
{"name" : "VFP_TABLE" , "value_type" : "INT" , "default" : 0},
|
||||
{"name" : "VAPOIL_C" , "value_type" : "FLOAT" , "default" : 0},
|
||||
{"name" : "GAS_STEAM_RATIO" , "value_type" : "FLOAT" , "default" : 0},
|
||||
|
||||
@@ -117,5 +117,5 @@ DATES -- 12
|
||||
/
|
||||
|
||||
WCONINJE
|
||||
'W_1' 'WATER' 'SHUT' 'RATE' 20000.000 200000.000 123 678 4* /
|
||||
'W_1' 'WATER' 'SHUT' 'RATE' 20000.000 * 123 678 4* /
|
||||
/
|
||||
|
||||
Reference in New Issue
Block a user