2017-01-02 14:13:34 +01:00
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// 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 "RimFracture.h"
2017-01-19 10:43:23 +01:00
# include "RiaApplication.h"
2017-06-14 07:25:34 +02:00
# include "RiaEclipseUnitTools.h"
2017-03-06 15:14:11 +01:00
# include "RiaLogging.h"
2017-01-19 10:43:23 +01:00
2017-01-30 10:45:18 +01:00
# include "RifReaderInterface.h"
2017-01-31 15:58:13 +01:00
# include "RigActiveCellInfo.h"
2017-01-30 10:45:18 +01:00
# include "RigCaseCellResultsData.h"
2017-01-19 10:43:23 +01:00
# include "RigCell.h"
2017-01-23 15:22:51 +01:00
# include "RigCellGeometryTools.h"
2017-01-30 10:45:18 +01:00
# include "RigEclipseCaseData.h"
2017-01-19 10:43:23 +01:00
# include "RigMainGrid.h"
2017-01-30 10:45:18 +01:00
# include "RigResultAccessor.h"
# include "RigResultAccessorFactory.h"
2017-01-04 08:10:02 +01:00
# include "RigTesselatorTools.h"
2017-01-10 13:37:50 +01:00
2017-01-30 10:45:18 +01:00
# include "RimEclipseCase.h"
# include "RimEclipseCellColors.h"
2017-01-19 10:43:23 +01:00
# include "RimEclipseView.h"
2017-01-12 13:29:18 +01:00
# include "RimEllipseFractureTemplate.h"
2017-06-15 10:49:27 +02:00
# include "RimFractureTemplate.h"
2017-02-07 11:08:56 +01:00
# include "RimFractureTemplateCollection.h"
2017-01-19 10:43:23 +01:00
# include "RimOilField.h"
# include "RimProject.h"
2017-01-31 15:58:13 +01:00
# include "RimReservoirCellResultsStorage.h"
2017-02-15 12:16:01 +01:00
# include "RimStimPlanFractureTemplate.h"
2017-01-10 13:37:50 +01:00
# include "RimView.h"
2017-01-19 10:43:23 +01:00
# include "RivWellFracturePartMgr.h"
# include "cafHexGridIntersectionTools/cafHexGridIntersectionTools.h"
2017-02-15 11:29:44 +01:00
# include "cafPdmUiDoubleSliderEditor.h"
# include "cafPdmUiTreeOrdering.h"
2017-01-02 14:13:34 +01:00
2017-01-19 10:43:23 +01:00
# include "cvfBoundingBox.h"
# include "cvfGeometryTools.h"
2017-01-11 14:32:15 +01:00
# include "cvfMath.h"
2017-01-10 13:37:50 +01:00
# include "cvfMatrix4.h"
2017-01-13 15:49:21 +01:00
# include "cvfPlane.h"
2017-01-19 10:43:23 +01:00
2017-01-24 15:39:39 +01:00
# include "clipper/clipper.hpp"
2017-01-30 10:45:18 +01:00
# include <math.h>
2017-02-15 11:29:44 +01:00
2017-02-10 13:29:31 +01:00
# include <QDebug>
2017-02-15 12:16:01 +01:00
# include <QString>
2017-06-16 14:13:42 +02:00
# include "RigHexIntersectionTools.h"
2017-06-20 11:18:19 +02:00
# include "RimFractureContainment.h"
2017-01-02 14:13:34 +01:00
2017-01-04 08:10:02 +01:00
CAF_PDM_XML_ABSTRACT_SOURCE_INIT ( RimFracture , " Fracture " ) ;
2017-01-02 14:13:34 +01:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFracture : : RimFracture ( void )
{
CAF_PDM_InitObject ( " Fracture " , " " , " " , " " ) ;
2017-01-19 10:43:23 +01:00
CAF_PDM_InitFieldNoDefault ( & m_fractureTemplate , " FractureDef " , " Fracture Template " , " " , " " , " " ) ;
CAF_PDM_InitFieldNoDefault ( & m_anchorPosition , " anchorPosition " , " Anchor Position " , " " , " " , " " ) ;
m_anchorPosition . uiCapability ( ) - > setUiHidden ( true ) ;
2017-01-19 13:35:07 +01:00
CAF_PDM_InitFieldNoDefault ( & m_uiAnchorPosition , " ui_positionAtWellpath " , " Fracture Position " , " " , " " , " " ) ;
2017-01-19 10:43:23 +01:00
m_uiAnchorPosition . registerGetMethod ( this , & RimFracture : : fracturePositionForUi ) ;
m_uiAnchorPosition . uiCapability ( ) - > setUiReadOnly ( true ) ;
2017-06-16 14:13:42 +02:00
2017-01-10 10:53:54 +01:00
CAF_PDM_InitField ( & azimuth , " Azimuth " , 0.0 , " Azimuth " , " " , " " , " " ) ;
2017-02-15 12:16:01 +01:00
azimuth . uiCapability ( ) - > setUiEditorTypeName ( caf : : PdmUiDoubleSliderEditor : : uiEditorTypeName ( ) ) ;
2017-06-16 14:13:42 +02:00
2017-06-08 11:00:35 +02:00
CAF_PDM_InitField ( & perforationLength , " PerforationLength " , 1.0 , " Perforation Length " , " " , " " , " " ) ;
2017-11-30 13:44:18 +01:00
CAF_PDM_InitField ( & perforationEfficiency , " perforationEfficiency " , 1.0 , " Perforation Efficiency " , " " , " " , " " ) ;
2017-04-18 15:23:26 +02:00
perforationEfficiency . uiCapability ( ) - > setUiEditorTypeName ( caf : : PdmUiDoubleSliderEditor : : uiEditorTypeName ( ) ) ;
2017-06-16 14:13:42 +02:00
2017-06-08 09:15:50 +02:00
CAF_PDM_InitField ( & wellDiameter , " wellDiameter " , 0.216 , " Well Diameter at Fracture " , " " , " " , " " ) ;
2017-03-06 13:32:42 +01:00
CAF_PDM_InitField ( & dip , " Dip " , 0.0 , " Dip " , " " , " " , " " ) ;
2017-03-29 10:12:01 +02:00
CAF_PDM_InitField ( & tilt , " Tilt " , 0.0 , " Tilt " , " " , " " , " " ) ;
2017-06-30 12:54:51 +02:00
CAF_PDM_InitField ( & showPolygonFractureOutline , " showPolygonFractureOutline " , false , " Show Polygon Outline " , " " , " " , " " ) ;
showPolygonFractureOutline . uiCapability ( ) - > setUiHidden ( true ) ;
2017-06-20 14:46:58 +02:00
CAF_PDM_InitField ( & m_fractureUnit , " fractureUnit " , caf : : AppEnum < RiaEclipseUnitTools : : UnitSystem > ( RiaEclipseUnitTools : : UNITS_METRIC ) , " Fracture Unit System " , " " , " " , " " ) ;
m_fractureUnit . uiCapability ( ) - > setUiReadOnly ( true ) ;
2017-01-23 08:54:27 +01:00
2017-02-22 11:52:06 +01:00
CAF_PDM_InitField ( & stimPlanTimeIndexToPlot , " timeIndexToPlot " , 0 , " StimPlan Time Step " , " " , " " , " " ) ;
2017-01-10 10:53:54 +01:00
2017-06-29 10:34:20 +02:00
CAF_PDM_InitFieldNoDefault ( & m_uiWellPathAzimuth , " WellPathAzimuth " , " Well Path Azimuth " , " " , " " , " " ) ;
2017-06-29 11:28:30 +02:00
m_uiWellPathAzimuth . registerGetMethod ( this , & RimFracture : : wellAzimuthAtFracturePositionText ) ;
2017-06-29 10:34:20 +02:00
m_uiWellPathAzimuth . uiCapability ( ) - > setUiReadOnly ( true ) ;
2017-08-30 08:34:42 +02:00
CAF_PDM_InitFieldNoDefault ( & m_uiWellFractureAzimuthDiff , " WellFractureAzimuthDiff " , " Azimuth Difference Between \n Fracture and Well " , " " , " " , " " ) ;
2017-06-29 11:28:30 +02:00
m_uiWellFractureAzimuthDiff . registerGetMethod ( this , & RimFracture : : wellFractureAzimuthDiffText ) ;
2017-06-29 10:34:20 +02:00
m_uiWellFractureAzimuthDiff . uiCapability ( ) - > setUiReadOnly ( true ) ;
2017-06-27 14:11:55 +02:00
CAF_PDM_InitField ( & m_wellFractureAzimuthAngleWarning , " WellFractureAzimithAngleWarning " , QString ( " Difference is below 10 degrees. Consider longitudinal fracture " ) , " " , " " , " " , " " ) ;
2017-06-29 10:34:20 +02:00
m_wellFractureAzimuthAngleWarning . uiCapability ( ) - > setUiReadOnly ( true ) ;
2017-06-26 15:09:33 +02:00
2017-06-09 17:21:59 +02:00
m_fracturePartMgr = new RivWellFracturePartMgr ( this ) ;
2017-01-02 14:13:34 +01:00
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFracture : : ~ RimFracture ( )
{
}
2017-01-04 08:10:02 +01:00
2017-01-12 12:19:52 +01:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2017-05-16 17:52:57 +02:00
std : : vector < size_t > RimFracture : : getPotentiallyFracturedCells ( const RigMainGrid * mainGrid )
2017-01-12 12:19:52 +01:00
{
std : : vector < size_t > cellindecies ;
if ( ! mainGrid ) return cellindecies ;
2017-06-12 12:45:09 +02:00
cvf : : BoundingBox fractureBBox = this - > boundingBoxInDomainCoords ( ) ;
2017-01-12 12:19:52 +01:00
2017-06-12 12:45:09 +02:00
mainGrid - > findIntersectingCells ( fractureBBox , & cellindecies ) ;
2017-01-12 12:19:52 +01:00
return cellindecies ;
}
2017-01-10 13:37:50 +01:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFracture : : fieldChangedByUi ( const caf : : PdmFieldHandle * changedField , const QVariant & oldValue , const QVariant & newValue )
{
2017-01-23 09:46:33 +01:00
if ( changedField = = & m_fractureTemplate )
{
2017-06-15 10:49:27 +02:00
setFractureTemplate ( m_fractureTemplate ) ;
2017-01-23 09:46:33 +01:00
}
2017-01-19 10:43:23 +01:00
if ( changedField = = & azimuth | |
2017-02-15 15:49:53 +01:00
changedField = = & m_fractureTemplate | |
2017-02-22 13:29:20 +01:00
changedField = = & stimPlanTimeIndexToPlot | |
2017-02-28 14:28:14 +01:00
changedField = = this - > objectToggleField ( ) | |
2017-03-02 10:08:45 +01:00
changedField = = & showPolygonFractureOutline | |
2017-03-29 10:12:01 +02:00
changedField = = & dip | |
changedField = = & tilt )
2017-01-10 13:37:50 +01:00
{
2017-01-23 08:54:27 +01:00
2017-06-12 12:45:09 +02:00
clearDisplayGeometryCache ( ) ;
2017-01-10 13:37:50 +01:00
RimView * rimView = nullptr ;
this - > firstAncestorOrThisOfType ( rimView ) ;
if ( rimView )
{
rimView - > createDisplayModelAndRedraw ( ) ;
}
2017-01-19 10:43:23 +01:00
else
{
// Can be triggered from well path, find active view
2017-06-16 09:44:39 +02:00
RimProject * proj ;
this - > firstAncestorOrThisOfTypeAsserted ( proj ) ;
proj - > reloadCompletionTypeResultsInAllViews ( ) ;
2017-01-19 10:43:23 +01:00
}
2017-01-10 13:37:50 +01:00
}
2017-01-23 08:54:27 +01:00
2017-01-10 13:37:50 +01:00
}
2017-01-19 13:35:07 +01:00
//--------------------------------------------------------------------------------------------------
2017-02-06 11:44:24 +01:00
///
//--------------------------------------------------------------------------------------------------
cvf : : Vec3d RimFracture : : fracturePosition ( ) const
{
return m_anchorPosition ;
}
2017-06-29 10:34:20 +02:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFracture : : wellFractureAzimuthDiff ( ) const
{
double wellDifference = abs ( wellAzimuthAtFracturePosition ( ) - azimuth ) ;
return wellDifference ;
}
2017-06-29 11:28:30 +02:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFracture : : wellFractureAzimuthDiffText ( ) const
{
double wellDifference = wellFractureAzimuthDiff ( ) ;
return QString : : number ( wellDifference , ' f ' , 2 ) ;
}
QString RimFracture : : wellAzimuthAtFracturePositionText ( ) const
{
double wellAzimuth = wellAzimuthAtFracturePosition ( ) ;
return QString : : number ( wellAzimuth , ' f ' , 2 ) ;
}
2017-01-04 08:10:02 +01:00
//--------------------------------------------------------------------------------------------------
2017-06-09 13:05:59 +02:00
///
//--------------------------------------------------------------------------------------------------
cvf : : BoundingBox RimFracture : : boundingBoxInDomainCoords ( )
{
2017-06-12 12:45:09 +02:00
std : : vector < cvf : : Vec3f > nodeCoordVec ;
std : : vector < cvf : : uint > triangleIndices ;
2017-06-09 13:05:59 +02:00
2017-06-12 12:45:09 +02:00
this - > triangleGeometry ( & triangleIndices , & nodeCoordVec ) ;
2017-06-09 13:05:59 +02:00
2017-06-12 12:45:09 +02:00
cvf : : BoundingBox fractureBBox ;
for ( cvf : : Vec3f nodeCoord : nodeCoordVec ) fractureBBox . add ( nodeCoord ) ;
return fractureBBox ;
2017-06-09 13:05:59 +02:00
}
2017-01-12 10:52:47 +01:00
2017-06-08 09:15:50 +02:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2017-06-20 14:46:58 +02:00
double RimFracture : : wellRadius ( RiaEclipseUnitTools : : UnitSystem unitSystem ) const
2017-06-08 09:15:50 +02:00
{
2017-06-20 14:46:58 +02:00
if ( m_fractureUnit = = RiaEclipseUnitTools : : UNITS_METRIC )
2017-06-08 09:15:50 +02:00
{
2017-06-20 14:46:58 +02:00
if ( unitSystem = = RiaEclipseUnitTools : : UNITS_FIELD )
{
return RiaEclipseUnitTools : : meterToFeet ( wellDiameter / 2 ) ;
}
else
{
return wellDiameter / 2 ;
}
2017-06-08 09:15:50 +02:00
}
2017-06-20 14:46:58 +02:00
else if ( m_fractureUnit = = RiaEclipseUnitTools : : UNITS_FIELD )
2017-06-08 09:15:50 +02:00
{
2017-06-20 14:46:58 +02:00
if ( unitSystem = = RiaEclipseUnitTools : : UNITS_METRIC )
{
return RiaEclipseUnitTools : : inchToMeter ( wellDiameter / 2 ) ;
}
else
{
return RiaEclipseUnitTools : : inchToFeet ( wellDiameter / 2 ) ;
}
2017-06-08 09:15:50 +02:00
}
return cvf : : UNDEFINED_DOUBLE ;
}
2017-01-19 10:43:23 +01:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2017-05-22 18:11:03 +02:00
cvf : : Vec3d RimFracture : : anchorPosition ( ) const
2017-01-19 10:43:23 +01:00
{
return m_anchorPosition ( ) ;
}
2017-01-12 10:52:47 +01:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2017-06-23 10:16:39 +02:00
cvf : : Mat4d RimFracture : : transformMatrix ( ) const
2017-01-12 10:52:47 +01:00
{
2017-01-19 10:43:23 +01:00
cvf : : Vec3d center = anchorPosition ( ) ;
2017-01-12 10:52:47 +01:00
2017-03-06 13:32:42 +01:00
// Dip (in XY plane)
2017-06-23 10:16:39 +02:00
cvf : : Mat4d dipRotation = cvf : : Mat4d : : fromRotation ( cvf : : Vec3d : : Z_AXIS , cvf : : Math : : toRadians ( dip ( ) ) ) ;
2017-03-06 13:32:42 +01:00
2017-03-29 10:12:01 +02:00
// Dip (out of XY plane)
2017-06-23 10:16:39 +02:00
cvf : : Mat4d tiltRotation = cvf : : Mat4d : : fromRotation ( cvf : : Vec3d : : X_AXIS , cvf : : Math : : toRadians ( tilt ( ) ) ) ;
2017-03-29 10:12:01 +02:00
2017-01-10 13:37:50 +01:00
// Ellipsis geometry is produced in XY-plane, rotate 90 deg around X to get zero azimuth along Y
2017-06-23 10:16:39 +02:00
cvf : : Mat4d rotationFromTesselator = cvf : : Mat4d : : fromRotation ( cvf : : Vec3d : : X_AXIS , cvf : : Math : : toRadians ( 90.0f ) ) ;
2017-03-06 13:32:42 +01:00
2017-01-10 13:37:50 +01:00
// Azimuth rotation
2017-06-23 10:16:39 +02:00
cvf : : Mat4d azimuthRotation = cvf : : Mat4d : : fromRotation ( cvf : : Vec3d : : Z_AXIS , cvf : : Math : : toRadians ( - azimuth ( ) - 90 ) ) ;
2017-01-10 13:37:50 +01:00
2017-06-23 10:16:39 +02:00
cvf : : Mat4d m = azimuthRotation * rotationFromTesselator * dipRotation * tiltRotation ;
m . setTranslation ( center ) ;
2017-01-10 13:37:50 +01:00
2017-01-12 10:52:47 +01:00
return m ;
}
2017-01-04 08:10:02 +01:00
2017-01-06 13:13:25 +01:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2017-06-12 12:45:09 +02:00
void RimFracture : : clearDisplayGeometryCache ( )
2017-01-06 13:13:25 +01:00
{
2017-06-09 17:21:59 +02:00
m_fracturePartMgr - > clearGeometryCache ( ) ;
2017-01-06 13:13:25 +01:00
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2017-06-12 12:45:09 +02:00
void RimFracture : : triangleGeometry ( std : : vector < cvf : : uint > * triangleIndices , std : : vector < cvf : : Vec3f > * nodeCoords )
2017-01-06 13:13:25 +01:00
{
2017-06-12 12:45:09 +02:00
RimFractureTemplate * fractureDef = fractureTemplate ( ) ;
if ( fractureDef )
{
fractureDef - > fractureTriangleGeometry ( nodeCoords , triangleIndices , fractureUnit ( ) ) ;
}
2017-06-23 10:16:39 +02:00
cvf : : Mat4d m = transformMatrix ( ) ;
2017-06-12 12:45:09 +02:00
for ( cvf : : Vec3f & v : * nodeCoords )
{
2017-06-23 10:16:39 +02:00
cvf : : Vec3d vd ( v ) ;
vd . transformPoint ( m ) ;
v = cvf : : Vec3f ( vd ) ;
2017-06-12 12:45:09 +02:00
}
2017-01-04 08:10:02 +01:00
}
2017-06-12 12:45:09 +02:00
2017-01-19 10:43:23 +01:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf : : Vec3d RimFracture : : fracturePositionForUi ( ) const
{
cvf : : Vec3d v = m_anchorPosition ;
v . z ( ) = - v . z ( ) ;
return v ;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList < caf : : PdmOptionItemInfo > RimFracture : : calculateValueOptions ( const caf : : PdmFieldHandle * fieldNeedingOptions , bool * useOptionsOnly )
{
QList < caf : : PdmOptionItemInfo > options ;
RimProject * proj = RiaApplication : : instance ( ) - > project ( ) ;
CVF_ASSERT ( proj ) ;
RimOilField * oilField = proj - > activeOilField ( ) ;
if ( oilField = = nullptr ) return options ;
if ( fieldNeedingOptions = = & m_fractureTemplate )
{
2017-02-07 11:08:56 +01:00
RimFractureTemplateCollection * fracDefColl = oilField - > fractureDefinitionCollection ( ) ;
2017-01-19 10:43:23 +01:00
if ( fracDefColl = = nullptr ) return options ;
2017-02-07 09:09:00 +01:00
for ( RimFractureTemplate * fracDef : fracDefColl - > fractureDefinitions ( ) )
2017-01-19 10:43:23 +01:00
{
options . push_back ( caf : : PdmOptionItemInfo ( fracDef - > name ( ) , fracDef ) ) ;
}
}
2017-02-15 12:16:01 +01:00
else if ( fieldNeedingOptions = = & stimPlanTimeIndexToPlot )
{
2017-06-09 17:21:59 +02:00
if ( fractureTemplate ( ) )
2017-02-15 12:16:01 +01:00
{
2017-06-09 17:21:59 +02:00
RimFractureTemplate * fracTemplate = fractureTemplate ( ) ;
2017-02-15 12:16:01 +01:00
if ( dynamic_cast < RimStimPlanFractureTemplate * > ( fracTemplate ) )
{
RimStimPlanFractureTemplate * fracTemplateStimPlan = dynamic_cast < RimStimPlanFractureTemplate * > ( fracTemplate ) ;
2017-06-13 11:38:22 +02:00
std : : vector < double > timeValues = fracTemplateStimPlan - > timeSteps ( ) ;
2017-02-15 12:16:01 +01:00
int index = 0 ;
for ( double value : timeValues )
{
options . push_back ( caf : : PdmOptionItemInfo ( QString : : number ( value ) , index ) ) ;
index + + ;
}
}
}
}
2017-01-19 10:43:23 +01:00
return options ;
}
2017-01-10 10:53:54 +01:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFracture : : defineUiOrdering ( QString uiConfigName , caf : : PdmUiOrdering & uiOrdering )
{
2017-06-20 14:46:58 +02:00
if ( m_fractureUnit ( ) = = RiaEclipseUnitTools : : UNITS_METRIC )
2017-06-08 09:15:50 +02:00
{
wellDiameter . uiCapability ( ) - > setUiName ( " Well Diameter [m] " ) ;
2017-06-08 11:00:35 +02:00
perforationLength . uiCapability ( ) - > setUiName ( " Perforation Length [m] " ) ;
2017-06-08 09:15:50 +02:00
}
2017-06-20 14:46:58 +02:00
else if ( m_fractureUnit ( ) = = RiaEclipseUnitTools : : UNITS_FIELD )
2017-06-08 09:15:50 +02:00
{
wellDiameter . uiCapability ( ) - > setUiName ( " Well Diameter [inches] " ) ;
2017-06-08 11:00:35 +02:00
perforationLength . uiCapability ( ) - > setUiName ( " Perforation Length [Ft] " ) ;
2017-06-08 09:15:50 +02:00
}
2017-06-09 17:21:59 +02:00
if ( fractureTemplate ( ) )
2017-02-15 12:16:01 +01:00
{
2017-06-27 14:11:55 +02:00
if ( fractureTemplate ( ) - > orientationType = = RimFractureTemplate : : ALONG_WELL_PATH
| | fractureTemplate ( ) - > orientationType = = RimFractureTemplate : : TRANSVERSE_WELL_PATH )
{
2017-06-29 10:34:20 +02:00
m_uiWellPathAzimuth . uiCapability ( ) - > setUiHidden ( true ) ;
m_uiWellFractureAzimuthDiff . uiCapability ( ) - > setUiHidden ( true ) ;
2017-06-27 14:11:55 +02:00
m_wellFractureAzimuthAngleWarning . uiCapability ( ) - > setUiHidden ( true ) ;
}
else if ( fractureTemplate ( ) - > orientationType = = RimFractureTemplate : : AZIMUTH )
{
2017-06-29 10:34:20 +02:00
m_uiWellPathAzimuth . uiCapability ( ) - > setUiHidden ( false ) ;
m_uiWellFractureAzimuthDiff . uiCapability ( ) - > setUiHidden ( false ) ;
if ( wellFractureAzimuthDiff ( ) < 10
| | ( wellFractureAzimuthDiff ( ) > 170 & & wellFractureAzimuthDiff ( ) < 190 )
| | wellFractureAzimuthDiff ( ) > 350 )
2017-06-27 14:11:55 +02:00
{
2017-06-29 10:34:20 +02:00
m_wellFractureAzimuthAngleWarning . uiCapability ( ) - > setUiHidden ( false ) ;
2017-06-27 14:11:55 +02:00
}
else
{
2017-06-29 10:34:20 +02:00
m_wellFractureAzimuthAngleWarning . uiCapability ( ) - > setUiHidden ( true ) ;
2017-06-27 14:11:55 +02:00
}
}
2017-06-09 17:21:59 +02:00
if ( fractureTemplate ( ) - > orientationType = = RimFractureTemplate : : ALONG_WELL_PATH
| | fractureTemplate ( ) - > orientationType = = RimFractureTemplate : : TRANSVERSE_WELL_PATH )
2017-02-15 12:16:01 +01:00
{
azimuth . uiCapability ( ) - > setUiReadOnly ( true ) ;
}
2017-06-09 17:21:59 +02:00
else if ( fractureTemplate ( ) - > orientationType = = RimFractureTemplate : : AZIMUTH )
2017-02-15 12:16:01 +01:00
{
azimuth . uiCapability ( ) - > setUiReadOnly ( false ) ;
}
2017-06-09 17:21:59 +02:00
if ( fractureTemplate ( ) - > orientationType = = RimFractureTemplate : : ALONG_WELL_PATH )
2017-06-02 15:34:37 +02:00
{
perforationEfficiency . uiCapability ( ) - > setUiHidden ( false ) ;
perforationLength . uiCapability ( ) - > setUiHidden ( false ) ;
}
else
{
perforationEfficiency . uiCapability ( ) - > setUiHidden ( true ) ;
perforationLength . uiCapability ( ) - > setUiHidden ( true ) ;
}
2017-06-26 10:43:14 +02:00
if ( fractureTemplate ( ) - > conductivityType = = RimFractureTemplate : : FINITE_CONDUCTIVITY )
{
wellDiameter . uiCapability ( ) - > setUiHidden ( false ) ;
}
else if ( fractureTemplate ( ) - > conductivityType = = RimFractureTemplate : : INFINITE_CONDUCTIVITY )
{
wellDiameter . uiCapability ( ) - > setUiHidden ( true ) ;
}
2017-06-09 17:21:59 +02:00
RimFractureTemplate * fracTemplate = fractureTemplate ( ) ;
2017-02-15 12:16:01 +01:00
if ( dynamic_cast < RimStimPlanFractureTemplate * > ( fracTemplate ) )
{
stimPlanTimeIndexToPlot . uiCapability ( ) - > setUiHidden ( false ) ;
2017-04-07 11:02:31 +02:00
stimPlanTimeIndexToPlot . uiCapability ( ) - > setUiReadOnly ( true ) ;
2017-02-15 12:16:01 +01:00
}
else
{
stimPlanTimeIndexToPlot . uiCapability ( ) - > setUiHidden ( true ) ;
}
}
else
{
stimPlanTimeIndexToPlot . uiCapability ( ) - > setUiHidden ( true ) ;
}
2017-01-10 10:53:54 +01:00
}
2017-01-10 13:37:50 +01:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFracture : : defineEditorAttribute ( const caf : : PdmFieldHandle * field , QString uiConfigName , caf : : PdmUiEditorAttribute * attribute )
{
if ( field = = & azimuth )
{
caf : : PdmUiDoubleSliderEditorAttribute * myAttr = dynamic_cast < caf : : PdmUiDoubleSliderEditorAttribute * > ( attribute ) ;
if ( myAttr )
{
myAttr - > m_minimum = 0 ;
myAttr - > m_maximum = 360 ;
}
}
2017-04-18 15:23:26 +02:00
if ( field = = & perforationEfficiency )
{
caf : : PdmUiDoubleSliderEditorAttribute * myAttr = dynamic_cast < caf : : PdmUiDoubleSliderEditorAttribute * > ( attribute ) ;
if ( myAttr )
{
myAttr - > m_minimum = 0 ;
myAttr - > m_maximum = 1.0 ;
}
}
2017-01-10 13:37:50 +01:00
}
2017-02-15 11:29:44 +01:00
//--------------------------------------------------------------------------------------------------
2017-01-19 10:43:23 +01:00
///
//--------------------------------------------------------------------------------------------------
void RimFracture : : setAnchorPosition ( const cvf : : Vec3d & pos )
{
m_anchorPosition = pos ;
2017-06-12 12:45:09 +02:00
clearDisplayGeometryCache ( ) ;
2017-01-19 10:43:23 +01:00
2017-06-16 14:13:42 +02:00
}
2017-01-19 10:43:23 +01:00
2017-06-20 14:46:58 +02:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaEclipseUnitTools : : UnitSystem RimFracture : : fractureUnit ( ) const
{
return m_fractureUnit ( ) ;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFracture : : setFractureUnit ( RiaEclipseUnitTools : : UnitSystem unitSystem )
{
m_fractureUnit = unitSystem ;
}
2017-06-20 11:18:19 +02:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2017-06-20 16:40:32 +02:00
bool RimFracture : : isEclipseCellWithinContainment ( const RigMainGrid * mainGrid , size_t globalCellIndex ) const
2017-06-20 11:18:19 +02:00
{
CVF_ASSERT ( fractureTemplate ( ) ) ;
if ( ! fractureTemplate ( ) - > fractureContainment ( ) - > isEnabled ( ) ) return true ;
size_t anchorEclipseCell = findAnchorEclipseCell ( mainGrid ) ;
return fractureTemplate ( ) - > fractureContainment ( ) - > isEclipseCellWithinContainment ( mainGrid , anchorEclipseCell , globalCellIndex ) ;
}
2017-06-16 14:13:42 +02:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimFracture : : findAnchorEclipseCell ( const RigMainGrid * mainGrid ) const
{
cvf : : BoundingBox pointBBox ;
pointBBox . add ( m_anchorPosition ) ;
2017-01-19 10:43:23 +01:00
2017-06-16 14:13:42 +02:00
std : : vector < size_t > cellIndices ;
mainGrid - > findIntersectingCells ( pointBBox , & cellIndices ) ;
size_t cellContainingAchorPoint = cvf : : UNDEFINED_SIZE_T ;
2017-01-19 10:43:23 +01:00
2017-06-16 14:13:42 +02:00
for ( size_t cellIndex : cellIndices )
{
auto cornerIndices = mainGrid - > globalCellArray ( ) [ cellIndex ] . cornerIndices ( ) ;
cvf : : Vec3d vertices [ 8 ] ;
vertices [ 0 ] = ( mainGrid - > nodes ( ) [ cornerIndices [ 0 ] ] ) ;
vertices [ 1 ] = ( mainGrid - > nodes ( ) [ cornerIndices [ 1 ] ] ) ;
vertices [ 2 ] = ( mainGrid - > nodes ( ) [ cornerIndices [ 2 ] ] ) ;
vertices [ 3 ] = ( mainGrid - > nodes ( ) [ cornerIndices [ 3 ] ] ) ;
vertices [ 4 ] = ( mainGrid - > nodes ( ) [ cornerIndices [ 4 ] ] ) ;
vertices [ 5 ] = ( mainGrid - > nodes ( ) [ cornerIndices [ 5 ] ] ) ;
vertices [ 6 ] = ( mainGrid - > nodes ( ) [ cornerIndices [ 6 ] ] ) ;
vertices [ 7 ] = ( mainGrid - > nodes ( ) [ cornerIndices [ 7 ] ] ) ;
if ( RigHexIntersectionTools : : isPointInCell ( m_anchorPosition , vertices ) )
2017-01-19 10:43:23 +01:00
{
2017-06-16 14:13:42 +02:00
cellContainingAchorPoint = cellIndex ;
break ;
2017-01-19 10:43:23 +01:00
}
2017-06-16 14:13:42 +02:00
}
return cellContainingAchorPoint ;
2017-01-19 10:43:23 +01:00
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2017-02-07 09:09:00 +01:00
void RimFracture : : setFractureTemplate ( RimFractureTemplate * fractureTemplate )
2017-01-19 10:43:23 +01:00
{
m_fractureTemplate = fractureTemplate ;
2017-02-23 09:22:19 +01:00
2017-06-09 17:21:59 +02:00
RimStimPlanFractureTemplate * stimPlanFracTemplate = dynamic_cast < RimStimPlanFractureTemplate * > ( fractureTemplate ) ;
2017-02-23 09:22:19 +01:00
if ( stimPlanFracTemplate )
{
2017-06-12 14:42:35 +02:00
stimPlanTimeIndexToPlot = stimPlanFracTemplate - > activeTimeStepIndex ( ) ;
2017-02-23 09:22:19 +01:00
}
2017-06-29 15:06:44 +02:00
if ( fractureTemplate - > orientationType = = RimFractureTemplate : : AZIMUTH )
{
azimuth = fractureTemplate - > azimuthAngle ;
}
else
{
this - > updateAzimuthBasedOnWellAzimuthAngle ( ) ;
}
2017-06-20 14:46:58 +02:00
this - > wellDiameter = fractureTemplate - > wellDiameterInFractureUnit ( m_fractureUnit ( ) ) ;
this - > perforationLength = fractureTemplate - > perforationLengthInFractureUnit ( m_fractureUnit ( ) ) ;
2017-01-19 10:43:23 +01:00
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2017-06-09 17:21:59 +02:00
RimFractureTemplate * RimFracture : : fractureTemplate ( ) const
2017-01-19 10:43:23 +01:00
{
return m_fractureTemplate ( ) ;
}
2017-01-19 07:28:04 +01:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivWellFracturePartMgr * RimFracture : : fracturePartManager ( )
{
2017-06-09 17:21:59 +02:00
CVF_ASSERT ( m_fracturePartMgr . notNull ( ) ) ;
2017-01-19 07:28:04 +01:00
2017-06-09 17:21:59 +02:00
return m_fracturePartMgr . p ( ) ;
2017-01-19 07:28:04 +01:00
}