Add Well::production_rate/injection_rate

Two convenince call for downstream users that allows querying well rates
with the assumption that if something is unsupported or of the wrong
type, return plain zero.
This commit is contained in:
Jørgen Kvalsvik
2016-06-17 13:39:54 +02:00
parent c3db8fc3a0
commit 1a0465c4fc
2 changed files with 38 additions and 0 deletions

View File

@@ -88,6 +88,33 @@ namespace Opm {
}
double Well::production_rate( Phase::PhaseEnum phase, size_t timestep ) const {
if( !this->isProducer( timestep ) ) return 0.0;
const auto& p = this->getProductionProperties( timestep );
switch( phase ) {
case Phase::WATER: return p.WaterRate;
case Phase::OIL: return p.OilRate;
case Phase::GAS: return p.GasRate;
}
throw std::logic_error( "Unreachable state. Invalid PhaseEnum value. "
"This is likely a programming error." );
}
double Well::injection_rate( Phase::PhaseEnum phase, size_t timestep ) const {
if( !this->isInjector( timestep ) ) return 0.0;
const auto& i = this->getInjectionProperties( timestep );
const auto type = i.injectorType;
if( phase == Phase::WATER && type != WellInjector::WATER ) return 0.0;
if( phase == Phase::OIL && type != WellInjector::OIL ) return 0.0;
if( phase == Phase::GAS && type != WellInjector::GAS ) return 0.0;
return i.surfaceInjectionRate;
}
bool Well::setProductionProperties(size_t timeStep , const WellProductionProperties newProperties) {
if (isInjector(timeStep))