From 3bc6de69bb8d3c6fed472aa1aab32318811292ed Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Thu, 11 Apr 2024 15:19:38 +0200 Subject: [PATCH] Work in progress --- .../FileInterface/RifReaderOpmCommon.cpp | 25 ++++++++++++++++--- .../FileInterface/RifReaderOpmCommon.h | 4 ++- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp b/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp index 918626b992..1f3e58c44b 100644 --- a/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp @@ -176,7 +176,7 @@ bool RifReaderOpmCommon::importGrid( RigMainGrid* mainGrid, RigEclipseCaseData* { auto task = progInfo.task( "Loading Main Grid Data", 3 ); - transferGeometry( opmGrid, opmGrid, mainGrid, mainGrid, caseData ); + transferGeometry( opmGrid, opmGrid, mainGrid, mainGrid, caseData, 0, 0 ); } activeCellInfo->setGridCount( 1 + numLGRs ); @@ -191,7 +191,7 @@ bool RifReaderOpmCommon::importGrid( RigMainGrid* mainGrid, RigEclipseCaseData* RigLocalGrid* localGrid = static_cast( mainGrid->gridById( lgrIdx + 1 ) ); - transferGeometry( opmGrid, lgrGrids[lgrIdx], mainGrid, localGrid, caseData ); + transferGeometry( opmGrid, lgrGrids[lgrIdx], mainGrid, localGrid, caseData, globalMatrixActiveSize, globalFractureActiveSize ); int matrixActiveCellCount = lgrGrids[lgrIdx].activeCells(); globalMatrixActiveSize += matrixActiveCellCount; @@ -238,7 +238,9 @@ void RifReaderOpmCommon::transferGeometry( Opm::EclIO::EGrid& opmMainGrid, Opm::EclIO::EGrid& opmGrid, RigMainGrid* mainGrid, RigGridBase* localGrid, - RigEclipseCaseData* caseData ) + RigEclipseCaseData* caseData, + size_t matrixActiveStartIndex, + size_t fractureActiveStartIndex ) { int cellCount = opmGrid.totalNumberOfCells(); size_t cellStartIndex = mainGrid->globalCellArray().size(); @@ -261,7 +263,7 @@ void RifReaderOpmCommon::transferGeometry( Opm::EclIO::EGrid& opmMainGrid, // same mapping as libecl const size_t cellMappingECLRi[8] = { 0, 1, 3, 2, 4, 5, 7, 6 }; - // #pragma omp parallel for +#pragma omp parallel for for ( int opmCellIndex = 0; opmCellIndex < static_cast( localGrid->cellCount() ); opmCellIndex++ ) { auto opmIJK = opmGrid.ijk_from_global_index( opmCellIndex ); @@ -270,6 +272,19 @@ void RifReaderOpmCommon::transferGeometry( Opm::EclIO::EGrid& opmMainGrid, RigCell& cell = mainGrid->globalCellArray()[riReservoirIndex]; cell.setGridLocalCellIndex( riReservoirIndex ); + // active cell index + int matrixActiveIndex = opmGrid.active_index( opmIJK[0], opmIJK[1], opmIJK[2] ); + if ( matrixActiveIndex != -1 ) + { + activeCellInfo->setCellResultIndex( cellStartIndex + opmCellIndex, matrixActiveStartIndex + matrixActiveIndex ); + } + + int fractureActiveIndex = opmGrid.active_frac_index( opmIJK[0], opmIJK[1], opmIJK[2] ); + if ( fractureActiveIndex != -1 ) + { + fractureActiveCellInfo->setCellResultIndex( cellStartIndex + opmCellIndex, fractureActiveStartIndex + fractureActiveIndex ); + } + std::array opmX{}; std::array opmY{}; std::array opmZ{}; @@ -290,6 +305,8 @@ void RifReaderOpmCommon::transferGeometry( Opm::EclIO::EGrid& opmMainGrid, cell.cornerIndices()[riCornerIndex] = riNodeIndex; } + + cell.setInvalid( cell.isLongPyramidCell() ); } } diff --git a/ApplicationLibCode/FileInterface/RifReaderOpmCommon.h b/ApplicationLibCode/FileInterface/RifReaderOpmCommon.h index 75915e9daf..cc3db22cfc 100644 --- a/ApplicationLibCode/FileInterface/RifReaderOpmCommon.h +++ b/ApplicationLibCode/FileInterface/RifReaderOpmCommon.h @@ -54,7 +54,9 @@ class RifReaderOpmCommon : public RifReaderInterface Opm::EclIO::EGrid& opmGrid, RigMainGrid* riMainGrid, RigGridBase* riGrid, - RigEclipseCaseData* caseData ); + RigEclipseCaseData* caseData, + size_t matrixActiveStartIndex, + size_t fractureActiveStartIndex ); bool isDualPorosity( Opm::EclIO::EGrid& opmMainGrid );