Add option to skip/invalidate long, thin cells. (#11691)

* Add option to choose if the user wants to skip/invalidate long, thin cells.
This commit is contained in:
jonjenssen
2024-09-13 07:34:14 +02:00
committed by GitHub
parent 92907b04ef
commit fd2989972d
10 changed files with 61 additions and 14 deletions

View File

@@ -161,7 +161,7 @@ bool RifEclipseInputFileTools::openGridFile( const QString& fileName, RigEclipse
ecl_grid_type* inputGrid = ecl_grid_alloc_GRDECL_kw( nx, ny, nz, zCornKw, coordKw, actNumKw, mapAxesKw );
RifReaderEclipseOutput::transferGeometry( inputGrid, eclipseCase );
RifReaderEclipseOutput::transferGeometry( inputGrid, eclipseCase, false );
if ( readFaultData )
{

View File

@@ -155,7 +155,8 @@ bool RifReaderEclipseOutput::transferGridCellData( RigMainGrid* mainGrid
RigGridBase* localGrid,
const ecl_grid_type* localEclGrid,
size_t matrixActiveStartIndex,
size_t fractureActiveStartIndex )
size_t fractureActiveStartIndex,
bool invalidateLongPyramidCells )
{
CVF_ASSERT( activeCellInfo && fractureActiveCellInfo );
@@ -225,7 +226,10 @@ bool RifReaderEclipseOutput::transferGridCellData( RigMainGrid* mainGrid
// Forslag
// if (!invalid && (cell.isInCoarseCell() || (!cell.isActiveInMatrixModel() &&
// !cell.isActiveInFractureModel()) ) )
cell.setInvalid( cell.isLongPyramidCell() );
if ( invalidateLongPyramidCells )
{
cell.setInvalid( cell.isLongPyramidCell() );
}
}
return true;
@@ -234,7 +238,7 @@ bool RifReaderEclipseOutput::transferGridCellData( RigMainGrid* mainGrid
//--------------------------------------------------------------------------------------------------
/// Read geometry from file given by name into given reservoir object
//--------------------------------------------------------------------------------------------------
bool RifReaderEclipseOutput::transferGeometry( const ecl_grid_type* mainEclGrid, RigEclipseCaseData* eclipseCase )
bool RifReaderEclipseOutput::transferGeometry( const ecl_grid_type* mainEclGrid, RigEclipseCaseData* eclipseCase, bool invalidateLongThinCells )
{
CVF_ASSERT( eclipseCase );
@@ -306,7 +310,7 @@ bool RifReaderEclipseOutput::transferGeometry( const ecl_grid_type* mainEclGrid,
{
auto task = progInfo.task( "Loading Main Grid Data", 3 );
transferGridCellData( mainGrid, activeCellInfo, fractureActiveCellInfo, mainGrid, mainEclGrid, 0, 0 );
transferGridCellData( mainGrid, activeCellInfo, fractureActiveCellInfo, mainGrid, mainEclGrid, 0, 0, invalidateLongThinCells );
}
size_t globalMatrixActiveSize = ecl_grid_get_nactive( mainEclGrid );
@@ -327,7 +331,14 @@ bool RifReaderEclipseOutput::transferGeometry( const ecl_grid_type* mainEclGrid,
ecl_grid_type* localEclGrid = ecl_grid_iget_lgr( mainEclGrid, lgrIdx );
RigLocalGrid* localGrid = static_cast<RigLocalGrid*>( mainGrid->gridByIndex( lgrIdx + 1 ) );
transferGridCellData( mainGrid, activeCellInfo, fractureActiveCellInfo, localGrid, localEclGrid, globalMatrixActiveSize, globalFractureActiveSize );
transferGridCellData( mainGrid,
activeCellInfo,
fractureActiveCellInfo,
localGrid,
localEclGrid,
globalMatrixActiveSize,
globalFractureActiveSize,
invalidateLongThinCells );
int matrixActiveCellCount = ecl_grid_get_nactive( localEclGrid );
globalMatrixActiveSize += matrixActiveCellCount;
@@ -395,7 +406,7 @@ bool RifReaderEclipseOutput::open( const QString& fileName, RigEclipseCaseData*
{
auto task = progress.task( "Transferring grid geometry", 10 );
if ( !transferGeometry( mainEclGrid, eclipseCaseData ) ) return false;
if ( !transferGeometry( mainEclGrid, eclipseCaseData, invalidateLongThinCells() ) ) return false;
RifOpmRadialGridTools::importCoordinatesForRadialGrid( fileName.toStdString(), eclipseCaseData->mainGrid() );
}

View File

@@ -72,7 +72,7 @@ public:
std::vector<QDateTime> allTimeSteps() const;
static bool transferGeometry( const ecl_grid_type* mainEclGrid, RigEclipseCaseData* eclipseCase );
static bool transferGeometry( const ecl_grid_type* mainEclGrid, RigEclipseCaseData* eclipseCase, bool invalidateLongThinCells );
static void transferCoarseningInfo( const ecl_grid_type* eclGrid, RigGridBase* grid );
static void
importEquilData( const QString& deckFileName, const QString& includeStatementAbsolutePathPrefix, RigEclipseCaseData* eclipseCase );
@@ -111,7 +111,8 @@ private:
RigGridBase* localGrid,
const ecl_grid_type* localEclGrid,
size_t matrixActiveStartIndex,
size_t fractureActiveStartIndex );
size_t fractureActiveStartIndex,
bool invalidateLongPyramidCells );
private:
QString m_fileName; // Name of file used to start accessing Eclipse output files

View File

@@ -89,6 +89,14 @@ bool RifReaderInterface::onlyLoadActiveCells() const
return m_readerSettings.onlyLoadActiveCells;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RifReaderInterface::invalidateLongThinCells() const
{
return m_readerSettings.invalidateLongThinCells;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -58,6 +58,7 @@ public:
bool loadWellDataEnabled() const;
const QString faultIncludeFileAbsolutePathPrefix() const;
bool onlyLoadActiveCells() const;
bool invalidateLongThinCells() const;
void setReaderSettings( RifReaderSettings readerSettings );

View File

@@ -414,6 +414,8 @@ void RifReaderOpmCommon::transferGeometry( Opm::EclIO::EGrid& opmMainGrid,
size_t cellStartIndex = mainGrid->globalCellArray().size();
size_t nodeStartIndex = mainGrid->nodes().size();
const bool invalidateLongPyramidCells = invalidateLongThinCells();
RigCell defaultCell;
defaultCell.setHostGrid( localGrid );
@@ -504,8 +506,10 @@ void RifReaderOpmCommon::transferGeometry( Opm::EclIO::EGrid& opmMainGrid,
yCenterCoordOpm );
}
}
cell.setInvalid( cell.isLongPyramidCell() );
if ( invalidateLongPyramidCells )
{
cell.setInvalid( cell.isLongPyramidCell() );
}
}
// subgrid pointers

View File

@@ -183,6 +183,8 @@ void RifReaderOpmCommonActive::transferActiveGeometry( Opm::EclIO::EGrid& opmMa
? RifOpmRadialGridTools::computeXyCenterForTopOfCells( opmMainGrid, opmMainGrid, activeGrid )
: std::map<int, std::pair<double, double>>();
const bool invalidateLongPyramidCells = invalidateLongThinCells();
// use same mapping as resdata
const size_t cellMappingECLRi[8] = { 0, 1, 3, 2, 4, 5, 7, 6 };
@@ -230,6 +232,9 @@ void RifReaderOpmCommonActive::transferActiveGeometry( Opm::EclIO::EGrid& opmMa
cell.cornerIndices()[riCornerIndex] = riNodeIndex;
}
cell.setInvalid( cell.isLongPyramidCell() );
if ( invalidateLongPyramidCells )
{
cell.setInvalid( cell.isLongPyramidCell() );
}
}
}

View File

@@ -36,4 +36,5 @@ struct RifReaderSettings
bool importSummaryData;
QString includeFileAbsolutePathPrefix;
bool onlyLoadActiveCells;
bool invalidateLongThinCells;
};