#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

@@ -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 );
}
}