Skip to content

[LGR] Support writing NNA blocks for cross-LGR NNC connections#5060

Merged
bska merged 4 commits intoOPM:masterfrom
arturcastiel:lgr-nnca
Mar 13, 2026
Merged

[LGR] Support writing NNA blocks for cross-LGR NNC connections#5060
bska merged 4 commits intoOPM:masterfrom
arturcastiel:lgr-nnca

Conversation

@arturcastiel
Copy link
Member

@arturcastiel arturcastiel commented Mar 13, 2026

Support writing NNA blocks for cross-LGR NNC connections

Description

This PR extends the EGRID writer to support cross-LGR NNC connections using the NNA keywords.
Previously, only the following NNC types were written:

  • Same-grid NNC (NNC1 / NNC2)
  • Local–global NNC (NNCL / NNCG)

Connections between two different LGR grids were not written to the EGRID file.
This PR adds support for those connections via:

  • NNCHEADA
  • NNA1
  • NNA2

Implementation

The following changes were introduced:

  • Added save_nna() to write cross-grid NNC blocks.
  • Iteration over NNCCollection::diff_grid_nnc() to detect connections between different grids.
  • Skip global-grid connections (grid = 0) in the NNA stage since those are written as NNCL/NNCG.
  • Simplified save_nnc_local_global() by removing the local_first parameter and assuming the normalized ordering provided by NNCDiffGrid.

New output structure:

Connection type Keywords written
Same grid NNCHEAD, NNC1, NNC2
LGR–Global NNCHEAD, NNCL, NNCG
LGR–LGR NNCHEADA, NNA1, NNA2

Tests

Added a new integration test:

tests/parser/integration/NNCTestsLGR.cpp

The test:

  • Constructs an NNCCollection containing:
    • global NNCs
    • same-grid LGR NNCs
    • LGR–global cross-grid NNCs
    • LGR–LGR cross-grid NNCs
  • Verifies that the correct blocks are produced and that the indices match expectations.

Bug fixes

save_nnc_local_global was also simplified, ensuring consistent order of NNCL and NNCG. Tests were changed accordingly.

@arturcastiel
Copy link
Member Author

jenkins build this please

@bska bska added the manual:irrelevant This PR is a minor fix and should not appear in the manual label Mar 13, 2026
@arturcastiel
Copy link
Member Author

jenkins build this please

@arturcastiel arturcastiel changed the title [LGR] Support writing NNCA blocks for cross-LGR NNC connections [LGR] Support writing NNA blocks for cross-LGR NNC connections Mar 13, 2026
Copy link
Member

@bska bska left a comment

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 b4f30cc into OPM:master Mar 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

manual:irrelevant This PR is a minor fix and should not appear in the manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants