#1298 Included wells with "closed" state consistently

This commit is contained in:
Jacob Støren
2017-03-07 12:19:19 +01:00
parent 6a3f3e3670
commit c9dc41d374
6 changed files with 59 additions and 70 deletions

View File

@@ -172,17 +172,10 @@ std::map<std::string, std::vector<int> > RimFlowDiagSolution::allTracerActiveCel
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx ) for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx )
{ {
if (!wellResults[wIdx]->hasWellResult(timeStepIndex) ) continue; if (!wellResults[wIdx]->hasWellResult(timeStepIndex) ) continue;
const RigWellResultFrame& wellResFrame = wellResults[wIdx]->wellResultFrame(timeStepIndex);
size_t wellTimeStep = wellResults[wIdx]->m_resultTimeStepIndexToWellTimeStepIndex[timeStepIndex];
bool isInjectorWell = ( wellResFrame.m_productionType != RigWellResultFrame::PRODUCER
if (wellTimeStep == cvf::UNDEFINED_SIZE_T) continue; && wellResFrame.m_productionType != RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE);
const RigWellResultFrame& wellResFrame = wellResults[wIdx]->m_wellCellsTimeSteps[wellTimeStep];
if ( !wellResFrame.m_isOpen ) continue;
if (wellResFrame.m_productionType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE) continue;
bool isInjectorWell = (wellResFrame.m_productionType != RigWellResultFrame::PRODUCER);
std::string wellname = wellResults[wIdx]->m_wellName.toStdString(); std::string wellname = wellResults[wIdx]->m_wellName.toStdString();
std::string wellNameXf = addCrossFlowEnding(wellResults[wIdx]->m_wellName).toStdString(); std::string wellNameXf = addCrossFlowEnding(wellResults[wIdx]->m_wellName).toStdString();
@@ -242,20 +235,17 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusOverall(c
tracerStatus = CLOSED; tracerStatus = CLOSED;
for ( const RigWellResultFrame& wellResFrame : wellResults[wIdx]->m_wellCellsTimeSteps ) for ( const RigWellResultFrame& wellResFrame : wellResults[wIdx]->m_wellCellsTimeSteps )
{ {
if (wellResFrame.m_isOpen) if ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR )
{ {
if ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR if ( tracerStatus == PRODUCER ) tracerStatus = VARYING;
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR else tracerStatus = INJECTOR;
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR ) }
{ else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER )
if ( tracerStatus == PRODUCER ) tracerStatus = VARYING; {
else tracerStatus = INJECTOR; if ( tracerStatus == INJECTOR ) tracerStatus = VARYING;
} else tracerStatus = PRODUCER;
else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER )
{
if ( tracerStatus == INJECTOR ) tracerStatus = VARYING;
else tracerStatus = PRODUCER;
}
} }
if ( tracerStatus == VARYING ) break; if ( tracerStatus == VARYING ) break;
} }
@@ -287,33 +277,28 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeSte
QString wellName = removeCrossFlowEnding(tracerName); QString wellName = removeCrossFlowEnding(tracerName);
if ( wellResults[wIdx]->m_wellName != wellName ) continue; if ( wellResults[wIdx]->m_wellName != wellName ) continue;
if (!wellResults[wIdx]->hasWellResult(timeStepIndex)) return CLOSED;
size_t wellTimeStep = wellResults[wIdx]->m_resultTimeStepIndexToWellTimeStepIndex[timeStepIndex]; const RigWellResultFrame& wellResFrame = wellResults[wIdx]->wellResultFrame(timeStepIndex);
if (wellTimeStep == cvf::UNDEFINED_SIZE_T) return CLOSED; if ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR
const RigWellResultFrame& wellResFrame = wellResults[wIdx]->m_wellCellsTimeSteps[wellTimeStep]; || wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR )
{ {
if (!wellResFrame.m_isOpen) return CLOSED; if ( hasCrossFlowEnding(tracerName) ) return PRODUCER;
if ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR return INJECTOR;
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR }
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR ) else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER
{ || wellResFrame.m_productionType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE )
if (hasCrossFlowEnding(tracerName)) return PRODUCER; {
if ( hasCrossFlowEnding(tracerName) ) return INJECTOR;
return INJECTOR; return PRODUCER;
} }
else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER ) else
{ {
if (hasCrossFlowEnding(tracerName)) return INJECTOR; CVF_ASSERT(false);
return PRODUCER;
}
else
{
return UNDEFINED;
}
} }
} }

View File

@@ -49,11 +49,11 @@ public:
enum TracerStatusType enum TracerStatusType
{ {
CLOSED, CLOSED, ///< Tracer has no active cells, and does not contribute
PRODUCER, PRODUCER, ///< Tracer with producing cells
INJECTOR, INJECTOR, ///< Tracer with injecting cells
VARYING, VARYING, ///< Tracer is producing and injecting at different time steps. Only used as a timestep-overall type
UNDEFINED UNDEFINED ///< Used as "Any" or "not set"
}; };
TracerStatusType tracerStatusOverall(const QString& tracerName); TracerStatusType tracerStatusOverall(const QString& tracerName);

View File

@@ -84,7 +84,10 @@ void RimFlowPlotCollection::loadDataAndUpdate()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
size_t RimFlowPlotCollection::plotCount() const size_t RimFlowPlotCollection::plotCount() const
{ {
return m_flowPlots.size(); size_t plotCount = 0;
if (m_defaultPlot) plotCount = 1;
plotCount += m_flowPlots.size();
return plotCount;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -206,7 +206,8 @@ void RimWellAllocationPlot::updateFromWell()
if ( tracerFractionCellValues.size() ) if ( tracerFractionCellValues.size() )
{ {
bool isProducer = wellResults->wellProductionType(m_timeStep) == RigWellResultFrame::PRODUCER ; bool isProducer = ( wellResults->wellProductionType(m_timeStep) == RigWellResultFrame::PRODUCER
|| wellResults->wellProductionType(m_timeStep) == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE );
RigEclCellIndexCalculator cellIdxCalc(m_case->reservoirData()->mainGrid(), m_case->reservoirData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)); RigEclCellIndexCalculator cellIdxCalc(m_case->reservoirData()->mainGrid(), m_case->reservoirData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS));
wfCalculator.reset(new RigAccWellFlowCalculator(pipeBranchesCLCoords, wfCalculator.reset(new RigAccWellFlowCalculator(pipeBranchesCLCoords,
pipeBranchesCellIds, pipeBranchesCellIds,
@@ -341,31 +342,29 @@ std::map<QString, const std::vector<double> *> RimWellAllocationPlot::findReleva
{ {
std::map<QString, const std::vector<double> *> tracerCellFractionValues; std::map<QString, const std::vector<double> *> tracerCellFractionValues;
if ( m_flowDiagSolution && wellResults->isOpen(m_timeStep) ) if ( m_flowDiagSolution && wellResults->hasWellResult(m_timeStep) )
{ {
RimFlowDiagSolution::TracerStatusType requestedTracerType = RimFlowDiagSolution::UNDEFINED; RimFlowDiagSolution::TracerStatusType requestedTracerType = RimFlowDiagSolution::UNDEFINED;
const RigWellResultFrame::WellProductionType prodType = wellResults->wellProductionType(m_timeStep); const RigWellResultFrame::WellProductionType prodType = wellResults->wellProductionType(m_timeStep);
if ( prodType == RigWellResultFrame::PRODUCER ) if ( prodType == RigWellResultFrame::PRODUCER
|| prodType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE )
{ {
requestedTracerType = RimFlowDiagSolution::INJECTOR; requestedTracerType = RimFlowDiagSolution::INJECTOR;
} }
else if (prodType != RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE) else
{ {
requestedTracerType = RimFlowDiagSolution::PRODUCER; requestedTracerType = RimFlowDiagSolution::PRODUCER;
} }
if ( prodType != RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE ) std::vector<QString> tracerNames = m_flowDiagSolution->tracerNames();
for ( const QString& tracerName : tracerNames )
{ {
std::vector<QString> tracerNames = m_flowDiagSolution->tracerNames(); if ( m_flowDiagSolution->tracerStatusInTimeStep(tracerName, m_timeStep) == requestedTracerType )
for ( const QString& tracerName : tracerNames )
{ {
if ( m_flowDiagSolution->tracerStatusInTimeStep(tracerName, m_timeStep) == requestedTracerType ) RigFlowDiagResultAddress resAddr(RIG_FLD_CELL_FRACTION_RESNAME, tracerName.toStdString());
{ const std::vector<double>* tracerCellFractions = m_flowDiagSolution->flowDiagResults()->resultValues(resAddr, m_timeStep);
RigFlowDiagResultAddress resAddr(RIG_FLD_CELL_FRACTION_RESNAME, tracerName.toStdString()); tracerCellFractionValues[tracerName] = tracerCellFractions;
const std::vector<double>* tracerCellFractions = m_flowDiagSolution->flowDiagResults()->resultValues(resAddr, m_timeStep);
tracerCellFractionValues[tracerName] = tracerCellFractions;
}
} }
} }
} }

View File

@@ -425,11 +425,12 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
{ {
RimFlowDiagSolution::TracerStatusType status = flowSol->tracerStatusOverall(tracerName); RimFlowDiagSolution::TracerStatusType status = flowSol->tracerStatusOverall(tracerName);
QString prefix; QString prefix;
switch (status) switch ( status )
{ {
case RimFlowDiagSolution::INJECTOR: prefix = "I : "; break; case RimFlowDiagSolution::INJECTOR: prefix = "I : "; break;
case RimFlowDiagSolution::PRODUCER: prefix = "P : "; break; case RimFlowDiagSolution::PRODUCER: prefix = "P : "; break;
case RimFlowDiagSolution::VARYING: prefix = "I/P: "; break; case RimFlowDiagSolution::VARYING: prefix = "I/P: "; break;
case RimFlowDiagSolution::UNDEFINED:prefix = "U : "; break;
} }
if (status != RimFlowDiagSolution::CLOSED) prefixedTracerNamesMap[prefix + tracerName] = tracerName; if (status != RimFlowDiagSolution::CLOSED) prefixedTracerNamesMap[prefix + tracerName] = tracerName;

View File

@@ -381,7 +381,8 @@ std::vector<const std::vector<double>* > RigFlowDiagResults::findResultsForSelec
{ {
RimFlowDiagSolution::TracerStatusType tracerType = m_flowDiagSolution->tracerStatusInTimeStep(QString::fromStdString(tracerName), frameIndex); RimFlowDiagSolution::TracerStatusType tracerType = m_flowDiagSolution->tracerStatusInTimeStep(QString::fromStdString(tracerName), frameIndex);
if (tracerType != RimFlowDiagSolution::CLOSED && ( tracerType == wantedTracerType || wantedTracerType == RimFlowDiagSolution::UNDEFINED) ) if (tracerType != RimFlowDiagSolution::CLOSED
&& ( tracerType == wantedTracerType || wantedTracerType == RimFlowDiagSolution::UNDEFINED) )
{ {
selectedTracersResults.push_back(findOrCalculateResult(RigFlowDiagResultAddress(nativeResultName, tracerName), frameIndex)); selectedTracersResults.push_back(findOrCalculateResult(RigFlowDiagResultAddress(nativeResultName, tracerName), frameIndex));
} }