re-organizing the history() for WellProductionProperties

This commit is contained in:
Kai Bao
2019-01-03 12:21:25 +01:00
parent 875626b738
commit c6bbe5d24b
3 changed files with 54 additions and 37 deletions

View File

@@ -986,6 +986,9 @@ namespace Opm {
updateWellStatus( *well, currentStep, status );
WellInjectionProperties properties(well->getInjectionPropertiesCopy(currentStep));
std::cout << " well " << well->name() << " currentStep " << currentStep << " prev_properties " << std::endl
<< properties << std::endl;
properties.injectorType = injectorType;
if (!record.getItem("RATE").defaultApplied(0)) {
@@ -1004,6 +1007,8 @@ namespace Opm {
// Otherwise, we need to make a decision
// TODO: some tests are required to check how WELTARG interacts with WCONINJH BHP control
const bool switching_from_producer = well->isProducer(currentStep);
std::cout << " well " << well->name() << " switching_from_producer " << switching_from_producer
<< " at report step " << currentStep << std::endl;
if (properties.predictionMode || properties.controlMode == WellInjector::BHP || switching_from_producer) {
// there is no document about what value the default BHP limit should be
// we use the one from WCONINJE for now
@@ -1025,6 +1030,9 @@ namespace Opm {
properties.VFPTableNumber = VFPTableNumber;
}
std::cout << " well " << well->name() << " currentStep " << currentStep << " new_properties " << std::endl
<< properties << std::endl;
if (well->setInjectionProperties(currentStep, properties))
m_events.addEvent( ScheduleEvents::INJECTION_UPDATE , currentStep );

View File

@@ -53,47 +53,56 @@ namespace Opm {
// update LiquidRate
p.LiquidRate = p.WaterRate + p.OilRate;
const auto& cmodeItem = record.getItem("CMODE");
if ( !cmodeItem.defaultApplied(0) ) {
namespace wp = WellProducer;
auto cmode = wp::ControlModeFromString( cmodeItem.getTrimmedString( 0 ) );
// when there is an effective control mode specified by WHISTCL, we always use this control mode
if (effectiveHistoryProductionControl(controlModeWHISTCL) ) {
cmode = controlModeWHISTCL;
}
if (effectiveHistoryProductionControl(cmode) ) {
p.addProductionControl( cmode );
p.controlMode = cmode;
} else {
const std::string cmode_string = cmodeItem.getTrimmedString( 0 );
const std::string msg = "unsupported control mode " + cmode_string + " for WCONHIST";
throw std::invalid_argument(msg);
}
// 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 ( !p.hasProductionControl( wp::BHP ) )
p.addProductionControl( wp::BHP );
if (cmode == wp::BHP) {
p.BHPLimit = record.getItem( "BHP" ).getSIDouble( 0 );
} else {
if (!prev_properties.predictionMode && !switching_from_injector) {
p.BHPLimit = prev_properties.BHPLimit;
} else {
// by default the BHP limit is 1 atm
p.BHPLimit = 1. * unit::atm;
}
}
}
if ( record.getItem( "BHP" ).hasValue(0) )
p.BHPH = record.getItem("BHP").getSIDouble(0);
if ( record.getItem( "THP" ).hasValue(0) )
p.THPH = record.getItem("THP").getSIDouble(0);
const auto& cmodeItem = record.getItem("CMODE");
if ( cmodeItem.defaultApplied(0) ) {
const std::string msg = "control mode can not be defaulted for keyword WCONHIST";
throw std::invalid_argument(msg);
}
namespace wp = WellProducer;
auto cmode = wp::ControlModeFromString( cmodeItem.getTrimmedString( 0 ) );
// when there is an effective control mode specified by WHISTCL, we always use this control mode
if (effectiveHistoryProductionControl(controlModeWHISTCL) ) {
cmode = controlModeWHISTCL;
}
if (effectiveHistoryProductionControl(cmode) ) {
p.addProductionControl( cmode );
p.controlMode = cmode;
} else {
const std::string cmode_string = cmodeItem.getTrimmedString( 0 );
const std::string msg = "unsupported control mode " + cmode_string + " for WCONHIST";
throw std::invalid_argument(msg);
}
// 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 ( !p.hasProductionControl( wp::BHP ) )
p.addProductionControl( wp::BHP );
if (cmode == wp::BHP) {
p.BHPLimit = p.BHPH;
} else {
// when first time the well is claimed to be history matching producer
// or switching from injector to producer
// or switching from BHP control to RATE control
// 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 ) {
// by default the BHP limit is 1 atm
p.BHPLimit = 1. * unit::atm;
} else {
p.BHPLimit = prev_properties.BHPLimit;
}
}
p.VFPTableNumber = record.getItem("VFPTable").get< int >(0);
if (p.VFPTableNumber == 0)

View File

@@ -70,7 +70,7 @@ WELOPEN
/
WCONHIST
'W3' 'SHUT' /
'W3' 'SHUT' 'ORAT'/
/