mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Whitespace and rename
This commit is contained in:
parent
e195eed246
commit
45f0f6b485
@ -34,34 +34,44 @@
|
|||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RigWellPathStimplanIntersector::RigWellPathStimplanIntersector(const RigWellPath* wellpathGeom, const RimFracture* rimFracture)
|
RigWellPathStimplanIntersector::RigWellPathStimplanIntersector(const RigWellPath* wellPathGeom, const RimFracture* rimFracture)
|
||||||
{
|
{
|
||||||
std::vector<cvf::Vec3d> wellPathPoints = wellpathGeom->wellPathPointsIncludingInterpolatedIntersectionPoint(rimFracture->fractureMD());
|
std::vector<cvf::Vec3d> wellPathPoints =
|
||||||
cvf::Mat4d fractureXf = rimFracture->transformMatrix();
|
wellPathGeom->wellPathPointsIncludingInterpolatedIntersectionPoint(rimFracture->fractureMD());
|
||||||
double wellRadius = rimFracture->wellRadius();
|
cvf::Mat4d fractureXf = rimFracture->transformMatrix();
|
||||||
std::vector<std::vector<cvf::Vec3d> > stpCellPolygons;
|
double wellRadius = rimFracture->wellRadius();
|
||||||
|
|
||||||
|
std::vector<std::vector<cvf::Vec3d>> fractureGridCellPolygons;
|
||||||
{
|
{
|
||||||
RimFractureTemplate* fractureTemplate = rimFracture->fractureTemplate();
|
RimFractureTemplate* fractureTemplate = rimFracture->fractureTemplate();
|
||||||
|
|
||||||
if(fractureTemplate)
|
if (fractureTemplate && fractureTemplate->fractureGrid())
|
||||||
{
|
{
|
||||||
const std::vector<RigFractureCell>& stpCells = fractureTemplate->fractureGrid()->fractureCells();
|
const std::vector<RigFractureCell>& stpCells = fractureTemplate->fractureGrid()->fractureCells();
|
||||||
for ( const auto& stpCell: stpCells ) stpCellPolygons.push_back(stpCell.getPolygon());
|
for (const auto& stpCell : stpCells)
|
||||||
|
{
|
||||||
|
fractureGridCellPolygons.push_back(stpCell.getPolygon());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
double perforationLength = rimFracture->perforationLength();
|
double perforationLength = rimFracture->perforationLength();
|
||||||
|
|
||||||
calculate(fractureXf, wellPathPoints, wellRadius, perforationLength, stpCellPolygons, m_stimPlanCellIdxToIntersectionInfoMap);
|
calculate(fractureXf,
|
||||||
|
wellPathPoints,
|
||||||
|
wellRadius,
|
||||||
|
perforationLength,
|
||||||
|
fractureGridCellPolygons,
|
||||||
|
m_stimPlanCellIdxToIntersectionInfoMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
const std::map<size_t, RigWellPathStimplanIntersector::RigWellPathStimplanIntersector::WellCellIntersection >& RigWellPathStimplanIntersector::intersections() const
|
const std::map<size_t, RigWellPathStimplanIntersector::RigWellPathStimplanIntersector::WellCellIntersection>&
|
||||||
|
RigWellPathStimplanIntersector::intersections() const
|
||||||
{
|
{
|
||||||
return m_stimPlanCellIdxToIntersectionInfoMap;
|
return m_stimPlanCellIdxToIntersectionInfoMap;
|
||||||
}
|
}
|
||||||
@ -69,74 +79,77 @@ const std::map<size_t, RigWellPathStimplanIntersector::RigWellPathStimplanInters
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Todo: Use only the perforated parts of the well path
|
/// Todo: Use only the perforated parts of the well path
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RigWellPathStimplanIntersector::calculate(const cvf::Mat4d &fractureXf,
|
void RigWellPathStimplanIntersector::calculate(const cvf::Mat4d& fractureXf,
|
||||||
const std::vector<cvf::Vec3d>& wellPathPointsOrg,
|
const std::vector<cvf::Vec3d>& wellPathPointsDomainCoords,
|
||||||
double wellRadius,
|
double wellRadius,
|
||||||
double perforationLength,
|
double perforationLength,
|
||||||
const std::vector<std::vector<cvf::Vec3d> >& stpCellPolygons,
|
const std::vector<std::vector<cvf::Vec3d>>& fractureGridCellPolygons,
|
||||||
std::map<size_t, WellCellIntersection>& m_stimPlanCellIdxToIntersectionInfoMap)
|
std::map<size_t, WellCellIntersection>& m_stimPlanCellIdxToIntersectionInfoMap)
|
||||||
{
|
{
|
||||||
cvf::Mat4d toFractureXf = fractureXf.getInverted();
|
cvf::Mat4d toFractureXf = fractureXf.getInverted();
|
||||||
|
|
||||||
std::vector<cvf::Vec3d> perforationLengthBoundingBoxPolygon;
|
std::vector<cvf::Vec3d> perforationLengthBoundingBoxPolygon;
|
||||||
double cicleRadius = perforationLength / 2;
|
|
||||||
int pointsInCirclePolygon = 20;
|
|
||||||
for (int i = 0; i < pointsInCirclePolygon; i++)
|
|
||||||
{
|
{
|
||||||
double x = cicleRadius * cvf::Math::cos(i * (2 * cvf::PI_D / pointsInCirclePolygon));
|
double cicleRadius = perforationLength / 2;
|
||||||
double y = cicleRadius * cvf::Math::sin(i * (2 * cvf::PI_D / pointsInCirclePolygon));
|
int pointsInCirclePolygon = 20;
|
||||||
perforationLengthBoundingBoxPolygon.push_back(cvf::Vec3d(x, y, 0));
|
|
||||||
|
for (int i = 0; i < pointsInCirclePolygon; i++)
|
||||||
|
{
|
||||||
|
double x = cicleRadius * cvf::Math::cos(i * (2 * cvf::PI_D / pointsInCirclePolygon));
|
||||||
|
double y = cicleRadius * cvf::Math::sin(i * (2 * cvf::PI_D / pointsInCirclePolygon));
|
||||||
|
perforationLengthBoundingBoxPolygon.push_back(cvf::Vec3d(x, y, 0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert well path to fracture template system
|
// Convert well path to fracture template system
|
||||||
|
|
||||||
std::vector<cvf::Vec3d> fractureRelativeWellPathPoints;
|
std::vector<cvf::Vec3d> fractureRelativeWellPathPoints;
|
||||||
for ( auto & wellPPoint : wellPathPointsOrg ) fractureRelativeWellPathPoints.push_back(wellPPoint.getTransformedPoint( toFractureXf));
|
for (const auto& wellPPoint : wellPathPointsDomainCoords)
|
||||||
|
{
|
||||||
|
fractureRelativeWellPathPoints.push_back(wellPPoint.getTransformedPoint(toFractureXf));
|
||||||
|
}
|
||||||
|
|
||||||
// Clip well path to fracture domain
|
// Clip well path to fracture domain
|
||||||
|
|
||||||
std::vector<std::vector<cvf::Vec3d> > wellPathPartsWithinFracture =
|
std::vector<std::vector<cvf::Vec3d>> wellPathPartsWithinFracture = RigCellGeometryTools::clipPolylineByPolygon(
|
||||||
RigCellGeometryTools::clipPolylineByPolygon(fractureRelativeWellPathPoints,
|
fractureRelativeWellPathPoints, perforationLengthBoundingBoxPolygon, RigCellGeometryTools::INTERPOLATE_LINE_Z);
|
||||||
perforationLengthBoundingBoxPolygon,
|
|
||||||
RigCellGeometryTools::INTERPOLATE_LINE_Z);
|
|
||||||
|
|
||||||
// Remove the part of the well path that is more than well radius away from the fracture plane
|
// Remove the part of the well path that is more than well radius away from the fracture plane
|
||||||
|
|
||||||
std::vector< std::vector< cvf::Vec3d > > intersectingWellPathParts;
|
std::vector<std::vector<cvf::Vec3d>> intersectingWellPathParts;
|
||||||
|
|
||||||
for ( const auto& part : wellPathPartsWithinFracture )
|
for (const auto& part : wellPathPartsWithinFracture)
|
||||||
{
|
{
|
||||||
std::vector< cvf::Vec3d > currentIntersectingWpPart;
|
std::vector<cvf::Vec3d> currentIntersectingWpPart;
|
||||||
for ( size_t vxIdx = 0; vxIdx < part.size() -1; ++vxIdx )
|
for (size_t vxIdx = 0; vxIdx < part.size() - 1; ++vxIdx)
|
||||||
{
|
{
|
||||||
double thisAbsZ = fabs(part[vxIdx].z());
|
double thisAbsZ = fabs(part[vxIdx].z());
|
||||||
double nextAbsZ = fabs(part[vxIdx + 1].z());
|
double nextAbsZ = fabs(part[vxIdx + 1].z());
|
||||||
double thisZ = part[vxIdx].z();
|
double thisZ = part[vxIdx].z();
|
||||||
double nextZ = part[vxIdx + 1].z();
|
double nextZ = part[vxIdx + 1].z();
|
||||||
|
|
||||||
if ( thisAbsZ >= wellRadius && nextAbsZ >= wellRadius )
|
if (thisAbsZ >= wellRadius && nextAbsZ >= wellRadius)
|
||||||
{
|
{
|
||||||
if ( (thisZ >= 0 && nextZ >= 0)
|
if ((thisZ >= 0 && nextZ >= 0) || (thisZ <= 0 && nextZ <= 0))
|
||||||
|| (thisZ <= 0 && nextZ <= 0 ) )
|
|
||||||
{
|
{
|
||||||
continue; // Outside
|
continue; // Outside
|
||||||
}
|
}
|
||||||
else // In and out
|
else // In and out
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
double wellRadiusDistFromPlane = thisZ > 0 ? wellRadius: -wellRadius;
|
double wellRadiusDistFromPlane = thisZ > 0 ? wellRadius : -wellRadius;
|
||||||
|
|
||||||
double fraction = (wellRadiusDistFromPlane - thisZ)/ (nextZ - thisZ);
|
double fraction = (wellRadiusDistFromPlane - thisZ) / (nextZ - thisZ);
|
||||||
|
|
||||||
cvf::Vec3d intersectPoint = part[vxIdx] + fraction * (part[vxIdx+1] - part[vxIdx]);
|
cvf::Vec3d intersectPoint = part[vxIdx] + fraction * (part[vxIdx + 1] - part[vxIdx]);
|
||||||
currentIntersectingWpPart.push_back(intersectPoint);
|
currentIntersectingWpPart.push_back(intersectPoint);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
double wellRadiusDistFromPlane = nextZ > 0 ? wellRadius: -wellRadius;
|
double wellRadiusDistFromPlane = nextZ > 0 ? wellRadius : -wellRadius;
|
||||||
|
|
||||||
double fraction = (wellRadiusDistFromPlane - thisZ)/ (nextZ - thisZ);
|
double fraction = (wellRadiusDistFromPlane - thisZ) / (nextZ - thisZ);
|
||||||
|
|
||||||
cvf::Vec3d intersectPoint = part[vxIdx] + fraction * (part[vxIdx+1] - part[vxIdx]);
|
cvf::Vec3d intersectPoint = part[vxIdx] + fraction * (part[vxIdx + 1] - part[vxIdx]);
|
||||||
currentIntersectingWpPart.push_back(intersectPoint);
|
currentIntersectingWpPart.push_back(intersectPoint);
|
||||||
|
|
||||||
intersectingWellPathParts.push_back(currentIntersectingWpPart);
|
intersectingWellPathParts.push_back(currentIntersectingWpPart);
|
||||||
@ -145,21 +158,21 @@ void RigWellPathStimplanIntersector::calculate(const cvf::Mat4d &fractureXf,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( thisAbsZ < wellRadius && nextAbsZ < wellRadius ) // Inside
|
if (thisAbsZ < wellRadius && nextAbsZ < wellRadius) // Inside
|
||||||
{
|
{
|
||||||
currentIntersectingWpPart.push_back(part[vxIdx]);
|
currentIntersectingWpPart.push_back(part[vxIdx]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( thisAbsZ < wellRadius && nextAbsZ >= wellRadius ) // Going out
|
if (thisAbsZ < wellRadius && nextAbsZ >= wellRadius) // Going out
|
||||||
{
|
{
|
||||||
currentIntersectingWpPart.push_back(part[vxIdx]);
|
currentIntersectingWpPart.push_back(part[vxIdx]);
|
||||||
|
|
||||||
double wellRadiusDistFromPlane = nextZ > 0 ? wellRadius: -wellRadius;
|
double wellRadiusDistFromPlane = nextZ > 0 ? wellRadius : -wellRadius;
|
||||||
|
|
||||||
double fraction = (wellRadiusDistFromPlane - thisZ)/ (nextZ - thisZ);
|
double fraction = (wellRadiusDistFromPlane - thisZ) / (nextZ - thisZ);
|
||||||
|
|
||||||
cvf::Vec3d intersectPoint = part[vxIdx] + fraction * (part[vxIdx+1] - part[vxIdx]);
|
cvf::Vec3d intersectPoint = part[vxIdx] + fraction * (part[vxIdx + 1] - part[vxIdx]);
|
||||||
currentIntersectingWpPart.push_back(intersectPoint);
|
currentIntersectingWpPart.push_back(intersectPoint);
|
||||||
|
|
||||||
intersectingWellPathParts.push_back(currentIntersectingWpPart);
|
intersectingWellPathParts.push_back(currentIntersectingWpPart);
|
||||||
@ -167,17 +180,16 @@ void RigWellPathStimplanIntersector::calculate(const cvf::Mat4d &fractureXf,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( thisAbsZ >= wellRadius && nextAbsZ < wellRadius ) // Going in
|
if (thisAbsZ >= wellRadius && nextAbsZ < wellRadius) // Going in
|
||||||
{
|
{
|
||||||
double wellRadiusDistFromPlane = thisZ > 0 ? wellRadius: -wellRadius;
|
double wellRadiusDistFromPlane = thisZ > 0 ? wellRadius : -wellRadius;
|
||||||
|
|
||||||
double fraction = (wellRadiusDistFromPlane - thisZ)/ (nextZ - thisZ);
|
double fraction = (wellRadiusDistFromPlane - thisZ) / (nextZ - thisZ);
|
||||||
|
|
||||||
cvf::Vec3d intersectPoint = part[vxIdx] + fraction * (part[vxIdx+1] - part[vxIdx]);
|
cvf::Vec3d intersectPoint = part[vxIdx] + fraction * (part[vxIdx + 1] - part[vxIdx]);
|
||||||
currentIntersectingWpPart.push_back(intersectPoint);
|
currentIntersectingWpPart.push_back(intersectPoint);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add last point if it is within the radius
|
// Add last point if it is within the radius
|
||||||
@ -187,7 +199,7 @@ void RigWellPathStimplanIntersector::calculate(const cvf::Mat4d &fractureXf,
|
|||||||
currentIntersectingWpPart.push_back(part.back());
|
currentIntersectingWpPart.push_back(part.back());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !currentIntersectingWpPart.empty() )
|
if (!currentIntersectingWpPart.empty())
|
||||||
{
|
{
|
||||||
intersectingWellPathParts.push_back(currentIntersectingWpPart);
|
intersectingWellPathParts.push_back(currentIntersectingWpPart);
|
||||||
}
|
}
|
||||||
@ -195,26 +207,24 @@ void RigWellPathStimplanIntersector::calculate(const cvf::Mat4d &fractureXf,
|
|||||||
|
|
||||||
// Find the StimPlan cells touched by the intersecting well path parts
|
// Find the StimPlan cells touched by the intersecting well path parts
|
||||||
|
|
||||||
for ( size_t cIdx = 0; cIdx < stpCellPolygons.size(); ++ cIdx )
|
for (size_t cIdx = 0; cIdx < fractureGridCellPolygons.size(); ++cIdx)
|
||||||
{
|
{
|
||||||
const std::vector<cvf::Vec3d>& cellPolygon = stpCellPolygons[cIdx];
|
const std::vector<cvf::Vec3d>& cellPolygon = fractureGridCellPolygons[cIdx];
|
||||||
for ( const auto& wellpathPart :intersectingWellPathParts )
|
for (const auto& wellpathPart : intersectingWellPathParts)
|
||||||
{
|
{
|
||||||
std::vector<std::vector<cvf::Vec3d> > wellPathPartsInPolygon =
|
std::vector<std::vector<cvf::Vec3d>> wellPathPartsInPolygon =
|
||||||
RigCellGeometryTools::clipPolylineByPolygon(wellpathPart,
|
RigCellGeometryTools::clipPolylineByPolygon(wellpathPart, cellPolygon, RigCellGeometryTools::USE_HUGEVAL);
|
||||||
cellPolygon,
|
for (const auto& wellPathPartInCell : wellPathPartsInPolygon)
|
||||||
RigCellGeometryTools::USE_HUGEVAL);
|
|
||||||
for ( const auto& wellPathPartInCell: wellPathPartsInPolygon )
|
|
||||||
{
|
{
|
||||||
if ( !wellPathPartInCell.empty() )
|
if (!wellPathPartInCell.empty())
|
||||||
{
|
{
|
||||||
int endpointCount = 0;
|
int endpointCount = 0;
|
||||||
if ( wellPathPartInCell.front().z() != HUGE_VAL ) ++endpointCount;
|
if (wellPathPartInCell.front().z() != HUGE_VAL) ++endpointCount;
|
||||||
if ( wellPathPartInCell.back().z() != HUGE_VAL ) ++endpointCount;
|
if (wellPathPartInCell.back().z() != HUGE_VAL) ++endpointCount;
|
||||||
|
|
||||||
cvf::Vec3d intersectionLength = (wellPathPartInCell.back() - wellPathPartInCell.front());
|
cvf::Vec3d intersectionLength = (wellPathPartInCell.back() - wellPathPartInCell.front());
|
||||||
double xLengthInCell = fabs(intersectionLength.x());
|
double xLengthInCell = fabs(intersectionLength.x());
|
||||||
double yLengthInCell = fabs(intersectionLength.y());
|
double yLengthInCell = fabs(intersectionLength.y());
|
||||||
|
|
||||||
m_stimPlanCellIdxToIntersectionInfoMap[cIdx].endpointCount += endpointCount;
|
m_stimPlanCellIdxToIntersectionInfoMap[cIdx].endpointCount += endpointCount;
|
||||||
m_stimPlanCellIdxToIntersectionInfoMap[cIdx].hlength += xLengthInCell;
|
m_stimPlanCellIdxToIntersectionInfoMap[cIdx].hlength += xLengthInCell;
|
||||||
|
Loading…
Reference in New Issue
Block a user