#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 )
{
if (!wellResults[wIdx]->hasWellResult(timeStepIndex) ) continue;
size_t wellTimeStep = wellResults[wIdx]->m_resultTimeStepIndexToWellTimeStepIndex[timeStepIndex];
if (wellTimeStep == cvf::UNDEFINED_SIZE_T) continue;
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);
const RigWellResultFrame& wellResFrame = wellResults[wIdx]->wellResultFrame(timeStepIndex);
bool isInjectorWell = ( wellResFrame.m_productionType != RigWellResultFrame::PRODUCER
&& wellResFrame.m_productionType != RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE);
std::string wellname = 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;
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
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR )
{
if ( tracerStatus == PRODUCER ) tracerStatus = VARYING;
else tracerStatus = INJECTOR;
}
else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER )
{
if ( tracerStatus == INJECTOR ) tracerStatus = VARYING;
else tracerStatus = PRODUCER;
}
if ( tracerStatus == PRODUCER ) tracerStatus = VARYING;
else tracerStatus = INJECTOR;
}
else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER )
{
if ( tracerStatus == INJECTOR ) tracerStatus = VARYING;
else tracerStatus = PRODUCER;
}
if ( tracerStatus == VARYING ) break;
}
@@ -287,33 +277,28 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeSte
QString wellName = removeCrossFlowEnding(tracerName);
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;
const RigWellResultFrame& wellResFrame = wellResults[wIdx]->m_wellCellsTimeSteps[wellTimeStep];
if ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR )
{
if (!wellResFrame.m_isOpen) return CLOSED;
if ( hasCrossFlowEnding(tracerName) ) return PRODUCER;
if ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR )
{
if (hasCrossFlowEnding(tracerName)) return PRODUCER;
return INJECTOR;
}
else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER
|| wellResFrame.m_productionType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE )
{
if ( hasCrossFlowEnding(tracerName) ) return INJECTOR;
return INJECTOR;
}
else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER )
{
if (hasCrossFlowEnding(tracerName)) return INJECTOR;
return PRODUCER;
}
else
{
return UNDEFINED;
}
return PRODUCER;
}
else
{
CVF_ASSERT(false);
}
}

View File

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

View File

@@ -84,7 +84,10 @@ void RimFlowPlotCollection::loadDataAndUpdate()
//--------------------------------------------------------------------------------------------------
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() )
{
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));
wfCalculator.reset(new RigAccWellFlowCalculator(pipeBranchesCLCoords,
pipeBranchesCellIds,
@@ -341,31 +342,29 @@ std::map<QString, const std::vector<double> *> RimWellAllocationPlot::findReleva
{
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;
const RigWellResultFrame::WellProductionType prodType = wellResults->wellProductionType(m_timeStep);
if ( prodType == RigWellResultFrame::PRODUCER )
if ( prodType == RigWellResultFrame::PRODUCER
|| prodType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE )
{
requestedTracerType = RimFlowDiagSolution::INJECTOR;
}
else if (prodType != RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE)
else
{
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();
for ( const QString& tracerName : tracerNames )
if ( m_flowDiagSolution->tracerStatusInTimeStep(tracerName, m_timeStep) == requestedTracerType )
{
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);
tracerCellFractionValues[tracerName] = tracerCellFractions;
}
RigFlowDiagResultAddress resAddr(RIG_FLD_CELL_FRACTION_RESNAME, tracerName.toStdString());
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);
QString prefix;
switch (status)
switch ( status )
{
case RimFlowDiagSolution::INJECTOR: prefix = "I : "; break;
case RimFlowDiagSolution::PRODUCER: prefix = "P : "; break;
case RimFlowDiagSolution::VARYING: prefix = "I/P: "; break;
case RimFlowDiagSolution::INJECTOR: prefix = "I : "; break;
case RimFlowDiagSolution::PRODUCER: prefix = "P : "; break;
case RimFlowDiagSolution::VARYING: prefix = "I/P: "; break;
case RimFlowDiagSolution::UNDEFINED:prefix = "U : "; break;
}
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);
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));
}