mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#6888 Fix assert when MD gives anchor position outside of active cells bounding box.
This commit is contained in:
parent
1f748e3c39
commit
be8b54046e
@ -243,8 +243,6 @@ RimFractureModel::~RimFractureModel()
|
||||
if ( wellPath && wellPathCollection )
|
||||
{
|
||||
wellPathCollection->removeWellPath( wellPath );
|
||||
delete wellPath;
|
||||
|
||||
wellPathCollection->uiCapability()->updateConnectedEditors();
|
||||
wellPathCollection->scheduleRedrawAffectedViews();
|
||||
}
|
||||
@ -502,24 +500,29 @@ void RimFractureModel::updateThicknessDirection()
|
||||
|
||||
if ( m_thicknessDirectionWellPath )
|
||||
{
|
||||
RimWellPathGeometryDef* wellGeomDef = m_thicknessDirectionWellPath->geometryDefinition();
|
||||
wellGeomDef->deleteAllTargets();
|
||||
// Disable auto-generated target at sea level: this will usually be outside the
|
||||
// bounding box, and will introduce problems when the project is reloaded.
|
||||
wellGeomDef->setUseAutoGeneratedTargetAtSeaLevel( false );
|
||||
|
||||
cvf::Vec3d topPosition;
|
||||
cvf::Vec3d bottomPosition;
|
||||
|
||||
findThicknessTargetPoints( topPosition, bottomPosition );
|
||||
topPosition.z() *= -1.0;
|
||||
bottomPosition.z() *= -1.0;
|
||||
if ( findThicknessTargetPoints( topPosition, bottomPosition ) )
|
||||
{
|
||||
topPosition.z() *= -1.0;
|
||||
bottomPosition.z() *= -1.0;
|
||||
|
||||
RimWellPathGeometryDef* wellGeomDef = m_thicknessDirectionWellPath->geometryDefinition();
|
||||
wellGeomDef->deleteAllTargets();
|
||||
RimWellPathTarget* topPathTarget = new RimWellPathTarget();
|
||||
topPathTarget->setAsPointTargetXYD( topPosition );
|
||||
|
||||
RimWellPathTarget* topPathTarget = new RimWellPathTarget();
|
||||
RimWellPathTarget* bottomPathTarget = new RimWellPathTarget();
|
||||
bottomPathTarget->setAsPointTargetXYD( bottomPosition );
|
||||
|
||||
topPathTarget->setAsPointTargetXYD( topPosition );
|
||||
RimWellPathTarget* bottomPathTarget = new RimWellPathTarget();
|
||||
bottomPathTarget->setAsPointTargetXYD( bottomPosition );
|
||||
|
||||
wellGeomDef->insertTarget( nullptr, topPathTarget );
|
||||
wellGeomDef->insertTarget( nullptr, bottomPathTarget );
|
||||
wellGeomDef->insertTarget( nullptr, topPathTarget );
|
||||
wellGeomDef->insertTarget( nullptr, bottomPathTarget );
|
||||
}
|
||||
|
||||
wellGeomDef->updateConnectedEditors();
|
||||
wellGeomDef->updateWellPathVisualization();
|
||||
@ -951,10 +954,10 @@ QString RimFractureModel::vecToString( const cvf::Vec3d& vec )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFractureModel::findThicknessTargetPoints( cvf::Vec3d& topPosition, cvf::Vec3d& bottomPosition )
|
||||
bool RimFractureModel::findThicknessTargetPoints( cvf::Vec3d& topPosition, cvf::Vec3d& bottomPosition )
|
||||
{
|
||||
RigEclipseCaseData* eclipseCaseData = getEclipseCaseData();
|
||||
if ( !eclipseCaseData ) return;
|
||||
if ( !eclipseCaseData ) return false;
|
||||
|
||||
const cvf::Vec3d& position = anchorPosition();
|
||||
const cvf::Vec3d& direction = thicknessDirection();
|
||||
@ -970,6 +973,13 @@ void RimFractureModel::findThicknessTargetPoints( cvf::Vec3d& topPosition, cvf::
|
||||
RiaLogging::info( QString( "Position: %1" ).arg( RimFractureModel::vecToString( position ) ) );
|
||||
RiaLogging::info( QString( "Direction: %1" ).arg( RimFractureModel::vecToString( direction ) ) );
|
||||
|
||||
if ( !geometryBoundingBox.contains( position ) )
|
||||
{
|
||||
//
|
||||
RiaLogging::error( "Anchor position is outside the grid bounding box. Unable to compute direction." );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create plane on top and bottom of formation
|
||||
cvf::Plane topPlane;
|
||||
topPlane.setFromPointAndNormal( geometryBoundingBox.max(), cvf::Vec3d::Z_AXIS );
|
||||
@ -985,6 +995,8 @@ void RimFractureModel::findThicknessTargetPoints( cvf::Vec3d& topPosition, cvf::
|
||||
cvf::Vec3d belowPlane = position + ( direction * 10000.0 );
|
||||
bottomPlane.intersect( position, belowPlane, &bottomPosition );
|
||||
RiaLogging::info( QString( "Bottom: %1" ).arg( RimFractureModel::vecToString( bottomPosition ) ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -190,7 +190,7 @@ private:
|
||||
void updateThicknessDirection();
|
||||
void updateDistanceToBarrierAndDip();
|
||||
cvf::Vec3d calculateTSTDirection() const;
|
||||
void findThicknessTargetPoints( cvf::Vec3d& topPosition, cvf::Vec3d& bottomPosition );
|
||||
bool findThicknessTargetPoints( cvf::Vec3d& topPosition, cvf::Vec3d& bottomPosition );
|
||||
static double calculateFormationDip( const cvf::Vec3d& direction );
|
||||
|
||||
static QString vecToString( const cvf::Vec3d& vec );
|
||||
|
@ -119,6 +119,11 @@ bool RimFractureModelStressCalculator::calculate( RiaDefines::CurveProperty curv
|
||||
// Generate MD data by interpolation
|
||||
const std::vector<double>& mdValuesOfWellPath = wellPathGeometry->measuredDepths();
|
||||
std::vector<double> tvdValuesOfWellPath = wellPathGeometry->trueVerticalDepths();
|
||||
if ( mdValuesOfWellPath.empty() )
|
||||
{
|
||||
RiaLogging::error( "Well path geometry had no MD values." );
|
||||
return false;
|
||||
}
|
||||
|
||||
measuredDepthValues =
|
||||
RigWellPathGeometryTools::interpolateMdFromTvd( mdValuesOfWellPath, tvdValuesOfWellPath, tvDepthValues );
|
||||
|
@ -584,3 +584,11 @@ void RimWellPathGeometryDef::initAfterRead()
|
||||
m_useAutoGeneratedTargetAtSeaLevel = false;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathGeometryDef::setUseAutoGeneratedTargetAtSeaLevel( bool autoGenerate )
|
||||
{
|
||||
m_useAutoGeneratedTargetAtSeaLevel = autoGenerate;
|
||||
}
|
||||
|
@ -68,6 +68,8 @@ public:
|
||||
|
||||
void enableTargetPointPicking( bool isEnabling );
|
||||
|
||||
void setUseAutoGeneratedTargetAtSeaLevel( bool autoGenerate );
|
||||
|
||||
std::vector<RiaWellPlanCalculator::WellPlanSegment> wellPlan() const;
|
||||
std::vector<RimWellPathTarget*> activeWellTargets() const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user