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 authored and GitHub committed 2024-09-13 07:34:14 +02:00
1 parent 92907b04ef
commit fd2989972d
10 files changed
+61 -14

No files matched your search

@@ -91,6 +91,9 @@ RiaPreferencesGrid::RiaPreferencesGrid()
CAF_PDM_InitField( &m_onlyLoadActiveCells, "onlyLoadActiveCells", false, "Only Load Active Cell Geometry (Experimental)" ); CAF_PDM_InitField( &m_onlyLoadActiveCells, "onlyLoadActiveCells", false, "Only Load Active Cell Geometry (Experimental)" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_onlyLoadActiveCells ); 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" ); auto newCBGroup = uiOrdering.addNewGroup( "Behavior When Loading Data" );
newCBGroup->add( &m_autoComputeDepthRelatedProperties ); newCBGroup->add( &m_autoComputeDepthRelatedProperties );
newCBGroup->add( &m_loadAndShowSoil ); newCBGroup->add( &m_loadAndShowSoil );
newCBGroup->add( &m_invalidateLongThinCells );
auto faultGrp = uiOrdering.addNewGroup( "Fault Import" ); auto faultGrp = uiOrdering.addNewGroup( "Fault Import" );
@@ -158,7 +162,8 @@ RifReaderSettings RiaPreferencesGrid::gridOnlyReaderSettings()
true, // skipWellData true, // skipWellData
false, // import summary data false, // import summary data
"", // include prefix, "", // include prefix,
false // only active cells false, // only active cells
true // ignore long thin cells
}; };
return rs; return rs;
} }
@@ -176,7 +181,8 @@ RifReaderSettings RiaPreferencesGrid::readerSettings()
m_skipWellData, m_skipWellData,
true, // import summary data true, // import summary data
m_includeFileAbsolutePathPrefix, m_includeFileAbsolutePathPrefix,
m_onlyLoadActiveCells }; m_onlyLoadActiveCells,
m_invalidateLongThinCells };
return rs; return rs;
} }
@@ -260,6 +266,14 @@ bool RiaPreferencesGrid::onlyLoadActiveCells() const
return m_onlyLoadActiveCells; return m_onlyLoadActiveCells;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaPreferencesGrid::invalidateLongThinCells() const
{
return m_invalidateLongThinCells;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -55,6 +55,7 @@ public:
bool loadAndShowSoil() const; bool loadAndShowSoil() const;
bool autoComputeDepthRelatedProperties() const; bool autoComputeDepthRelatedProperties() const;
bool onlyLoadActiveCells() const; bool onlyLoadActiveCells() const;
bool invalidateLongThinCells() const;
RiaDefines::GridModelReader gridModelReader() const; RiaDefines::GridModelReader gridModelReader() const;
void setGridModelReaderOverride( const std::string& readerName ); void setGridModelReaderOverride( const std::string& readerName );
@@ -75,4 +76,5 @@ private:
caf::PdmField<bool> m_autoComputeDepthRelatedProperties; caf::PdmField<bool> m_autoComputeDepthRelatedProperties;
caf::PdmField<bool> m_loadAndShowSoil; caf::PdmField<bool> m_loadAndShowSoil;
caf::PdmField<bool> m_onlyLoadActiveCells; caf::PdmField<bool> m_onlyLoadActiveCells;
caf::PdmField<bool> m_invalidateLongThinCells;
}; };
@@ -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 ); 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 ) if ( readFaultData )
{ {
@@ -155,7 +155,8 @@ bool RifReaderEclipseOutput::transferGridCellData( RigMainGrid* mainGrid
RigGridBase* localGrid, RigGridBase* localGrid,
const ecl_grid_type* localEclGrid, const ecl_grid_type* localEclGrid,
size_t matrixActiveStartIndex, size_t matrixActiveStartIndex,
size_t fractureActiveStartIndex ) size_t fractureActiveStartIndex,
bool invalidateLongPyramidCells )
{ {
CVF_ASSERT( activeCellInfo && fractureActiveCellInfo ); CVF_ASSERT( activeCellInfo && fractureActiveCellInfo );
@@ -225,7 +226,10 @@ bool RifReaderEclipseOutput::transferGridCellData( RigMainGrid* mainGrid
// Forslag // Forslag
// if (!invalid && (cell.isInCoarseCell() || (!cell.isActiveInMatrixModel() && // if (!invalid && (cell.isInCoarseCell() || (!cell.isActiveInMatrixModel() &&
// !cell.isActiveInFractureModel()) ) ) // !cell.isActiveInFractureModel()) ) )
cell.setInvalid( cell.isLongPyramidCell() ); if ( invalidateLongPyramidCells )
{
cell.setInvalid( cell.isLongPyramidCell() );
}
} }
return true; return true;
@@ -234,7 +238,7 @@ bool RifReaderEclipseOutput::transferGridCellData( RigMainGrid* mainGrid
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Read geometry from file given by name into given reservoir object /// 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 ); CVF_ASSERT( eclipseCase );
@@ -306,7 +310,7 @@ bool RifReaderEclipseOutput::transferGeometry( const ecl_grid_type* mainEclGrid,
{ {
auto task = progInfo.task( "Loading Main Grid Data", 3 ); 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 ); 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 ); ecl_grid_type* localEclGrid = ecl_grid_iget_lgr( mainEclGrid, lgrIdx );
RigLocalGrid* localGrid = static_cast<RigLocalGrid*>( mainGrid->gridByIndex( lgrIdx + 1 ) ); 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 ); int matrixActiveCellCount = ecl_grid_get_nactive( localEclGrid );
globalMatrixActiveSize += matrixActiveCellCount; globalMatrixActiveSize += matrixActiveCellCount;
@@ -395,7 +406,7 @@ bool RifReaderEclipseOutput::open( const QString& fileName, RigEclipseCaseData*
{ {
auto task = progress.task( "Transferring grid geometry", 10 ); 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() ); RifOpmRadialGridTools::importCoordinatesForRadialGrid( fileName.toStdString(), eclipseCaseData->mainGrid() );
} }
@@ -72,7 +72,7 @@ public:
std::vector<QDateTime> allTimeSteps() const; 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 transferCoarseningInfo( const ecl_grid_type* eclGrid, RigGridBase* grid );
static void static void
importEquilData( const QString& deckFileName, const QString& includeStatementAbsolutePathPrefix, RigEclipseCaseData* eclipseCase ); importEquilData( const QString& deckFileName, const QString& includeStatementAbsolutePathPrefix, RigEclipseCaseData* eclipseCase );
@@ -111,7 +111,8 @@ private:
RigGridBase* localGrid, RigGridBase* localGrid,
const ecl_grid_type* localEclGrid, const ecl_grid_type* localEclGrid,
size_t matrixActiveStartIndex, size_t matrixActiveStartIndex,
size_t fractureActiveStartIndex ); size_t fractureActiveStartIndex,
bool invalidateLongPyramidCells );
private: private:
QString m_fileName; // Name of file used to start accessing Eclipse output files QString m_fileName; // Name of file used to start accessing Eclipse output files
@@ -89,6 +89,14 @@ bool RifReaderInterface::onlyLoadActiveCells() const
return m_readerSettings.onlyLoadActiveCells; return m_readerSettings.onlyLoadActiveCells;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RifReaderInterface::invalidateLongThinCells() const
{
return m_readerSettings.invalidateLongThinCells;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -58,6 +58,7 @@ public:
bool loadWellDataEnabled() const; bool loadWellDataEnabled() const;
const QString faultIncludeFileAbsolutePathPrefix() const; const QString faultIncludeFileAbsolutePathPrefix() const;
bool onlyLoadActiveCells() const; bool onlyLoadActiveCells() const;
bool invalidateLongThinCells() const;
void setReaderSettings( RifReaderSettings readerSettings ); void setReaderSettings( RifReaderSettings readerSettings );
@@ -414,6 +414,8 @@ void RifReaderOpmCommon::transferGeometry( Opm::EclIO::EGrid& opmMainGrid,
size_t cellStartIndex = mainGrid->globalCellArray().size(); size_t cellStartIndex = mainGrid->globalCellArray().size();
size_t nodeStartIndex = mainGrid->nodes().size(); size_t nodeStartIndex = mainGrid->nodes().size();
const bool invalidateLongPyramidCells = invalidateLongThinCells();
RigCell defaultCell; RigCell defaultCell;
defaultCell.setHostGrid( localGrid ); defaultCell.setHostGrid( localGrid );
@@ -504,8 +506,10 @@ void RifReaderOpmCommon::transferGeometry( Opm::EclIO::EGrid& opmMainGrid,
yCenterCoordOpm ); yCenterCoordOpm );
} }
} }
if ( invalidateLongPyramidCells )
cell.setInvalid( cell.isLongPyramidCell() ); {
cell.setInvalid( cell.isLongPyramidCell() );
}
} }
// subgrid pointers // subgrid pointers
@@ -183,6 +183,8 @@ void RifReaderOpmCommonActive::transferActiveGeometry( Opm::EclIO::EGrid& opmMa
? RifOpmRadialGridTools::computeXyCenterForTopOfCells( opmMainGrid, opmMainGrid, activeGrid ) ? RifOpmRadialGridTools::computeXyCenterForTopOfCells( opmMainGrid, opmMainGrid, activeGrid )
: std::map<int, std::pair<double, double>>(); : std::map<int, std::pair<double, double>>();
const bool invalidateLongPyramidCells = invalidateLongThinCells();
// use same mapping as resdata // use same mapping as resdata
const size_t cellMappingECLRi[8] = { 0, 1, 3, 2, 4, 5, 7, 6 }; 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.cornerIndices()[riCornerIndex] = riNodeIndex;
} }
cell.setInvalid( cell.isLongPyramidCell() ); if ( invalidateLongPyramidCells )
{
cell.setInvalid( cell.isLongPyramidCell() );
}
} }
} }
@@ -36,4 +36,5 @@ struct RifReaderSettings
bool importSummaryData; bool importSummaryData;
QString includeFileAbsolutePathPrefix; QString includeFileAbsolutePathPrefix;
bool onlyLoadActiveCells; bool onlyLoadActiveCells;
bool invalidateLongThinCells;
}; };