mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-10 23:46:00 -06:00
#1167 - pre-proto - Calculating azimuth angle for well path and using this angle in setting azimuth angle for fracture.
This commit is contained in:
parent
10bb3a834d
commit
093b998fcd
@ -114,7 +114,12 @@ void RimEllipseFractureTemplate::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
||||
|
||||
if (changedField == &orientation)
|
||||
{
|
||||
fracture->setAzimuth(orientation());
|
||||
fracture->setAzimuth();
|
||||
if (orientation() == FracOrientationEnum::AZIMUTH)
|
||||
{
|
||||
fracture->azimuth = azimuthAngle;
|
||||
}
|
||||
|
||||
fracture->setRecomputeGeometryFlag();
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
|
||||
cvf::Vec3d anchorPosition();
|
||||
void setAnchorPosition(const cvf::Vec3d& pos);
|
||||
virtual void setAzimuth(RimEllipseFractureTemplate::FracOrientationEnum orientation) =0;
|
||||
virtual void setAzimuth() =0;
|
||||
|
||||
cvf::Mat4f transformMatrix();
|
||||
|
||||
|
@ -71,8 +71,12 @@ void RimSimWellFracture::setClosestWellCoord(cvf::Vec3d& position, size_t branch
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSimWellFracture::setAzimuth(RimEllipseFractureTemplate::FracOrientationEnum orientation)
|
||||
void RimSimWellFracture::setAzimuth()
|
||||
{
|
||||
RimEllipseFractureTemplate::FracOrientationEnum orientation;
|
||||
if (attachedFractureDefinition()) orientation = attachedFractureDefinition()->orientation();
|
||||
else orientation = RimEllipseFractureTemplate::AZIMUTH;
|
||||
|
||||
if (orientation == RimEllipseFractureTemplate::ALONG_WELL_PATH || orientation== RimEllipseFractureTemplate::TRANSVERSE_WELL_PATH)
|
||||
{
|
||||
updateBranchGeometry();
|
||||
@ -88,12 +92,10 @@ void RimSimWellFracture::setAzimuth(RimEllipseFractureTemplate::FracOrientationE
|
||||
}
|
||||
|
||||
}
|
||||
else //Azimuth value, read from template
|
||||
else //Azimuth value read from template
|
||||
{
|
||||
azimuth = attachedFractureDefinition()->azimuthAngle;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -108,6 +110,11 @@ void RimSimWellFracture::fieldChangedByUi(const caf::PdmFieldHandle* changedFiel
|
||||
)
|
||||
{
|
||||
updateFracturePositionFromLocation();
|
||||
setAzimuth();
|
||||
|
||||
RimProject* proj;
|
||||
this->firstAncestorOrThisOfType(proj);
|
||||
if (proj) proj->createDisplayModelAndRedrawAllViews();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
|
||||
void recomputeWellCenterlineCoordinates();
|
||||
void updateFracturePositionFromLocation();
|
||||
void setAzimuth(RimEllipseFractureTemplate::FracOrientationEnum orientation) override;
|
||||
void setAzimuth() override;
|
||||
|
||||
|
||||
protected:
|
||||
|
@ -75,6 +75,7 @@ void RimWellPathFracture::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
|
||||
if (changedField == &m_measuredDepth)
|
||||
{
|
||||
updatePositionFromMeasuredDepth();
|
||||
setAzimuth();
|
||||
|
||||
RimProject* proj = nullptr;
|
||||
this->firstAncestorOrThisOfType(proj);
|
||||
@ -85,27 +86,39 @@ void RimWellPathFracture::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathFracture::setAzimuth(RimEllipseFractureTemplate::FracOrientationEnum orientation)
|
||||
void RimWellPathFracture::setAzimuth()
|
||||
{
|
||||
RimEllipseFractureTemplate::FracOrientationEnum orientation;
|
||||
if (attachedFractureDefinition()) orientation = attachedFractureDefinition()->orientation();
|
||||
else orientation = RimEllipseFractureTemplate::AZIMUTH;
|
||||
|
||||
if (orientation == RimEllipseFractureTemplate::ALONG_WELL_PATH || orientation == RimEllipseFractureTemplate::TRANSVERSE_WELL_PATH)
|
||||
{
|
||||
// updateBranchGeometry();
|
||||
// double simWellAzimuth = m_branchCenterLines[m_branchIndex].wellPathAzimuthAngle(fracturePosition());
|
||||
//TODO: Calculate well path azimuth angle
|
||||
double WellPathAzimuth = 0.0;
|
||||
if (orientation == RimEllipseFractureTemplate::ALONG_WELL_PATH)
|
||||
{
|
||||
azimuth = WellPathAzimuth;
|
||||
}
|
||||
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(this);
|
||||
if (!objHandle) return;
|
||||
|
||||
RimWellPath* wellPath = nullptr;
|
||||
objHandle->firstAncestorOrThisOfType(wellPath);
|
||||
if (!wellPath) return;
|
||||
|
||||
RigWellPath* wellPathGeometry = wellPath->wellPathGeometry();
|
||||
double wellPathAzimuth = wellPathGeometry->wellPathAzimuthAngle(fracturePosition());
|
||||
if (orientation == RimEllipseFractureTemplate::TRANSVERSE_WELL_PATH)
|
||||
{
|
||||
if (WellPathAzimuth + 90 < 360) azimuth = WellPathAzimuth + 90;
|
||||
else azimuth = WellPathAzimuth - 90;
|
||||
azimuth = wellPathAzimuth;
|
||||
}
|
||||
if (orientation == RimEllipseFractureTemplate::ALONG_WELL_PATH)
|
||||
{
|
||||
if (wellPathAzimuth + 90 < 360) azimuth = wellPathAzimuth + 90;
|
||||
else azimuth = wellPathAzimuth - 90;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//TODO: Reset value if choosing azimuth in frac template!
|
||||
// else //Azimuth value read from template
|
||||
// {
|
||||
// azimuth = attachedFractureDefinition()->azimuthAngle;
|
||||
// }
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
void setMeasuredDepth(double mdValue);
|
||||
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
virtual void setAzimuth(RimEllipseFractureTemplate::FracOrientationEnum orientation) override;
|
||||
virtual void setAzimuth() override;
|
||||
|
||||
protected:
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
|
@ -17,6 +17,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RigWellPath.h"
|
||||
#include "cvfGeometryTools.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -90,3 +91,62 @@ cvf::Vec3d RigWellPath::interpolatedPointAlongWellPath(double measuredDepth)
|
||||
return wellPathPoint;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigWellPath::wellPathAzimuthAngle(const cvf::Vec3d& position) const
|
||||
{
|
||||
size_t closestIndex = cvf::UNDEFINED_SIZE_T;
|
||||
double closestDistance = cvf::UNDEFINED_DOUBLE;
|
||||
|
||||
for (size_t i = 1; i < m_wellPathPoints.size(); i++)
|
||||
{
|
||||
cvf::Vec3d p1 = m_wellPathPoints[i - 1];
|
||||
cvf::Vec3d p2 = m_wellPathPoints[i - 0];
|
||||
|
||||
double candidateDistance = cvf::GeometryTools::linePointSquareDist(p1, p2, position);
|
||||
if (candidateDistance < closestDistance)
|
||||
{
|
||||
closestDistance = candidateDistance;
|
||||
closestIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
//For vertical well (x-component of direction = 0) returned angle will be 0.
|
||||
double AzimuthAngle = 0.0;
|
||||
|
||||
if (closestIndex != cvf::UNDEFINED_DOUBLE)
|
||||
{
|
||||
cvf::Vec3d p1;
|
||||
cvf::Vec3d p2;
|
||||
|
||||
if (closestIndex > 0)
|
||||
{
|
||||
p1 = m_wellPathPoints[closestIndex - 1];
|
||||
p2 = m_wellPathPoints[closestIndex - 0];
|
||||
}
|
||||
else
|
||||
{
|
||||
p1 = m_wellPathPoints[closestIndex + 1];
|
||||
p2 = m_wellPathPoints[closestIndex + 0];
|
||||
}
|
||||
|
||||
cvf::Vec3d direction = p1 - p2;
|
||||
|
||||
|
||||
if (abs(direction.x()) > 1e-5)
|
||||
{
|
||||
double atanValue = direction.y() / direction.x();
|
||||
AzimuthAngle = atan(atanValue);
|
||||
AzimuthAngle = cvf::Math::toDegrees(AzimuthAngle);
|
||||
AzimuthAngle = -AzimuthAngle;
|
||||
}
|
||||
}
|
||||
|
||||
return AzimuthAngle;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,7 @@ public:
|
||||
bool hasDatumElevation() const;
|
||||
double datumElevation() const;
|
||||
cvf::Vec3d interpolatedPointAlongWellPath(double measuredDepth);
|
||||
double wellPathAzimuthAngle(const cvf::Vec3d& position) const;
|
||||
|
||||
private:
|
||||
bool m_hasDatumElevation;
|
||||
|
Loading…
Reference in New Issue
Block a user