#1279 Added <wellname>-Xf as tracer on connections with opposite flow thant the well type indicates.

This commit is contained in:
Jacob Støren 2017-03-06 16:33:29 +01:00
parent 0bccc883ff
commit 0428dbffa3
3 changed files with 156 additions and 94 deletions

View File

@ -35,6 +35,37 @@
CAF_PDM_SOURCE_INIT(RimFlowDiagSolution, "FlowDiagSolution"); CAF_PDM_SOURCE_INIT(RimFlowDiagSolution, "FlowDiagSolution");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool hasCrossFlowEnding(const QString& tracerName)
{
return tracerName.endsWith("-Xf");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString removeCrossFlowEnding(const QString& tracerName)
{
if (tracerName.endsWith("-Xf"))
{
return tracerName.left(tracerName.size() - 3);
}
else
{
return tracerName;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString addCrossFlowEnding(const QString& wellName)
{
return wellName + "-Xf";
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -99,6 +130,7 @@ std::vector<QString> RimFlowDiagSolution::tracerNames()
for (size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx) for (size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx)
{ {
tracerNameSet.push_back(wellResults[wIdx]->m_wellName); tracerNameSet.push_back(wellResults[wIdx]->m_wellName);
tracerNameSet.push_back(addCrossFlowEnding(wellResults[wIdx]->m_wellName));
} }
} }
@ -148,17 +180,15 @@ std::map<std::string, std::vector<int> > RimFlowDiagSolution::allTracerActiveCel
const RigWellResultFrame& wellResFrame = wellResults[wIdx]->m_wellCellsTimeSteps[wellTimeStep]; const RigWellResultFrame& wellResFrame = wellResults[wIdx]->m_wellCellsTimeSteps[wellTimeStep];
if ( !wellResFrame.m_isOpen ) continue; if ( !wellResFrame.m_isOpen ) continue;
if (wellResFrame.m_productionType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE) continue;
bool useWell = ( useInjectors && ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR bool isInjectorWell = (wellResFrame.m_productionType != RigWellResultFrame::PRODUCER);
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR) )
|| (!useInjectors && wellResFrame.m_productionType == RigWellResultFrame::PRODUCER);
if (useWell)
{
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::vector<int>& tracerCells = tracersWithCells[wellname]; std::vector<int>& tracerCells = tracersWithCells[wellname];
std::vector<int>& tracerCellsCrossFlow = tracersWithCells[wellNameXf];
for (const RigWellResultBranch& wBr: wellResFrame.m_wellResultBranches) for (const RigWellResultBranch& wBr: wellResFrame.m_wellResultBranches)
{ {
@ -171,8 +201,15 @@ std::map<std::string, std::vector<int> > RimFlowDiagSolution::allTracerActiveCel
size_t reservoirCellIndex = grid->reservoirCellIndex(wrp.m_gridCellIndex); size_t reservoirCellIndex = grid->reservoirCellIndex(wrp.m_gridCellIndex);
int cellActiveIndex = static_cast<int>(activeCellInfo->cellResultIndex(reservoirCellIndex)); int cellActiveIndex = static_cast<int>(activeCellInfo->cellResultIndex(reservoirCellIndex));
if ( useInjectors == isInjectorWell )
{
tracerCells.push_back(cellActiveIndex); tracerCells.push_back(cellActiveIndex);
} }
else
{
tracerCellsCrossFlow.push_back(cellActiveIndex);
}
} }
} }
} }
@ -187,19 +224,21 @@ std::map<std::string, std::vector<int> > RimFlowDiagSolution::allTracerActiveCel
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusOverall(QString tracerName) RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusOverall(const QString& tracerName)
{ {
RimEclipseResultCase* eclCase; RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase); this->firstAncestorOrThisOfTypeAsserted(eclCase);
TracerStatusType tracerStatus = UNDEFINED; TracerStatusType tracerStatus = UNDEFINED;
if ( eclCase )
{
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->reservoirData()->wellResults(); const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->reservoirData()->wellResults();
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx ) for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx )
{ {
if ( wellResults[wIdx]->m_wellName == tracerName ) QString wellName = removeCrossFlowEnding(tracerName);
{
if ( wellResults[wIdx]->m_wellName != wellName ) continue;
tracerStatus = CLOSED; tracerStatus = CLOSED;
for ( const RigWellResultFrame& wellResFrame : wellResults[wIdx]->m_wellCellsTimeSteps ) for ( const RigWellResultFrame& wellResFrame : wellResults[wIdx]->m_wellCellsTimeSteps )
{ {
@ -223,7 +262,11 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusOverall(Q
break; break;
} }
}
if (hasCrossFlowEnding(tracerName))
{
if (tracerStatus == PRODUCER) tracerStatus = INJECTOR;
else if (tracerStatus == INJECTOR) tracerStatus = PRODUCER;
} }
return tracerStatus; return tracerStatus;
@ -232,19 +275,19 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusOverall(Q
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeStep(QString tracerName, size_t timeStepIndex) RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeStep(const QString& tracerName, size_t timeStepIndex)
{ {
RimEclipseResultCase* eclCase; RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase); this->firstAncestorOrThisOfTypeAsserted(eclCase);
if ( eclCase )
{
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->reservoirData()->wellResults(); const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->reservoirData()->wellResults();
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx ) for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx )
{ {
if ( wellResults[wIdx]->m_wellName == tracerName ) QString wellName = removeCrossFlowEnding(tracerName);
{
if ( wellResults[wIdx]->m_wellName != wellName ) continue;
size_t wellTimeStep = wellResults[wIdx]->m_resultTimeStepIndexToWellTimeStepIndex[timeStepIndex]; size_t wellTimeStep = wellResults[wIdx]->m_resultTimeStepIndexToWellTimeStepIndex[timeStepIndex];
if (wellTimeStep == cvf::UNDEFINED_SIZE_T) return CLOSED; if (wellTimeStep == cvf::UNDEFINED_SIZE_T) return CLOSED;
@ -257,10 +300,14 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeSte
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR || wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR ) || wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR )
{ {
if (hasCrossFlowEnding(tracerName)) return PRODUCER;
return INJECTOR; return INJECTOR;
} }
else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER ) else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER )
{ {
if (hasCrossFlowEnding(tracerName)) return INJECTOR;
return PRODUCER; return PRODUCER;
} }
else else
@ -269,8 +316,6 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeSte
} }
} }
} }
}
}
CVF_ASSERT(false); CVF_ASSERT(false);
@ -280,18 +325,20 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeSte
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
cvf::Color3f RimFlowDiagSolution::tracerColor(QString tracerName) cvf::Color3f RimFlowDiagSolution::tracerColor(const QString& tracerName)
{ {
RimEclipseResultCase* eclCase; RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase); this->firstAncestorOrThisOfType(eclCase);
QString wellName = removeCrossFlowEnding(tracerName);
if ( eclCase ) if ( eclCase )
{ {
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView()); RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
if (activeView) if (activeView)
{ {
RimEclipseWell* well = activeView->wellCollection->findWell(tracerName); RimEclipseWell* well = activeView->wellCollection->findWell(wellName);
if (well) if (well)
{ {
return well->wellPipeColor(); return well->wellPipeColor();
@ -306,7 +353,7 @@ cvf::Color3f RimFlowDiagSolution::tracerColor(QString tracerName)
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx ) for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx )
{ {
if ( wellResults[wIdx]->m_wellName == tracerName ) if ( wellResults[wIdx]->m_wellName == wellName )
{ {
return RiaColorTables::wellsPaletteColors().cycledColor3f(wIdx); return RiaColorTables::wellsPaletteColors().cycledColor3f(wIdx);
} }
@ -314,9 +361,9 @@ cvf::Color3f RimFlowDiagSolution::tracerColor(QString tracerName)
} }
} }
if (tracerName == RIG_FLOW_TOTAL_NAME) return cvf::Color3f::LIGHT_GRAY; if (wellName == RIG_FLOW_TOTAL_NAME) return cvf::Color3f::LIGHT_GRAY;
if (tracerName == RIG_RESERVOIR_TRACER_NAME) return cvf::Color3f::LIGHT_GRAY; if (wellName == RIG_RESERVOIR_TRACER_NAME) return cvf::Color3f::LIGHT_GRAY;
if (tracerName == RIG_TINY_TRACER_GROUP_NAME) return cvf::Color3f::DARK_GRAY; if (wellName == RIG_TINY_TRACER_GROUP_NAME) return cvf::Color3f::DARK_GRAY;
return cvf::Color3f::LIGHT_GRAY; return cvf::Color3f::LIGHT_GRAY;
} }

View File

@ -56,9 +56,9 @@ public:
UNDEFINED UNDEFINED
}; };
TracerStatusType tracerStatusOverall(QString tracerName); TracerStatusType tracerStatusOverall(const QString& tracerName);
TracerStatusType tracerStatusInTimeStep(QString tracerName, size_t timeStepIndex); TracerStatusType tracerStatusInTimeStep(const QString& tracerName, size_t timeStepIndex);
cvf::Color3f tracerColor(QString tracerName); cvf::Color3f tracerColor(const QString& tracerName);
protected: protected:

View File

@ -239,8 +239,11 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI
injectorCellSet.push_back(CellSet(CellSetID(tIt.first), tIt.second)); injectorCellSet.push_back(CellSet(CellSetID(tIt.first), tIt.second));
} }
try
{
Solution injSol = m_opmFldData->fldToolbox->computeInjectionDiagnostics(injectorCellSet).fd; Solution injSol = m_opmFldData->fldToolbox->computeInjectionDiagnostics(injectorCellSet).fd;
for ( const CellSetID& tracerId: injSol.startPoints() ) for ( const CellSetID& tracerId: injSol.startPoints() )
{ {
CellSetValues tofVals = injSol.timeOfFlight(tracerId); CellSetValues tofVals = injSol.timeOfFlight(tracerId);
@ -249,6 +252,11 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI
result.setTracerFraction(tracerId.to_string(), fracVals); result.setTracerFraction(tracerId.to_string(), fracVals);
} }
} }
catch (...)
{
CVF_ASSERT(false);
}
}
progressInfo.incrementProgress(); progressInfo.incrementProgress();
progressInfo.setProgressDescription("Producer Solution"); progressInfo.setProgressDescription("Producer Solution");
@ -261,6 +269,8 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI
prodjCellSet.push_back(CellSet(CellSetID(tIt.first), tIt.second)); prodjCellSet.push_back(CellSet(CellSetID(tIt.first), tIt.second));
} }
try
{
Solution prodSol = m_opmFldData->fldToolbox->computeProductionDiagnostics(prodjCellSet).fd; Solution prodSol = m_opmFldData->fldToolbox->computeProductionDiagnostics(prodjCellSet).fd;
for ( const CellSetID& tracerId: prodSol.startPoints() ) for ( const CellSetID& tracerId: prodSol.startPoints() )
@ -271,6 +281,11 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI
result.setTracerFraction(tracerId.to_string(), fracVals); result.setTracerFraction(tracerId.to_string(), fracVals);
} }
} }
catch (...)
{
CVF_ASSERT(false);
}
}
return result; // Relying on implicit move constructor return result; // Relying on implicit move constructor
} }