#2605 Show perforations along well path in 2D intersections view

This commit is contained in:
Jacob Støren 2018-03-20 17:28:27 +01:00
parent 7aa07d6a78
commit c22bafbf29
5 changed files with 127 additions and 26 deletions

View File

@ -164,7 +164,8 @@ void RivWellPathPartMgr::appendImportedFishbonesToModel(cvf::ModelBasicList* mod
void RivWellPathPartMgr::appendPerforationsToModel(cvf::ModelBasicList* model, void RivWellPathPartMgr::appendPerforationsToModel(cvf::ModelBasicList* model,
size_t timeStepIndex, size_t timeStepIndex,
const caf::DisplayCoordTransform* displayCoordTransform, const caf::DisplayCoordTransform* displayCoordTransform,
double characteristicCellSize) double characteristicCellSize,
bool doFlatten)
{ {
if (!m_rimWellPath || !m_rimWellPath->perforationIntervalCollection()->isChecked()) return; if (!m_rimWellPath || !m_rimWellPath->perforationIntervalCollection()->isChecked()) return;
@ -201,23 +202,53 @@ void RivWellPathPartMgr::appendPerforationsToModel(cvf::ModelBasicList* model,
m_rimWellPath->descendantsIncludingThisOfType(perforations); m_rimWellPath->descendantsIncludingThisOfType(perforations);
for (RimPerforationInterval* perforation : perforations) for (RimPerforationInterval* perforation : perforations)
{ {
using namespace std;
if (!perforation->isChecked()) continue; if (!perforation->isChecked()) continue;
if (perforation->startMD() > perforation->endMD()) continue; if (perforation->startMD() > perforation->endMD()) continue;
if (!perforation->isActiveOnDate(currentTimeStamp)) continue; if (!perforation->isActiveOnDate(currentTimeStamp)) continue;
double horizontalLengthAlongWellPath = 0.0;
vector<cvf::Vec3d> perfIntervalCL;
{
pair<vector<cvf::Vec3d>, vector<double> > perfintervalCoordsAndMD = wellPathGeometry->clippedPointSubset(perforation->startMD(),
perforation->endMD(),
&horizontalLengthAlongWellPath);
perfIntervalCL = perfintervalCoordsAndMD.first;
}
using namespace std; if (perfIntervalCL.size() < 2) continue;
pair<vector<cvf::Vec3d>, vector<double> > displayCoordsAndMD = wellPathGeometry->clippedPointSubset(perforation->startMD(),
perforation->endMD());
if (displayCoordsAndMD.first.size() < 2) continue;
for (cvf::Vec3d& point : displayCoordsAndMD.first) point = displayCoordTransform->transformToDisplayCoord(point);
vector<cvf::Vec3d> perfIntervalCLDiplayCS;
if ( doFlatten )
{
cvf::Vec3d dummy;
vector<cvf::Mat4d> flatningCSs =
RivSectionFlattner::calculateFlatteningCSsForPolyline(perfIntervalCL,
cvf::Vec3d::Z_AXIS,
{ horizontalLengthAlongWellPath, 0.0, perfIntervalCL[0].z() },
&dummy);
for ( size_t cIdx = 0; cIdx < perfIntervalCL.size(); ++cIdx )
{
auto clpoint = perfIntervalCL[cIdx].getTransformedPoint(flatningCSs[cIdx]);
perfIntervalCLDiplayCS.push_back( displayCoordTransform->scaleToDisplaySize(clpoint));
}
}
else
{
for ( cvf::Vec3d& point : perfIntervalCL )
{
perfIntervalCLDiplayCS.push_back( displayCoordTransform->transformToDisplayCoord(point));
}
}
cvf::ref<RivObjectSourceInfo> objectSourceInfo = new RivObjectSourceInfo(perforation); cvf::ref<RivObjectSourceInfo> objectSourceInfo = new RivObjectSourceInfo(perforation);
cvf::Collection<cvf::Part> parts; cvf::Collection<cvf::Part> parts;
geoGenerator.cylinderWithCenterLineParts(&parts, displayCoordsAndMD.first, cvf::Color3f::GREEN, perforationRadius); geoGenerator.cylinderWithCenterLineParts(&parts, perfIntervalCLDiplayCS, cvf::Color3f::GREEN, perforationRadius);
for (auto part : parts) for (auto part : parts)
{ {
part->setSourceInfo(objectSourceInfo.p()); part->setSourceInfo(objectSourceInfo.p());
@ -503,7 +534,7 @@ void RivWellPathPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList*
return; return;
} }
appendPerforationsToModel(model, timeStepIndex, displayCoordTransform, characteristicCellSize); appendPerforationsToModel(model, timeStepIndex, displayCoordTransform, characteristicCellSize, false);
appendVirtualTransmissibilitiesToModel(model, timeStepIndex, displayCoordTransform, characteristicCellSize); appendVirtualTransmissibilitiesToModel(model, timeStepIndex, displayCoordTransform, characteristicCellSize);
if (!m_rimWellPath->rim3dWellLogCurveCollection()) return; if (!m_rimWellPath->rim3dWellLogCurveCollection()) return;
@ -521,6 +552,25 @@ void RivWellPathPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList*
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellPathPartMgr::appendFlattenedDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
size_t timeStepIndex,
const caf::DisplayCoordTransform* displayCoordTransform,
double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox)
{
CVF_ASSERT(model);
RimWellPathCollection* wellPathCollection = this->wellPathCollection();
if (!wellPathCollection) return;
if (m_rimWellPath.isNull()) return;
appendPerforationsToModel(model, timeStepIndex, displayCoordTransform, characteristicCellSize, true);
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -74,7 +74,13 @@ public:
const caf::DisplayCoordTransform* displayCoordTransform, const caf::DisplayCoordTransform* displayCoordTransform,
double characteristicCellSize, double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox); const cvf::BoundingBox& wellPathClipBoundingBox);
void appendFlattenedDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
size_t timeStepIndex,
const caf::DisplayCoordTransform* displayCoordTransform,
double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox);
void appendStaticFracturePartsToModel(cvf::ModelBasicList* model); void appendStaticFracturePartsToModel(cvf::ModelBasicList* model);
size_t segmentIndexFromTriangleIndex(size_t triangleIndex); size_t segmentIndexFromTriangleIndex(size_t triangleIndex);
@ -91,7 +97,8 @@ private:
void appendPerforationsToModel(cvf::ModelBasicList* model, void appendPerforationsToModel(cvf::ModelBasicList* model,
size_t timeStepIndex, size_t timeStepIndex,
const caf::DisplayCoordTransform* displayCoordTransform, const caf::DisplayCoordTransform* displayCoordTransform,
double characteristicCellSize); double characteristicCellSize,
bool doFlatten);
void appendVirtualTransmissibilitiesToModel(cvf::ModelBasicList* model, void appendVirtualTransmissibilitiesToModel(cvf::ModelBasicList* model,
size_t timeStepIndex, size_t timeStepIndex,

View File

@ -503,6 +503,29 @@ void Rim2dIntersectionView::updateCurrentTimeStep()
} }
} }
if ( m_flatWellpathPartMgr.notNull() )
{
cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep);
if (frameScene)
{
{
cvf::String name = "WellPipeDynMod";
Rim3dView::removeModelByName(frameScene, name);
cvf::ref<cvf::ModelBasicList> dynWellPathModel = new cvf::ModelBasicList;
dynWellPathModel->setName(name);
m_flatWellpathPartMgr->appendFlattenedDynamicGeometryPartsToModel(dynWellPathModel.p(),
m_currentTimeStep,
this->displayCoordTransform().p(),
this->ownerCase()->characteristicCellSize(),
this->ownerCase()->activeCellsBoundingBox());
dynWellPathModel->updateBoundingBoxesRecursive();
frameScene->addModel(dynWellPathModel.p());
}
}
}
if ((this->hasUserRequestedAnimation() && this->hasResults())) if ((this->hasUserRequestedAnimation() && this->hasResults()))
{ {
m_flatIntersectionPartMgr->updateCellResultColor(m_currentTimeStep, m_flatIntersectionPartMgr->updateCellResultColor(m_currentTimeStep,

View File

@ -59,19 +59,27 @@ double RigWellPath::datumElevation() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
cvf::Vec3d RigWellPath::interpolatedPointAlongWellPath(double measuredDepth) const cvf::Vec3d RigWellPath::interpolatedPointAlongWellPath(double measuredDepth, double * horizontalLengthAlongWellToStartClipPoint) const
{ {
cvf::Vec3d wellPathPoint = cvf::Vec3d::ZERO; cvf::Vec3d wellPathPoint = cvf::Vec3d::ZERO;
size_t i = 0; if (horizontalLengthAlongWellToStartClipPoint) *horizontalLengthAlongWellToStartClipPoint = 0.0;
while ( i < m_measuredDepths.size() && m_measuredDepths.at(i) < measuredDepth )
size_t vxIdx = 0;
while ( vxIdx < m_measuredDepths.size() && m_measuredDepths.at(vxIdx) < measuredDepth )
{ {
i++; if ( vxIdx > 0 && horizontalLengthAlongWellToStartClipPoint)
{
cvf::Vec3d segment = m_wellPathPoints[vxIdx] - m_wellPathPoints[vxIdx-1];
segment[2] = 0.0;
*horizontalLengthAlongWellToStartClipPoint += segment.length();
}
vxIdx++;
} }
if ( m_measuredDepths.size() > i ) if ( m_measuredDepths.size() > vxIdx )
{ {
if ( i == 0 ) if ( vxIdx == 0 )
{ {
//For measuredDepth same or lower than first point, use this first point //For measuredDepth same or lower than first point, use this first point
wellPathPoint = m_wellPathPoints.at(0); wellPathPoint = m_wellPathPoints.at(0);
@ -79,15 +87,23 @@ cvf::Vec3d RigWellPath::interpolatedPointAlongWellPath(double measuredDepth) con
else else
{ {
//Do interpolation //Do interpolation
double stepsize = (measuredDepth - m_measuredDepths.at(i-1)) / double segmentFraction = (measuredDepth - m_measuredDepths.at(vxIdx-1)) /
(m_measuredDepths.at(i) - m_measuredDepths.at(i - 1)); (m_measuredDepths.at(vxIdx) - m_measuredDepths.at(vxIdx - 1));
wellPathPoint = m_wellPathPoints.at(i - 1) + stepsize * (m_wellPathPoints.at(i) - m_wellPathPoints.at(i-1)); cvf::Vec3d segment = m_wellPathPoints[vxIdx] - m_wellPathPoints[vxIdx-1];
wellPathPoint = m_wellPathPoints[vxIdx - 1] + segmentFraction * segment;
if ( horizontalLengthAlongWellToStartClipPoint )
{
segment[2] = 0.0;
*horizontalLengthAlongWellToStartClipPoint += segment.length();
}
} }
} }
else else
{ {
//Use endpoint if measuredDepth same or higher than last point // Use endpoint if measuredDepth same or higher than last point
wellPathPoint = m_wellPathPoints.at(i-1); wellPathPoint = m_wellPathPoints.at(vxIdx-1);
} }
@ -188,13 +204,15 @@ void RigWellPath::twoClosestPoints(const cvf::Vec3d& position, cvf::Vec3d* p1, c
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::pair<std::vector<cvf::Vec3d>, std::vector<double> > RigWellPath::clippedPointSubset(double startMD, double endMD) const std::pair<std::vector<cvf::Vec3d>, std::vector<double> > RigWellPath::clippedPointSubset(double startMD,
double endMD,
double * horizontalLengthAlongWellToStartClipPoint) const
{ {
std::pair<std::vector<cvf::Vec3d>, std::vector<double> > pointsAndMDs; std::pair<std::vector<cvf::Vec3d>, std::vector<double> > pointsAndMDs;
if ( m_measuredDepths.empty() ) return pointsAndMDs; if ( m_measuredDepths.empty() ) return pointsAndMDs;
if ( startMD > endMD ) return pointsAndMDs; if ( startMD > endMD ) return pointsAndMDs;
pointsAndMDs.first.push_back(interpolatedPointAlongWellPath(startMD)); pointsAndMDs.first.push_back(interpolatedPointAlongWellPath(startMD, horizontalLengthAlongWellToStartClipPoint));
pointsAndMDs.second.push_back(startMD); pointsAndMDs.second.push_back(startMD);
for ( size_t i = 0; i < m_measuredDepths.size(); ++i ) for ( size_t i = 0; i < m_measuredDepths.size(); ++i )

View File

@ -45,12 +45,15 @@ public:
void setDatumElevation(double value); void setDatumElevation(double value);
bool hasDatumElevation() const; bool hasDatumElevation() const;
double datumElevation() const; double datumElevation() const;
cvf::Vec3d interpolatedPointAlongWellPath(double measuredDepth) const; cvf::Vec3d interpolatedPointAlongWellPath(double measuredDepth,
double * horizontalLengthAlongWellToStartClipPoint = nullptr) const;
double wellPathAzimuthAngle(const cvf::Vec3d& position) const; double wellPathAzimuthAngle(const cvf::Vec3d& position) const;
void twoClosestPoints(const cvf::Vec3d& position, cvf::Vec3d* p1, cvf::Vec3d* p2) const; void twoClosestPoints(const cvf::Vec3d& position, cvf::Vec3d* p1, cvf::Vec3d* p2) const;
std::pair<std::vector<cvf::Vec3d>, std::vector<double> > std::pair<std::vector<cvf::Vec3d>, std::vector<double> >
clippedPointSubset(double startMD, double endMD) const; clippedPointSubset(double startMD,
double endMD,
double * horizontalLengthAlongWellToStartClipPoint = nullptr) const;
std::vector<cvf::Vec3d> wellPathPointsIncludingInterpolatedIntersectionPoint(double intersectionMeasuredDepth) const; std::vector<cvf::Vec3d> wellPathPointsIncludingInterpolatedIntersectionPoint(double intersectionMeasuredDepth) const;