mirror of
https://github.com/OPM/ResInsight.git
synced 2024-12-28 18:01:08 -06:00
#2569 Fracture containment. Fix fracture border polygon calculation
This commit is contained in:
parent
0629551fa8
commit
6942a99406
@ -667,7 +667,7 @@ cvf::ref<cvf::Part> RivWellFracturePartMgr::createStimPlanElementColorSurfacePar
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
cvf::ref<cvf::Part> RivWellFracturePartMgr::createContainmentMaskPart(const RimEclipseView& activeView)
|
cvf::ref<cvf::Part> RivWellFracturePartMgr::createContainmentMaskPart(const RimEclipseView& activeView)
|
||||||
{
|
{
|
||||||
std::vector<cvf::Vec3f> borderPolygonLocalCS = m_rimFracture->fractureTemplate()->fractureBorderPolygon();
|
std::vector<cvf::Vec3d> borderPolygonLocalCS = fractureBorderPolygon();
|
||||||
cvf::Mat4d frMx = m_rimFracture->transformMatrix();
|
cvf::Mat4d frMx = m_rimFracture->transformMatrix();
|
||||||
|
|
||||||
cvf::BoundingBox frBBox;
|
cvf::BoundingBox frBBox;
|
||||||
@ -871,7 +871,7 @@ cvf::ref<cvf::Part> RivWellFracturePartMgr::createStimPlanMeshPart(const RimEcli
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
cvf::ref<cvf::DrawableGeo> RivWellFracturePartMgr::createStimPlanMeshDrawable(RimStimPlanFractureTemplate* stimPlanFracTemplate, const RimEclipseView& activeView) const
|
cvf::ref<cvf::DrawableGeo> RivWellFracturePartMgr::createStimPlanMeshDrawable(RimStimPlanFractureTemplate* stimPlanFracTemplate, const RimEclipseView& activeView)
|
||||||
{
|
{
|
||||||
if (!stimPlanFracTemplate->fractureGrid()) return nullptr;
|
if (!stimPlanFracTemplate->fractureGrid()) return nullptr;
|
||||||
|
|
||||||
@ -888,6 +888,7 @@ cvf::ref<cvf::DrawableGeo> RivWellFracturePartMgr::createStimPlanMeshDrawable(Ri
|
|||||||
resultUnitFromColors,
|
resultUnitFromColors,
|
||||||
stimPlanFracTemplate->activeTimeStepIndex());
|
stimPlanFracTemplate->activeTimeStepIndex());
|
||||||
|
|
||||||
|
m_visibleFracturePolygons.clear();
|
||||||
for ( size_t cIdx = 0; cIdx < stimPlanCells.size() ; ++cIdx)
|
for ( size_t cIdx = 0; cIdx < stimPlanCells.size() ; ++cIdx)
|
||||||
{
|
{
|
||||||
if (prCellResults[cIdx] > 1e-7)
|
if (prCellResults[cIdx] > 1e-7)
|
||||||
@ -898,6 +899,7 @@ cvf::ref<cvf::DrawableGeo> RivWellFracturePartMgr::createStimPlanMeshDrawable(Ri
|
|||||||
{
|
{
|
||||||
stimPlanMeshVertices.push_back(static_cast<cvf::Vec3f>(cellCorner));
|
stimPlanMeshVertices.push_back(static_cast<cvf::Vec3f>(cellCorner));
|
||||||
}
|
}
|
||||||
|
m_visibleFracturePolygons.push_back(stimPlanCellPolygon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -907,7 +909,7 @@ cvf::ref<cvf::DrawableGeo> RivWellFracturePartMgr::createStimPlanMeshDrawable(Ri
|
|||||||
}
|
}
|
||||||
|
|
||||||
cvf::Mat4d fractureXf = m_rimFracture->transformMatrix();
|
cvf::Mat4d fractureXf = m_rimFracture->transformMatrix();
|
||||||
std::vector<cvf::Vec3f> stimPlanMeshVerticesDisplayCoords = transformToFractureDisplayCoords(stimPlanMeshVertices,
|
std::vector<cvf::Vec3f> stimPlanMeshVerticesDisplayCoords = transformToFractureDisplayCoords(stimPlanMeshVertices,
|
||||||
fractureXf,
|
fractureXf,
|
||||||
*displayCoordTransform);
|
*displayCoordTransform);
|
||||||
|
|
||||||
@ -926,6 +928,14 @@ cvf::ref<cvf::DrawableGeo> RivWellFracturePartMgr::createStimPlanMeshDrawable(Ri
|
|||||||
return stimPlanMeshGeo;
|
return stimPlanMeshGeo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::vector<cvf::Vec3d> RivWellFracturePartMgr::fractureBorderPolygon()
|
||||||
|
{
|
||||||
|
return RigCellGeometryTools::unionOfPolygons(m_visibleFracturePolygons);
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -42,6 +42,7 @@ namespace caf
|
|||||||
}
|
}
|
||||||
|
|
||||||
class RimFracture;
|
class RimFracture;
|
||||||
|
class RimFractureTemplate;
|
||||||
class RimStimPlanFractureTemplate;
|
class RimStimPlanFractureTemplate;
|
||||||
class RimEclipseView;
|
class RimEclipseView;
|
||||||
class RigFractureCell;
|
class RigFractureCell;
|
||||||
@ -74,7 +75,9 @@ private:
|
|||||||
void appendFracturePerforationLengthParts(const RimEclipseView& activeView, cvf::ModelBasicList* model);
|
void appendFracturePerforationLengthParts(const RimEclipseView& activeView, cvf::ModelBasicList* model);
|
||||||
|
|
||||||
cvf::ref<cvf::Part> createStimPlanMeshPart(const RimEclipseView& activeView);
|
cvf::ref<cvf::Part> createStimPlanMeshPart(const RimEclipseView& activeView);
|
||||||
cvf::ref<cvf::DrawableGeo> createStimPlanMeshDrawable(RimStimPlanFractureTemplate* stimPlanFracTemplate, const RimEclipseView& activeView) const;
|
cvf::ref<cvf::DrawableGeo> createStimPlanMeshDrawable(RimStimPlanFractureTemplate* stimPlanFracTemplate, const RimEclipseView& activeView);
|
||||||
|
|
||||||
|
std::vector<cvf::Vec3d> fractureBorderPolygon();
|
||||||
|
|
||||||
static std::vector<cvf::Vec3f> transformToFractureDisplayCoords(const std::vector<cvf::Vec3f>& polygon,
|
static std::vector<cvf::Vec3f> transformToFractureDisplayCoords(const std::vector<cvf::Vec3f>& polygon,
|
||||||
cvf::Mat4d m,
|
cvf::Mat4d m,
|
||||||
@ -84,4 +87,6 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmPointer<RimFracture> m_rimFracture;
|
caf::PdmPointer<RimFracture> m_rimFracture;
|
||||||
|
|
||||||
|
std::vector<std::vector<cvf::Vec3d>> m_visibleFracturePolygons;
|
||||||
};
|
};
|
||||||
|
@ -746,20 +746,7 @@ void RimStimPlanFractureTemplate::fractureTriangleGeometry(std::vector<cvf::Vec3
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<cvf::Vec3f> RimStimPlanFractureTemplate::fractureBorderPolygon()
|
std::vector<cvf::Vec3f> RimStimPlanFractureTemplate::fractureBorderPolygon()
|
||||||
{
|
{
|
||||||
if (m_stimPlanFractureDefinitionData.isNull()) return std::vector<cvf::Vec3f>();
|
// Not implemented
|
||||||
|
|
||||||
QString parameterName = m_borderPolygonResultName;
|
|
||||||
QString parameterUnit = getUnitForStimPlanParameter(parameterName);
|
|
||||||
|
|
||||||
if (m_stimPlanFractureDefinitionData.notNull())
|
|
||||||
{
|
|
||||||
return m_stimPlanFractureDefinitionData->createFractureBorderPolygon(parameterName,
|
|
||||||
parameterUnit,
|
|
||||||
m_activeTimeStepIndex,
|
|
||||||
m_wellPathDepthAtFracture,
|
|
||||||
name());
|
|
||||||
}
|
|
||||||
|
|
||||||
return std::vector<cvf::Vec3f>();
|
return std::vector<cvf::Vec3f>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,6 +455,43 @@ double RigCellGeometryTools::getLengthOfPolygonAlongLine(const std::pair<cvf::Ve
|
|||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::vector<cvf::Vec3d> RigCellGeometryTools::unionOfPolygons(std::vector<std::vector<cvf::Vec3d>> polygons)
|
||||||
|
{
|
||||||
|
// Convert to int for clipper library and store as clipper "path"
|
||||||
|
std::vector<ClipperLib::Path> polygonPaths;
|
||||||
|
for (const std::vector<cvf::Vec3d>& polygon : polygons)
|
||||||
|
{
|
||||||
|
polygonPaths.emplace_back();
|
||||||
|
auto& p = polygonPaths.back();
|
||||||
|
for (const cvf::Vec3d& pp : polygon)
|
||||||
|
{
|
||||||
|
p.push_back(toClipperPoint(pp));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ClipperLib::Clipper clpr;
|
||||||
|
clpr.AddPaths(polygonPaths, ClipperLib::ptSubject, true);
|
||||||
|
|
||||||
|
ClipperLib::Paths solution;
|
||||||
|
clpr.Execute(ClipperLib::ctUnion, solution, ClipperLib::pftEvenOdd, ClipperLib::pftEvenOdd);
|
||||||
|
|
||||||
|
// Convert back to std::vector<std::vector<cvf::Vec3d> >
|
||||||
|
std::vector<cvf::Vec3d> unionPolygon;
|
||||||
|
for (ClipperLib::Path pathInSol : solution)
|
||||||
|
{
|
||||||
|
std::vector<cvf::Vec3d> clippedPolygon;
|
||||||
|
for (ClipperLib::IntPoint IntPosition : pathInSol)
|
||||||
|
{
|
||||||
|
unionPolygon.push_back(fromClipperPoint(IntPosition));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return unionPolygon;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -51,6 +51,8 @@ public:
|
|||||||
|
|
||||||
static double getLengthOfPolygonAlongLine(const std::pair<cvf::Vec3d, cvf::Vec3d>& line, const std::vector<cvf::Vec3d>& polygon);
|
static double getLengthOfPolygonAlongLine(const std::pair<cvf::Vec3d, cvf::Vec3d>& line, const std::vector<cvf::Vec3d>& polygon);
|
||||||
|
|
||||||
|
static std::vector<cvf::Vec3d> unionOfPolygons(std::vector<std::vector<cvf::Vec3d>> polygons);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::vector<cvf::Vec3d> ajustPolygonToAvoidIntersectionsAtVertex(const std::vector<cvf::Vec3d>& polyLine,
|
static std::vector<cvf::Vec3d> ajustPolygonToAvoidIntersectionsAtVertex(const std::vector<cvf::Vec3d>& polyLine,
|
||||||
const std::vector<cvf::Vec3d>& polygon);
|
const std::vector<cvf::Vec3d>& polygon);
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Internal functions
|
/// Internal functions
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -408,13 +407,13 @@ cvf::ref<RigFractureGrid> RigStimPlanFractureDefinition::createFractureGrid(cons
|
|||||||
RiaLogging::error("Did not find stim plan cell at well crossing!");
|
RiaLogging::error("Did not find stim plan cell at well crossing!");
|
||||||
}
|
}
|
||||||
|
|
||||||
cvf::ref<RigFractureGrid> m_fractureGrid = new RigFractureGrid;
|
cvf::ref<RigFractureGrid> fractureGrid = new RigFractureGrid;
|
||||||
m_fractureGrid->setFractureCells(stimPlanCells);
|
fractureGrid->setFractureCells(stimPlanCells);
|
||||||
m_fractureGrid->setWellCenterFractureCellIJ(wellCenterStimPlanCellIJ);
|
fractureGrid->setWellCenterFractureCellIJ(wellCenterStimPlanCellIJ);
|
||||||
m_fractureGrid->setICellCount(this->m_Xs.size() - 2);
|
fractureGrid->setICellCount(this->m_Xs.size() - 2);
|
||||||
m_fractureGrid->setJCellCount(this->adjustedYCoordsAroundWellPathPosition(wellPathIntersectionAtFractureDepth).size() - 2);
|
fractureGrid->setJCellCount(this->adjustedYCoordsAroundWellPathPosition(wellPathIntersectionAtFractureDepth).size() - 2);
|
||||||
|
|
||||||
return m_fractureGrid;
|
return fractureGrid;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -526,68 +525,6 @@ void sortPolygon(std::vector<cvf::Vec3f> &polygon)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
std::vector<cvf::Vec3f> RigStimPlanFractureDefinition::createFractureBorderPolygon(const QString& resultName,
|
|
||||||
const QString& resultUnit,
|
|
||||||
int activeTimeStepIndex,
|
|
||||||
double wellPathIntersectionAtFractureDepth,
|
|
||||||
const QString& fractureUserName)
|
|
||||||
{
|
|
||||||
std::vector<cvf::Vec3f> polygon;
|
|
||||||
|
|
||||||
std::vector<std::vector<double>> dataAtTimeStep = this->getDataAtTimeIndex(resultName, resultUnit, activeTimeStepIndex);
|
|
||||||
|
|
||||||
std::vector<double> adjustedYs = this->adjustedYCoordsAroundWellPathPosition(wellPathIntersectionAtFractureDepth);
|
|
||||||
|
|
||||||
for ( int k = 0; k < static_cast<int>(dataAtTimeStep.size()); k++ )
|
|
||||||
{
|
|
||||||
for ( int i = 0; i < static_cast<int>(dataAtTimeStep[k].size()); i++ )
|
|
||||||
{
|
|
||||||
if ( (dataAtTimeStep[k])[i] < 1e-7 ) //polygon should consist of nodes with value 0
|
|
||||||
{
|
|
||||||
if ( (i > 0) && ((dataAtTimeStep[k])[(i - 1)] > 1e-7) ) //side neighbour cell different from 0
|
|
||||||
{
|
|
||||||
polygon.push_back(cvf::Vec3f(static_cast<float>(this->m_Xs[i]),
|
|
||||||
static_cast<float>(adjustedYs[k]), 0.0f));
|
|
||||||
}
|
|
||||||
else if ( (k < static_cast<int>(dataAtTimeStep.size()) - 1) && ((dataAtTimeStep[k + 1])[(i)] > 1e-7) )//cell below different from 0
|
|
||||||
{
|
|
||||||
polygon.push_back(cvf::Vec3f(static_cast<float>(this->m_Xs[i]),
|
|
||||||
static_cast<float>(adjustedYs[k]), 0.0f));
|
|
||||||
}
|
|
||||||
else if ( (k > 0) && ((dataAtTimeStep[k - 1])[(i)] > 1e-7) )//cell above different from 0
|
|
||||||
{
|
|
||||||
polygon.push_back(cvf::Vec3f(static_cast<float>(this->m_Xs[i]),
|
|
||||||
static_cast<float>(adjustedYs[k]), 0.0f));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sortPolygon(polygon);
|
|
||||||
|
|
||||||
std::vector<cvf::Vec3f> negPolygon;
|
|
||||||
for ( const cvf::Vec3f& node : polygon )
|
|
||||||
{
|
|
||||||
cvf::Vec3f negNode = node;
|
|
||||||
negNode.x() = -negNode.x();
|
|
||||||
negPolygon.insert(negPolygon.begin(), negNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( const cvf::Vec3f& negNode : negPolygon )
|
|
||||||
{
|
|
||||||
polygon.push_back(negNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Adding first point last - to close the polygon
|
|
||||||
if ( polygon.size()>0 ) polygon.push_back(polygon[0]);
|
|
||||||
|
|
||||||
return polygon;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -81,12 +81,6 @@ public:
|
|||||||
std::vector<cvf::Vec3f>* vertices,
|
std::vector<cvf::Vec3f>* vertices,
|
||||||
std::vector<cvf::uint>* triangleIndices);
|
std::vector<cvf::uint>* triangleIndices);
|
||||||
|
|
||||||
std::vector<cvf::Vec3f> createFractureBorderPolygon(const QString& resultName,
|
|
||||||
const QString& resultUnit,
|
|
||||||
int activeTimeStepIndex,
|
|
||||||
double wellPathIntersectionAtFractureDepth,
|
|
||||||
const QString& fractureUserName);
|
|
||||||
|
|
||||||
const std::vector<double>& timeSteps() const;
|
const std::vector<double>& timeSteps() const;
|
||||||
void addTimeStep(double time);
|
void addTimeStep(double time);
|
||||||
size_t totalNumberTimeSteps();
|
size_t totalNumberTimeSteps();
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
Title Classes related to fractures
|
Title Classes related to fractures
|
||||||
|
|
||||||
note as N1
|
note as N1
|
||||||
Updated 2018-02-07
|
Updated 2018-03-07
|
||||||
end note
|
end note
|
||||||
|
|
||||||
class RimFracture {
|
class RimFracture {
|
||||||
@ -19,6 +19,10 @@ class RimWellPathFracture {
|
|||||||
RimFracture <|-- RimSimWellFracture
|
RimFracture <|-- RimSimWellFracture
|
||||||
RimFracture <|-- RimWellPathFracture
|
RimFracture <|-- RimWellPathFracture
|
||||||
|
|
||||||
|
RimFracture -> RimStimPlanFractureTemplate
|
||||||
|
|
||||||
|
RimFracture -> RivWellFracturePartMgr
|
||||||
|
RivWellFracturePartMgr ->RimFracture
|
||||||
|
|
||||||
class RimFractureTemplate {
|
class RimFractureTemplate {
|
||||||
RimDefines::UnitSystemType fractureTemplateUnit;
|
RimDefines::UnitSystemType fractureTemplateUnit;
|
||||||
|
Loading…
Reference in New Issue
Block a user