From fee9e8f20a2f56088491eec0004139082dc258be Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Mon, 16 Feb 2026 18:43:01 +0100 Subject: [PATCH 1/6] Work in progress --- .../FileInterface/RifOpmDeckTools.cpp | 22 ++++ .../FileInterface/RifOpmDeckTools.h | 4 + .../FileInterface/RifOpmFlowDeckFile.cpp | 13 ++ .../FileInterface/RifOpmFlowDeckFile.h | 3 +- .../SimulationFile/RigSimulationInputTool.cpp | 113 +++++++++++++++++- .../SimulationFile/RigSimulationInputTool.h | 12 +- 6 files changed, 158 insertions(+), 9 deletions(-) diff --git a/ApplicationLibCode/FileInterface/RifOpmDeckTools.cpp b/ApplicationLibCode/FileInterface/RifOpmDeckTools.cpp index 5cbd77a6e79..6600f17455f 100644 --- a/ApplicationLibCode/FileInterface/RifOpmDeckTools.cpp +++ b/ApplicationLibCode/FileInterface/RifOpmDeckTools.cpp @@ -135,4 +135,26 @@ Opm::DeckItem optionalItem( std::string name, std::optional value ) return defaultItem( name ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +Opm::DeckItem item( std::string name, std::set values ) +{ + Opm::DeckItem item1( name, "" ); + for ( const auto& value : values ) + item1.push_back( value ); + return item1; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +Opm::DeckItem item( std::string name, std::vector values ) +{ + Opm::DeckItem item1( name, "" ); + for ( const auto& value : values ) + item1.push_back( value ); + return item1; +} + } // namespace RifOpmDeckTools diff --git a/ApplicationLibCode/FileInterface/RifOpmDeckTools.h b/ApplicationLibCode/FileInterface/RifOpmDeckTools.h index 30dd9b2c00e..f27cd6c7852 100644 --- a/ApplicationLibCode/FileInterface/RifOpmDeckTools.h +++ b/ApplicationLibCode/FileInterface/RifOpmDeckTools.h @@ -19,7 +19,9 @@ #pragma once #include +#include #include +#include namespace Opm { @@ -38,5 +40,7 @@ Opm::DeckItem item( std::string name, double value ); Opm::DeckItem optionalItem( std::string name, std::optional value ); Opm::DeckItem optionalItem( std::string name, std::optional value ); Opm::DeckItem defaultItem( std::string name ); +Opm::DeckItem item( std::string name, std::set values ); +Opm::DeckItem item( std::string name, std::vector values ); } // namespace RifOpmDeckTools diff --git a/ApplicationLibCode/FileInterface/RifOpmFlowDeckFile.cpp b/ApplicationLibCode/FileInterface/RifOpmFlowDeckFile.cpp index aa739c059f5..dd58137bb2b 100644 --- a/ApplicationLibCode/FileInterface/RifOpmFlowDeckFile.cpp +++ b/ApplicationLibCode/FileInterface/RifOpmFlowDeckFile.cpp @@ -986,6 +986,19 @@ bool RifOpmFlowDeckFile::replaceKeywordAtIndex( const Opm::FileDeck::Index& inde return true; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RifOpmFlowDeckFile::removeKeywordAtIndex( const Opm::FileDeck::Index& index ) +{ + if ( m_fileDeck.get() == nullptr ) return false; + + // Erase the keyword at the given index and insert the new one + m_fileDeck->erase( index ); + + return true; +} + //-------------------------------------------------------------------------------------------------- /// Returns number of removed keywords //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/FileInterface/RifOpmFlowDeckFile.h b/ApplicationLibCode/FileInterface/RifOpmFlowDeckFile.h index e6083e652ce..1dbcf36310c 100644 --- a/ApplicationLibCode/FileInterface/RifOpmFlowDeckFile.h +++ b/ApplicationLibCode/FileInterface/RifOpmFlowDeckFile.h @@ -104,7 +104,8 @@ class RifOpmFlowDeckFile bool replaceAllKeywords( const std::string& keywordName, const std::vector& keywords ); bool replaceKeywordAtIndex( const Opm::FileDeck::Index& index, const Opm::DeckKeyword& keyword ); - int removeKeywords( const std::string& keywordName ); + int removeKeywords( const std::string& keywordName ); + bool removeKeywordAtIndex( const Opm::FileDeck::Index& index ); private: void splitDatesIfNecessary(); diff --git a/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp b/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp index 2f82361529d..a21246ee36a 100644 --- a/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp +++ b/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp @@ -145,7 +145,14 @@ std::expected RigSimulationInputTool::exportSimulationInput( RimE return result; } - if ( auto result = filterAndUpdateWellKeywords( &eclipseCase, settings, deckFile ); !result ) + auto validWellNames = wellNamesToInclude( &eclipseCase, settings ); + + if ( auto result = filterAndUpdateWellKeywords( validWellNames, settings, deckFile ); !result ) + { + return result; + } + + if ( auto result = updateWellListKeywords( validWellNames, settings, deckFile ); !result ) { return result; } @@ -1269,9 +1276,7 @@ std::expected RigSimulationInputTool::processBoxRecord //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::expected RigSimulationInputTool::filterAndUpdateWellKeywords( RimEclipseCase* eclipseCase, - const RigSimulationInputSettings& settings, - RifOpmFlowDeckFile& deckFile ) +std::set RigSimulationInputTool::wellNamesToInclude( RimEclipseCase* eclipseCase, const RigSimulationInputSettings& settings ) { // Find wells that intersect with the sector auto intersectingWells = findIntersectingWells( eclipseCase, settings.min(), settings.max() ); @@ -1306,6 +1311,102 @@ std::expected RigSimulationInputTool::filterAndUpdateWellKeywords return names; }() ) ) ); + return validWellNames; +} + +#pragma optimize( "", off ) + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::expected RigSimulationInputTool::updateWellListKeywords( std::set& validWellNames, + const RigSimulationInputSettings& settings, + RifOpmFlowDeckFile& deckFile ) +{ + using W = Opm::ParserKeywords::WLIST; + + // gather existing lists + + auto keywordsWithIndices = deckFile.findAllKeywordsWithIndices( W::keywordName ); + if ( keywordsWithIndices.empty() ) return {}; + + std::map> wellLists; + + for ( auto [index, kw] : keywordsWithIndices ) + { + for ( size_t recordIdx = 0; recordIdx < kw.size(); recordIdx++ ) + { + const auto& record = kw.getRecord( recordIdx ); + if ( record.size() < 3 ) continue; + + const auto& listNameItem = record.getItem( 0 ); + if ( !listNameItem.hasValue( 0 ) || listNameItem.getType() != Opm::type_tag::string ) continue; + std::string listName = listNameItem.get( 0 ); + + const auto& operationItem = record.getItem( 1 ); + if ( !operationItem.hasValue( 0 ) || operationItem.getType() != Opm::type_tag::string ) continue; + std::string operationName = operationItem.get( 0 ); + if ( operationName != "ADD" && operationName != "NEW" ) + { + RiaLogging::warning( + QString( "Unsupported WLIST operation '%1' in list '%2', skipping" ).arg( operationName.c_str() ).arg( listName.c_str() ) ); + continue; + } + + const auto& wellsItem = record.getItem( 2 ); + for ( size_t i = 0; i < wellsItem.data_size(); i++ ) + { + std::string wellName = wellsItem.get( i ); + if ( validWellNames.contains( wellName ) ) + { + wellLists[listName].insert( wellName ); + } + } + } + } + + // generate new wlist kw with the updated set of wells + auto [index, kw] = keywordsWithIndices.front(); + Opm::DeckKeyword newKw( kw.location(), kw.name() ); + + for ( const auto& [listName, wells] : wellLists ) + { + if ( wells.empty() ) continue; + std::vector items; + items.push_back( RifOpmDeckTools::item( "NAME", listName ) ); + items.push_back( RifOpmDeckTools::item( "ACTION", "NEW" ) ); + items.push_back( RifOpmDeckTools::item( "WELLS", wells ) ); + newKw.addRecord( Opm::DeckRecord{ std::move( items ) } ); + } + + if ( newKw.size() > 0 ) + { + // replace the first wlist kw with the new one, remove remaining kws + deckFile.replaceKeywordAtIndex( index, std::move( newKw ) ); + + for ( size_t idx = keywordsWithIndices.size() - 1; idx > 0; idx-- ) + { + deckFile.removeKeywordAtIndex( keywordsWithIndices[idx].first ); + } + } + else + { + // No valid wells - remove all WLIST keywords + deckFile.removeKeywords( W::keywordName ); + } + + return {}; +} + +#pragma optimize( "", on ) + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::expected RigSimulationInputTool::filterAndUpdateWellKeywords( std::set& validWellNames, + const RigSimulationInputSettings& settings, + RifOpmFlowDeckFile& deckFile ) +{ // List of well-related keywords to filter (keywords that reference well names) std::vector wellKeywords = { "COMPDAT", "COMPLUMP", "COMPORD", "COMPSEGS", "WCONHIST", "WCONINJE", "WCONINJH", "WCONPROD", "WCYCLE", "WDFAC", "WDFACCOR", "WEFAC", "WELCNTL", "WELOPEN", @@ -1361,7 +1462,7 @@ std::expected RigSimulationInputTool::filterAndUpdateWellKeywords if ( keywordName == "COMPSEGS" || keywordName == "WELSEGS" ) { currentSegmentWell = wellName; - keepSegmentRecords = ( validWellNames.find( wellName ) != validWellNames.end() ); + keepSegmentRecords = ( validWellNames.contains( wellName ) ); } } else if ( keywordName == "COMPSEGS" || keywordName == "WELSEGS" ) @@ -1371,7 +1472,7 @@ std::expected RigSimulationInputTool::filterAndUpdateWellKeywords } // Check if this well is in our valid set - if ( ( isWellNameRecord && validWellNames.find( wellName ) != validWellNames.end() ) || + if ( ( isWellNameRecord && validWellNames.contains( wellName ) ) || ( !isWellNameRecord && ( keywordName == "COMPSEGS" || keywordName == "WELSEGS" ) && keepSegmentRecords ) ) { // For keywords with IJK coordinates, we need to transform them diff --git a/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.h b/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.h index 46f19299ad7..3e8c7c4867c 100644 --- a/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.h +++ b/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.h @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -148,8 +149,15 @@ class RigSimulationInputTool static std::expected addFaultsToDeckFile( RimEclipseCase* eclipseCase, const RigSimulationInputSettings& settings, RifOpmFlowDeckFile& deckFile ); - static std::expected - filterAndUpdateWellKeywords( RimEclipseCase* eclipseCase, const RigSimulationInputSettings& settings, RifOpmFlowDeckFile& deckFile ); + static std::expected filterAndUpdateWellKeywords( std::set& validWellNames, + const RigSimulationInputSettings& settings, + RifOpmFlowDeckFile& deckFile ); + + static std::expected updateWellListKeywords( std::set& validWellNames, + const RigSimulationInputSettings& settings, + RifOpmFlowDeckFile& deckFile ); + + static std::set wellNamesToInclude( RimEclipseCase* eclipseCase, const RigSimulationInputSettings& settings ); static std::expected exportEditNncKeyword( RimEclipseCase* eclipseCase, const RigSimulationInputSettings& settings, RifOpmFlowDeckFile& deckFile ); From 34555a173a729d32e0fe7cf648be6f4362f31d16 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Tue, 17 Feb 2026 02:13:02 +0100 Subject: [PATCH 2/6] Work in progress --- .../SimulationFile/RigSimulationInputTool.cpp | 57 ++++++++++--------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp b/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp index a21246ee36a..56c2269ce92 100644 --- a/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp +++ b/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp @@ -1330,10 +1330,14 @@ std::expected RigSimulationInputTool::updateWellListKeywords( std auto keywordsWithIndices = deckFile.findAllKeywordsWithIndices( W::keywordName ); if ( keywordsWithIndices.empty() ) return {}; - std::map> wellLists; + std::set existingLists; for ( auto [index, kw] : keywordsWithIndices ) { + std::map> wellLists; + + // TODO - fix this + for ( size_t recordIdx = 0; recordIdx < kw.size(); recordIdx++ ) { const auto& record = kw.getRecord( recordIdx ); @@ -1362,38 +1366,37 @@ std::expected RigSimulationInputTool::updateWellListKeywords( std wellLists[listName].insert( wellName ); } } - } - } - // generate new wlist kw with the updated set of wells - auto [index, kw] = keywordsWithIndices.front(); - Opm::DeckKeyword newKw( kw.location(), kw.name() ); + Opm::DeckKeyword newKw( kw.location(), kw.name() ); - for ( const auto& [listName, wells] : wellLists ) - { - if ( wells.empty() ) continue; - std::vector items; - items.push_back( RifOpmDeckTools::item( "NAME", listName ) ); - items.push_back( RifOpmDeckTools::item( "ACTION", "NEW" ) ); - items.push_back( RifOpmDeckTools::item( "WELLS", wells ) ); - newKw.addRecord( Opm::DeckRecord{ std::move( items ) } ); - } + for ( const auto& [listName, wells] : wellLists ) + { + if ( wells.empty() ) continue; + std::vector items; + items.push_back( RifOpmDeckTools::item( "NAME", listName ) ); + const std::string action = existingLists.contains( listName ) ? "ADD" : "NEW"; + items.push_back( RifOpmDeckTools::item( "ACTION", action ) ); + items.push_back( RifOpmDeckTools::item( "WELLS", wells ) ); + newKw.addRecord( Opm::DeckRecord{ std::move( items ) } ); + } - if ( newKw.size() > 0 ) - { - // replace the first wlist kw with the new one, remove remaining kws - deckFile.replaceKeywordAtIndex( index, std::move( newKw ) ); + if ( newKw.size() > 0 ) + { + // replace the first wlist kw with the new one, remove remaining kws + deckFile.replaceKeywordAtIndex( index, std::move( newKw ) ); + } + else + { + // replace with SKIP kw to remove later + deckFile.replaceKeywordAtIndex( index, Opm::DeckKeyword( kw.location(), "SKIP" ) ); + } - for ( size_t idx = keywordsWithIndices.size() - 1; idx > 0; idx-- ) - { - deckFile.removeKeywordAtIndex( keywordsWithIndices[idx].first ); + if ( wellLists.contains( listName ) ) + { + existingLists.insert( listName ); + } } } - else - { - // No valid wells - remove all WLIST keywords - deckFile.removeKeywords( W::keywordName ); - } return {}; } From b0ad2832c548ea05aa6bfe02445f7284f6b6e850 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Fri, 20 Feb 2026 13:57:15 +0100 Subject: [PATCH 3/6] Support ADD and NEW operations in WLIST kw --- .../SimulationFile/RigSimulationInputTool.cpp | 74 ++++++++++--------- 1 file changed, 41 insertions(+), 33 deletions(-) diff --git a/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp b/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp index 56c2269ce92..9eb89a76008 100644 --- a/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp +++ b/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp @@ -1314,7 +1314,7 @@ std::set RigSimulationInputTool::wellNamesToInclude( RimEclipseCase return validWellNames; } -#pragma optimize( "", off ) +// #pragma optimize( "", off ) //-------------------------------------------------------------------------------------------------- /// @@ -1325,6 +1325,9 @@ std::expected RigSimulationInputTool::updateWellListKeywords( std { using W = Opm::ParserKeywords::WLIST; + int replacedCount = 0; + int removedCount = 0; + // gather existing lists auto keywordsWithIndices = deckFile.findAllKeywordsWithIndices( W::keywordName ); @@ -1332,31 +1335,36 @@ std::expected RigSimulationInputTool::updateWellListKeywords( std std::set existingLists; + // for each WLIST keyword for ( auto [index, kw] : keywordsWithIndices ) { std::map> wellLists; - // TODO - fix this - + // for each list operation in this keyword for ( size_t recordIdx = 0; recordIdx < kw.size(); recordIdx++ ) { const auto& record = kw.getRecord( recordIdx ); if ( record.size() < 3 ) continue; + // the list name const auto& listNameItem = record.getItem( 0 ); if ( !listNameItem.hasValue( 0 ) || listNameItem.getType() != Opm::type_tag::string ) continue; std::string listName = listNameItem.get( 0 ); + // the list operation const auto& operationItem = record.getItem( 1 ); if ( !operationItem.hasValue( 0 ) || operationItem.getType() != Opm::type_tag::string ) continue; std::string operationName = operationItem.get( 0 ); if ( operationName != "ADD" && operationName != "NEW" ) { - RiaLogging::warning( - QString( "Unsupported WLIST operation '%1' in list '%2', skipping" ).arg( operationName.c_str() ).arg( listName.c_str() ) ); + RiaLogging::warning( QString( "Unsupported %1 operation '%2' in list '%3', skipping" ) + .arg( W::keywordName ) + .arg( operationName.c_str() ) + .arg( listName.c_str() ) ); continue; } + // the list of wells to do something with, only include the ones in our valid list const auto& wellsItem = record.getItem( 2 ); for ( size_t i = 0; i < wellsItem.data_size(); i++ ) { @@ -1366,42 +1374,42 @@ std::expected RigSimulationInputTool::updateWellListKeywords( std wellLists[listName].insert( wellName ); } } + } + Opm::DeckKeyword newKw( kw.location(), kw.name() ); - Opm::DeckKeyword newKw( kw.location(), kw.name() ); - - for ( const auto& [listName, wells] : wellLists ) - { - if ( wells.empty() ) continue; - std::vector items; - items.push_back( RifOpmDeckTools::item( "NAME", listName ) ); - const std::string action = existingLists.contains( listName ) ? "ADD" : "NEW"; - items.push_back( RifOpmDeckTools::item( "ACTION", action ) ); - items.push_back( RifOpmDeckTools::item( "WELLS", wells ) ); - newKw.addRecord( Opm::DeckRecord{ std::move( items ) } ); - } - - if ( newKw.size() > 0 ) - { - // replace the first wlist kw with the new one, remove remaining kws - deckFile.replaceKeywordAtIndex( index, std::move( newKw ) ); - } - else - { - // replace with SKIP kw to remove later - deckFile.replaceKeywordAtIndex( index, Opm::DeckKeyword( kw.location(), "SKIP" ) ); - } + for ( const auto& [listName, wells] : wellLists ) + { + if ( wells.empty() ) continue; + std::vector items; + items.push_back( RifOpmDeckTools::item( "NAME", listName ) ); + const std::string action = existingLists.contains( listName ) ? "ADD" : "NEW"; + items.push_back( RifOpmDeckTools::item( "ACTION", action ) ); + items.push_back( RifOpmDeckTools::item( "WELLS", wells ) ); + newKw.addRecord( Opm::DeckRecord{ std::move( items ) } ); + existingLists.insert( listName ); + } - if ( wellLists.contains( listName ) ) - { - existingLists.insert( listName ); - } + if ( newKw.size() > 0 ) + { + // replace the first wlist kw with the new one, remove remaining kws + deckFile.replaceKeywordAtIndex( index, std::move( newKw ) ); + replacedCount++; + } + else + { + // replace with SKIP kw to remove later + deckFile.replaceKeywordAtIndex( index, Opm::DeckKeyword( kw.location(), "SKIP" ) ); + removedCount++; } } + RiaLogging::info( + QString( "Processed keyword '%1': %2 updated, %3 removed" ).arg( W::keywordName ).arg( replacedCount ).arg( removedCount ) ); + return {}; } -#pragma optimize( "", on ) +// #pragma optimize( "", on ) //-------------------------------------------------------------------------------------------------- /// From 5e7452d7beebbefe4d48ed60ec5aca677d700213 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Fri, 20 Feb 2026 15:09:41 +0100 Subject: [PATCH 4/6] Add support for DEL operation --- .../SimulationFile/RigSimulationInputTool.cpp | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp b/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp index 9eb89a76008..c0df56eb60d 100644 --- a/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp +++ b/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp @@ -20,6 +20,7 @@ #include "RiaLogging.h" #include "RiaNncDefines.h" +#include "RiaStdStringTools.h" #include "RigModelPaddingSettings.h" #include "RigPadModel.h" @@ -1339,6 +1340,7 @@ std::expected RigSimulationInputTool::updateWellListKeywords( std for ( auto [index, kw] : keywordsWithIndices ) { std::map> wellLists; + std::map> deleteLists; // for each list operation in this keyword for ( size_t recordIdx = 0; recordIdx < kw.size(); recordIdx++ ) @@ -1355,7 +1357,10 @@ std::expected RigSimulationInputTool::updateWellListKeywords( std const auto& operationItem = record.getItem( 1 ); if ( !operationItem.hasValue( 0 ) || operationItem.getType() != Opm::type_tag::string ) continue; std::string operationName = operationItem.get( 0 ); - if ( operationName != "ADD" && operationName != "NEW" ) + operationName = RiaStdStringTools::toUpper( operationName ); + + bool delOperation = operationName == "DEL"; + if ( operationName != "ADD" && operationName != "NEW" && !delOperation ) { RiaLogging::warning( QString( "Unsupported %1 operation '%2' in list '%3', skipping" ) .arg( W::keywordName ) @@ -1371,7 +1376,10 @@ std::expected RigSimulationInputTool::updateWellListKeywords( std std::string wellName = wellsItem.get( i ); if ( validWellNames.contains( wellName ) ) { - wellLists[listName].insert( wellName ); + if ( delOperation ) + deleteLists[listName].insert( wellName ); + else + wellLists[listName].insert( wellName ); } } } @@ -1389,6 +1397,16 @@ std::expected RigSimulationInputTool::updateWellListKeywords( std existingLists.insert( listName ); } + for ( const auto& [listName, wells] : deleteLists ) + { + if ( wells.empty() ) continue; + std::vector items; + items.push_back( RifOpmDeckTools::item( "NAME", listName ) ); + items.push_back( RifOpmDeckTools::item( "ACTION", "DEL" ) ); + items.push_back( RifOpmDeckTools::item( "WELLS", wells ) ); + newKw.addRecord( Opm::DeckRecord{ std::move( items ) } ); + } + if ( newKw.size() > 0 ) { // replace the first wlist kw with the new one, remove remaining kws From 35eec0b6e2a9e539f2e880148c67da322796ed41 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Fri, 20 Feb 2026 15:13:49 +0100 Subject: [PATCH 5/6] Clean up --- .../SimulationFile/RigSimulationInputTool.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp b/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp index c0df56eb60d..b870014c3db 100644 --- a/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp +++ b/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp @@ -1315,8 +1315,6 @@ std::set RigSimulationInputTool::wellNamesToInclude( RimEclipseCase return validWellNames; } -// #pragma optimize( "", off ) - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1427,8 +1425,6 @@ std::expected RigSimulationInputTool::updateWellListKeywords( std return {}; } -// #pragma optimize( "", on ) - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- From 303265c77a56f4b55d129f77cf8f516a876ae962 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Fri, 20 Feb 2026 15:15:58 +0100 Subject: [PATCH 6/6] Build fix --- .../SimulationFile/RigSimulationInputTool.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp b/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp index b870014c3db..45fc9863b48 100644 --- a/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp +++ b/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp @@ -1361,7 +1361,7 @@ std::expected RigSimulationInputTool::updateWellListKeywords( std if ( operationName != "ADD" && operationName != "NEW" && !delOperation ) { RiaLogging::warning( QString( "Unsupported %1 operation '%2' in list '%3', skipping" ) - .arg( W::keywordName ) + .arg( W::keywordName.c_str() ) .arg( operationName.c_str() ) .arg( listName.c_str() ) ); continue; @@ -1420,7 +1420,7 @@ std::expected RigSimulationInputTool::updateWellListKeywords( std } RiaLogging::info( - QString( "Processed keyword '%1': %2 updated, %3 removed" ).arg( W::keywordName ).arg( replacedCount ).arg( removedCount ) ); + QString( "Processed keyword '%1': %2 updated, %3 removed" ).arg( W::keywordName.c_str() ).arg( replacedCount ).arg( removedCount ) ); return {}; }