#14252 MSW: Report a grid cell only once in COMPSEGS

When several perforation intervals overlap the same grid cell, the main bore COMPSEGS table emitted one row per interval. Two perforations placed back to back therefore reported the same IJK twice, while COMPDAT correctly reported a single connection for that cell.

The candidate intersections collected for one cell all describe the same IJK, so they are now merged into a single COMPSEGS row spanning the union of the overlapping measured depth ranges.

Add TestModels/msw-export/project-files/perf_two_back_to_back.rsp covering the case.
This commit is contained in:
Magne Sjaastad
2026-08-10 09:41:41 +02:00
parent 94da54c4f5
commit c8e11da3d5
2 changed files with 2369 additions and 1 deletions
@@ -360,7 +360,19 @@ RigMswBranch buildMainBoreBranch( const RimWellPath*
if ( !filterEval.includesGlobalCell( cellInfo.globCellIndex ) ) continue;
if ( auto ci = toMswCellIntersection( cellInfo, mainGrid, overlapStart, overlapEnd ) )
{
cellCompsegs.push_back( *ci );
// All candidates here describe the same grid cell, as they are derived from a single cellInfo.
// Several perforation intervals may overlap that cell, but the cell must be connected only once,
// matching the single COMPDAT connection. Widen the existing range instead of adding another row.
if ( cellCompsegs.empty() )
{
cellCompsegs.push_back( *ci );
}
else
{
auto& existing = cellCompsegs.front();
existing.distanceStart = std::min( existing.distanceStart, ci->distanceStart );
existing.distanceEnd = std::max( existing.distanceEnd, ci->distanceEnd );
}
emittedCountPerInterval[perf]++;
}
}
File diff suppressed because it is too large Load Diff