From 312caa75685cd4885f85d1e845530a2bc48afd47 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 6 Dec 2019 13:14:42 +0100 Subject: [PATCH] #5198 Export MSW : Add extra segment if user defined measured depth is above grid --- .../RicWellPathExportMswCompletionsImpl.cpp | 47 ++++++++++++++----- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp index d74fae15b6..cb478f94d1 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp +++ b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp @@ -1077,10 +1077,33 @@ RicMswExportInfo RicWellPathExportMswCompletionsImpl::generatePerforationsMswExp } } - // Skip all intersections before initialMD - std::vector filteredIntersections; + { + if ( !intersections.empty() && intersections[0].startMD > initialMD && + wellPath->perforationIntervalCollection()->mswParameters()->referenceMDType() == + RimMswCompletionParameters::MANUAL_REFERENCE_MD ) + { + WellPathCellIntersectionInfo firstIntersection = intersections[0]; + + // Add a segment from user defined MD to start of grid + cvf::Vec3d intersectionPoint = wellPathGeometry->interpolatedPointAlongWellPath( initialMD ); + + WellPathCellIntersectionInfo extraIntersection; + + extraIntersection.globCellIndex = std::numeric_limits::max(); + extraIntersection.startPoint = intersectionPoint; + extraIntersection.endPoint = firstIntersection.startPoint; + extraIntersection.startMD = initialMD; + extraIntersection.endMD = firstIntersection.startMD; + extraIntersection.intersectedCellFaceIn = cvf::StructGridInterface::NO_FACE; + extraIntersection.intersectedCellFaceOut = cvf::StructGridInterface::oppositeFace( + firstIntersection.intersectedCellFaceIn ); + extraIntersection.intersectionLengthsInCellCS = cvf::Vec3d::ZERO; + + filteredIntersections.push_back( extraIntersection ); + } + const double epsilon = 0.001; for ( const WellPathCellIntersectionInfo& intersection : intersections ) @@ -1100,24 +1123,24 @@ RicMswExportInfo RicWellPathExportMswCompletionsImpl::generatePerforationsMswExp cvf::Vec3d intersectionPoint = wellPathGeometry->interpolatedPointAlongWellPath( initialMD ); - WellPathCellIntersectionInfo smallerIntersection; + WellPathCellIntersectionInfo extraIntersection; - smallerIntersection.globCellIndex = intersection.globCellIndex; - smallerIntersection.startPoint = intersectionPoint; - smallerIntersection.endPoint = intersection.endPoint; - smallerIntersection.startMD = initialMD; - smallerIntersection.endMD = intersection.endMD; - smallerIntersection.intersectedCellFaceIn = cvf::StructGridInterface::NO_FACE; - smallerIntersection.intersectedCellFaceOut = intersection.intersectedCellFaceOut; + extraIntersection.globCellIndex = intersection.globCellIndex; + extraIntersection.startPoint = intersectionPoint; + extraIntersection.endPoint = intersection.endPoint; + extraIntersection.startMD = initialMD; + extraIntersection.endMD = intersection.endMD; + extraIntersection.intersectedCellFaceIn = cvf::StructGridInterface::NO_FACE; + extraIntersection.intersectedCellFaceOut = intersection.intersectedCellFaceOut; const RigMainGrid* grid = eclipseCase->mainGrid(); - smallerIntersection.intersectionLengthsInCellCS = + extraIntersection.intersectionLengthsInCellCS = RigWellPathIntersectionTools::calculateLengthInCell( grid, intersection.globCellIndex, intersectionPoint, intersection.endPoint ); - filteredIntersections.push_back( smallerIntersection ); + filteredIntersections.push_back( extraIntersection ); } } }