#14622 Sector export: Preserve separate include files for ACTNUM and FAULTS

Sector model export removed all ACTNUM and FAULTS keywords from the deck
and re-inserted the sector-specific replacements at the end of the GRID
section, which always lands in the main DATA file. Decks that keep these
keywords in separate include files lost their file organization, leaving
the original include files empty while the data was written inline.

Collapse duplicates to a single occurrence instead of removing all
occurrences, so the subsequent in-place replacement keeps the keyword in
its original file when the deck is saved with OutputMode::COPY. ACTNUM
keeps the last occurrence since a later ACTNUM overrides an earlier one;
FAULTS keeps the first so fault definitions do not move past keywords
referencing them.
This commit is contained in:
Kristian Bendiksen committed 2026-08-31 20:14:38 +02:00
1 parent c3c427a01f
commit 65f16d04ef
7 files changed
+466 -4

No files matched your search

@@ -210,8 +210,10 @@ std::expected<void, QString> RigSimulationInputTool::updateCornerPointGridInDeck
RigResdataGridConverter::convertGridToCornerPointArrays( gridAdapter, coordArray, zcornArray, actnumArray );
// Remove ACTNUM to handle deck where it appears more than once.
deckFile.removeKeywords( "ACTNUM" );
// Collapse ACTNUM to a single occurrence so the replacement below stays in its original
// (possibly included) file when the deck is saved. Keep the last occurrence, as it is the
// effective one when ACTNUM appears more than once.
deckFile.removeDuplicateKeywords( "ACTNUM", false );
auto keywords = deckFile.keywords( false );
@@ -1123,8 +1125,10 @@ std::expected<void, QString> RigSimulationInputTool::addFaultsToDeckFile( RimEcl
const RigSimulationInputSettings& settings,
RifOpmFlowDeckFile& deckFile )
{
// Remove FAULTS to handle deck where it appears more than once.
deckFile.removeKeywords( "FAULTS" );
// Collapse FAULTS to a single occurrence so the replacement below stays in its original
// (possibly included) file when the deck is saved. Keep the first occurrence so fault
// definitions do not move past keywords referencing them (e.g. MULTFLT).
deckFile.removeDuplicateKeywords( "FAULTS", true );
// Create FAULTS keyword using the factory
Opm::DeckKeyword faultsKw =