Guard against undefined permeability index in riTRANS computation

computeRiTransComponent() checks the transmissibility index and the neighbor
cell permeability index for cvf::UNDEFINED_SIZE_T, but not the permeability
index of the cell itself. The transmissibility and permeability results are
indexed independently, so a defined transmissibility index does not imply a
defined permeability index. For a case where transmissibility is stored per
cell and permeability per active cell, an inactive cell passes the
transmissibility check and then indexes the permeability vector with
UNDEFINED_SIZE_T.

Check the permeability index of the cell before use, matching the guard in
computeNncCombRiTrans().
This commit is contained in:
Magne Sjaastad
2026-08-10 10:07:32 +02:00
parent abfec02080
commit dd63083c13
@@ -2372,6 +2372,11 @@ void RigCaseCellResultsData::computeRiTransComponent( const QString& riTransComp
size_t neighborResvCellIdx = grid->reservoirCellIndex( gridLocalNeighborCellIdx );
const RigCell& neighborCell = m_ownerMainGrid->cell( neighborResvCellIdx );
// Do nothing if this cell has no permeability result. The transmissibility and the permeability results can use
// different indexing, so a defined transmissibility index does not imply a defined permeability index.
size_t nativeCellPermResIdx = ( *permIdxFunc )( activeCellInfo, nativeResvCellIndex );
if ( nativeCellPermResIdx == cvf::UNDEFINED_SIZE_T ) continue;
// Do nothing if neighbor cell has no results
size_t neighborCellPermResIdx = ( *permIdxFunc )( activeCellInfo, neighborResvCellIdx );
if ( neighborCellPermResIdx == cvf::UNDEFINED_SIZE_T ) continue;
@@ -2402,8 +2407,7 @@ void RigCaseCellResultsData::computeRiTransComponent( const QString& riTransComp
{
cvf::Vec3d centerToFace = nativeCell.faceCenter( faceId ) - nativeCell.center();
size_t permResIdx = ( *permIdxFunc )( activeCellInfo, nativeResvCellIndex );
double perm = permResults[permResIdx];
double perm = permResults[nativeCellPermResIdx];
double ntg = 1.0;
if ( hasNTGResults && faceId != cvf::StructGridInterface::POS_K )