mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5779 Create Well Path : Add auto generated target at sea level
This commit is contained in:
parent
5a561054bf
commit
5a7129ffdf
@ -45,18 +45,6 @@
|
|||||||
#include "cafPdmUiTreeOrdering.h"
|
#include "cafPdmUiTreeOrdering.h"
|
||||||
#include "cvfGeometryTools.h"
|
#include "cvfGeometryTools.h"
|
||||||
|
|
||||||
namespace caf
|
|
||||||
{
|
|
||||||
template <>
|
|
||||||
void caf::AppEnum<RimWellPathGeometryDef::WellStartType>::setUp()
|
|
||||||
{
|
|
||||||
addItem( RimWellPathGeometryDef::START_AT_FIRST_TARGET, "START_AT_FIRST_TARGET", "Start at First Target" );
|
|
||||||
addItem( RimWellPathGeometryDef::START_AT_SURFACE, "START_AT_SURFACE", "Start at Surface" );
|
|
||||||
|
|
||||||
setDefault( RimWellPathGeometryDef::START_AT_SURFACE );
|
|
||||||
}
|
|
||||||
} // namespace caf
|
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT( RimWellPathGeometryDef, "WellPathGeometryDef" );
|
CAF_PDM_SOURCE_INIT( RimWellPathGeometryDef, "WellPathGeometryDef" );
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -79,10 +67,19 @@ RimWellPathGeometryDef::RimWellPathGeometryDef()
|
|||||||
m_wellTargets.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
|
m_wellTargets.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
|
||||||
m_wellTargets.uiCapability()->setCustomContextMenuEnabled( true );
|
m_wellTargets.uiCapability()->setCustomContextMenuEnabled( true );
|
||||||
|
|
||||||
|
CAF_PDM_InitField( &m_useAutoGeneratedTargetAtSeaLevel,
|
||||||
|
"UseAutoGeneratedTargetAtSeaLevel",
|
||||||
|
true,
|
||||||
|
"Generate Target at Sea Level",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"" );
|
||||||
|
|
||||||
CAF_PDM_InitField( &m_pickPointsEnabled, "m_pickPointsEnabled", false, "", "", "", "" );
|
CAF_PDM_InitField( &m_pickPointsEnabled, "m_pickPointsEnabled", false, "", "", "", "" );
|
||||||
caf::PdmUiPushButtonEditor::configureEditorForField( &m_pickPointsEnabled );
|
caf::PdmUiPushButtonEditor::configureEditorForField( &m_pickPointsEnabled );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_wellStartType, "WellStartType", "Start Type", "", "", "" );
|
m_autoTargetAtSeaLevel.reset( new RimWellPathTarget );
|
||||||
|
m_autoTargetAtSeaLevel->setEnabled( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -151,6 +148,8 @@ cvf::ref<RigWellPath> RimWellPathGeometryDef::createWellPathGeometry()
|
|||||||
{
|
{
|
||||||
cvf::ref<RigWellPath> wellPathGeometry = new RigWellPath;
|
cvf::ref<RigWellPath> wellPathGeometry = new RigWellPath;
|
||||||
|
|
||||||
|
updateTargetAtSeaLevel();
|
||||||
|
|
||||||
RiaLineArcWellPathCalculator wellPathCalculator = lineArcWellPathCalculator();
|
RiaLineArcWellPathCalculator wellPathCalculator = lineArcWellPathCalculator();
|
||||||
|
|
||||||
if ( wellPathCalculator.lineArcEndpoints().size() < 2 ) return wellPathGeometry;
|
if ( wellPathCalculator.lineArcEndpoints().size() < 2 ) return wellPathGeometry;
|
||||||
@ -167,32 +166,6 @@ cvf::ref<RigWellPath> RimWellPathGeometryDef::createWellPathGeometry()
|
|||||||
wellPathGeometry->setDatumElevation( m_airGap );
|
wellPathGeometry->setDatumElevation( m_airGap );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_wellStartType == START_AT_SURFACE && !wellPathGeometry->m_wellPathPoints.empty() )
|
|
||||||
{
|
|
||||||
cvf::Vec3d mslPoint = wellPathGeometry->m_wellPathPoints.front();
|
|
||||||
mslPoint.z() = 0.0;
|
|
||||||
double depthDiff = mslPoint.z() - wellPathGeometry->m_wellPathPoints.front().z();
|
|
||||||
if ( std::abs( depthDiff ) > 1.0e-8 )
|
|
||||||
{
|
|
||||||
CAF_ASSERT( wellPathGeometry->m_wellPathPoints.size() == wellPathGeometry->m_measuredDepths.size() );
|
|
||||||
|
|
||||||
std::vector<cvf::Vec3d> newPoints;
|
|
||||||
newPoints.reserve( wellPathGeometry->m_wellPathPoints.size() + 1 );
|
|
||||||
std::vector<double> newMds;
|
|
||||||
newMds.reserve( wellPathGeometry->m_measuredDepths.size() + 1 );
|
|
||||||
|
|
||||||
newPoints.push_back( mslPoint );
|
|
||||||
newMds.push_back( 0.0 );
|
|
||||||
for ( size_t i = 0; i < wellPathGeometry->m_wellPathPoints.size(); ++i )
|
|
||||||
{
|
|
||||||
newPoints.push_back( wellPathGeometry->m_wellPathPoints[i] );
|
|
||||||
newMds.push_back( wellPathGeometry->m_measuredDepths[i] + depthDiff );
|
|
||||||
}
|
|
||||||
wellPathGeometry->m_wellPathPoints.swap( newPoints );
|
|
||||||
wellPathGeometry->m_measuredDepths.swap( newMds );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return wellPathGeometry;
|
return wellPathGeometry;
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -336,14 +309,6 @@ QList<caf::PdmOptionItemInfo>
|
|||||||
{
|
{
|
||||||
QList<caf::PdmOptionItemInfo> options;
|
QList<caf::PdmOptionItemInfo> options;
|
||||||
|
|
||||||
if ( fieldNeedingOptions == &m_wellStartType )
|
|
||||||
{
|
|
||||||
options.push_back( caf::PdmOptionItemInfo( "Start at Surface", RimWellPathGeometryDef::START_AT_SURFACE ) );
|
|
||||||
|
|
||||||
options.push_back(
|
|
||||||
caf::PdmOptionItemInfo( "Start at First Target", RimWellPathGeometryDef::START_AT_FIRST_TARGET ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,13 +336,14 @@ void RimWellPathGeometryDef::fieldChangedByUi( const caf::PdmFieldHandle* change
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellPathGeometryDef::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
void RimWellPathGeometryDef::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||||
{
|
{
|
||||||
uiOrdering.add( &m_wellStartType );
|
|
||||||
uiOrdering.add( &m_referencePointUtmXyd );
|
uiOrdering.add( &m_referencePointUtmXyd );
|
||||||
uiOrdering.add( &m_airGap );
|
uiOrdering.add( &m_airGap );
|
||||||
if ( m_wellStartType == START_AT_FIRST_TARGET )
|
if ( !m_useAutoGeneratedTargetAtSeaLevel() )
|
||||||
{
|
{
|
||||||
uiOrdering.add( &m_mdAtFirstTarget );
|
uiOrdering.add( &m_mdAtFirstTarget );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uiOrdering.add( &m_useAutoGeneratedTargetAtSeaLevel );
|
||||||
uiOrdering.add( &m_wellTargets );
|
uiOrdering.add( &m_wellTargets );
|
||||||
uiOrdering.add( &m_pickPointsEnabled );
|
uiOrdering.add( &m_pickPointsEnabled );
|
||||||
uiOrdering.skipRemainingFields( true );
|
uiOrdering.skipRemainingFields( true );
|
||||||
@ -397,6 +363,12 @@ void RimWellPathGeometryDef::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTre
|
|||||||
std::vector<RimWellPathTarget*> RimWellPathGeometryDef::activeWellTargets() const
|
std::vector<RimWellPathTarget*> RimWellPathGeometryDef::activeWellTargets() const
|
||||||
{
|
{
|
||||||
std::vector<RimWellPathTarget*> active;
|
std::vector<RimWellPathTarget*> active;
|
||||||
|
|
||||||
|
if ( m_useAutoGeneratedTargetAtSeaLevel() && !m_wellTargets.empty() )
|
||||||
|
{
|
||||||
|
active.push_back( m_autoTargetAtSeaLevel.get() );
|
||||||
|
}
|
||||||
|
|
||||||
for ( const auto& wt : m_wellTargets )
|
for ( const auto& wt : m_wellTargets )
|
||||||
{
|
{
|
||||||
if ( wt->isEnabled() )
|
if ( wt->isEnabled() )
|
||||||
@ -455,6 +427,35 @@ RiaLineArcWellPathCalculator RimWellPathGeometryDef::lineArcWellPathCalculator()
|
|||||||
return wellPathCalculator;
|
return wellPathCalculator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellPathGeometryDef::updateTargetAtSeaLevel()
|
||||||
|
{
|
||||||
|
if ( m_useAutoGeneratedTargetAtSeaLevel && !m_wellTargets.empty() )
|
||||||
|
{
|
||||||
|
cvf::Vec3d newPos = cvf::Vec3d::ZERO;
|
||||||
|
|
||||||
|
auto firstTarget = m_wellTargets[0];
|
||||||
|
|
||||||
|
cvf::Vec3d targetTangent = firstTarget->tangent();
|
||||||
|
double radius = firstTarget->radius1();
|
||||||
|
|
||||||
|
cvf::Vec3d tangentInHorizontalPlane = targetTangent;
|
||||||
|
tangentInHorizontalPlane[2] = 0.0;
|
||||||
|
tangentInHorizontalPlane.normalize();
|
||||||
|
|
||||||
|
RiaOffshoreSphericalCoords sphTangent( targetTangent );
|
||||||
|
double inc = sphTangent.inc();
|
||||||
|
double horizontalLengthFromTarget = radius - radius * cvf::Math::cos( inc );
|
||||||
|
|
||||||
|
newPos = firstTarget->targetPointXYZ() - horizontalLengthFromTarget * tangentInHorizontalPlane;
|
||||||
|
newPos.z() = -referencePointXyz().z();
|
||||||
|
|
||||||
|
m_autoTargetAtSeaLevel->setAsPointXYZAndTangentTarget( {newPos[0], newPos[1], newPos[2]}, 0, 0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -552,6 +553,6 @@ void RimWellPathGeometryDef::initAfterRead()
|
|||||||
{
|
{
|
||||||
if ( RiaApplication::instance()->project()->isProjectFileVersionEqualOrOlderThan( "2019.12.1" ) )
|
if ( RiaApplication::instance()->project()->isProjectFileVersionEqualOrOlderThan( "2019.12.1" ) )
|
||||||
{
|
{
|
||||||
m_wellStartType = START_AT_FIRST_TARGET;
|
m_autoTargetAtSeaLevel = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,12 +19,14 @@
|
|||||||
|
|
||||||
#include "RiaLineArcWellPathCalculator.h"
|
#include "RiaLineArcWellPathCalculator.h"
|
||||||
#include "RiaWellPlanCalculator.h"
|
#include "RiaWellPlanCalculator.h"
|
||||||
|
|
||||||
#include "cafAppEnum.h"
|
#include "cafAppEnum.h"
|
||||||
#include "cafPdmChildArrayField.h"
|
#include "cafPdmChildArrayField.h"
|
||||||
#include "cafPdmField.h"
|
#include "cafPdmField.h"
|
||||||
#include "cafPdmFieldCvfVec3d.h"
|
#include "cafPdmFieldCvfVec3d.h"
|
||||||
#include "cafPdmObject.h"
|
#include "cafPdmObject.h"
|
||||||
#include "cafPdmPtrField.h"
|
#include "cafPdmPtrField.h"
|
||||||
|
|
||||||
#include "cvfObject.h"
|
#include "cvfObject.h"
|
||||||
|
|
||||||
class RimWellPath;
|
class RimWellPath;
|
||||||
@ -41,12 +43,6 @@ public:
|
|||||||
RimWellPathGeometryDef();
|
RimWellPathGeometryDef();
|
||||||
~RimWellPathGeometryDef() override;
|
~RimWellPathGeometryDef() override;
|
||||||
|
|
||||||
enum WellStartType
|
|
||||||
{
|
|
||||||
START_AT_FIRST_TARGET,
|
|
||||||
START_AT_SURFACE,
|
|
||||||
};
|
|
||||||
|
|
||||||
cvf::Vec3d referencePointXyz() const;
|
cvf::Vec3d referencePointXyz() const;
|
||||||
void setReferencePointXyz( const cvf::Vec3d& refPointXyz );
|
void setReferencePointXyz( const cvf::Vec3d& refPointXyz );
|
||||||
|
|
||||||
@ -92,6 +88,8 @@ private:
|
|||||||
|
|
||||||
RiaLineArcWellPathCalculator lineArcWellPathCalculator() const;
|
RiaLineArcWellPathCalculator lineArcWellPathCalculator() const;
|
||||||
|
|
||||||
|
void updateTargetAtSeaLevel();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmField<cvf::Vec3d> m_referencePointUtmXyd;
|
caf::PdmField<cvf::Vec3d> m_referencePointUtmXyd;
|
||||||
|
|
||||||
@ -99,10 +97,10 @@ private:
|
|||||||
|
|
||||||
caf::PdmField<double> m_mdAtFirstTarget;
|
caf::PdmField<double> m_mdAtFirstTarget;
|
||||||
caf::PdmChildArrayField<RimWellPathTarget*> m_wellTargets;
|
caf::PdmChildArrayField<RimWellPathTarget*> m_wellTargets;
|
||||||
|
caf::PdmField<bool> m_useAutoGeneratedTargetAtSeaLevel;
|
||||||
|
|
||||||
caf::PdmField<bool> m_pickPointsEnabled;
|
caf::PdmField<bool> m_pickPointsEnabled;
|
||||||
|
|
||||||
caf::PdmField<caf::AppEnum<WellStartType>> m_wellStartType;
|
|
||||||
|
|
||||||
std::shared_ptr<RicCreateWellTargetsPickEventHandler> m_pickTargetsEventHandler;
|
std::shared_ptr<RicCreateWellTargetsPickEventHandler> m_pickTargetsEventHandler;
|
||||||
|
std::unique_ptr<RimWellPathTarget> m_autoTargetAtSeaLevel;
|
||||||
};
|
};
|
||||||
|
@ -70,6 +70,14 @@ RimWellPathTarget::~RimWellPathTarget()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellPathTarget::setEnabled( bool enable )
|
||||||
|
{
|
||||||
|
m_isEnabled = enable;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -33,6 +33,7 @@ public:
|
|||||||
RimWellPathTarget();
|
RimWellPathTarget();
|
||||||
~RimWellPathTarget() override;
|
~RimWellPathTarget() override;
|
||||||
|
|
||||||
|
void setEnabled( bool enable );
|
||||||
bool isEnabled() const;
|
bool isEnabled() const;
|
||||||
|
|
||||||
void setAsPointTargetXYD( const cvf::Vec3d& point );
|
void setAsPointTargetXYD( const cvf::Vec3d& point );
|
||||||
|
Loading…
Reference in New Issue
Block a user