From 6e8e658f6d1d002e64dd624ca3437c8e5fc1a3ed Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 19 Oct 2026 21:13:13 +0200 Subject: [PATCH] #14980: Remove global max segment length from segment collection The global max segment length no longer exists, so segment subdivision is defined only by the segment intervals. --- .../MswExport/RicMswBranchBuilder.cpp | 9 +-- .../MswExport/RicMswBranchBuilder.h | 3 - .../RicWellPathExportMswGeometryPath.cpp | 7 --- .../RicWellPathExportMswGeometryPath.h | 1 - .../RicMswTableDataTools.cpp | 63 ++----------------- .../RicMswTableDataTools.h | 6 +- .../RicWellPathExportMswTableData.cpp | 8 +-- .../Completions/RimSegmentCollection.cpp | 33 ++-------- .../Completions/RimSegmentCollection.h | 7 +-- .../UnitTests/RicMswBranchBuilder-Test.cpp | 49 +++++++++++++++ .../UnitTests/RimWellPathCompletions-Test.cpp | 11 ---- .../wells_and_fractures/modeled_well_path.py | 2 - .../rips/tests/test_msw_completion_data.py | 3 - .../rips/tests/test_wells_path_completions.py | 4 -- 14 files changed, 66 insertions(+), 140 deletions(-) diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/MswExport/RicMswBranchBuilder.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/MswExport/RicMswBranchBuilder.cpp index 32c864c644..db9f71342f 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/MswExport/RicMswBranchBuilder.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/MswExport/RicMswBranchBuilder.cpp @@ -388,7 +388,6 @@ RigMswBranch buildMainBoreBranch( const RimWellPath* int branchNumber, int& segmentNumber, int outletSegmentNumber, - double maxSegmentLength, const std::vector>& customSegmentIntervals, const RicMswTableDataTools::SegmentationSettings& segmentationSettings, const std::optional& exportDate, @@ -475,8 +474,7 @@ RigMswBranch buildMainBoreBranch( const RimWellPath* compsegsPerCell.push_back( collectCellCompsegs( cellInfo, compsegsContext ) ); - const auto subSegs = - RicMswTableDataTools::createSubSegmentMDPairs( cellInfo.startMD, cellInfo.endMD, maxSegmentLength, customSegmentIntervals ); + const auto subSegs = RicMswTableDataTools::createSubSegmentMDPairs( cellInfo.startMD, cellInfo.endMD, customSegmentIntervals ); for ( const auto& [subStartMD, subEndMD] : subSegs ) { cellPieces.push_back( { subStartMD, subEndMD } ); @@ -621,7 +619,6 @@ std::vector buildValveBranches( const RimWellPath* const std::string& wellNameForExport, int& segmentNumber, int& branchNumber, - double maxSegmentLength, const std::vector>& customSegmentIntervals, const std::optional& exportDate, RiaDefines::EclipseUnitSystem unitSystem ) @@ -1032,7 +1029,6 @@ std::vector buildFishbonesBranches( const RimEclipseCase* const std::string& wellNameForExport, int& segmentNumber, int& branchNumber, - double maxSegmentLength, const std::vector>& customSegmentIntervals, RiaDefines::EclipseUnitSystem unitSystem, FishbonesExportContext& fishbonesContext ) @@ -1207,8 +1203,7 @@ std::vector buildFishbonesBranches( const RimEclipseCase* lateralSegmentContext.globalCellIndex = cellIntInfo.globCellIndex; lateralSegmentContext.equivalentDiameter = subs->equivalentDiameter( unitSystem ); - const auto subSegs = - RicMswTableDataTools::createSubSegmentMDPairs( startMD, endMD, maxSegmentLength, customSegmentIntervals ); + const auto subSegs = RicMswTableDataTools::createSubSegmentMDPairs( startMD, endMD, customSegmentIntervals ); bool firstSubSeg = true; for ( const auto& [subStartMD, subEndMD] : subSegs ) diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/MswExport/RicMswBranchBuilder.h b/ApplicationLibCode/Commands/CompletionExportCommands/MswExport/RicMswBranchBuilder.h index 8a8d0d00d1..a9b494ca08 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/MswExport/RicMswBranchBuilder.h +++ b/ApplicationLibCode/Commands/CompletionExportCommands/MswExport/RicMswBranchBuilder.h @@ -177,7 +177,6 @@ RigMswBranch buildMainBoreBranch( const RimWellPath* int branchNumber, int& segmentNumber, int outletSegmentNumber, - double maxSegmentLength, const std::vector>& customSegmentIntervals, const RicMswTableDataTools::SegmentationSettings& segmentationSettings, const std::optional& exportDate, @@ -198,7 +197,6 @@ std::vector buildValveBranches( const RimWellPath* const std::string& wellNameForExport, int& segmentNumber, int& branchNumber, - double maxSegmentLength, const std::vector>& customSegmentIntervals, const std::optional& exportDate, RiaDefines::EclipseUnitSystem unitSystem ); @@ -226,7 +224,6 @@ std::vector buildFishbonesBranches( const RimEclipseCase* const std::string& wellNameForExport, int& segmentNumber, int& branchNumber, - double maxSegmentLength, const std::vector>& customSegmentIntervals, RiaDefines::EclipseUnitSystem unitSystem, FishbonesExportContext& fishbonesContext ); diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/MswExport/RicWellPathExportMswGeometryPath.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/MswExport/RicWellPathExportMswGeometryPath.cpp index 1cebcc0ddb..efc848c88f 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/MswExport/RicWellPathExportMswGeometryPath.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/MswExport/RicWellPathExportMswGeometryPath.cpp @@ -188,7 +188,6 @@ std::vector buildLateralBranches( RimEclipseCase* lateralBranchNum, segmentNumber, childOutletSeg, - mswParameters->maxSegmentLength(), segmentIntervals, RicMswTableDataTools::segmentationSettings( mswParameters, exportDate ), exportDate, @@ -237,7 +236,6 @@ std::vector buildLateralBranches( RimEclipseCase* wellNameForExport, segmentNumber, completionBranchNumber, - mswParameters->maxSegmentLength(), segmentIntervals, exportDate, unitSystem ); @@ -266,7 +264,6 @@ std::vector buildLateralBranches( RimEclipseCase* wellNameForExport, segmentNumber, completionBranchNumber, - mswParameters->maxSegmentLength(), segmentIntervals, unitSystem, fishbonesContext ); @@ -303,7 +300,6 @@ std::vector buildLateralBranches( RimEclipseCase* //-------------------------------------------------------------------------------------------------- RigMswWellExportData buildMswWellExportData( RimEclipseCase* eclipseCase, const RimWellPath* wellPath, - double maxSegmentLength, const std::vector>& customSegmentIntervals, CompletionType completionType, const std::optional& exportDate ) @@ -381,7 +377,6 @@ RigMswWellExportData buildMswWellExportData( RimEclipseCase* lateralBranchNumber, segmentNumber, 1, // outlet = heel (segment 1) - maxSegmentLength, customSegmentIntervals, RicMswTableDataTools::segmentationSettings( mswParameters, exportDate ), exportDate, @@ -424,7 +419,6 @@ RigMswWellExportData buildMswWellExportData( RimEclipseCase* wellNameForExport, segmentNumber, completionBranchNumber, - maxSegmentLength, customSegmentIntervals, exportDate, unitSystem ); @@ -450,7 +444,6 @@ RigMswWellExportData buildMswWellExportData( RimEclipseCase* wellNameForExport, segmentNumber, completionBranchNumber, - maxSegmentLength, customSegmentIntervals, unitSystem, fishbonesContext ); diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/MswExport/RicWellPathExportMswGeometryPath.h b/ApplicationLibCode/Commands/CompletionExportCommands/MswExport/RicWellPathExportMswGeometryPath.h index 80adbb6a5b..6c392a2288 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/MswExport/RicWellPathExportMswGeometryPath.h +++ b/ApplicationLibCode/Commands/CompletionExportCommands/MswExport/RicWellPathExportMswGeometryPath.h @@ -60,7 +60,6 @@ std::vector buildLateralBranches( RimEclipseCase* RigMswWellExportData buildMswWellExportData( RimEclipseCase* eclipseCase, const RimWellPath* wellPath, - double maxSegmentLength, const std::vector>& customSegmentIntervals, RicWellPathExportMswTableData::CompletionType completionType, const std::optional& exportDate ); diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicMswTableDataTools.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/RicMswTableDataTools.cpp index 0ca6efc2c5..b93ccc4106 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicMswTableDataTools.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicMswTableDataTools.cpp @@ -33,34 +33,20 @@ //-------------------------------------------------------------------------------------------------- /// Custom intervals define exact segment boundaries where specified -/// Areas without custom intervals use max segment length subdivision (if maxSegmentLength > 0) //-------------------------------------------------------------------------------------------------- std::vector> RicMswTableDataTools::createSubSegmentMDPairs( double startMD, double endMD, - double maxSegmentLength, const std::vector>& customSegmentIntervals ) { std::vector> subSegmentMDPairs; - // If no custom intervals, use original logic with maxSegmentLength subdivision - if ( customSegmentIntervals.empty() || maxSegmentLength <= 0.0 ) + if ( customSegmentIntervals.empty() ) { - int subSegmentCount = maxSegmentLength > 0.0 ? (int)( std::trunc( ( endMD - startMD ) / maxSegmentLength ) + 1 ) : 1; - double subSegmentLength = ( endMD - startMD ) / subSegmentCount; - - double subStartMD = startMD; - double subEndMD = startMD + subSegmentLength; - for ( int i = 0; i < subSegmentCount; ++i ) - { - subSegmentMDPairs.push_back( std::make_pair( subStartMD, subEndMD ) ); - subStartMD += subSegmentLength; - subEndMD = std::min( subEndMD + subSegmentLength, endMD ); - } + subSegmentMDPairs.push_back( std::make_pair( startMD, endMD ) ); return subSegmentMDPairs; } - // Combine custom intervals with maxSegmentLength subdivision // Collect all boundaries (start, end, custom interval boundaries) and sort them std::set boundaries; boundaries.insert( startMD ); @@ -87,51 +73,10 @@ std::vector> // Convert boundaries to sorted vector std::vector sortedBoundaries( boundaries.begin(), boundaries.end() ); - // For each gap between boundaries, either: - // - Use exact boundary if it's from a custom interval - // - Subdivide using maxSegmentLength if it's a gap + // For each gap between boundaries, use the exact boundary pair for ( size_t i = 0; i + 1 < sortedBoundaries.size(); ++i ) { - double gapStart = sortedBoundaries[i]; - double gapEnd = sortedBoundaries[i + 1]; - - // Check if this gap is covered by a custom interval - bool coveredByCustomInterval = false; - for ( const auto& [customStart, customEnd] : customSegmentIntervals ) - { - double clippedStart = std::max( customStart, startMD ); - double clippedEnd = std::min( customEnd, endMD ); - - // If the gap is fully within a custom interval, use exact boundaries - if ( gapStart >= clippedStart && gapEnd <= clippedEnd && std::abs( gapStart - clippedStart ) < 1e-6 && - std::abs( gapEnd - clippedEnd ) < 1e-6 ) - { - coveredByCustomInterval = true; - subSegmentMDPairs.push_back( std::make_pair( gapStart, gapEnd ) ); - break; - } - } - - // If not covered by custom interval, subdivide using maxSegmentLength - if ( !coveredByCustomInterval && maxSegmentLength > 0.0 ) - { - double gapLength = gapEnd - gapStart; - int subCount = (int)( std::trunc( gapLength / maxSegmentLength ) + 1 ); - double subLength = gapLength / subCount; - - double subStart = gapStart; - for ( int j = 0; j < subCount; ++j ) - { - double subEnd = ( j == subCount - 1 ) ? gapEnd : subStart + subLength; - subSegmentMDPairs.push_back( std::make_pair( subStart, subEnd ) ); - subStart = subEnd; - } - } - else if ( !coveredByCustomInterval ) - { - // No maxSegmentLength, use gap as-is - subSegmentMDPairs.push_back( std::make_pair( gapStart, gapEnd ) ); - } + subSegmentMDPairs.push_back( std::make_pair( sortedBoundaries[i], sortedBoundaries[i + 1] ) ); } return subSegmentMDPairs; diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicMswTableDataTools.h b/ApplicationLibCode/Commands/CompletionExportCommands/RicMswTableDataTools.h index d3725c85a8..f495cbb98a 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicMswTableDataTools.h +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicMswTableDataTools.h @@ -58,10 +58,8 @@ struct SegmentationSettings bool singleSegmentAfterLastPerforation = false; }; -std::vector> createSubSegmentMDPairs( double startMD, - double endMD, - double maxSegmentLength, - const std::vector>& customSegmentIntervals = {} ); +std::vector> + createSubSegmentMDPairs( double startMD, double endMD, const std::vector>& customSegmentIntervals = {} ); std::vector segmentationIntervals( const RimSegmentCollection* segmentCollection, const std::optional& exportDate ); diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswTableData.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswTableData.cpp index 627d219413..0cfa6fad7b 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswTableData.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswTableData.cpp @@ -76,12 +76,8 @@ std::expected RicWellPathExportMswTableData::extra if ( !segmentCollection ) return std::unexpected( "Missing MSW completion parameters" ); const std::vector> customSegmentIntervals = segmentCollection->getSegmentIntervals(); - auto wellExportData = RicWellPathExportMswGeometryPath::buildMswWellExportData( eclipseCase, - wellPath, - segmentCollection->maxSegmentLength(), - customSegmentIntervals, - completionType, - exportDate ); + auto wellExportData = + RicWellPathExportMswGeometryPath::buildMswWellExportData( eclipseCase, wellPath, customSegmentIntervals, completionType, exportDate ); auto unitSystem = eclipseCase->eclipseCaseData()->unitsType(); return RicWellPathExportMswGeometryPath::collectTableData( wellExportData, unitSystem, segmentCollection->exportCompsegsSegmentNumber() ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimSegmentCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimSegmentCollection.cpp index 4d48d01be9..26830af9c2 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimSegmentCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimSegmentCollection.cpp @@ -82,9 +82,6 @@ RimSegmentCollection::RimSegmentCollection() CAF_PDM_InitScriptableField( &m_roughnessFactor, "RoughnessFactor", defaultRoughnessFactor( unitSystem ), "Roughness Factor" ); CAF_PDM_InitScriptableFieldNoDefault( &m_segmentIntervals, "Intervals", "Segment Intervals" ); - CAF_PDM_InitScriptableField( &m_enforceMaxSegmentLength, "EnforceMaxSegmentLength", false, "Enforce Max Segment Length" ); - CAF_PDM_InitScriptableField( &m_maxSegmentLength, "MaxSegmentLength", 200.0, "Max Segment Length" ); - m_maxSegmentLength.uiCapability()->setUiHidden( true ); CAF_PDM_InitScriptableField( &m_singleSegmentBeforeFirstPerforation, "SingleSegmentBeforeFirstPerforation", false, @@ -176,14 +173,6 @@ double RimSegmentCollection::roughnessFactor() const return m_roughnessFactor(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -double RimSegmentCollection::maxSegmentLength() const -{ - return m_enforceMaxSegmentLength() ? m_maxSegmentLength() : std::numeric_limits::infinity(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -445,8 +434,6 @@ void RimSegmentCollection::updateFromTopLevelWell( const RimSegmentCollection* t { m_refMDType = topLevelWellParameters->m_refMDType(); m_refMD = topLevelWellParameters->m_refMD(); - m_enforceMaxSegmentLength = topLevelWellParameters->m_enforceMaxSegmentLength(); - m_maxSegmentLength = topLevelWellParameters->m_maxSegmentLength(); m_compsegsSegmentNumber = topLevelWellParameters->m_compsegsSegmentNumber(); m_singleSegmentBeforeFirstPerforation = topLevelWellParameters->m_singleSegmentBeforeFirstPerforation(); m_singleSegmentAfterLastPerforation = topLevelWellParameters->m_singleSegmentAfterLastPerforation(); @@ -464,18 +451,15 @@ void RimSegmentCollection::importLegacyData( const RimMswCompletionParameters* l legacyParameters->linerDiameter() != defaultLinerDiameter( RiaDefines::EclipseUnitSystem::UNITS_METRIC ) || legacyParameters->roughnessFactor() != defaultRoughnessFactor( RiaDefines::EclipseUnitSystem::UNITS_METRIC ) || legacyParameters->diameterRoughnessMode() != RimMswCompletionParameters::DiameterRoughnessMode::UNIFORM || - legacyParameters->enforceMaxSegmentLength() || legacyParameters->storedMaxSegmentLength() != 200.0 || !legacyParameters->diameterRoughnessIntervals()->intervals().empty() || !legacyParameters->customSegmentIntervals()->intervals().empty(); if ( !hasLegacyData ) return; - m_refMDType = static_cast( static_cast( legacyParameters->referenceMDType() ) ); - m_refMD = legacyParameters->storedReferenceMD(); - m_customValuesForLateral = legacyParameters->customValuesForLateral(); - m_linerDiameter = legacyParameters->linerDiameter(); - m_roughnessFactor = legacyParameters->roughnessFactor(); - m_enforceMaxSegmentLength = legacyParameters->enforceMaxSegmentLength(); - m_maxSegmentLength = legacyParameters->storedMaxSegmentLength(); + m_refMDType = static_cast( static_cast( legacyParameters->referenceMDType() ) ); + m_refMD = legacyParameters->storedReferenceMD(); + m_customValuesForLateral = legacyParameters->customValuesForLateral(); + m_linerDiameter = legacyParameters->linerDiameter(); + m_roughnessFactor = legacyParameters->roughnessFactor(); removeAllIntervals(); if ( legacyParameters->diameterRoughnessMode() == RimMswCompletionParameters::DiameterRoughnessMode::INTERVALS ) @@ -529,11 +513,6 @@ double RimSegmentCollection::defaultRoughnessFactor( RiaDefines::EclipseUnitSyst void RimSegmentCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) { if ( changedField == &m_refMDType ) updateAllRequiredEditors(); - if ( changedField == &m_enforceMaxSegmentLength ) - { - m_maxSegmentLength.uiCapability()->setUiHidden( !m_enforceMaxSegmentLength() ); - caf::PdmUiObjectEditorHandle::updateUiAllObjectEditors(); - } updateMswSegments(); } @@ -596,8 +575,6 @@ void RimSegmentCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrd uiOrdering.add( &m_compsegsSegmentNumber ); auto* segmentationGroup = uiOrdering.addNewGroup( "Segmentation" ); - segmentationGroup->add( &m_enforceMaxSegmentLength ); - segmentationGroup->add( &m_maxSegmentLength ); segmentationGroup->add( &m_singleSegmentBeforeFirstPerforation ); segmentationGroup->add( &m_singleSegmentAfterLastPerforation ); } diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimSegmentCollection.h b/ApplicationLibCode/ProjectDataModel/Completions/RimSegmentCollection.h index 5be54e2633..2ad22949a1 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimSegmentCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimSegmentCollection.h @@ -64,7 +64,6 @@ public: double linerDiameter() const; double roughnessFactor() const; double roughnessFactor( RiaDefines::EclipseUnitSystem unitSystem ) const; - double maxSegmentLength() const; bool singleSegmentBeforeFirstPerforation() const; bool singleSegmentAfterLastPerforation() const; bool exportCompsegsSegmentNumber() const; @@ -126,10 +125,8 @@ private: caf::PdmChildArrayField m_segmentIntervals; - caf::PdmField m_enforceMaxSegmentLength; - caf::PdmField m_maxSegmentLength; - caf::PdmField m_singleSegmentBeforeFirstPerforation; - caf::PdmField m_singleSegmentAfterLastPerforation; + caf::PdmField m_singleSegmentBeforeFirstPerforation; + caf::PdmField m_singleSegmentAfterLastPerforation; caf::PdmField m_compsegsSegmentNumber; }; diff --git a/ApplicationLibCode/UnitTests/RicMswBranchBuilder-Test.cpp b/ApplicationLibCode/UnitTests/RicMswBranchBuilder-Test.cpp index 597064b852..c03c3a78bb 100644 --- a/ApplicationLibCode/UnitTests/RicMswBranchBuilder-Test.cpp +++ b/ApplicationLibCode/UnitTests/RicMswBranchBuilder-Test.cpp @@ -249,6 +249,55 @@ TEST( RicMswBranchBuilder, PlaceSegmentNodes_FixedLengthNotBeforeFirstCell ) expectNodes( { 1050.0, 1070.0, 1090.0 }, nodes ); } +TEST( RicMswBranchBuilder, CreateSubSegmentMDPairs_NoIntervalsKeepsWholeCell ) +{ + const auto pairs = RicMswTableDataTools::createSubSegmentMDPairs( 10.0, 30.0, {} ); + ASSERT_EQ( 1u, pairs.size() ); + EXPECT_DOUBLE_EQ( 10.0, pairs[0].first ); + EXPECT_DOUBLE_EQ( 30.0, pairs[0].second ); +} + +TEST( RicMswBranchBuilder, CreateSubSegmentMDPairs_IntervalInsideCellSplitsInThree ) +{ + const auto pairs = RicMswTableDataTools::createSubSegmentMDPairs( 10.0, 30.0, { { 15.0, 25.0 } } ); + ASSERT_EQ( 3u, pairs.size() ); + EXPECT_DOUBLE_EQ( 10.0, pairs[0].first ); + EXPECT_DOUBLE_EQ( 15.0, pairs[0].second ); + EXPECT_DOUBLE_EQ( 15.0, pairs[1].first ); + EXPECT_DOUBLE_EQ( 25.0, pairs[1].second ); + EXPECT_DOUBLE_EQ( 25.0, pairs[2].first ); + EXPECT_DOUBLE_EQ( 30.0, pairs[2].second ); +} + +TEST( RicMswBranchBuilder, CreateSubSegmentMDPairs_IntervalOverlappingCellIsClipped ) +{ + const auto pairs = RicMswTableDataTools::createSubSegmentMDPairs( 10.0, 30.0, { { 0.0, 20.0 } } ); + ASSERT_EQ( 2u, pairs.size() ); + EXPECT_DOUBLE_EQ( 10.0, pairs[0].first ); + EXPECT_DOUBLE_EQ( 20.0, pairs[0].second ); + EXPECT_DOUBLE_EQ( 20.0, pairs[1].first ); + EXPECT_DOUBLE_EQ( 30.0, pairs[1].second ); +} + +TEST( RicMswBranchBuilder, CreateSubSegmentMDPairs_IntervalOutsideOrTouchingCellIsIgnored ) +{ + for ( const auto& interval : { std::pair( 30.0, 40.0 ), std::pair( 0.0, 10.0 ), std::pair( 40.0, 50.0 ) } ) + { + const auto pairs = RicMswTableDataTools::createSubSegmentMDPairs( 10.0, 30.0, { interval } ); + ASSERT_EQ( 1u, pairs.size() ); + EXPECT_DOUBLE_EQ( 10.0, pairs[0].first ); + EXPECT_DOUBLE_EQ( 30.0, pairs[0].second ); + } +} + +TEST( RicMswBranchBuilder, CreateSubSegmentMDPairs_AdjacentIntervalsShareBoundary ) +{ + const auto pairs = RicMswTableDataTools::createSubSegmentMDPairs( 10.0, 30.0, { { 10.0, 20.0 }, { 20.0, 30.0 } } ); + ASSERT_EQ( 2u, pairs.size() ); + EXPECT_DOUBLE_EQ( 20.0, pairs[0].second ); + EXPECT_DOUBLE_EQ( 20.0, pairs[1].first ); +} + TEST( RicMswBranchBuilder, CollapseNodesOutsidePerforations ) { const std::vector nodes = { 5.0, 12.0, 22.0, 31.5, 46.5, 55.0 }; diff --git a/ApplicationLibCode/UnitTests/RimWellPathCompletions-Test.cpp b/ApplicationLibCode/UnitTests/RimWellPathCompletions-Test.cpp index 66068bb7c6..97d0f4690d 100644 --- a/ApplicationLibCode/UnitTests/RimWellPathCompletions-Test.cpp +++ b/ApplicationLibCode/UnitTests/RimWellPathCompletions-Test.cpp @@ -168,11 +168,8 @@ TEST( RimWellPathCompletions, LegacyMigrationPreservesDisabledSettings ) { RimMswCompletionParameters legacyParameters; legacyParameters.setManualReferenceMD( 123.0 ); - auto* maxLength = dynamic_cast*>( legacyParameters.findField( "MaxSegmentLength" ) ); auto* customValues = dynamic_cast*>( legacyParameters.findField( "CustomValuesForLateral" ) ); - ASSERT_NE( nullptr, maxLength ); ASSERT_NE( nullptr, customValues ); - maxLength->setValue( 345.0 ); customValues->setValue( true ); legacyParameters.setPressureDrop( RimMswCompletionParameters::PressureDropType::HYDROSTATIC_FRICTION_ACCELERATION ); legacyParameters.setLengthAndDepth( RimMswCompletionParameters::LengthAndDepthType::INC ); @@ -183,22 +180,14 @@ TEST( RimWellPathCompletions, LegacyMigrationPreservesDisabledSettings ) completionSettings.importLegacyMswData( &legacyParameters ); EXPECT_EQ( RimSegmentCollection::ReferenceMDType::AUTO_REFERENCE_MD, segments.referenceMDType() ); - auto* migratedMaxLength = dynamic_cast*>( segments.findField( "MaxSegmentLength" ) ); auto* migratedCustomValues = dynamic_cast*>( segments.findField( "CustomValuesForLateral" ) ); - auto* enforceMaxLength = dynamic_cast*>( segments.findField( "EnforceMaxSegmentLength" ) ); - ASSERT_NE( nullptr, migratedMaxLength ); ASSERT_NE( nullptr, migratedCustomValues ); - ASSERT_NE( nullptr, enforceMaxLength ); - EXPECT_DOUBLE_EQ( 345.0, migratedMaxLength->value() ); EXPECT_TRUE( migratedCustomValues->value() ); - EXPECT_FALSE( enforceMaxLength->value() ); EXPECT_EQ( RimWellPathCompletionSettings::PressureDropType::HYDROSTATIC_FRICTION_ACCELERATION, completionSettings.pressureDrop() ); EXPECT_EQ( RimWellPathCompletionSettings::LengthAndDepthType::INC, completionSettings.lengthAndDepth() ); segments.setReferenceMDType( RimSegmentCollection::ReferenceMDType::MANUAL_REFERENCE_MD ); EXPECT_DOUBLE_EQ( 123.0, segments.manualReferenceMD() ); - enforceMaxLength->setValue( true ); - EXPECT_DOUBLE_EQ( 345.0, segments.maxSegmentLength() ); } TEST( RimWellPathCompletions, DefaultLegacySettingsDoNotOverwriteSegments ) diff --git a/GrpcInterface/Python/rips/PythonExamples/wells_and_fractures/modeled_well_path.py b/GrpcInterface/Python/rips/PythonExamples/wells_and_fractures/modeled_well_path.py index 4e53271315..1a11d55717 100644 --- a/GrpcInterface/Python/rips/PythonExamples/wells_and_fractures/modeled_well_path.py +++ b/GrpcInterface/Python/rips/PythonExamples/wells_and_fractures/modeled_well_path.py @@ -81,9 +81,7 @@ print( # Optionally update the segment settings msw_settings = well_path.segment_collection() msw_settings.custom_values_for_lateral = False -msw_settings.enforce_max_segment_length = False msw_settings.liner_diameter = 0.152 -msw_settings.max_segment_length = 200 msw_settings.reference_md_type = "GridEntryPoint" msw_settings.roughness_factor = 1e-05 msw_settings.user_defined_reference_md = 0 diff --git a/GrpcInterface/Python/rips/tests/test_msw_completion_data.py b/GrpcInterface/Python/rips/tests/test_msw_completion_data.py index 8d3f6fd17b..69863446d6 100644 --- a/GrpcInterface/Python/rips/tests/test_msw_completion_data.py +++ b/GrpcInterface/Python/rips/tests/test_msw_completion_data.py @@ -249,9 +249,6 @@ def test_msw_settings_read(rips_instance, initialize_test): assert msw_settings.liner_diameter == 0.152, "Liner diameter should be 0.152m" assert msw_settings.roughness_factor == 1e-05, "Roughness factor should be 1e-05" - # Check max segment length setting - assert msw_settings.max_segment_length == 200.0, "Max segment length should be 200m" - # Verify completion settings completion_settings = well_y1.completion_settings() assert completion_settings.pressure_drop == "HF-", "Pressure drop should be HF-" diff --git a/GrpcInterface/Python/rips/tests/test_wells_path_completions.py b/GrpcInterface/Python/rips/tests/test_wells_path_completions.py index f111ff2313..8540b66430 100644 --- a/GrpcInterface/Python/rips/tests/test_wells_path_completions.py +++ b/GrpcInterface/Python/rips/tests/test_wells_path_completions.py @@ -116,9 +116,7 @@ def test_add_well_path_completions(rips_instance, initialize_test): segment_collection = well_path.segment_collection() segment_collection.custom_values_for_lateral = True - segment_collection.enforce_max_segment_length = True segment_collection.liner_diameter = 20.0 - segment_collection.max_segment_length = 123.05 segment_collection.reference_md_type = "UserDefined" segment_collection.roughness_factor = 1.3 segment_collection.user_defined_reference_md = 1234.56 @@ -126,9 +124,7 @@ def test_add_well_path_completions(rips_instance, initialize_test): segment_collection_updated = well_path.segment_collection() assert segment_collection_updated.custom_values_for_lateral - assert segment_collection_updated.enforce_max_segment_length assert segment_collection_updated.liner_diameter == 20.0 - assert segment_collection_updated.max_segment_length == 123.05 assert segment_collection_updated.reference_md_type == "UserDefined" assert segment_collection_updated.roughness_factor == 1.3 assert segment_collection_updated.user_defined_reference_md == 1234.56