From 837a0f208ce72ade4250768742ec1d54fa1facbc Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 13 May 2022 11:26:05 +0200 Subject: [PATCH] #8846 StimPlan model plot: Correct perforation interval for longitudinal fracture Fixes #8846. --- .../StimPlanModel/RimStimPlanModel.cpp | 14 +++++++- .../RigStimPlanModelTools.cpp | 32 +++++++++++++++++++ .../RigStimPlanModelTools.h | 2 ++ 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp index aadbdfa90f..80200c99c1 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp @@ -795,8 +795,20 @@ void RimStimPlanModel::updatePerforationInterval() m_thicknessDirectionWellPath->perforationIntervalCollection()->appendPerforation( m_perforationInterval ); } + double halfPerforationLength = m_perforationLength() * 0.5; + if ( m_fractureOrientation == FractureOrientation::ALONG_WELL_PATH ) + { + // Adjust perforation interval for longitudinal fractures to correct TVD depth + CAF_ASSERT( wellPath() ); + CAF_ASSERT( wellPath()->wellPathGeometry() ); + + cvf::Vec3d wellPathTangent = wellPath()->wellPathGeometry()->tangentAlongWellPath( m_MD() ); + halfPerforationLength = + RigStimPlanModelTools::calculatePerforationLength( wellPathTangent, m_perforationLength() ) * 0.5; + } + double closestMd = m_thicknessDirectionWellPath->wellPathGeometry()->closestMeasuredDepth( m_anchorPosition ); - m_perforationInterval->setStartAndEndMD( closestMd - perforationLength(), closestMd + perforationLength() ); + m_perforationInterval->setStartAndEndMD( closestMd - halfPerforationLength, closestMd + halfPerforationLength ); m_perforationInterval->updateConnectedEditors(); updateViewsAndPlots(); } diff --git a/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.cpp b/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.cpp index 9e20662f97..3e4f3fc077 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.cpp @@ -261,3 +261,35 @@ QString RigStimPlanModelTools::vecToString( const cvf::Vec3d& vec ) { return QString( "[%1, %2, %3]" ).arg( vec.x() ).arg( vec.y() ).arg( vec.z() ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigStimPlanModelTools::calculatePerforationLength( const cvf::Vec3d& direction, double perforationLength ) +{ + // Deviation from vertical. Since well path is tending downwards we compare with negative z. + double inclination = cvf::GeometryTools::getAngle( direction, -cvf::Vec3d::Z_AXIS ); + + // Keep inclination in 0-90 degrees range + if ( inclination > cvf::PI_D / 2.0 ) + { + inclination = cvf::PI_D - inclination; + } + + double correctedPerforationLength = perforationLength * std::cos( inclination ); + + RiaLogging::info( + QString( "Perforation length correction: original length: %1 inclination: %2 corrected length: %3" ) + .arg( perforationLength ) + .arg( cvf::Math::toDegrees( inclination ) ) + .arg( correctedPerforationLength ) ); + + // Handle well inclination close to 90 dgr to ensure visual perforation interval in StimPlan model plot + if ( std::fabs( cvf::Math::toDegrees( inclination ) - 90.0 ) < 0.1 ) + { + double minimumPerforationInterval = 0.5; + return std::max( minimumPerforationInterval, correctedPerforationLength ); + } + + return correctedPerforationLength; +} diff --git a/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.h b/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.h index 7181631f73..e6b31a349b 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.h +++ b/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.h @@ -67,4 +67,6 @@ public: generateBarrierIntersectionsBetweenPoints( RigEclipseCaseData* eclipseCaseData, const cvf::Vec3d& startPosition, const cvf::Vec3d& endPosition ); + + static double calculatePerforationLength( const cvf::Vec3d& wellPathDirection, double perforationLength ); };