#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,31 +180,36 @@ 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);
std::string wellname = wellResults[wIdx]->m_wellName.toStdString();
std::string wellNameXf = addCrossFlowEnding(wellResults[wIdx]->m_wellName).toStdString();
if (useWell) std::vector<int>& tracerCells = tracersWithCells[wellname];
std::vector<int>& tracerCellsCrossFlow = tracersWithCells[wellNameXf];
for (const RigWellResultBranch& wBr: wellResFrame.m_wellResultBranches)
{ {
std::string wellname = wellResults[wIdx]->m_wellName.toStdString(); for (const RigWellResultPoint& wrp: wBr.m_branchResultPoints)
std::vector<int>& tracerCells = tracersWithCells[wellname];
for (const RigWellResultBranch& wBr: wellResFrame.m_wellResultBranches)
{ {
for (const RigWellResultPoint& wrp: wBr.m_branchResultPoints) if (wrp.isValid() && wrp.m_isOpen
&& ( (useInjectors && wrp.flowRate() < 0.0) || (!useInjectors && wrp.flowRate() > 0.0) ) )
{ {
if (wrp.isValid() && wrp.m_isOpen RigGridBase * grid = mainGrid->gridByIndex(wrp.m_gridIndex);
&& ( (useInjectors && wrp.flowRate() < 0.0) || (!useInjectors && wrp.flowRate() > 0.0) ) ) size_t reservoirCellIndex = grid->reservoirCellIndex(wrp.m_gridCellIndex);
{
RigGridBase * grid = mainGrid->gridByIndex(wrp.m_gridIndex);
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,43 +224,49 @@ 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();
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx )
{ {
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->reservoirData()->wellResults(); QString wellName = removeCrossFlowEnding(tracerName);
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx ) if ( wellResults[wIdx]->m_wellName != wellName ) continue;
tracerStatus = CLOSED;
for ( const RigWellResultFrame& wellResFrame : wellResults[wIdx]->m_wellCellsTimeSteps )
{ {
if ( wellResults[wIdx]->m_wellName == tracerName ) if (wellResFrame.m_isOpen)
{ {
tracerStatus = CLOSED; if ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR
for ( const RigWellResultFrame& wellResFrame : wellResults[wIdx]->m_wellCellsTimeSteps ) || wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR )
{ {
if (wellResFrame.m_isOpen) if ( tracerStatus == PRODUCER ) tracerStatus = VARYING;
{ else tracerStatus = INJECTOR;
if ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR }
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER )
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR ) {
{ if ( tracerStatus == INJECTOR ) tracerStatus = VARYING;
if ( tracerStatus == PRODUCER ) tracerStatus = VARYING; else tracerStatus = PRODUCER;
else tracerStatus = INJECTOR;
}
else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER )
{
if ( tracerStatus == INJECTOR ) tracerStatus = VARYING;
else tracerStatus = PRODUCER;
}
}
if ( tracerStatus == VARYING ) break;
} }
break;
} }
if ( tracerStatus == VARYING ) break;
} }
break;
}
if (hasCrossFlowEnding(tracerName))
{
if (tracerStatus == PRODUCER) tracerStatus = INJECTOR;
else if (tracerStatus == INJECTOR) tracerStatus = PRODUCER;
} }
return tracerStatus; return tracerStatus;
@ -232,42 +275,44 @@ 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();
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx )
{ {
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->reservoirData()->wellResults(); QString wellName = removeCrossFlowEnding(tracerName);
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx ) if ( wellResults[wIdx]->m_wellName != wellName ) continue;
size_t wellTimeStep = wellResults[wIdx]->m_resultTimeStepIndexToWellTimeStepIndex[timeStepIndex];
if (wellTimeStep == cvf::UNDEFINED_SIZE_T) return CLOSED;
const RigWellResultFrame& wellResFrame = wellResults[wIdx]->m_wellCellsTimeSteps[wellTimeStep];
{ {
if ( wellResults[wIdx]->m_wellName == tracerName ) if (!wellResFrame.m_isOpen) return CLOSED;
if ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR )
{ {
size_t wellTimeStep = wellResults[wIdx]->m_resultTimeStepIndexToWellTimeStepIndex[timeStepIndex]; if (hasCrossFlowEnding(tracerName)) return PRODUCER;
if (wellTimeStep == cvf::UNDEFINED_SIZE_T) return CLOSED; return INJECTOR;
}
else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER )
{
if (hasCrossFlowEnding(tracerName)) return INJECTOR;
const RigWellResultFrame& wellResFrame = wellResults[wIdx]->m_wellCellsTimeSteps[wellTimeStep]; return PRODUCER;
{ }
if (!wellResFrame.m_isOpen) return CLOSED; else
{
if ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR return UNDEFINED;
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR )
{
return INJECTOR;
}
else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER )
{
return PRODUCER;
}
else
{
return UNDEFINED;
}
}
} }
} }
} }
@ -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,14 +239,22 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI
injectorCellSet.push_back(CellSet(CellSetID(tIt.first), tIt.second)); injectorCellSet.push_back(CellSet(CellSetID(tIt.first), tIt.second));
} }
Solution injSol = m_opmFldData->fldToolbox->computeInjectionDiagnostics(injectorCellSet).fd; try
for ( const CellSetID& tracerId: injSol.startPoints() )
{ {
CellSetValues tofVals = injSol.timeOfFlight(tracerId); Solution injSol = m_opmFldData->fldToolbox->computeInjectionDiagnostics(injectorCellSet).fd;
result.setTracerTOF(tracerId.to_string(), tofVals);
CellSetValues fracVals = injSol.concentration(tracerId);
result.setTracerFraction(tracerId.to_string(), fracVals); for ( const CellSetID& tracerId: injSol.startPoints() )
{
CellSetValues tofVals = injSol.timeOfFlight(tracerId);
result.setTracerTOF(tracerId.to_string(), tofVals);
CellSetValues fracVals = injSol.concentration(tracerId);
result.setTracerFraction(tracerId.to_string(), fracVals);
}
}
catch (...)
{
CVF_ASSERT(false);
} }
} }
@ -261,14 +269,21 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI
prodjCellSet.push_back(CellSet(CellSetID(tIt.first), tIt.second)); prodjCellSet.push_back(CellSet(CellSetID(tIt.first), tIt.second));
} }
Solution prodSol = m_opmFldData->fldToolbox->computeProductionDiagnostics(prodjCellSet).fd; try
for ( const CellSetID& tracerId: prodSol.startPoints() )
{ {
CellSetValues tofVals = prodSol.timeOfFlight(tracerId); Solution prodSol = m_opmFldData->fldToolbox->computeProductionDiagnostics(prodjCellSet).fd;
result.setTracerTOF(tracerId.to_string(), tofVals);
CellSetValues fracVals = prodSol.concentration(tracerId); for ( const CellSetID& tracerId: prodSol.startPoints() )
result.setTracerFraction(tracerId.to_string(), fracVals); {
CellSetValues tofVals = prodSol.timeOfFlight(tracerId);
result.setTracerTOF(tracerId.to_string(), tofVals);
CellSetValues fracVals = prodSol.concentration(tracerId);
result.setTracerFraction(tracerId.to_string(), fracVals);
}
}
catch (...)
{
CVF_ASSERT(false);
} }
} }