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

@@ -91,6 +91,9 @@ RiaPreferencesGrid::RiaPreferencesGrid()
CAF_PDM_InitField( &m_onlyLoadActiveCells, "onlyLoadActiveCells", false, "Only Load Active Cell Geometry (Experimental)" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_onlyLoadActiveCells );
CAF_PDM_InitField( &m_invalidateLongThinCells, "invalidateLongThinCells", false, "Skip Long, Thin Cells" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_invalidateLongThinCells );
}
//--------------------------------------------------------------------------------------------------
@@ -109,6 +112,7 @@ void RiaPreferencesGrid::appendItems( caf::PdmUiOrdering& uiOrdering )
auto newCBGroup = uiOrdering.addNewGroup( "Behavior When Loading Data" );
newCBGroup->add( &m_autoComputeDepthRelatedProperties );
newCBGroup->add( &m_loadAndShowSoil );
newCBGroup->add( &m_invalidateLongThinCells );
auto faultGrp = uiOrdering.addNewGroup( "Fault Import" );
@@ -158,7 +162,8 @@ RifReaderSettings RiaPreferencesGrid::gridOnlyReaderSettings()
true, // skipWellData
false, // import summary data
"", // include prefix,
false // only active cells
false, // only active cells
true // ignore long thin cells
};
return rs;
}
@@ -176,7 +181,8 @@ RifReaderSettings RiaPreferencesGrid::readerSettings()
m_skipWellData,
true, // import summary data
m_includeFileAbsolutePathPrefix,
m_onlyLoadActiveCells };
m_onlyLoadActiveCells,
m_invalidateLongThinCells };
return rs;
}
@@ -260,6 +266,14 @@ bool RiaPreferencesGrid::onlyLoadActiveCells() const
return m_onlyLoadActiveCells;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaPreferencesGrid::invalidateLongThinCells() const
{
return m_invalidateLongThinCells;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -55,6 +55,7 @@ public:
bool loadAndShowSoil() const;
bool autoComputeDepthRelatedProperties() const;
bool onlyLoadActiveCells() const;
bool invalidateLongThinCells() const;
RiaDefines::GridModelReader gridModelReader() const;
void setGridModelReaderOverride( const std::string& readerName );
@@ -75,4 +76,5 @@ private:
caf::PdmField<bool> m_autoComputeDepthRelatedProperties;
caf::PdmField<bool> m_loadAndShowSoil;
caf::PdmField<bool> m_onlyLoadActiveCells;
caf::PdmField<bool> m_invalidateLongThinCells;
};

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;
};