Handle active cells in files with thermal data (rockv) (#13159)

* Handle active cells in files with thermal data from intersect
This commit is contained in:
JJ
2025-11-12 07:13:24 +01:00
committed by GitHub
parent 6df569850d
commit 39c2282904
4 changed files with 28 additions and 6 deletions
@@ -445,6 +445,14 @@ QString RiaResultNames::porv()
return "PORV";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaResultNames::rockv()
{
return "ROCKV";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -84,6 +84,7 @@ QString faultDistanceName();
QString facies();
QString porv();
QString rockv();
QString soil();
QString sgas();
QString swat();
@@ -1101,6 +1101,8 @@ std::vector<std::vector<int>> RifReaderOpmCommon::readActiveCellInfoFromPorv( Ri
std::vector<std::vector<int>> activeCellsAllGrids;
bool hasThermalData = m_initFile->hasArray( RiaResultNames::rockv().toStdString() );
bool divideCellCountByTwo = isDualPorosity;
const int nGrids = (int)m_gridNames.size();
@@ -1108,6 +1110,10 @@ std::vector<std::vector<int>> RifReaderOpmCommon::readActiveCellInfoFromPorv( Ri
for ( int gridIdx = 0; gridIdx < nGrids; gridIdx++ )
{
auto porvValues = m_initFile->getInitData<float>( RiaResultNames::porv().toStdString(), m_gridNames[gridIdx] );
auto rockValues = hasThermalData ? m_initFile->getInitData<float>( RiaResultNames::rockv().toStdString(), m_gridNames[gridIdx] )
: std::vector<float>();
rockValues.resize( porvValues.size(), 0.0f ); // Ensure rockValues has same size as porvValues, fill with 0.0f if not present
int activeCellCount = (int)porvValues.size();
if ( divideCellCountByTwo )
@@ -1118,19 +1124,19 @@ std::vector<std::vector<int>> RifReaderOpmCommon::readActiveCellInfoFromPorv( Ri
std::vector<int> activeCellsOneGrid;
activeCellsOneGrid.resize( activeCellCount, 0 );
for ( int poreValueIndex = 0; poreValueIndex < static_cast<int>( porvValues.size() ); poreValueIndex++ )
for ( int resultIndex = 0; resultIndex < static_cast<int>( porvValues.size() ); resultIndex++ )
{
int indexToCell = poreValueIndex;
int indexToCell = resultIndex;
if ( indexToCell >= activeCellCount )
{
indexToCell = poreValueIndex - activeCellCount;
indexToCell = resultIndex - activeCellCount;
}
if ( porvValues[poreValueIndex] > 0.0f )
if ( porvValues[resultIndex] > 0.0f )
{
if ( isDualPorosity )
{
if ( poreValueIndex < activeCellCount )
if ( resultIndex < activeCellCount )
{
activeCellsOneGrid[indexToCell] += (int)ActiveType::ACTIVE_MATRIX_VALUE;
}
@@ -1144,6 +1150,13 @@ std::vector<std::vector<int>> RifReaderOpmCommon::readActiveCellInfoFromPorv( Ri
activeCellsOneGrid[indexToCell] += (int)ActiveType::ACTIVE_MATRIX_VALUE;
}
}
if ( rockValues[resultIndex] > 0.0f )
{
if ( activeCellsOneGrid[indexToCell] == 0 )
{
activeCellsOneGrid[indexToCell] += (int)ActiveType::ACTIVE_MATRIX_VALUE;
}
}
}
activeCellsAllGrids.push_back( activeCellsOneGrid );