From 2f5acc38ac757d939f4a9966da4dd44c516829d3 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 9 Sep 2016 11:03:57 +0200 Subject: [PATCH] Added debug output of grid name and size, added comments --- .../ReservoirDataModel/RigCaseData.cpp | 58 ++++++++++++++----- 1 file changed, 43 insertions(+), 15 deletions(-) diff --git a/ApplicationCode/ReservoirDataModel/RigCaseData.cpp b/ApplicationCode/ReservoirDataModel/RigCaseData.cpp index b9749dbd51..641f42e67e 100644 --- a/ApplicationCode/ReservoirDataModel/RigCaseData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigCaseData.cpp @@ -19,10 +19,13 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RigCaseData.h" -#include "RigMainGrid.h" + #include "RigCaseCellResultsData.h" -#include "RigResultAccessorFactory.h" #include "RigFormationNames.h" +#include "RigMainGrid.h" +#include "RigResultAccessorFactory.h" + +#include //-------------------------------------------------------------------------------------------------- /// @@ -139,6 +142,25 @@ void RigCaseData::computeWellCellsPrGrid() std::vector grids; this->allGrids(&grids); + + // Debug code used to display grid names and grid sizes +/* + size_t totCellCount = 0; + for (auto g : grids) + { + qDebug() << g->gridName().data(); + qDebug() << g->cellCountI() << " " << g->cellCountJ() << " " << g->cellCountK() << " "; + + size_t cellCount = g->cellCount(); + totCellCount += cellCount; + qDebug() << cellCount; + + qDebug() << "\n"; + } + + qDebug() << "\nTotal cell count " << totCellCount; +*/ + size_t gIdx; // Allocate and initialize the arrays @@ -169,32 +191,38 @@ void RigCaseData::computeWellCellsPrGrid() { RigWellResultFrame& wellCells = m_wellResults[wIdx]->m_wellCellsTimeSteps[tIdx]; - size_t gridIndex = wellCells.m_wellHead.m_gridIndex; - size_t gridCellIndex = wellCells.m_wellHead.m_gridCellIndex; - - if (gridIndex < m_wellCellsInGrid.size() && gridCellIndex < m_wellCellsInGrid[gridIndex]->size()) + // Well head { - size_t reservoirCellIndex = grids[gridIndex]->reservoirCellIndex(gridCellIndex); - if (m_activeCellInfo->isActive(reservoirCellIndex) - || m_fractureActiveCellInfo->isActive(reservoirCellIndex)) + size_t gridIndex = wellCells.m_wellHead.m_gridIndex; + size_t gridCellIndex = wellCells.m_wellHead.m_gridCellIndex; + + if (gridIndex < m_wellCellsInGrid.size() && gridCellIndex < m_wellCellsInGrid[gridIndex]->size()) { - m_wellCellsInGrid[gridIndex]->set(gridCellIndex, true); - m_gridCellToResultWellIndex[gridIndex]->set(gridCellIndex, static_cast(wIdx)); + size_t reservoirCellIndex = grids[gridIndex]->reservoirCellIndex(gridCellIndex); + if (m_activeCellInfo->isActive(reservoirCellIndex) + || m_fractureActiveCellInfo->isActive(reservoirCellIndex)) + { + m_wellCellsInGrid[gridIndex]->set(gridCellIndex, true); + m_gridCellToResultWellIndex[gridIndex]->set(gridCellIndex, static_cast(wIdx)); + } } } - size_t sIdx; - for (sIdx = 0; sIdx < wellCells.m_wellResultBranches.size(); ++sIdx) + // Well result branches + for (size_t sIdx = 0; sIdx < wellCells.m_wellResultBranches.size(); ++sIdx) { RigWellResultBranch& wellSegment = wellCells.m_wellResultBranches[sIdx]; size_t cdIdx; for (cdIdx = 0; cdIdx < wellSegment.m_branchResultPoints.size(); ++cdIdx) { - gridIndex = wellSegment.m_branchResultPoints[cdIdx].m_gridIndex; - gridCellIndex = wellSegment.m_branchResultPoints[cdIdx].m_gridCellIndex; + size_t gridIndex = wellSegment.m_branchResultPoints[cdIdx].m_gridIndex; + size_t gridCellIndex = wellSegment.m_branchResultPoints[cdIdx].m_gridCellIndex; if(gridIndex < m_wellCellsInGrid.size() && gridCellIndex < m_wellCellsInGrid[gridIndex]->size()) { + // NOTE : We do not check if the grid cell is active as we do for well head. + // If we add test for active cell, thorough testing and verification of the new behaviour must be adressed + m_wellCellsInGrid[gridIndex]->set(gridCellIndex, true); m_gridCellToResultWellIndex[gridIndex]->set(gridCellIndex, static_cast(wIdx)); }