Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
p4#: 21652
2013-05-16 06:06:00 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
|
|
|
//
|
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RigWellPath.h"
|
2017-02-06 06:12:56 -06:00
|
|
|
#include "cvfGeometryTools.h"
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
p4#: 21652
2013-05-16 06:06:00 -05:00
|
|
|
|
2017-05-05 04:21:40 -05:00
|
|
|
#include "cvfGeometryTools.h"
|
|
|
|
|
2016-10-25 07:56:26 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RigWellPath::RigWellPath()
|
|
|
|
: m_hasDatumElevation(false),
|
|
|
|
m_datumElevation(0.0)
|
|
|
|
{
|
|
|
|
}
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
p4#: 21652
2013-05-16 06:06:00 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-10-25 07:56:26 -05:00
|
|
|
void RigWellPath::setDatumElevation(double value)
|
|
|
|
{
|
|
|
|
m_hasDatumElevation = true;
|
|
|
|
m_datumElevation = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RigWellPath::hasDatumElevation() const
|
|
|
|
{
|
|
|
|
return m_hasDatumElevation;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
double RigWellPath::datumElevation() const
|
|
|
|
{
|
|
|
|
return m_datumElevation;
|
|
|
|
}
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
p4#: 21652
2013-05-16 06:06:00 -05:00
|
|
|
|
2017-01-04 06:29:25 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-05-29 05:56:40 -05:00
|
|
|
cvf::Vec3d RigWellPath::interpolatedPointAlongWellPath(double measuredDepth) const
|
2017-01-04 06:29:25 -06:00
|
|
|
{
|
|
|
|
cvf::Vec3d wellPathPoint = cvf::Vec3d::ZERO;
|
|
|
|
|
2017-02-03 03:14:02 -06:00
|
|
|
size_t i = 0;
|
2017-01-04 06:29:25 -06:00
|
|
|
while (i < m_measuredDepths.size() && m_measuredDepths.at(i) < measuredDepth )
|
|
|
|
{
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_measuredDepths.size() > i)
|
|
|
|
{
|
|
|
|
if (i == 0)
|
|
|
|
{
|
2017-01-04 07:09:40 -06:00
|
|
|
//For measuredDepth same or lower than first point, use this first point
|
2017-01-04 06:29:25 -06:00
|
|
|
wellPathPoint = m_wellPathPoints.at(0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//Do interpolation
|
|
|
|
double stepsize = (measuredDepth - m_measuredDepths.at(i-1)) /
|
|
|
|
(m_measuredDepths.at(i) - m_measuredDepths.at(i - 1));
|
|
|
|
wellPathPoint = m_wellPathPoints.at(i - 1) + stepsize * (m_wellPathPoints.at(i) - m_wellPathPoints.at(i-1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//Use endpoint if measuredDepth same or higher than last point
|
|
|
|
wellPathPoint = m_wellPathPoints.at(i-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return wellPathPoint;
|
|
|
|
}
|
|
|
|
|
2017-02-06 06:12:56 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
double RigWellPath::wellPathAzimuthAngle(const cvf::Vec3d& position) const
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-02 04:36:46 -05:00
|
|
|
//For vertical well (x-component of direction = 0) returned angle will be 90.
|
2018-01-04 12:31:44 -06:00
|
|
|
double azimuthAngleDegrees = 90.0;
|
2017-02-06 06:12:56 -06:00
|
|
|
|
|
|
|
if (closestIndex != cvf::UNDEFINED_DOUBLE)
|
|
|
|
{
|
|
|
|
cvf::Vec3d p1;
|
|
|
|
cvf::Vec3d p2;
|
|
|
|
|
|
|
|
if (closestIndex > 0)
|
|
|
|
{
|
|
|
|
p1 = m_wellPathPoints[closestIndex - 1];
|
|
|
|
p2 = m_wellPathPoints[closestIndex - 0];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p1 = m_wellPathPoints[closestIndex + 1];
|
|
|
|
p2 = m_wellPathPoints[closestIndex + 0];
|
|
|
|
}
|
|
|
|
|
2017-06-27 07:11:55 -05:00
|
|
|
cvf::Vec3d direction = p2 - p1;
|
2017-02-06 06:12:56 -06:00
|
|
|
|
2018-01-04 12:31:44 -06:00
|
|
|
if (fabs(direction.y()) > 1e-5)
|
2017-02-06 06:12:56 -06:00
|
|
|
{
|
2017-06-27 07:11:55 -05:00
|
|
|
double atanValue = direction.x() / direction.y();
|
2018-01-04 12:31:44 -06:00
|
|
|
double azimuthRadians = atan(atanValue);
|
|
|
|
azimuthAngleDegrees = cvf::Math::toDegrees(azimuthRadians);
|
2017-02-06 06:12:56 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-04 12:31:44 -06:00
|
|
|
return azimuthAngleDegrees;
|
2017-02-06 06:12:56 -06:00
|
|
|
}
|
|
|
|
|
2017-05-05 04:21:40 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RigWellPath::twoClosestPoints(const cvf::Vec3d& position, cvf::Vec3d* p1, cvf::Vec3d* p2) const
|
|
|
|
{
|
|
|
|
CVF_ASSERT(p1 && p2);
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
if (closestIndex > 0)
|
|
|
|
{
|
|
|
|
*p1 = m_wellPathPoints[closestIndex - 1];
|
|
|
|
*p2 = m_wellPathPoints[closestIndex - 0];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*p1 = m_wellPathPoints[closestIndex + 1];
|
|
|
|
*p2 = m_wellPathPoints[closestIndex + 0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-26 05:37:01 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-09-19 10:20:49 -05:00
|
|
|
std::pair<std::vector<cvf::Vec3d>, std::vector<double> > RigWellPath::clippedPointSubset(double startMD, double endMD) const
|
2017-05-26 05:37:01 -05:00
|
|
|
{
|
2017-09-19 10:20:49 -05:00
|
|
|
std::pair<std::vector<cvf::Vec3d>, std::vector<double> > pointsAndMDs;
|
|
|
|
if (m_measuredDepths.empty()) return pointsAndMDs;
|
|
|
|
if (startMD > endMD) return pointsAndMDs;
|
|
|
|
|
|
|
|
pointsAndMDs.first.push_back(interpolatedPointAlongWellPath(startMD));
|
|
|
|
pointsAndMDs.second.push_back(startMD);
|
2017-05-26 05:37:01 -05:00
|
|
|
|
2017-09-18 09:24:29 -05:00
|
|
|
for (size_t i = 0; i < m_measuredDepths.size(); ++i)
|
2017-05-26 05:37:01 -05:00
|
|
|
{
|
2017-09-18 09:24:29 -05:00
|
|
|
double measuredDepth = m_measuredDepths[i];
|
|
|
|
if (measuredDepth > startMD && measuredDepth < endMD)
|
|
|
|
{
|
2017-09-19 10:20:49 -05:00
|
|
|
pointsAndMDs.first.push_back(m_wellPathPoints[i]);
|
|
|
|
pointsAndMDs.second.push_back(measuredDepth);
|
2017-09-18 09:24:29 -05:00
|
|
|
}
|
2017-05-26 05:37:01 -05:00
|
|
|
}
|
2017-09-19 10:20:49 -05:00
|
|
|
pointsAndMDs.first.push_back(interpolatedPointAlongWellPath(endMD));
|
|
|
|
pointsAndMDs.second.push_back(endMD);
|
2017-05-26 05:37:01 -05:00
|
|
|
|
|
|
|
|
2017-09-19 10:20:49 -05:00
|
|
|
return pointsAndMDs;
|
2017-05-26 05:37:01 -05:00
|
|
|
}
|
|
|
|
|
2017-08-02 04:13:27 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-16 00:54:03 -06:00
|
|
|
std::vector<cvf::Vec3d> RigWellPath::wellPathPointsIncludingInterpolatedIntersectionPoint(double intersectionMeasuredDepth) const
|
2017-08-02 04:13:27 -05:00
|
|
|
{
|
|
|
|
std::vector<cvf::Vec3d> points;
|
|
|
|
if (m_measuredDepths.empty()) return points;
|
|
|
|
|
2018-01-16 00:54:03 -06:00
|
|
|
cvf::Vec3d interpolatedWellPathPoint = interpolatedPointAlongWellPath(intersectionMeasuredDepth);
|
2017-08-02 04:13:27 -05:00
|
|
|
|
2018-01-16 00:54:03 -06:00
|
|
|
for (size_t i = 0; i < m_measuredDepths.size() - 1; i++)
|
2017-08-02 04:13:27 -05:00
|
|
|
{
|
2018-01-16 00:54:03 -06:00
|
|
|
if (m_measuredDepths[i] == intersectionMeasuredDepth)
|
2017-08-02 04:13:27 -05:00
|
|
|
{
|
|
|
|
points.push_back(m_wellPathPoints[i]);
|
2018-01-16 00:54:03 -06:00
|
|
|
}
|
|
|
|
else if (m_measuredDepths[i] < intersectionMeasuredDepth)
|
|
|
|
{
|
|
|
|
points.push_back(m_wellPathPoints[i]);
|
|
|
|
if (m_measuredDepths[i + 1] > intersectionMeasuredDepth)
|
2017-08-02 04:13:27 -05:00
|
|
|
{
|
2018-01-16 00:54:03 -06:00
|
|
|
points.push_back(interpolatedWellPathPoint);
|
2017-08-02 04:13:27 -05:00
|
|
|
}
|
|
|
|
}
|
2018-01-16 00:54:03 -06:00
|
|
|
else if (m_measuredDepths[i] > intersectionMeasuredDepth)
|
2017-08-02 04:13:27 -05:00
|
|
|
{
|
|
|
|
if (i == 0)
|
|
|
|
{
|
2018-01-16 00:54:03 -06:00
|
|
|
points.push_back(interpolatedWellPathPoint);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
points.push_back(m_wellPathPoints[i]);
|
2017-08-02 04:13:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
points.push_back(m_wellPathPoints.back());
|
|
|
|
|
|
|
|
return points;
|
|
|
|
}
|
|
|
|
|