diff --git a/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp b/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp index dcc285a0ed..bcd70c5249 100644 --- a/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp +++ b/ApplicationLibCode/ReservoirDataModel/SimulationFile/RigSimulationInputTool.cpp @@ -108,8 +108,6 @@ std::expected RigSimulationInputTool::exportSimulationInput( RimE // TODO: fix this.. deckFile.removeKeywords( "MAPAXES" ); - deckFile.removeKeywords( "SPECGRID" ); - // Save the modified deck file to the export directory if ( !deckFile.saveDeckInline( outputFolder.toStdString(), outputFile.toStdString() ) ) { @@ -147,6 +145,17 @@ std::expected RigSimulationInputTool::updateCornerPointGridInDeck return std::unexpected( "Failed to replace DIMENS keyword in deck file" ); } + // SPECGRID has the same dimensions plus NUMRES and COORD_TYPE + // Format: NX NY NZ (use defaults for NUMRES (1) and COORD_TYPE: 'F'=Cartesian) + std::vector specgrid = { static_cast( gridAdapter.cellCountI() ), + static_cast( gridAdapter.cellCountJ() ), + static_cast( gridAdapter.cellCountK() ) }; + + if ( !deckFile.replaceKeywordData( "SPECGRID", specgrid ) ) + { + return std::unexpected( "Failed to replace SPECGRID keyword in deck file" ); + } + auto convertToDoubleVector = []( const std::vector& vec ) { std::vector outVec;