#1135 Compute accumulated length along sim well and added slider

This commit is contained in:
Magne Sjaastad
2017-01-30 14:28:37 +01:00
parent 758bc96ff5
commit b13ca8bb1c
12 changed files with 115 additions and 79 deletions

View File

@@ -75,7 +75,7 @@ void RicNewSimWellFractureAtPosFeature::onActionTriggered(bool isChecked)
fractureCollection->simwellFractures.push_back(fracture);
fracture->name = "Simulation Well Fracture";
fracture->setIJK(simWellItem->i, simWellItem->j, simWellItem->k);
fracture->setClosestWellCoord(simWellItem->m_domainCoord, simWellItem->m_branchIndex);
RimOilField* oilfield = nullptr;
objHandle->firstAncestorOrThisOfType(oilfield);

View File

@@ -75,8 +75,6 @@ void RicNewSimWellFractureFeature::onActionTriggered(bool isChecked)
fracture->perforationLength = fracDef->perforationLength();
}
fracture->setIJK(0, 0, 0);
fractureCollection->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(fracture);

View File

@@ -41,6 +41,14 @@ RimEclipseWell* RivSimWellPipeSourceInfo::well() const
return m_eclipseWell.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RivSimWellPipeSourceInfo::branchIndex() const
{
return m_branchIndex;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -32,6 +32,8 @@ public:
RimEclipseWell* well() const;
size_t branchIndex() const;
void findGridIndexAndCellIndex(size_t triangleIndex, size_t* gridIndex, size_t* gridCellIndex) const;
private:

View File

@@ -27,6 +27,8 @@
#include "RimEclipseView.h"
#include "RimEclipseWell.h"
#include "RimSimWellFracture.h"
#include "RimSimWellFractureCollection.h"
#include "RivReservoirViewPartMgr.h"
@@ -317,6 +319,17 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
m_applySingleColorToWells = false;
}
if (&wellPipeCoordType)
{
for (RimEclipseWell* w : wells)
{
for (RimSimWellFracture* frac : w->simwellFractureCollection()->simwellFractures())
{
frac->recomputeWellCenterlineCoordinates();
}
}
}
}
//--------------------------------------------------------------------------------------------------

View File

@@ -38,8 +38,8 @@ RimSimWellFracture::RimSimWellFracture(void)
{
CAF_PDM_InitObject("SimWellFracture", ":/FractureSymbol16x16.png", "", "");
CAF_PDM_InitField(&measuredDepth, "MeasuredDepth", 0.0f, "Measured Depth Location", "", "", "");
measuredDepth.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
CAF_PDM_InitField(&m_location, "MeasuredDepth", 0.0f, "Measured Depth Location", "", "", "");
m_location.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
CAF_PDM_InitField(&m_branchIndex, "Branch", 0, "Branch", "", "", "");
}
@@ -54,16 +54,17 @@ RimSimWellFracture::~RimSimWellFracture()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSimWellFracture::setIJK(size_t i, size_t j, size_t k)
void RimSimWellFracture::setClosestWellCoord(cvf::Vec3d& position, size_t branchIndex)
{
cvf::Vec3d cellCenter = findCellCenterPosition(i, j, k);
this->setAnchorPosition(cellCenter);
updateBranchGeometry();
RimProject* proj;
this->firstAncestorOrThisOfType(proj);
if (proj) proj->createDisplayModelAndRedrawAllViews();
double location = m_branchCenterLines[branchIndex].locationAlongWellCoords(position);
m_branchIndex = static_cast<int>(branchIndex);
m_location = location;
updateFracturePositionFromLocation();
}
//--------------------------------------------------------------------------------------------------
///
@@ -72,27 +73,34 @@ void RimSimWellFracture::fieldChangedByUi(const caf::PdmFieldHandle* changedFiel
{
RimFracture::fieldChangedByUi(changedField, oldValue, newValue);
if ( changedField == &measuredDepth
if ( changedField == &m_location
|| changedField == &m_branchIndex
)
{
updateFractureAnchorPosition();
updateFracturePositionFromLocation();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSimWellFracture::updateFractureAnchorPosition()
void RimSimWellFracture::recomputeWellCenterlineCoordinates()
{
if (m_branchCenterLines.size() == 0)
{
updateBranchGeometry();
}
m_branchCenterLines.clear();
updateBranchGeometry();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSimWellFracture::updateFracturePositionFromLocation()
{
updateBranchGeometry();
if (m_branchCenterLines.size() > 0)
{
cvf::Vec3d interpolated = m_branchCenterLines[m_branchIndex()].interpolatedPointAlongWellPath(measuredDepth());
cvf::Vec3d interpolated = m_branchCenterLines[m_branchIndex()].interpolatedPointAlongWellPath(m_location());
this->setAnchorPosition(interpolated);
@@ -109,7 +117,7 @@ void RimSimWellFracture::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderi
{
uiOrdering.add(&name);
uiOrdering.add(&measuredDepth);
uiOrdering.add(&m_location);
caf::PdmUiGroup* geometryGroup = uiOrdering.addNewGroup("Properties");
geometryGroup->add(&azimuth);
@@ -125,16 +133,13 @@ void RimSimWellFracture::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderi
//--------------------------------------------------------------------------------------------------
void RimSimWellFracture::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute)
{
if (field == &measuredDepth)
if (field == &m_location)
{
caf::PdmUiDoubleSliderEditorAttribute* myAttr = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>(attribute);
if (myAttr)
{
if (m_branchCenterLines.size() == 0)
{
updateBranchGeometry();
}
updateBranchGeometry();
if (m_branchCenterLines.size() > 0)
{
@@ -180,31 +185,18 @@ QList<caf::PdmOptionItemInfo> RimSimWellFracture::calculateValueOptions(const ca
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RimSimWellFracture::findCellCenterPosition(size_t i, size_t j, size_t k) const
void RimSimWellFracture::updateBranchGeometry()
{
cvf::Vec3d undef = cvf::Vec3d::UNDEFINED;
const caf::PdmObjectHandle* objHandle = dynamic_cast<const caf::PdmObjectHandle*>(this);
if (!objHandle) return undef;
RimEclipseView* mainView = nullptr;
objHandle->firstAncestorOrThisOfType(mainView);
if (!mainView) return undef;
const RigMainGrid* mainGrid = mainView->mainGrid();
if (!mainGrid) return undef;
size_t gridCellIndex = mainGrid->cellIndexFromIJK(i, j, k); // cellIndexFromIJK uses 0-based indexing
const RigCell& rigCell = mainGrid->cell(gridCellIndex);
cvf::Vec3d center = rigCell.center();
return center;
if (m_branchCenterLines.size() == 0)
{
setBranchGeometry();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSimWellFracture::updateBranchGeometry()
void RimSimWellFracture::setBranchGeometry()
{
m_branchCenterLines.clear();
@@ -224,4 +216,3 @@ void RimSimWellFracture::updateBranchGeometry()
m_branchCenterLines.push_back(wellPathWithMD);
}
}

View File

@@ -35,13 +35,12 @@ public:
RimSimWellFracture(void);
virtual ~RimSimWellFracture(void);
caf::PdmField<float> measuredDepth;
void setIJK(size_t i, size_t j, size_t k);
void setClosestWellCoord(cvf::Vec3d& position, size_t branchIndex);
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
void updateFractureAnchorPosition();
void recomputeWellCenterlineCoordinates();
protected:
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
@@ -49,10 +48,12 @@ protected:
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
private:
cvf::Vec3d findCellCenterPosition(size_t i, size_t j, size_t k) const;
void updateFracturePositionFromLocation();
void updateBranchGeometry();
void setBranchGeometry();
private:
caf::PdmField<float> m_location;
caf::PdmField<int> m_branchIndex;
std::vector<RigSimulationWellCoordsAndMD> m_branchCenterLines;
};

View File

@@ -18,6 +18,8 @@
#include "RigSimulationWellCoordsAndMD.h"
#include "cvfGeometryTools.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -81,6 +83,44 @@ cvf::Vec3d RigSimulationWellCoordsAndMD::interpolatedPointAlongWellPath(double m
return wellPathPoint;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigSimulationWellCoordsAndMD::locationAlongWellCoords(const cvf::Vec3d& position) const
{
double location = 0.0;
size_t closestIndex = cvf::UNDEFINED_SIZE_T;
double closestDistance = cvf::UNDEFINED_DOUBLE;
for (size_t i = 1; i < m_wellPathPoints.size(); i++)
{
cvf::Vec3d p1 = m_wellPathPoints[i - 1];
cvf::Vec3d p2 = m_wellPathPoints[i - 0];
double candidateDistance = cvf::GeometryTools::linePointSquareDist(p1, p2, position);
if (candidateDistance < closestDistance)
{
closestDistance = candidateDistance;
closestIndex = i;
}
}
if (closestIndex != cvf::UNDEFINED_DOUBLE)
{
cvf::Vec3d p1 = m_wellPathPoints[closestIndex - 1];
cvf::Vec3d p2 = m_wellPathPoints[closestIndex - 0];
double intersection = 0.0;
cvf::GeometryTools::projectPointOnLine(p1, p2, position, &intersection);
location = m_measuredDepths[closestIndex - 1];
location += intersection * (p1-p2).length();
}
return location;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -39,6 +39,7 @@ public:
const std::vector<double>& measuredDepths() const;
cvf::Vec3d interpolatedPointAlongWellPath(double measuredDepth) const;
double locationAlongWellCoords(const cvf::Vec3d& position) const;
private:
void computeMeasuredDepths();

View File

@@ -221,13 +221,11 @@ RiuWellPathSelectionItem::RiuWellPathSelectionItem(const RivWellPathSourceInfo*
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuSimWellSelectionItem::RiuSimWellSelectionItem(const RivSimWellPipeSourceInfo* simwellSourceInfo,
size_t i,
size_t j,
size_t k)
: i(i),
j(j),
k(k)
RiuSimWellSelectionItem::RiuSimWellSelectionItem(RimEclipseWell* simwell,
cvf::Vec3d m_domainCoord,
size_t m_branchIndex)
: m_simWell(simwell),
m_domainCoord(m_domainCoord),
m_branchIndex(m_branchIndex)
{
m_simWell = simwellSourceInfo->well();
}

View File

@@ -222,8 +222,7 @@ public:
class RiuSimWellSelectionItem : public RiuSelectionItem
{
public:
explicit RiuSimWellSelectionItem(const RivSimWellPipeSourceInfo* simwellSourceInfo,
size_t i, size_t j, size_t k);
explicit RiuSimWellSelectionItem(RimEclipseWell* simwell, cvf::Vec3d domainCoord, size_t branchIndex);
virtual ~RiuSimWellSelectionItem() {};
@@ -234,9 +233,7 @@ public:
}
public:
// const RivSimWellPipeSourceInfo* m_simwellSourceInfo;
RimEclipseWell* m_simWell;
size_t i;
size_t j;
size_t k;
cvf::Vec3d m_domainCoord;
size_t m_branchIndex;
};

View File

@@ -321,23 +321,10 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
commandIds << "RicNewSimWellIntersectionFeature";
commandIds << "RicShowWellAllocationPlotFeature";
size_t gridIndex = cvf::UNDEFINED_SIZE_T;
size_t gridCellIndex = cvf::UNDEFINED_SIZE_T;
eclipseWellSourceInfo->findGridIndexAndCellIndex(firstPartTriangleIndex, &gridIndex, &gridCellIndex);
if (gridIndex != cvf::UNDEFINED_SIZE_T && gridCellIndex != cvf::UNDEFINED_SIZE_T)
{
size_t i = 0;
size_t j = 0;
size_t k = 0;
ijkFromCellIndex(gridIndex, gridCellIndex, &i, &j, &k);
RiuSelectionItem* selItem = new RiuSimWellSelectionItem(eclipseWellSourceInfo, i, j, k);
RiuSelectionItem* selItem = new RiuSimWellSelectionItem(eclipseWellSourceInfo->well(), m_currentPickPositionInDomainCoords, eclipseWellSourceInfo->branchIndex());
RiuSelectionManager::instance()->setSelectedItem(selItem, RiuSelectionManager::RUI_TEMPORARY);
commandIds << "RicNewSimWellFractureAtPosFeature";
}
}
}