Skip to content

processEclipseFormat: merge removed cells on edge-conformal grids - #1064

Merged
bska merged 1 commit into
OPM:masterfrom
hnil:pr/edge-conformal-merge-minpv
Aug 21, 2026
Merged

processEclipseFormat: merge removed cells on edge-conformal grids#1064
bska merged 1 commit into
OPM:masterfrom
hnil:pr/edge-conformal-merge-minpv

Conversation

@hnil

@hnil hnil commented Aug 20, 2026

Copy link
Copy Markdown
Member

An edge-conformal grid has to stay topologically connected. Cells removed by MINPV must therefore be merged geometrically rather than bridged with NNCs, which would create faces with no geometric counterpart — vertex-based discretizations cannot use those.

So for edge_conformal grids this selects mergeMinPVCells, asserts that no MINPV, PINCH or explicit NNC survives, and treats the merged columns as active gaps.

Nothing changes unless edge_conformal is set.

Split out of #1058 so it can be reviewed on its own: that PR also adds an opt-in thin-cell mode to MinpvProcessor, which is a separate question and not needed for ordinary grids. #1058 is now stacked on this one.

An edge-conformal grid has to stay topologically connected, so cells removed
by MINPV must be merged geometrically rather than bridged with NNCs, which
would create faces with no geometric counterpart.  Selects mergeMinPVCells
for edge-conformal grids, asserts no MINPV/PINCH/explicit NNC survives, and
treats the merged columns as active gaps.

No effect unless edge_conformal is set.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@hnil hnil added the manual:enhancement This is an enhancement/improvent that needs to be documented in the manual label Aug 20, 2026
@hnil
hnil requested a review from bska August 20, 2026 09:55
@bska
bska requested a lite review from Copilot August 20, 2026 09:59
@bska

bska commented Aug 20, 2026

Copy link
Copy Markdown
Member

jenkins build this please

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates CPGrid Eclipse-format processing to support edge-conformal grids by merging MINPV-removed cells geometrically (instead of bridging via NNCs), and by enforcing that edge-conformal grids do not rely on PINCH or explicit NNC connections that would create non-geometric faces.

Changes:

  • Wire edge_conformal to enable geometric merging of MINPV-removed cells via MinpvProcessor (mergeMinPVCells).
  • Add edge-conformal invariants intended to ensure no MINPV/PINCH/explicit NNC bridging remains.
  • Treat merged columns as active gaps by forcing pinchActive during grid construction when edge_conformal is enabled.
Suppressed comments (3)

opm/grid/cpgrid/processEclipseFormat.cpp:216

  • When edge_conformal is enabled, mergeMinPVCells avoids MINPV NNCs, so minpv_result.nnc can be empty even though MinpvProcessor::process() still modified zcornData (collapsed/merged cells). Guarding this->zcorn = zcornData; only on minpv_result.nnc risks losing the updated ZCORN needed for correct EclipseGrid output.

This issue also appears in the following locations of the same file:

  • line 230
  • line 431
                                          poreVolume, ecl_grid.getMinpvVector(), actnumData, mergeMinPVCells,
                                          zcornData.data(), nogap, pinchOptionALL,
                                          permZ, multZ, tolerance_unique_points);
                if (!minpv_result.nnc.empty()) {
                    this->zcorn = zcornData;

opm/grid/cpgrid/processEclipseFormat.cpp:234

  • This assert(minpv_result.nnc.empty()) is a release-build no-op, so an edge_conformal grid could silently proceed while still having MINPV/PINCH NNCs (MinpvProcessor can also generate NNCs for vertical gaps unrelated to MINPV). If edge_conformal requires no NNCs, enforce it with a runtime check and a clear error message.
            if (edge_conformal) {
                // Merged (not bridged) cells: an edge-conformal grid must not
                // produce artificial faces via MINPV NNCs.
                assert(minpv_result.nnc.empty());
            }

opm/grid/cpgrid/processEclipseFormat.cpp:435

  • These assert()s are compiled out in release builds, so edge_conformal grids could still be built with PINCH or explicit NNCs even though the comment states they must not. Convert the invariant into a runtime check so invalid decks/configurations fail deterministically with an actionable message.
                // the merged columns as active gaps.
                pinchActive_copy = true;
                assert(nnc_cells[PinchNNC].empty());
                assert(nnc_cells[ExplicitNNC].empty());
            }

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@bska bska left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good. I'll merge into master.

@bska
bska merged commit 0f95d63 into OPM:master Aug 21, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

manual:enhancement This is an enhancement/improvent that needs to be documented in the manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants