#13651 Fix formation dip sign issue when fracture normal is rotated 180 deg

Rename calculateFormationDip to calculateAngleFromVertical to better reflect what the function computes. Add calculateFormationDipFromHorizontal which applies the -90 deg adjustment and std::abs, fixing the wrong sign when the fracture direction normal is flipped.
This commit is contained in:
Magne Sjaastad committed 2026-02-24 13:46:15 +01:00
1 parent d3d1c1a148
commit 71b734efec
4 files changed
+19 -9

No files matched your search

@@ -652,12 +652,11 @@ void RimStimPlanModel::updateDistanceToBarrierAndDip()
cvf::Vec3d fractureDirectionNormal = computeFractureDirectionNormal( wellPath(), position );
// Update formation dip. The direction for the barrier search follows the
// inclination of the formation, and is in effect the formation dip in the
// fracture plane. -90 to convert from horizontal to vertical.
// Update formation dip. The direction for the barrier search follows the inclination of the formation, and is in effect the formation
// dip in the fracture plane.
cvf::Vec3d formationDirection = projectVectorIntoFracturePlane( position, fractureDirectionNormal, m_originalThicknessDirection );
if ( formationDirection.isUndefined() ) return;
m_formationDip = std::abs( RigStimPlanModelTools::calculateFormationDip( formationDirection ) - 90.0 );
m_formationDip = RigStimPlanModelTools::calculateFormationDipFromHorizontal( formationDirection );
cvf::Vec3d directionToBarrier = projectVectorIntoFracturePlane( position, fractureDirectionNormal, m_thicknessDirection );
if ( directionToBarrier.isUndefined() ) return;
@@ -105,7 +105,7 @@ std::expected<caf::PdmObjectHandle*, QString> RimcWellPath_addFracture::execute(
cvf::Vec3d formationDirection = RimStimPlanModel::projectVectorIntoFracturePlane( position, fractureDirectionNormal, direction );
if ( !formationDirection.isUndefined() )
{
double formationDip = RigStimPlanModelTools::calculateFormationDip( formationDirection ) - 90.0;
double formationDip = RigStimPlanModelTools::calculateFormationDipFromHorizontal( formationDirection );
RiaLogging::info( QString( "Computed formation dip: %1" ).arg( formationDip ) );
wellPathFracture->setDip( formationDip );
@@ -93,12 +93,22 @@ cvf::Vec3d RigStimPlanModelTools::calculateTSTDirection( RigEclipseCaseData* ecl
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigStimPlanModelTools::calculateFormationDip( const cvf::Vec3d& direction )
double RigStimPlanModelTools::calculateAngleFromVertical( const cvf::Vec3d& direction )
{
// Formation dip is inclination of a plane from horizontal.
// Angle from vertical is the inclination of a vector from the vertical axis.
return cvf::Math::toDegrees( cvf::GeometryTools::getAngle( direction, -cvf::Vec3d::Z_AXIS ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigStimPlanModelTools::calculateFormationDipFromHorizontal( const cvf::Vec3d& direction )
{
// Convert from angle-with-vertical to angle-from-horizontal, and take abs since
// direction sign depends on fracture normal orientation.
return std::abs( calculateAngleFromVertical( direction ) - 90.0 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -130,7 +140,7 @@ std::tuple<const RigFault*, double, cvf::Vec3d, double> RigStimPlanModelTools::f
const RigCell& cell = mainGrid->cell( intersection.globCellIndex );
cvf::Vec3d faceNormal = cell.faceNormalWithAreaLength( intersection.intersectedCellFaceIn );
barrierDip = RigStimPlanModelTools::calculateFormationDip( faceNormal );
barrierDip = RigStimPlanModelTools::calculateAngleFromVertical( faceNormal );
}
}
@@ -50,7 +50,8 @@ public:
cvf::Vec3d& bottomPosition );
static double calculateFormationDip( const cvf::Vec3d& direction );
static double calculateAngleFromVertical( const cvf::Vec3d& direction );
static double calculateFormationDipFromHorizontal( const cvf::Vec3d& direction );
static QString vecToString( const cvf::Vec3d& vec );