From b771421087b798c4522453c65fc70eb527abab8c Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 8 Oct 2025 08:59:41 +0200 Subject: [PATCH] #12994 Radial model: Freeze when selecting cell result INDEX_IJK When a LGR is created to be able to show the radial grid, the active index usage when computing INDEX_IJK was wrong. wip --- .../Commands/RicCreateTemporaryLgrFeature.cpp | 18 +++--------------- .../Commands/RicCreateTemporaryLgrFeature.h | 5 +++-- .../RigIndexIjkResultCalculator.cpp | 10 +++++----- 3 files changed, 11 insertions(+), 22 deletions(-) diff --git a/ApplicationLibCode/Commands/RicCreateTemporaryLgrFeature.cpp b/ApplicationLibCode/Commands/RicCreateTemporaryLgrFeature.cpp index a89676f03d..1242a5a259 100644 --- a/ApplicationLibCode/Commands/RicCreateTemporaryLgrFeature.cpp +++ b/ApplicationLibCode/Commands/RicCreateTemporaryLgrFeature.cpp @@ -64,24 +64,12 @@ void RicCreateTemporaryLgrFeature::createLgrsForWellPaths( std::vector& completionTypes, QStringList* wellsIntersectingOtherLgrs ) { - auto eclipseCaseData = eclipseCase->eclipseCaseData(); - RigActiveCellInfo* activeCellInfo = eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ); - RigActiveCellInfo* fractureActiveCellInfo = eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::FRACTURE_MODEL ); - auto lgrs = RicExportLgrFeature::buildLgrsForWellPaths( wellPaths, eclipseCase, timeStep, refinement, splitType, completionTypes, wellsIntersectingOtherLgrs ); for ( const auto& lgr : lgrs ) { - createLgr( lgr, eclipseCase->eclipseCaseData()->mainGrid() ); - - size_t lgrCellCount = lgr.lgrCellCount(); - - activeCellInfo->addLgr( lgrCellCount ); - if ( fractureActiveCellInfo->reservoirActiveCellCount() > 0 ) - { - fractureActiveCellInfo->addLgr( lgrCellCount ); - } + createLgr( lgr, eclipseCase->eclipseCaseData() ); } } @@ -154,7 +142,7 @@ void RicCreateTemporaryLgrFeature::setupActionLook( QAction* actionToSetup ) //-------------------------------------------------------------------------------------------------- /// Todo: Guarding, caching LGR corner nodes calculations //-------------------------------------------------------------------------------------------------- -RigGridBase* RicCreateTemporaryLgrFeature::createLgr( const LgrInfo& lgrInfo, RigMainGrid* mainGrid ) +RigGridBase* RicCreateTemporaryLgrFeature::createLgrForGrid( const LgrInfo& lgrInfo, RigMainGrid* mainGrid ) { int lgrId = lgrInfo.id; size_t totalCellCount = mainGrid->totalCellCount(); @@ -245,7 +233,7 @@ RigGridBase* RicCreateTemporaryLgrFeature::createLgr( const LgrInfo& lgrInfo, Ri auto gridCount = mainGrid->gridCount(); auto mainGridCellCount = mainGrid->totalCellCount(); - auto localGrid = createLgr( lgrInfo, mainGrid ); + auto localGrid = createLgrForGrid( lgrInfo, mainGrid ); if ( auto activeInfo = caseData->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ) ) { diff --git a/ApplicationLibCode/Commands/RicCreateTemporaryLgrFeature.h b/ApplicationLibCode/Commands/RicCreateTemporaryLgrFeature.h index 0a490f5935..936a63d788 100644 --- a/ApplicationLibCode/Commands/RicCreateTemporaryLgrFeature.h +++ b/ApplicationLibCode/Commands/RicCreateTemporaryLgrFeature.h @@ -52,10 +52,11 @@ public: QStringList* wellsIntersectingOtherLgrs ); static RigGridBase* createLgr( const LgrInfo& lgrInfo, RigEclipseCaseData* caseData ); - static RigGridBase* createLgr( const LgrInfo& lgrInfo, RigMainGrid* mainGrid ); -protected: +private: bool isCommandEnabled() const override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; + + static RigGridBase* createLgrForGrid( const LgrInfo& lgrInfo, RigMainGrid* mainGrid ); }; diff --git a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigIndexIjkResultCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigIndexIjkResultCalculator.cpp index b8557da0f2..0fc1cc80ec 100644 --- a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigIndexIjkResultCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigIndexIjkResultCalculator.cpp @@ -55,7 +55,8 @@ bool RigIndexIjkResultCalculator::isMatching( const RigEclipseResultAddress& res //-------------------------------------------------------------------------------------------------- void RigIndexIjkResultCalculator::calculate( const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex ) { - size_t activeCellCount = m_resultsData->activeCellInfo()->reservoirActiveCellCount(); + const auto activeReservoirCellIndices = m_resultsData->activeCellInfo()->activeReservoirCellIndices(); + const size_t activeCellCount = activeReservoirCellIndices.size(); if ( activeCellCount == 0 ) return; size_t iResultIndex = @@ -98,13 +99,12 @@ void RigIndexIjkResultCalculator::calculate( const RigEclipseResultAddress& resV if ( !( computeIndexI || computeIndexJ || computeIndexK ) ) return; - const auto mainGrid = m_resultsData->m_ownerMainGrid; - const auto activeCells = m_resultsData->activeCellInfo()->activeReservoirCellIndices(); + const auto mainGrid = m_resultsData->m_ownerMainGrid; #pragma omp parallel for - for ( int activeIndex = 0; activeIndex < static_cast( activeCells.size() ); activeIndex++ ) + for ( int activeIndex = 0; activeIndex < static_cast( activeReservoirCellIndices.size() ); activeIndex++ ) { - auto cellIdx = activeCells[activeIndex]; + auto cellIdx = activeReservoirCellIndices[activeIndex]; if ( cellIdx == cvf::UNDEFINED_SIZE_T ) continue; const RigCell& cell = mainGrid->cell( cellIdx );