From 44617ae1058b0ec3bcaf148052d1e9142a1eda3c Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 14 Feb 2024 13:41:39 +0100 Subject: [PATCH] #11069 RFT segment topology The segment symbol is displayed once per segment. Previous code used segment start as symbol location. Add support for selecting the location for the segment indicator, either start, mid or end. When reading segment property values, always use segment end as the curve is plotted using step left. --- .../ProjectDataModel/WellLog/RimRftTools.cpp | 41 +++++++++++++----- .../ProjectDataModel/WellLog/RimRftTools.h | 16 ++++--- .../WellLog/RimRftTopologyCurve.cpp | 43 +++++++++++++++++-- .../WellLog/RimRftTopologyCurve.h | 20 ++++++--- .../WellLog/RimWellLogRftCurve.cpp | 3 +- 5 files changed, 97 insertions(+), 26 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTools.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTools.cpp index b88cfdb79b..b6ac8e17f7 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTools.cpp @@ -178,27 +178,48 @@ QList RimRftTools::segmentBranchIndexOptions( RifReaderR //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimRftTools::seglenstValues( RifReaderRftInterface* readerRft, - const QString& wellName, - const QDateTime& dateTime, - int segmentBranchIndex, - RiaDefines::RftBranchType segmentBranchType ) +std::vector RimRftTools::segmentStartMdValues( RifReaderRftInterface* readerRft, + const QString& wellName, + const QDateTime& dateTime, + int segmentBranchIndex, + RiaDefines::RftBranchType segmentBranchType ) { - std::vector seglenstValues; + std::vector values; auto resultNameSeglenst = RifEclipseRftAddress::createBranchSegmentAddress( wellName, dateTime, RiaDefines::segmentStartDepthResultName(), segmentBranchIndex, segmentBranchType ); - readerRft->values( resultNameSeglenst, &seglenstValues ); + readerRft->values( resultNameSeglenst, &values ); - if ( seglenstValues.size() > 2 ) + if ( values.size() > 2 ) { // Segment 1 has zero length, assign seglenst to the start value of segment 2 // Ref mail dated June 10, 2022, topic "SELENST fix" - seglenstValues[0] = seglenstValues[1]; + values[0] = values[1]; } - return seglenstValues; + return values; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimRftTools::segmentEndMdValues( RifReaderRftInterface* readerRft, + const QString& wellName, + const QDateTime& dateTime, + int segmentBranchIndex, + RiaDefines::RftBranchType segmentBranchType ) +{ + std::vector values; + + auto resultNameSeglenst = RifEclipseRftAddress::createBranchSegmentAddress( wellName, + dateTime, + RiaDefines::segmentEndDepthResultName(), + segmentBranchIndex, + segmentBranchType ); + readerRft->values( resultNameSeglenst, &values ); + + return values; } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTools.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTools.h index c73e4474e2..acc7f79437 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTools.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTools.h @@ -46,9 +46,15 @@ public: const QDateTime& timeStep, RiaDefines::RftBranchType branchType ); - static std::vector seglenstValues( RifReaderRftInterface* readerRft, - const QString& wellName, - const QDateTime& dateTime, - int segmentBranchIndex, - RiaDefines::RftBranchType segmentBranchType ); + static std::vector segmentStartMdValues( RifReaderRftInterface* readerRft, + const QString& wellName, + const QDateTime& dateTime, + int segmentBranchIndex, + RiaDefines::RftBranchType segmentBranchType ); + + static std::vector segmentEndMdValues( RifReaderRftInterface* readerRft, + const QString& wellName, + const QDateTime& dateTime, + int segmentBranchIndex, + RiaDefines::RftBranchType segmentBranchType ); }; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTopologyCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTopologyCurve.cpp index 771eefbf2d..e0e638839b 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTopologyCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTopologyCurve.cpp @@ -48,6 +48,15 @@ void caf::AppEnum::setUp() setDefault( RimRftTopologyCurve::CurveType::TUBING ); } +template <> +void caf::AppEnum::setUp() +{ + addItem( RimRftTopologyCurve::SymbolLocationType::START, "START", "Start" ); + addItem( RimRftTopologyCurve::SymbolLocationType::MID, "MID", "Midpoint" ); + addItem( RimRftTopologyCurve::SymbolLocationType::END, "END", "End" ); + + setDefault( RimRftTopologyCurve::SymbolLocationType::END ); +} } // End namespace caf @@ -68,6 +77,7 @@ RimRftTopologyCurve::RimRftTopologyCurve() CAF_PDM_InitFieldNoDefault( &m_segmentBranchType, "SegmentBranchType", "Completion" ); CAF_PDM_InitFieldNoDefault( &m_curveType, "CurveType", "Curve Type" ); + CAF_PDM_InitFieldNoDefault( &m_symbolLocation, "SymbolLocation", "Symbol Location on Segment" ); } //-------------------------------------------------------------------------------------------------- @@ -221,6 +231,7 @@ void RimRftTopologyCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde curveDataGroup->add( &m_wellName ); curveDataGroup->add( &m_timeStep ); curveDataGroup->add( &m_curveType ); + curveDataGroup->add( &m_symbolLocation ); curveDataGroup->add( &m_segmentBranchIndex ); curveDataGroup->add( &m_segmentBranchType ); @@ -289,8 +300,32 @@ void RimRftTopologyCurve::onLoadDataAndUpdate( bool updateParentPlot ) std::vector depths; std::vector propertyValues; - std::vector seglenstValues = - RimRftTools::seglenstValues( rftReader, m_wellName, m_timeStep, -1, RiaDefines::RftBranchType::RFT_UNKNOWN ); + std::vector symbolLocationDepths; + if ( m_symbolLocation() == SymbolLocationType::START ) + { + symbolLocationDepths = + RimRftTools::segmentStartMdValues( rftReader, m_wellName, m_timeStep, -1, RiaDefines::RftBranchType::RFT_UNKNOWN ); + } + else if ( m_symbolLocation() == SymbolLocationType::MID ) + { + symbolLocationDepths = + RimRftTools::segmentStartMdValues( rftReader, m_wellName, m_timeStep, -1, RiaDefines::RftBranchType::RFT_UNKNOWN ); + auto endDepths = + RimRftTools::segmentEndMdValues( rftReader, m_wellName, m_timeStep, -1, RiaDefines::RftBranchType::RFT_UNKNOWN ); + + if ( symbolLocationDepths.size() == endDepths.size() ) + { + for ( size_t i = 0; i < symbolLocationDepths.size(); ++i ) + { + symbolLocationDepths[i] = ( symbolLocationDepths[i] + endDepths[i] ) / 2.0; + } + } + } + else if ( m_symbolLocation() == SymbolLocationType::END ) + { + symbolLocationDepths = + RimRftTools::segmentEndMdValues( rftReader, m_wellName, m_timeStep, -1, RiaDefines::RftBranchType::RFT_UNKNOWN ); + } auto segment = rftReader->segmentForWell( m_wellName, m_timeStep ); auto segmentIndices = segment.segmentIndicesForBranchIndex( m_segmentBranchIndex(), m_segmentBranchType() ); @@ -317,7 +352,7 @@ void RimRftTopologyCurve::onLoadDataAndUpdate( bool updateParentPlot ) for ( auto segmentIndex : packerSegmentIndices ) { - depths.push_back( seglenstValues[segmentIndex] ); + depths.push_back( symbolLocationDepths[segmentIndex] ); propertyValues.push_back( curveValue ); } @@ -326,7 +361,7 @@ void RimRftTopologyCurve::onLoadDataAndUpdate( bool updateParentPlot ) { for ( auto segmentIndex : segmentIndices ) { - depths.push_back( seglenstValues[segmentIndex] ); + depths.push_back( symbolLocationDepths[segmentIndex] ); propertyValues.push_back( curveValue ); } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTopologyCurve.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTopologyCurve.h index 449d7daeca..893e9c7abf 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTopologyCurve.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTopologyCurve.h @@ -44,6 +44,13 @@ public: ANNULUS }; + enum class SymbolLocationType + { + START, + MID, + END + }; + public: RimRftTopologyCurve(); @@ -77,12 +84,13 @@ protected: void onLoadDataAndUpdate( bool updateParentPlot ) override; private: - caf::PdmPtrField m_summaryCase; - caf::PdmField m_timeStep; - caf::PdmField m_wellName; - caf::PdmField m_segmentBranchIndex; - caf::PdmField> m_segmentBranchType; - caf::PdmField> m_curveType; + caf::PdmPtrField m_summaryCase; + caf::PdmField m_timeStep; + caf::PdmField m_wellName; + caf::PdmField m_segmentBranchIndex; + caf::PdmField> m_segmentBranchType; + caf::PdmField> m_curveType; + caf::PdmField> m_symbolLocation; public: void setAdditionalDataSources( const std::vector& additionalDataSources ); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp index 6b01a74ac3..3ed71e357f 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp @@ -1152,7 +1152,8 @@ std::vector RimWellLogRftCurve::measuredDepthValues( QString& prefixText { prefixText = "SEGMENT/"; - return RimRftTools::seglenstValues( reader, m_wellName(), m_timeStep, segmentBranchIndex(), m_segmentBranchType() ); + // Always use segment end MD values for segment data, as the curve is plotted as step left + return RimRftTools::segmentEndMdValues( reader, m_wellName(), m_timeStep, segmentBranchIndex(), m_segmentBranchType() ); } return {}; }