mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
First numbers to file achieved, but they are wrong and too few
This commit is contained in:
@@ -10,31 +10,55 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
||||
RigWellPathStimplanIntersector::RigWellPathStimplanIntersector(const RigWellPath* wellpathGeom, const RimFracture * rimFracture)
|
||||
{
|
||||
std::vector<cvf::Vec3d> wellPathPoints = wellpathGeom->m_wellPathPoints;
|
||||
cvf::Mat4f fractureXf = rimFracture->transformMatrix();
|
||||
double wellRadius = rimFracture->wellRadius();
|
||||
std::vector<cvf::Vec3f> fracturePolygonf ;
|
||||
std::vector<std::vector<cvf::Vec3d> > stpCellPolygons;
|
||||
{
|
||||
auto stimPlanFractureTemplate = dynamic_cast<RimStimPlanFractureTemplate*> (rimFracture->attachedFractureDefinition());
|
||||
|
||||
CVF_ASSERT(stimPlanFractureTemplate);
|
||||
|
||||
fracturePolygonf = stimPlanFractureTemplate->fracturePolygon(rimFracture->fractureUnit());
|
||||
{
|
||||
const std::vector<RigStimPlanFracTemplateCell>& stpCells = stimPlanFractureTemplate->getStimPlanCells();
|
||||
for ( const auto& stpCell: stpCells ) stpCellPolygons.push_back(stpCell.getPolygon());
|
||||
}
|
||||
}
|
||||
|
||||
calculate(fractureXf, fracturePolygonf, wellPathPoints, wellRadius, stpCellPolygons, m_stimPlanCellIdxToIntersectionInfoMap);
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Todo: Use only the perforated parts of the well path
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigWellPathStimplanIntersector::RigWellPathStimplanIntersector(const RigWellPath* wellpathGeom, const RimFracture * rimFracture)
|
||||
|
||||
void RigWellPathStimplanIntersector::calculate(const cvf::Mat4f &fractureXf,
|
||||
const std::vector<cvf::Vec3f>& fracturePolygonf,
|
||||
const std::vector<cvf::Vec3d>& wellPathPointsOrg,
|
||||
double wellRadius,
|
||||
const std::vector<std::vector<cvf::Vec3d> >& stpCellPolygons,
|
||||
std::map<size_t, WellCellIntersection>& m_stimPlanCellIdxToIntersectionInfoMap)
|
||||
{
|
||||
auto stimPlanFractureTemplate = dynamic_cast<RimStimPlanFractureTemplate*> (rimFracture->attachedFractureDefinition());
|
||||
cvf::Mat4d toFractureXf = cvf::Mat4d(fractureXf.getInverted());
|
||||
|
||||
CVF_ASSERT(stimPlanFractureTemplate);
|
||||
|
||||
std::vector<cvf::Vec3d> wellPathPoints = wellpathGeom->m_wellPathPoints;
|
||||
cvf::Mat4d toFractureXf = cvf::Mat4d (rimFracture->transformMatrix().getInverted());
|
||||
double wellRadius = rimFracture->wellRadius();
|
||||
std::vector<cvf::Vec3d> fracturePolygon;
|
||||
{
|
||||
std::vector<cvf::Vec3f> fracturePolygonf = stimPlanFractureTemplate->fracturePolygon(rimFracture->fractureUnit());
|
||||
for ( auto fpv: fracturePolygonf ) fracturePolygon.push_back(cvf::Vec3d(fpv));
|
||||
}
|
||||
for ( auto fpv: fracturePolygonf ) fracturePolygon.push_back(cvf::Vec3d(fpv));
|
||||
|
||||
// Convert well path to fracture template system
|
||||
for ( auto & wellPPoint : wellPathPoints ) wellPPoint.transformPoint(toFractureXf);
|
||||
|
||||
std::vector<cvf::Vec3d> fractureRelativeWellPathPoints;
|
||||
for ( auto & wellPPoint : wellPathPointsOrg ) fractureRelativeWellPathPoints.push_back(wellPPoint.getTransformedPoint( toFractureXf));
|
||||
|
||||
// Clip well path to fracture domain
|
||||
|
||||
std::vector<std::vector<cvf::Vec3d> > wellPathPartsWithinFracture =
|
||||
RigCellGeometryTools::clipPolylineByPolygon(wellPathPoints, fracturePolygon, RigCellGeometryTools::INTERPOLATE_LINE_Z);
|
||||
RigCellGeometryTools::clipPolylineByPolygon(fractureRelativeWellPathPoints, fracturePolygon, RigCellGeometryTools::INTERPOLATE_LINE_Z);
|
||||
|
||||
// Remove the part of the well path that is more than well radius away from the fracture plane
|
||||
|
||||
@@ -45,22 +69,57 @@ RigWellPathStimplanIntersector::RigWellPathStimplanIntersector(const RigWellPath
|
||||
std::vector< cvf::Vec3d > currentIntersectingWpPart;
|
||||
for ( size_t vxIdx = 0; vxIdx < part.size() -1; ++vxIdx )
|
||||
{
|
||||
double thisZ = fabs(wellPathPoints[vxIdx].z());
|
||||
double nextZ = fabs(wellPathPoints[vxIdx + 1].z());
|
||||
double thisAbsZ = fabs(part[vxIdx].z());
|
||||
double nextAbsZ = fabs(part[vxIdx + 1].z());
|
||||
double thisZ = part[vxIdx].z();
|
||||
double nextZ = part[vxIdx + 1].z();
|
||||
|
||||
if ( thisZ >= wellRadius && nextZ >= wellRadius ) continue;
|
||||
|
||||
if ( thisZ < wellRadius && nextZ < wellRadius )
|
||||
if ( thisAbsZ >= wellRadius && nextAbsZ >= wellRadius )
|
||||
{
|
||||
currentIntersectingWpPart.push_back(wellPathPoints[vxIdx]);
|
||||
if ( (thisZ >= 0 && nextZ >= 0)
|
||||
|| (thisZ <= 0 && nextZ <= 0 ) )
|
||||
{
|
||||
continue; // Outside
|
||||
}
|
||||
else // In and out
|
||||
{
|
||||
{
|
||||
double wellRadiusDistFromPlane = thisZ > 0 ? wellRadius: -wellRadius;
|
||||
|
||||
double fraction = (wellRadiusDistFromPlane - thisZ)/ (nextZ - thisZ);
|
||||
|
||||
cvf::Vec3d intersectPoint = part[vxIdx] + fraction * (part[vxIdx+1] - part[vxIdx]);
|
||||
currentIntersectingWpPart.push_back(intersectPoint);
|
||||
}
|
||||
{
|
||||
double wellRadiusDistFromPlane = nextZ > 0 ? wellRadius: -wellRadius;
|
||||
|
||||
double fraction = (wellRadiusDistFromPlane - thisZ)/ (nextZ - thisZ);
|
||||
|
||||
cvf::Vec3d intersectPoint = part[vxIdx] + fraction * (part[vxIdx+1] - part[vxIdx]);
|
||||
currentIntersectingWpPart.push_back(intersectPoint);
|
||||
|
||||
intersectingWellPathParts.push_back(currentIntersectingWpPart);
|
||||
currentIntersectingWpPart.clear();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ( thisAbsZ < wellRadius && nextAbsZ < wellRadius ) // Inside
|
||||
{
|
||||
currentIntersectingWpPart.push_back(part[vxIdx]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( thisZ < wellRadius && nextZ >= wellRadius )
|
||||
if ( thisAbsZ < wellRadius && nextAbsZ >= wellRadius ) // Going out
|
||||
{
|
||||
currentIntersectingWpPart.push_back(wellPathPoints[vxIdx]);
|
||||
double fraction = (wellRadius - thisZ)/ (nextZ - thisZ);
|
||||
cvf::Vec3d intersectPoint = wellPathPoints[vxIdx] + fraction * (wellPathPoints[vxIdx+1] - wellPathPoints[vxIdx]);
|
||||
currentIntersectingWpPart.push_back(part[vxIdx]);
|
||||
|
||||
double wellRadiusDistFromPlane = nextZ > 0 ? wellRadius: -wellRadius;
|
||||
|
||||
double fraction = (wellRadiusDistFromPlane - thisZ)/ (nextZ - thisZ);
|
||||
|
||||
cvf::Vec3d intersectPoint = part[vxIdx] + fraction * (part[vxIdx+1] - part[vxIdx]);
|
||||
currentIntersectingWpPart.push_back(intersectPoint);
|
||||
|
||||
intersectingWellPathParts.push_back(currentIntersectingWpPart);
|
||||
@@ -68,13 +127,24 @@ RigWellPathStimplanIntersector::RigWellPathStimplanIntersector(const RigWellPath
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( thisZ >= wellRadius && nextZ < wellRadius )
|
||||
if ( thisAbsZ >= wellRadius && nextAbsZ < wellRadius ) // Going in
|
||||
{
|
||||
double fraction = (wellRadius - thisZ)/ (nextZ - thisZ);
|
||||
cvf::Vec3d intersectPoint = wellPathPoints[vxIdx] + fraction * (wellPathPoints[vxIdx+1] - wellPathPoints[vxIdx]);
|
||||
double wellRadiusDistFromPlane = thisZ > 0 ? wellRadius: -wellRadius;
|
||||
|
||||
double fraction = (wellRadiusDistFromPlane - thisZ)/ (nextZ - thisZ);
|
||||
|
||||
cvf::Vec3d intersectPoint = part[vxIdx] + fraction * (part[vxIdx+1] - part[vxIdx]);
|
||||
currentIntersectingWpPart.push_back(intersectPoint);
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Add last point if it is within the radius
|
||||
|
||||
if (part.size() > 1 && fabs(part.back().z()) < wellRadius)
|
||||
{
|
||||
currentIntersectingWpPart.push_back(part.back());
|
||||
}
|
||||
|
||||
if ( currentIntersectingWpPart.size() )
|
||||
@@ -85,12 +155,9 @@ RigWellPathStimplanIntersector::RigWellPathStimplanIntersector(const RigWellPath
|
||||
|
||||
// Find the StimPlan cells touched by the intersecting well path parts
|
||||
|
||||
const std::vector<RigStimPlanFracTemplateCell>& stpCells = stimPlanFractureTemplate->getStimPlanCells();
|
||||
|
||||
|
||||
for ( size_t cIdx = 0; cIdx < stpCells.size(); ++ cIdx )
|
||||
for ( size_t cIdx = 0; cIdx < stpCellPolygons.size(); ++ cIdx )
|
||||
{
|
||||
std::vector<cvf::Vec3d> cellPolygon = stpCells[cIdx].getPolygon();
|
||||
const std::vector<cvf::Vec3d>& cellPolygon = stpCellPolygons[cIdx];
|
||||
for ( const auto& wellpathPart :intersectingWellPathParts )
|
||||
{
|
||||
std::vector<std::vector<cvf::Vec3d> > wellPathPartsInPolygon =
|
||||
|
||||
Reference in New Issue
Block a user