From 5260a3f870d92980caa04f0c86e4138cdb42eff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Mon, 22 Aug 2016 17:00:57 +0200 Subject: [PATCH] #478 Allowed static results (INIT-file) to not have values for LGRs --- .../FileInterface/RifReaderEclipseOutput.cpp | 26 ++++++++++++++++--- .../RigActiveCellsResultAccessor.cpp | 14 +++++++--- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp index 369c4156bc..a68fc011ca 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp @@ -1566,9 +1566,12 @@ void RifReaderEclipseOutput::readWellCells(const ecl_grid_type* mainEclGrid, boo //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QStringList RifReaderEclipseOutput::validKeywordsForPorosityModel(const QStringList& keywords, const std::vector& keywordDataItemCounts, - const RigActiveCellInfo* matrixActiveCellInfo, const RigActiveCellInfo* fractureActiveCellInfo, - PorosityModelResultType porosityModel, size_t timeStepCount) const +QStringList RifReaderEclipseOutput::validKeywordsForPorosityModel(const QStringList& keywords, + const std::vector& keywordDataItemCounts, + const RigActiveCellInfo* matrixActiveCellInfo, + const RigActiveCellInfo* fractureActiveCellInfo, + PorosityModelResultType porosityModel, + size_t timeStepCount) const { CVF_ASSERT(matrixActiveCellInfo); @@ -1636,6 +1639,23 @@ QStringList RifReaderEclipseOutput::validKeywordsForPorosityModel(const QStringL } } + // Check for INIT values that has only values for main grid active cells + if (!validKeyword) + { + if (timeStepCount == 1) + { + size_t mainGridMatrixActiveCellCount; matrixActiveCellInfo->gridActiveCellCounts(0, mainGridMatrixActiveCellCount); + size_t mainGridFractureActiveCellCount; fractureActiveCellInfo->gridActiveCellCounts(0, mainGridFractureActiveCellCount); + + if ( keywordDataItemCount == mainGridMatrixActiveCellCount + || keywordDataItemCount == mainGridFractureActiveCellCount + || keywordDataItemCount == mainGridMatrixActiveCellCount + mainGridFractureActiveCellCount ) + { + validKeyword = true; + } + } + } + if (validKeyword) { keywordsWithCorrectNumberOfDataItems.push_back(keyword); diff --git a/ApplicationCode/ReservoirDataModel/RigActiveCellsResultAccessor.cpp b/ApplicationCode/ReservoirDataModel/RigActiveCellsResultAccessor.cpp index 446a95bdfd..2db41e94b7 100644 --- a/ApplicationCode/ReservoirDataModel/RigActiveCellsResultAccessor.cpp +++ b/ApplicationCode/ReservoirDataModel/RigActiveCellsResultAccessor.cpp @@ -44,9 +44,12 @@ double RigActiveCellsResultAccessor::cellScalar(size_t gridLocalCellIndex) const size_t resultValueIndex = m_activeCellInfo->cellResultIndex(reservoirCellIndex); if (resultValueIndex == cvf::UNDEFINED_SIZE_T) return HUGE_VAL; - CVF_TIGHT_ASSERT(resultValueIndex < m_reservoirResultValues->size()); + if (resultValueIndex < m_reservoirResultValues->size()) + return m_reservoirResultValues->at(resultValueIndex); - return m_reservoirResultValues->at(resultValueIndex); + CVF_TIGHT_ASSERT(resultValueIndex < m_activeCellInfo->reservoirActiveCellCount()); // Because some static results might lack LGR data + + return HUGE_VAL; } //-------------------------------------------------------------------------------------------------- @@ -67,9 +70,12 @@ double RigActiveCellsResultAccessor::cellScalarGlobIdx(size_t reservoirCellIndex size_t resultValueIndex = m_activeCellInfo->cellResultIndex(reservoirCellIndex); if (resultValueIndex == cvf::UNDEFINED_SIZE_T) return HUGE_VAL; - CVF_TIGHT_ASSERT(resultValueIndex < m_reservoirResultValues->size()); + if(resultValueIndex < m_reservoirResultValues->size()) + return m_reservoirResultValues->at(resultValueIndex); - return m_reservoirResultValues->at(resultValueIndex); + CVF_TIGHT_ASSERT(resultValueIndex < m_activeCellInfo->reservoirActiveCellCount()); // Because some static results might lack LGR data + + return HUGE_VAL; } //--------------------------------------------------------------------------------------------------