Skip to content

Commit

Permalink
Work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
jonjenssen committed Apr 11, 2024
1 parent d1be23e commit 3bc6de6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
25 changes: 21 additions & 4 deletions ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand All @@ -191,7 +191,7 @@ bool RifReaderOpmCommon::importGrid( RigMainGrid* mainGrid, RigEclipseCaseData*

RigLocalGrid* localGrid = static_cast<RigLocalGrid*>( 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;
Expand Down Expand Up @@ -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();
Expand All @@ -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<int>( localGrid->cellCount() ); opmCellIndex++ )
{
auto opmIJK = opmGrid.ijk_from_global_index( opmCellIndex );
Expand All @@ -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<double, 8> opmX{};
std::array<double, 8> opmY{};
std::array<double, 8> opmZ{};
Expand All @@ -290,6 +305,8 @@ void RifReaderOpmCommon::transferGeometry( Opm::EclIO::EGrid& opmMainGrid,

cell.cornerIndices()[riCornerIndex] = riNodeIndex;
}

cell.setInvalid( cell.isLongPyramidCell() );
}
}

Expand Down
4 changes: 3 additions & 1 deletion ApplicationLibCode/FileInterface/RifReaderOpmCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down

0 comments on commit 3bc6de6

Please sign in to comment.