#1602 Completion Type : Add fracture category

This commit is contained in:
Bjørnar Grip Fjær 2017-06-16 09:44:39 +02:00
parent 2090db62b2
commit 31a64e50ac
9 changed files with 105 additions and 13 deletions

View File

@ -71,6 +71,7 @@ namespace caf
addItem(RiaDefines::WELL_PATH, "WELL_PATH", "Well Path");
addItem(RiaDefines::PERFORATION_INTERVAL, "PERFORATION_INTERVAL", "Perforation Interval");
addItem(RiaDefines::FISHBONES, "FISHBONES", "Fishbones");
addItem(RiaDefines::FRACTURE, "FRACTURE", "Fracture");
setDefault(RiaDefines::WELL_PATH);
}

View File

@ -46,7 +46,8 @@ public:
enum CompletionType {
WELL_PATH,
PERFORATION_INTERVAL,
FISHBONES
FISHBONES,
FRACTURE,
};
static bool isPerCellFaceResult(const QString& resultName);

View File

@ -28,10 +28,17 @@
#include "RimFishbonesMultipleSubs.h"
#include "RimPerforationCollection.h"
#include "RimPerforationInterval.h"
#include "RimFracture.h"
#include "RimWellPathFracture.h"
#include "RimFractureTemplate.h"
#include "RimWellPathFractureCollection.h"
#include "RigMainGrid.h"
#include "RigWellPath.h"
#include "RigWellPathIntersectionTools.h"
#include "RigFractureGrid.h"
#include "RigFractureCell.h"
#include "RigCellGeometryTools.h"
#include <QDateTime>
@ -66,6 +73,11 @@ void RimCompletionCellIntersectionCalc::calculateWellPathIntersections(const Rim
calculateFishbonesIntersections(fishbones, grid, values);
}
for (const RimWellPathFracture* fracture : wellPath->fractureCollection()->fractures())
{
calculateFractureIntersections(grid, fracture, values);
}
for (const RimPerforationInterval* perforationInterval : wellPath->perforationIntervalCollection()->perforations())
{
if (perforationInterval->isActiveOnDate(fromDate))
@ -104,3 +116,68 @@ void RimCompletionCellIntersectionCalc::calculatePerforationIntersections(const
values[intersection.m_hexIndex] = RiaDefines::PERFORATION_INTERVAL;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCompletionCellIntersectionCalc::calculateFractureIntersections(const RigMainGrid* mainGrid, const RimFracture* fracture, std::vector<double>& values)
{
for (const RigFractureCell& fractureCell : fracture->fractureTemplate()->fractureGrid()->fractureCells())
{
std::vector<cvf::Vec3d> fractureCellTransformed;
for (const auto& v : fractureCell.getPolygon())
{
cvf::Vec3f polygonNode = cvf::Vec3f(v);
polygonNode.transformPoint(fracture->transformMatrix());
fractureCellTransformed.push_back(cvf::Vec3d(polygonNode));
}
std::vector<size_t> potentialCells;
{
cvf::BoundingBox boundingBox;
for (cvf::Vec3d nodeCoord : fractureCellTransformed)
{
boundingBox.add(nodeCoord);
}
mainGrid->findIntersectingCells(boundingBox, &potentialCells);
}
for (size_t cellIndex : potentialCells)
{
std::array<cvf::Vec3d, 8> hexCorners;
mainGrid->cellCornerVertices(cellIndex, hexCorners.data());
std::vector< std::vector<cvf::Vec3d> > planeCellPolygons;
bool isPlaneIntersected = RigHexIntersectionTools::planeHexIntersectionPolygons(hexCorners, fracture->transformMatrix(), planeCellPolygons);
if (!isPlaneIntersected || planeCellPolygons.empty()) continue;
{
cvf::Mat4d invertedTransformMatrix = cvf::Mat4d(fracture->transformMatrix().getInverted());
for (std::vector<cvf::Vec3d>& planeCellPolygon : planeCellPolygons)
{
for (cvf::Vec3d& v : planeCellPolygon)
{
v.transformPoint(invertedTransformMatrix);
}
}
}
for (const std::vector<cvf::Vec3d>& planeCellPolygon : planeCellPolygons)
{
std::vector< std::vector<cvf::Vec3d> > clippedPolygons = RigCellGeometryTools::intersectPolygons(planeCellPolygon, fractureCell.getPolygon());
for (const auto& clippedPolygon : clippedPolygons)
{
if (!clippedPolygon.empty())
{
values[cellIndex] = RiaDefines::FRACTURE;
break;
}
}
}
}
}
}

View File

@ -24,6 +24,7 @@ class RimProject;
class RimWellPath;
class RimFishbonesMultipleSubs;
class RimPerforationInterval;
class RimFracture;
class RigMainGrid;
class QDateTime;
@ -41,4 +42,5 @@ private:
static void calculateWellPathIntersections(const RimWellPath* wellPath, const RigMainGrid* grid, std::vector<double>& values, const QDateTime& fromDate);
static void calculateFishbonesIntersections(const RimFishbonesMultipleSubs* fishbonesSubs, const RigMainGrid* grid, std::vector<double>& values);
static void calculatePerforationIntersections(const RimWellPath* wellPath, const RimPerforationInterval* perforationInterval, const RigMainGrid* grid, std::vector<double>& values);
static void calculateFractureIntersections(const RigMainGrid* mainGrid, const RimFracture* fracture, std::vector<double>& values);
};

View File

@ -180,11 +180,9 @@ void RimFracture::fieldChangedByUi(const caf::PdmFieldHandle* changedField, cons
else
{
// Can be triggered from well path, find active view
RimView* activeView = RiaApplication::instance()->activeReservoirView();
if (activeView)
{
activeView->createDisplayModelAndRedraw();
}
RimProject* proj;
this->firstAncestorOrThisOfTypeAsserted(proj);
proj->reloadCompletionTypeResultsInAllViews();
}
}

View File

@ -80,7 +80,7 @@ void RimWellPathFracture::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
RimProject* proj = nullptr;
this->firstAncestorOrThisOfType(proj);
if (proj) proj->createDisplayModelAndRedrawAllViews();
if (proj) proj->reloadCompletionTypeResultsInAllViews();
}
}

View File

@ -389,10 +389,12 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep)
caf::AppEnum<RiaDefines::CompletionType> wellPath(RiaDefines::WELL_PATH);
caf::AppEnum<RiaDefines::CompletionType> fishbone(RiaDefines::FISHBONES);
caf::AppEnum<RiaDefines::CompletionType> perforationInterval(RiaDefines::PERFORATION_INTERVAL);
caf::AppEnum<RiaDefines::CompletionType> fracture(RiaDefines::FRACTURE);
categories.push_back(std::make_tuple(wellPath.uiText(), static_cast<int>(wellPath.index()), cvf::Color3::RED));
categories.push_back(std::make_tuple(fishbone.uiText(), static_cast<int>(fishbone.index()), cvf::Color3::DARK_GREEN));
categories.push_back(std::make_tuple(perforationInterval.uiText(), static_cast<int>(perforationInterval.index()), cvf::Color3::GREEN));
categories.push_back(std::make_tuple(fracture.uiText(), static_cast<int>(fracture.index()), cvf::Color3::YELLOW_GREEN));
legendConfig()->setCategoryItems(categories);
}

View File

@ -223,6 +223,16 @@ RimWellPathFractureCollection* RimWellPath::fractureCollection()
return m_completions->fractureCollection();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RimWellPathFractureCollection * RimWellPath::fractureCollection() const
{
CVF_ASSERT(m_completions);
return m_completions->fractureCollection();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -80,12 +80,13 @@ public:
caf::PdmChildField<RimWellLogFile*> m_wellLogFile;
RimFishbonesCollection* fishbonesCollection();
const RimFishbonesCollection* fishbonesCollection() const;
RimPerforationCollection* perforationIntervalCollection();
const RimPerforationCollection* perforationIntervalCollection() const;
const RimWellPathCompletions* completions() const;
RimWellPathFractureCollection* fractureCollection();
RimFishbonesCollection* fishbonesCollection();
const RimFishbonesCollection* fishbonesCollection() const;
RimPerforationCollection* perforationIntervalCollection();
const RimPerforationCollection* perforationIntervalCollection() const;
const RimWellPathCompletions* completions() const;
RimWellPathFractureCollection* fractureCollection();
const RimWellPathFractureCollection* fractureCollection() const;
RigWellPath* wellPathGeometry();
const RigWellPath* wellPathGeometry() const;