From 0f56eaed6b9b4f93776c95deb0c65037da6ee066 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 13 Nov 2023 10:21:20 +0100 Subject: [PATCH] Add optional IJK to ResultPoint for easier debugging --- .../FileInterface/RifReaderEclipseOutput.cpp | 6 +++++ .../RigSimulationWellCenterLineCalculator.cpp | 27 ++++++++++++------- .../ReservoirDataModel/RigWellResultPoint.cpp | 16 +++++++++++ .../ReservoirDataModel/RigWellResultPoint.h | 8 ++++++ 4 files changed, 47 insertions(+), 10 deletions(-) diff --git a/ApplicationLibCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationLibCode/FileInterface/RifReaderEclipseOutput.cpp index b50728dada..b4ee519238 100644 --- a/ApplicationLibCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderEclipseOutput.cpp @@ -1243,6 +1243,12 @@ RigWellResultPoint RifReaderEclipseOutput::createWellResultPoint( const RigGridB resultPoint.setFlowData( volumeRate, oilRate, adjustedGasRate, waterRate ); resultPoint.setConnectionFactor( connectionFactor ); + + auto ijkOneBased = grid->ijkFromCellIndexOneBased( gridCellIndex ); + if ( ijkOneBased ) + { + resultPoint.setIjk( *ijkOneBased ); + } } return resultPoint; diff --git a/ApplicationLibCode/ReservoirDataModel/RigSimulationWellCenterLineCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/RigSimulationWellCenterLineCalculator.cpp index 74b7e6e210..ee3cbadb8b 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigSimulationWellCenterLineCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigSimulationWellCenterLineCalculator.cpp @@ -220,19 +220,26 @@ void RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineForTimeSt bool isMultiSegmentWell = wellResults->isMultiSegmentWell(); -#if 0 // Fancy branch splitting, but with artifacts. Needs a bit more work to be better overall than the one we have. - RigWellResultFrame splittedWellFrame; - if (!isMultiSegmentWell && isAutoDetectBranches) - { - splittedWellFrame = splitIntoBranches(*wellFramePtr, eclipseCaseData); - wellFramePtr = &splittedWellFrame; - isMultiSegmentWell = true; - } -#endif - const RigWellResultFrame& wellFrame = *wellFramePtr; const std::vector resBranches = wellFrame.wellResultBranches(); + const bool debugOutput = false; + if ( debugOutput ) + { + for ( const auto& branch : resBranches ) + { + QString branchTxt; + for ( const auto& resultPoint : branch.branchResultPoints() ) + { + if ( resultPoint.cellIjk().has_value() ) + { + branchTxt += QString( " %1 \n" ).arg( QString::fromStdString( ( *resultPoint.cellIjk() ).toString() ) ); + } + } + RiaLogging::debug( branchTxt ); + } + } + // Well head // Match this position with well head position in RivWellHeadPartMgr::buildWellHeadParts() diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellResultPoint.cpp b/ApplicationLibCode/ReservoirDataModel/RigWellResultPoint.cpp index 5d17092969..3cd253efc8 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigWellResultPoint.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigWellResultPoint.cpp @@ -301,3 +301,19 @@ cvf::Vec3d RigWellResultPoint::bottomPosition() const { return m_bottomPosition; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::optional RigWellResultPoint::cellIjk() const +{ + return m_cellIjk; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigWellResultPoint::setIjk( caf::VecIjk cellIJK ) +{ + m_cellIjk = cellIJK; +} diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellResultPoint.h b/ApplicationLibCode/ReservoirDataModel/RigWellResultPoint.h index ad8134af8e..d770c39bef 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigWellResultPoint.h +++ b/ApplicationLibCode/ReservoirDataModel/RigWellResultPoint.h @@ -22,8 +22,11 @@ #include "cvfVector3.h" +#include "cafVecIjk.h" + #include +#include #include //================================================================================================== @@ -70,6 +73,9 @@ struct RigWellResultPoint cvf::Vec3d bottomPosition() const; + std::optional cellIjk() const; + void setIjk( caf::VecIjk cellIJK ); + private: size_t m_gridIndex; size_t m_cellIndex; //< Index to cell which is included in the well @@ -89,4 +95,6 @@ private: double m_connectionFactor; bool m_isConnectedToValve; + + std::optional m_cellIjk; };