2017-01-02 14:13:34 +01:00
/////////////////////////////////////////////////////////////////////////////////
//
2019-01-16 14:57:43 +01:00
// Copyright (C) 2017-2018 Statoil ASA
// Copyright (C) 2018- Equinor ASA
2018-08-10 15:04:56 +02:00
//
2017-01-02 14:13:34 +01:00
// 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.
2018-08-10 15:04:56 +02:00
//
2017-01-02 14:13:34 +01:00
// 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.
2018-08-10 15:04:56 +02:00
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
2017-01-02 14:13:34 +01:00
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimFracture.h"
2017-01-19 10:43:23 +01:00
#include "RiaApplication.h"
2018-10-11 16:03:49 +02:00
#include "RiaColorTables.h"
2018-05-09 08:39:36 +02:00
#include "RiaCompletionTypeCalculationScheduler.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
2019-01-16 14:57:43 +01:00
#include "Riu3DMainWindowTools.h"
2017-01-19 10:43:23 +01:00
#include "RigMainGrid.h"
2017-01-10 13:37:50 +01:00
2018-08-10 15:04:56 +02:00
#include "Rim3dView.h"
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-12-15 13:09:47 +01:00
#include "RimFractureContainment.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-12-20 13:14:43 +01:00
#include "RimStimPlanColors.h"
2018-08-10 15:04:56 +02:00
#include "RimStimPlanFractureTemplate.h"
2017-01-10 13:37:50 +01:00
2017-01-19 10:43:23 +01:00
#include "RivWellFracturePartMgr.h"
2019-01-16 14:57:43 +01:00
#include "FractureCommands/RicNewEllipseFractureTemplateFeature.h"
#include "FractureCommands/RicNewStimPlanFractureTemplateFeature.h"
2017-01-19 10:43:23 +01:00
#include "cafHexGridIntersectionTools/cafHexGridIntersectionTools.h"
2017-12-15 13:09:47 +01:00
2017-02-15 11:29:44 +01:00
#include "cafPdmUiDoubleSliderEditor.h"
2019-01-16 14:57:43 +01:00
#include "cafPdmUiPushButtonEditor.h"
#include "cafPdmUiToolButtonEditor.h"
2017-02-15 11:29:44 +01:00
#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
2018-02-19 14:32:33 +01:00
#include <QMessageBox>
2017-02-15 12:16:01 +01:00
#include <QString>
2017-12-15 13:09:47 +01:00
2019-01-10 16:16:49 +01:00
#include <cmath>
2017-01-02 14:13:34 +01:00
2019-09-06 10:40:57 +02:00
CAF_PDM_XML_ABSTRACT_SOURCE_INIT ( RimFracture , "Fracture" );
2017-01-02 14:13:34 +01:00
2017-12-20 13:14:43 +01:00
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
2017-12-20 13:14:43 +01:00
//--------------------------------------------------------------------------------------------------
void setDefaultFractureColorResult ()
{
2018-08-10 15:04:56 +02:00
RiaApplication * app = RiaApplication :: instance ();
RimProject * proj = app -> project ();
2017-12-20 13:14:43 +01:00
2019-09-06 10:40:57 +02:00
for ( RimEclipseCase * const eclCase : proj -> eclipseCases () )
2017-12-20 13:14:43 +01:00
{
2019-09-06 10:40:57 +02:00
for ( Rim3dView * const view : eclCase -> views () )
2017-12-20 13:14:43 +01:00
{
std :: vector < RimStimPlanColors *> fractureColors ;
2019-09-06 10:40:57 +02:00
view -> descendantsIncludingThisOfType ( fractureColors );
2017-12-20 13:14:43 +01:00
2019-09-06 10:40:57 +02:00
for ( RimStimPlanColors * const stimPlanColors : fractureColors )
2017-12-20 13:14:43 +01:00
{
2018-02-06 12:57:50 +01:00
stimPlanColors -> setDefaultResultName ();
2017-12-20 13:14:43 +01:00
}
}
}
}
2017-01-02 14:13:34 +01:00
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
2017-01-02 14:13:34 +01:00
//--------------------------------------------------------------------------------------------------
2018-08-10 14:55:50 +02:00
RimFracture :: RimFracture ()
2017-01-02 14:13:34 +01:00
{
2018-08-10 15:04:56 +02:00
// clang-format off
2017-01-02 14:13:34 +01:00
CAF_PDM_InitObject ( "Fracture" , "" , "" , "" );
2017-01-19 10:43:23 +01:00
CAF_PDM_InitFieldNoDefault ( & m_fractureTemplate , "FractureDef" , "Fracture Template" , "" , "" , "" );
2019-01-16 14:57:43 +01:00
CAF_PDM_InitField ( & m_editFractureTemplate , "EditTemplate" , false , "Edit" , "" , "" , "" );
m_editFractureTemplate . uiCapability () -> setUiEditorTypeName ( caf :: PdmUiToolButtonEditor :: uiEditorTypeName ());
m_editFractureTemplate . uiCapability () -> setUiLabelPosition ( caf :: PdmUiItemInfo :: HIDDEN );
CAF_PDM_InitField ( & m_createEllipseFractureTemplate , "CreateEllipseTemplate" , false , "No Fracture Templates Found." , "" , "" , "" );
m_createEllipseFractureTemplate . uiCapability () -> setUiEditorTypeName ( caf :: PdmUiPushButtonEditor :: uiEditorTypeName ());
m_createEllipseFractureTemplate . uiCapability () -> setUiLabelPosition ( caf :: PdmUiItemInfo :: TOP );
CAF_PDM_InitField ( & m_createStimPlanFractureTemplate , "CreateStimPlanTemplate" , false , "Create New Template?" , "" , "" , "" );
m_createStimPlanFractureTemplate . uiCapability () -> setUiEditorTypeName ( caf :: PdmUiPushButtonEditor :: uiEditorTypeName ());
m_createStimPlanFractureTemplate . uiCapability () -> setUiLabelPosition ( caf :: PdmUiItemInfo :: TOP );
2017-01-19 10:43:23 +01:00
2017-12-15 13:09:47 +01:00
CAF_PDM_InitFieldNoDefault ( & m_anchorPosition , "AnchorPosition" , "Anchor Position" , "" , "" , "" );
2017-01-19 10:43:23 +01:00
m_anchorPosition . uiCapability () -> setUiHidden ( true );
2018-01-10 14:43:01 +01:00
m_anchorPosition . xmlCapability () -> disableIO ();
2017-01-19 10:43:23 +01:00
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-12-15 13:09:47 +01:00
m_uiAnchorPosition . xmlCapability () -> disableIO ();
2017-06-16 14:13:42 +02:00
2018-01-12 10:21:10 +01:00
CAF_PDM_InitField ( & m_azimuth , "Azimuth" , 0.0 , "Azimuth" , "" , "" , "" );
m_azimuth . uiCapability () -> setUiEditorTypeName ( caf :: PdmUiDoubleSliderEditor :: uiEditorTypeName ());
2017-06-16 14:13:42 +02:00
2018-01-12 10:21:10 +01:00
CAF_PDM_InitField ( & m_perforationLength , "PerforationLength" , 1.0 , "Perforation Length" , "" , "" , "" );
CAF_PDM_InitField ( & m_perforationEfficiency , "PerforationEfficiency" , 1.0 , "Perforation Efficiency" , "" , "" , "" );
m_perforationEfficiency . uiCapability () -> setUiEditorTypeName ( caf :: PdmUiDoubleSliderEditor :: uiEditorTypeName ());
2017-06-16 14:13:42 +02:00
2018-01-12 10:21:10 +01:00
CAF_PDM_InitField ( & m_wellDiameter , "WellDiameter" , 0.216 , "Well Diameter at Fracture" , "" , "" , "" );
CAF_PDM_InitField ( & m_dip , "Dip" , 0.0 , "Dip" , "" , "" , "" );
CAF_PDM_InitField ( & m_tilt , "Tilt" , 0.0 , "Tilt" , "" , "" , "" );
2017-12-15 13:09:47 +01:00
2020-04-24 08:10:48 +02:00
CAF_PDM_InitField ( & m_fractureUnit , "FractureUnit" , caf :: AppEnum < RiaEclipseUnitTools :: UnitSystem > ( RiaEclipseUnitTools :: UnitSystem :: UNITS_METRIC ), "Fracture Unit System" , "" , "" , "" );
2017-06-20 14:46:58 +02:00
m_fractureUnit . uiCapability () -> setUiReadOnly ( true );
2017-01-23 08:54:27 +01:00
2018-01-12 10:21:10 +01:00
CAF_PDM_InitField ( & m_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-12-15 13:09:47 +01:00
m_uiWellPathAzimuth . xmlCapability () -> disableIO ();
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-12-15 13:09:47 +01:00
m_uiWellFractureAzimuthDiff . xmlCapability () -> disableIO ();
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-12-15 13:09:47 +01:00
m_wellFractureAzimuthAngleWarning . xmlCapability () -> disableIO ();
2017-06-26 15:09:33 +02:00
2017-06-09 17:21:59 +02:00
m_fracturePartMgr = new RivWellFracturePartMgr ( this );
2018-08-10 15:04:56 +02:00
// clang-format on
2017-01-02 14:13:34 +01:00
}
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
2017-01-02 14:13:34 +01:00
//--------------------------------------------------------------------------------------------------
2020-02-12 11:13:38 +01:00
RimFracture ::~ RimFracture ()
{
}
2017-01-04 08:10:02 +01:00
2018-01-12 10:21:10 +01:00
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
2018-01-12 10:21:10 +01:00
//--------------------------------------------------------------------------------------------------
double RimFracture :: perforationLength () const
{
return m_perforationLength ();
}
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
2018-01-12 10:21:10 +01:00
//--------------------------------------------------------------------------------------------------
double RimFracture :: perforationEfficiency () const
{
return m_perforationEfficiency ();
}
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
2018-01-12 10:21:10 +01:00
//--------------------------------------------------------------------------------------------------
2019-09-06 10:40:57 +02:00
void RimFracture :: setStimPlanTimeIndexToPlot ( int timeIndex )
2018-01-12 10:21:10 +01:00
{
m_stimPlanTimeIndexToPlot = timeIndex ;
}
2017-01-12 12:19:52 +01:00
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
2017-01-12 12:19:52 +01:00
//--------------------------------------------------------------------------------------------------
2019-09-06 10:40:57 +02:00
std :: vector < size_t > RimFracture :: getPotentiallyFracturedCells ( const RigMainGrid * mainGrid ) const
2017-01-12 12:19:52 +01:00
{
std :: vector < size_t > cellindecies ;
2019-09-06 10:40:57 +02:00
if ( ! mainGrid ) return cellindecies ;
2017-01-12 12:19:52 +01:00
2017-06-12 12:45:09 +02:00
cvf :: BoundingBox fractureBBox = this -> boundingBoxInDomainCoords ();
2017-01-12 12:19:52 +01:00
2019-09-06 10:40:57 +02:00
mainGrid -> findIntersectingCells ( fractureBBox , & cellindecies );
2017-01-12 12:19:52 +01:00
return cellindecies ;
}
2017-01-10 13:37:50 +01:00
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
2017-01-10 13:37:50 +01:00
//--------------------------------------------------------------------------------------------------
2020-02-12 11:43:15 +01:00
void RimFracture :: fieldChangedByUi ( const caf :: PdmFieldHandle * changedField , const QVariant & oldValue , const QVariant & newValue )
2017-01-10 13:37:50 +01:00
{
2019-09-06 10:40:57 +02:00
if ( changedField == & m_fractureTemplate )
2017-01-23 09:46:33 +01:00
{
2019-09-06 10:40:57 +02:00
if ( fractureUnit () != m_fractureTemplate -> fractureTemplateUnit () )
2018-02-19 14:32:33 +01:00
{
2019-09-06 10:40:57 +02:00
QString fractureUnitText = RiaEclipseUnitTools :: UnitSystemType :: uiText ( fractureUnit () );
2018-02-19 14:32:33 +01:00
2018-08-10 15:04:56 +02:00
QString warningText =
2019-09-06 10:40:57 +02:00
QString ( "Using a fracture template defined in a different unit is not supported. \n\n Please select a "
"fracture template of unit '%1'" )
. arg ( fractureUnitText );
2018-02-19 14:32:33 +01:00
2019-09-06 10:40:57 +02:00
QMessageBox :: warning ( nullptr , "Fracture Template Selection" , warningText );
2018-02-19 14:32:33 +01:00
2018-08-10 15:04:56 +02:00
PdmObjectHandle * prevValue = oldValue . value < caf :: PdmPointer < PdmObjectHandle >> (). rawPtr ();
2019-09-06 10:40:57 +02:00
auto prevTemplate = dynamic_cast < RimFractureTemplate *> ( prevValue );
2018-02-21 08:36:18 +01:00
m_fractureTemplate = prevTemplate ;
2018-02-19 14:32:33 +01:00
}
2019-09-06 10:40:57 +02:00
setFractureTemplate ( m_fractureTemplate );
2017-12-20 13:14:43 +01:00
setDefaultFractureColorResult ();
2017-01-23 09:46:33 +01:00
}
2019-09-06 10:40:57 +02:00
else if ( changedField == & m_editFractureTemplate )
2019-01-16 14:57:43 +01:00
{
m_editFractureTemplate = false ;
2019-09-06 10:40:57 +02:00
if ( m_fractureTemplate != nullptr )
2019-01-16 14:57:43 +01:00
{
2019-09-06 10:40:57 +02:00
Riu3DMainWindowTools :: selectAsCurrentItem ( m_fractureTemplate () );
2019-01-16 14:57:43 +01:00
}
}
2019-09-06 10:40:57 +02:00
else if ( changedField == & m_createEllipseFractureTemplate )
2019-01-16 14:57:43 +01:00
{
m_createEllipseFractureTemplate = false ;
2019-09-06 10:40:57 +02:00
RicNewEllipseFractureTemplateFeature :: createNewTemplateForFractureAndUpdate ( this );
2019-01-16 14:57:43 +01:00
}
2019-09-06 10:40:57 +02:00
else if ( changedField == & m_createStimPlanFractureTemplate )
2019-01-16 14:57:43 +01:00
{
2019-09-06 10:40:57 +02:00
RicNewStimPlanFractureTemplateFeature :: createNewTemplateForFractureAndUpdate ( this );
2019-01-16 14:57:43 +01:00
}
2019-09-06 10:40:57 +02:00
if ( changedField == & m_azimuth || changedField == & m_fractureTemplate ||
changedField == & m_stimPlanTimeIndexToPlot || changedField == this -> objectToggleField () ||
changedField == & m_dip || changedField == & m_tilt || changedField == & m_perforationLength )
2017-01-10 13:37:50 +01:00
{
2018-08-15 09:44:27 +02:00
clearCachedNonDarcyProperties ();
2018-09-12 13:18:48 +02:00
RimEclipseCase * eclipseCase = nullptr ;
2019-09-06 10:40:57 +02:00
this -> firstAncestorOrThisOfType ( eclipseCase );
2018-09-12 13:18:48 +02:00
if ( eclipseCase )
2017-01-10 13:37:50 +01:00
{
2018-09-12 13:18:48 +02:00
RiaCompletionTypeCalculationScheduler :: instance () -> scheduleRecalculateCompletionTypeAndRedrawAllViews (
2019-09-06 10:40:57 +02:00
eclipseCase );
2017-01-10 13:37:50 +01:00
}
2017-01-19 10:43:23 +01:00
else
{
2018-09-12 13:18:48 +02:00
RiaCompletionTypeCalculationScheduler :: instance () -> scheduleRecalculateCompletionTypeAndRedrawAllViews ();
2017-01-19 10:43:23 +01:00
}
2018-09-13 11:49:57 +02:00
2020-05-12 09:50:38 +02:00
RimProject :: current () -> scheduleCreateDisplayModelAndRedrawAllViews ();
2017-01-10 13:37:50 +01:00
}
}
2017-01-19 13:35:07 +01:00
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
2017-02-06 11:44:24 +01:00
//--------------------------------------------------------------------------------------------------
cvf :: Vec3d RimFracture :: fracturePosition () const
{
return m_anchorPosition ;
}
2018-08-15 09:44:27 +02:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const NonDarcyData & RimFracture :: nonDarcyProperties () const
{
2019-09-06 10:40:57 +02:00
CVF_ASSERT ( ! m_cachedFractureProperties . isDirty () );
2018-08-15 09:44:27 +02:00
return m_cachedFractureProperties ;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFracture :: ensureValidNonDarcyProperties ()
{
2019-09-06 10:40:57 +02:00
if ( m_cachedFractureProperties . isDirty () )
2018-08-15 09:44:27 +02:00
{
NonDarcyData props ;
2019-09-06 10:40:57 +02:00
if ( m_fractureTemplate )
2018-08-15 09:44:27 +02:00
{
2019-09-06 10:40:57 +02:00
props . width = m_fractureTemplate -> computeFractureWidth ( this );
props . conductivity = m_fractureTemplate -> computeKh ( this );
props . dFactor = m_fractureTemplate -> computeDFactor ( this );
props . effectivePermeability = m_fractureTemplate -> computeEffectivePermeability ( this );
props . eqWellRadius = m_fractureTemplate -> computeWellRadiusForDFactorCalculation ( this );
props . betaFactor = m_fractureTemplate -> getOrComputeBetaFactor ( this );
2018-08-15 09:44:27 +02:00
props . isDataDirty = false ;
}
m_cachedFractureProperties = props ;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFracture :: clearCachedNonDarcyProperties ()
{
m_cachedFractureProperties = NonDarcyData ();
}
2018-11-22 12:57:11 +01:00
//--------------------------------------------------------------------------------------------------
2018-10-09 11:06:10 +02:00
///
//--------------------------------------------------------------------------------------------------
2018-10-09 13:42:03 +02:00
RiaDefines :: WellPathComponentType RimFracture :: componentType () const
2018-10-09 11:06:10 +02:00
{
2020-04-24 07:13:33 +02:00
return RiaDefines :: WellPathComponentType :: FRACTURE ;
2018-10-09 11:06:10 +02:00
}
2018-10-10 16:57:43 +02:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFracture :: componentLabel () const
{
return name ();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFracture :: componentTypeLabel () const
{
return "Fracture" ;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf :: Color3f RimFracture :: defaultComponentColor () const
{
2018-10-11 16:03:49 +02:00
return RiaColorTables :: wellPathComponentColors ()[ componentType ()];
2018-10-10 16:57:43 +02:00
}
2018-10-09 11:06:10 +02:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFracture :: startMD () const
{
2019-09-06 10:40:57 +02:00
if ( fractureTemplate () -> orientationType () == RimFractureTemplate :: ALONG_WELL_PATH )
2018-10-09 11:06:10 +02:00
{
2019-09-06 10:40:57 +02:00
return fractureMD () - 0.5 * perforationLength ();
2018-10-09 11:06:10 +02:00
}
else
{
return fractureMD ();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFracture :: endMD () const
{
2019-09-06 10:40:57 +02:00
if ( fractureTemplate () -> orientationType () == RimFractureTemplate :: ALONG_WELL_PATH )
2018-10-09 11:06:10 +02:00
{
return startMD () + perforationLength ();
}
else
{
2019-09-06 10:40:57 +02:00
return startMD () + fractureTemplate () -> computeFractureWidth ( this );
2018-10-09 11:06:10 +02:00
}
}
2020-05-25 20:43:59 +02:00
//--------------------------------------------------------------------------------------------------
/// https://stackoverflow.com/a/52432897
//--------------------------------------------------------------------------------------------------
double getAbsoluteDiff2Angles ( const double x , const double y , const double c )
{
// c can be PI (for radians) or 180.0 (for degrees);
return c - fabs ( fmod ( fabs ( x - y ), 2 * c ) - c );
}
2017-06-29 10:34:20 +02:00
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
2017-06-29 10:34:20 +02:00
//--------------------------------------------------------------------------------------------------
double RimFracture :: wellFractureAzimuthDiff () const
{
2020-05-25 20:43:59 +02:00
// Compute the relative difference between two lines
// See https://github.com/OPM/ResInsight/issues/5899
double angle1 = wellAzimuthAtFracturePosition ();
double angle2 = m_azimuth ;
2020-05-25 21:02:36 +02:00
double diffDegrees = getAbsoluteDiff2Angles ( angle1 , angle2 , 180.0 );
double smallesDiffDegrees = std :: min ( 180.0 - diffDegrees , diffDegrees );
2020-05-25 20:43:59 +02:00
2020-05-25 21:02:36 +02:00
return smallesDiffDegrees ;
2017-06-29 10:34:20 +02:00
}
2017-06-29 11:28:30 +02:00
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
2017-06-29 11:28:30 +02:00
//--------------------------------------------------------------------------------------------------
QString RimFracture :: wellFractureAzimuthDiffText () const
{
double wellDifference = wellFractureAzimuthDiff ();
2019-09-06 10:40:57 +02:00
return QString :: number ( wellDifference , 'f' , 2 );
2017-06-29 11:28:30 +02:00
}
2020-05-25 20:43:59 +02:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2017-06-29 11:28:30 +02:00
QString RimFracture :: wellAzimuthAtFracturePositionText () const
{
double wellAzimuth = wellAzimuthAtFracturePosition ();
2019-09-06 10:40:57 +02:00
return QString :: number ( wellAzimuth , 'f' , 2 );
2017-06-29 11:28:30 +02:00
}
2017-01-04 08:10:02 +01:00
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
2017-06-09 13:05:59 +02:00
//--------------------------------------------------------------------------------------------------
2018-08-10 14:55:50 +02:00
cvf :: BoundingBox RimFracture :: boundingBoxInDomainCoords () const
2017-06-09 13:05:59 +02:00
{
2017-06-12 12:45:09 +02:00
std :: vector < cvf :: Vec3f > nodeCoordVec ;
2018-08-10 15:04:56 +02:00
std :: vector < cvf :: uint > triangleIndices ;
2017-06-09 13:05:59 +02:00
2019-09-06 10:40:57 +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 ;
2019-09-06 10:40:57 +02:00
for ( const auto & nodeCoord : nodeCoordVec )
fractureBBox . add ( nodeCoord );
2018-08-10 15:04:56 +02:00
2017-06-12 12:45:09 +02:00
return fractureBBox ;
2017-06-09 13:05:59 +02:00
}
2017-06-08 09:15:50 +02:00
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
2017-06-08 09:15:50 +02:00
//--------------------------------------------------------------------------------------------------
2018-02-21 09:10:08 +01:00
double RimFracture :: wellRadius () const
2017-06-08 09:15:50 +02:00
{
2020-04-24 08:10:48 +02:00
if ( m_fractureUnit == RiaEclipseUnitTools :: UnitSystem :: UNITS_METRIC )
2017-06-08 09:15:50 +02:00
{
2018-02-21 10:10:22 +01:00
return m_wellDiameter / 2.0 ;
2017-06-08 09:15:50 +02:00
}
2020-04-24 08:10:48 +02:00
else if ( m_fractureUnit == RiaEclipseUnitTools :: UnitSystem :: UNITS_FIELD )
2017-06-08 09:15:50 +02:00
{
2019-09-06 10:40:57 +02:00
return RiaEclipseUnitTools :: inchToFeet ( m_wellDiameter / 2.0 );
2017-06-08 09:15:50 +02:00
}
2018-02-21 09:10:08 +01:00
2017-06-08 09:15:50 +02:00
return cvf :: UNDEFINED_DOUBLE ;
}
2017-01-19 10:43:23 +01:00
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
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
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
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)
2019-09-06 10:40:57 +02:00
cvf :: Mat4d dipRotation = cvf :: Mat4d :: fromRotation ( cvf :: Vec3d :: Z_AXIS , cvf :: Math :: toRadians ( m_dip () ) );
2017-03-06 13:32:42 +01:00
2017-03-29 10:12:01 +02:00
// Dip (out of XY plane)
2019-09-06 10:40:57 +02:00
cvf :: Mat4d tiltRotation = cvf :: Mat4d :: fromRotation ( cvf :: Vec3d :: X_AXIS , cvf :: Math :: toRadians ( m_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
2019-09-06 10:40:57 +02:00
cvf :: Mat4d rotationFromTesselator = cvf :: Mat4d :: fromRotation ( cvf :: Vec3d :: X_AXIS , cvf :: Math :: toRadians ( 90.0f ) );
2018-08-10 15:04:56 +02:00
2017-01-10 13:37:50 +01:00
// Azimuth rotation
2019-09-06 10:40:57 +02:00
cvf :: Mat4d azimuthRotation = cvf :: Mat4d :: fromRotation ( cvf :: Vec3d :: Z_AXIS , cvf :: Math :: toRadians ( - m_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 ;
2019-09-06 10:40:57 +02:00
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
2018-06-29 10:57:26 +02:00
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
2018-06-29 10:57:26 +02:00
//--------------------------------------------------------------------------------------------------
double RimFracture :: dip () const
{
return m_dip ();
}
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
2018-06-29 10:57:26 +02:00
//--------------------------------------------------------------------------------------------------
double RimFracture :: tilt () const
{
return m_tilt ();
}
2018-02-27 12:05:37 +01:00
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
2018-02-27 12:05:37 +01:00
//--------------------------------------------------------------------------------------------------
2019-09-06 10:40:57 +02:00
void RimFracture :: setFractureTemplateNoUpdate ( RimFractureTemplate * fractureTemplate )
2018-02-27 12:05:37 +01:00
{
2019-09-06 10:40:57 +02:00
if ( fractureTemplate && fractureTemplate -> fractureTemplateUnit () != fractureUnit () )
2018-02-27 12:05:37 +01:00
{
2019-09-06 10:40:57 +02:00
QString fractureUnitText = RiaEclipseUnitTools :: UnitSystemType :: uiText ( fractureUnit () );
2018-02-27 12:05:37 +01:00
QString warningText =
2019-09-06 10:40:57 +02:00
QString ( "Using a fracture template defined in a different unit is not supported. \n\n Please select a "
"fracture template of unit '%1'" )
. arg ( fractureUnitText );
2018-02-27 12:05:37 +01:00
2019-09-06 10:40:57 +02:00
QMessageBox :: warning ( nullptr , "Fracture Template Selection" , warningText );
2018-02-27 12:05:37 +01:00
return ;
}
m_fractureTemplate = fractureTemplate ;
}
2017-01-06 13:13:25 +01:00
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
2017-01-06 13:13:25 +01:00
//--------------------------------------------------------------------------------------------------
2019-09-06 10:40:57 +02:00
void RimFracture :: triangleGeometry ( std :: vector < cvf :: uint >* triangleIndices , std :: vector < cvf :: Vec3f >* nodeCoords ) const
2017-01-06 13:13:25 +01:00
{
2018-01-12 10:21:10 +01:00
RimFractureTemplate * fractureDef = fractureTemplate ();
2019-09-06 10:40:57 +02:00
if ( fractureDef )
2018-01-12 10:21:10 +01:00
{
2019-09-06 10:40:57 +02:00
fractureDef -> fractureTriangleGeometry ( nodeCoords , triangleIndices );
2018-01-12 10:21:10 +01:00
}
2017-06-12 12:45:09 +02:00
2018-01-12 10:21:10 +01:00
cvf :: Mat4d m = transformMatrix ();
2017-06-12 12:45:09 +02:00
2019-09-06 10:40:57 +02:00
for ( cvf :: Vec3f & v : * nodeCoords )
2018-01-12 10:21:10 +01:00
{
2019-09-06 10:40:57 +02:00
cvf :: Vec3d vd ( v );
2017-06-23 10:16:39 +02:00
2019-09-06 10:40:57 +02:00
vd . transformPoint ( m );
2017-06-23 10:16:39 +02:00
2019-09-06 10:40:57 +02:00
v = cvf :: Vec3f ( vd );
2018-01-12 10:21:10 +01:00
}
2017-01-04 08:10:02 +01:00
}
2017-01-19 10:43:23 +01:00
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +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 ;
}
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
2017-01-19 10:43:23 +01:00
//--------------------------------------------------------------------------------------------------
2019-09-06 10:40:57 +02:00
QList < caf :: PdmOptionItemInfo > RimFracture :: calculateValueOptions ( const caf :: PdmFieldHandle * fieldNeedingOptions ,
bool * useOptionsOnly )
2017-01-19 10:43:23 +01:00
{
QList < caf :: PdmOptionItemInfo > options ;
2020-05-12 09:50:38 +02:00
RimProject * proj = RimProject :: current ();
2019-09-06 10:40:57 +02:00
CVF_ASSERT ( proj );
2017-01-19 10:43:23 +01:00
2019-09-06 10:40:57 +02:00
if ( fieldNeedingOptions == & m_fractureTemplate )
2017-01-19 10:43:23 +01:00
{
2018-02-21 08:36:18 +01:00
RimOilField * oilField = proj -> activeOilField ();
2019-09-06 10:40:57 +02:00
if ( oilField && oilField -> fractureDefinitionCollection () )
2017-01-19 10:43:23 +01:00
{
2018-02-21 08:36:18 +01:00
RimFractureTemplateCollection * fracDefColl = oilField -> fractureDefinitionCollection ();
2019-09-06 10:40:57 +02:00
for ( RimFractureTemplate * fracDef : fracDefColl -> fractureTemplates () )
2018-02-21 08:36:18 +01:00
{
QString displayText = fracDef -> nameAndUnit ();
2019-09-06 10:40:57 +02:00
if ( fracDef -> fractureTemplateUnit () != fractureUnit () )
2018-02-21 08:36:18 +01:00
{
displayText += " (non-matching unit)" ;
}
2019-09-06 10:40:57 +02:00
options . push_back ( caf :: PdmOptionItemInfo ( displayText , fracDef ) );
2018-02-21 08:36:18 +01:00
}
2017-01-19 10:43:23 +01:00
}
}
2019-09-06 10:40:57 +02:00
else if ( fieldNeedingOptions == & m_stimPlanTimeIndexToPlot )
2017-02-15 12:16:01 +01:00
{
2019-09-06 10:40:57 +02:00
if ( fractureTemplate () )
2017-02-15 12:16:01 +01:00
{
2017-06-09 17:21:59 +02:00
RimFractureTemplate * fracTemplate = fractureTemplate ();
2019-09-06 10:40:57 +02:00
if ( dynamic_cast < RimStimPlanFractureTemplate *> ( fracTemplate ) )
2017-02-15 12:16:01 +01:00
{
2020-02-12 11:43:15 +01:00
RimStimPlanFractureTemplate * fracTemplateStimPlan =
dynamic_cast < RimStimPlanFractureTemplate *> ( fracTemplate );
2019-09-06 10:40:57 +02:00
std :: vector < double > timeValues = fracTemplateStimPlan -> timeSteps ();
int index = 0 ;
for ( double value : timeValues )
2017-02-15 12:16:01 +01:00
{
2019-09-06 10:40:57 +02:00
options . push_back ( caf :: PdmOptionItemInfo ( QString :: number ( value ), index ) );
2017-02-15 12:16:01 +01:00
index ++ ;
}
}
}
}
2017-01-19 10:43:23 +01:00
return options ;
}
2017-01-10 10:53:54 +01:00
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
2017-01-10 10:53:54 +01:00
//--------------------------------------------------------------------------------------------------
2019-09-06 10:40:57 +02:00
void RimFracture :: defineUiOrdering ( QString uiConfigName , caf :: PdmUiOrdering & uiOrdering )
2017-01-10 10:53:54 +01:00
{
2020-04-24 08:10:48 +02:00
if ( m_fractureUnit () == RiaEclipseUnitTools :: UnitSystem :: UNITS_METRIC )
2017-06-08 09:15:50 +02:00
{
2019-09-06 10:40:57 +02:00
m_wellDiameter . uiCapability () -> setUiName ( "Well Diameter [m]" );
m_perforationLength . uiCapability () -> setUiName ( "Perforation Length [m]" );
2017-06-08 09:15:50 +02:00
}
2020-04-24 08:10:48 +02:00
else if ( m_fractureUnit () == RiaEclipseUnitTools :: UnitSystem :: UNITS_FIELD )
2017-06-08 09:15:50 +02:00
{
2019-09-06 10:40:57 +02:00
m_wellDiameter . uiCapability () -> setUiName ( "Well Diameter [inches]" );
m_perforationLength . uiCapability () -> setUiName ( "Perforation Length [ft]" );
2017-06-08 09:15:50 +02:00
}
2019-09-06 10:40:57 +02:00
if ( fractureTemplate () )
2017-02-15 12:16:01 +01:00
{
2019-09-06 10:40:57 +02:00
if ( fractureTemplate () -> orientationType () == RimFractureTemplate :: ALONG_WELL_PATH ||
fractureTemplate () -> orientationType () == RimFractureTemplate :: TRANSVERSE_WELL_PATH )
2017-06-27 14:11:55 +02:00
{
2019-09-06 10:40:57 +02:00
m_uiWellPathAzimuth . uiCapability () -> setUiHidden ( true );
m_uiWellFractureAzimuthDiff . uiCapability () -> setUiHidden ( true );
m_wellFractureAzimuthAngleWarning . uiCapability () -> setUiHidden ( true );
2017-06-27 14:11:55 +02:00
}
2019-09-06 10:40:57 +02:00
else if ( fractureTemplate () -> orientationType () == RimFractureTemplate :: AZIMUTH )
2017-06-27 14:11:55 +02:00
{
2019-09-06 10:40:57 +02:00
m_uiWellPathAzimuth . uiCapability () -> setUiHidden ( false );
m_uiWellFractureAzimuthDiff . uiCapability () -> setUiHidden ( false );
2020-02-12 11:43:15 +01:00
if ( wellFractureAzimuthDiff () < 10 || ( wellFractureAzimuthDiff () > 170 && wellFractureAzimuthDiff () < 190 ) ||
2019-09-06 10:40:57 +02:00
wellFractureAzimuthDiff () > 350 )
2017-06-27 14:11:55 +02:00
{
2019-09-06 10:40:57 +02:00
m_wellFractureAzimuthAngleWarning . uiCapability () -> setUiHidden ( false );
2017-06-27 14:11:55 +02:00
}
else
{
2019-09-06 10:40:57 +02:00
m_wellFractureAzimuthAngleWarning . uiCapability () -> setUiHidden ( true );
2017-06-27 14:11:55 +02:00
}
}
2019-09-06 10:40:57 +02:00
if ( fractureTemplate () -> orientationType () == RimFractureTemplate :: ALONG_WELL_PATH ||
fractureTemplate () -> orientationType () == RimFractureTemplate :: TRANSVERSE_WELL_PATH )
2017-02-15 12:16:01 +01:00
{
2019-09-06 10:40:57 +02:00
m_azimuth . uiCapability () -> setUiReadOnly ( true );
2017-02-15 12:16:01 +01:00
}
2019-09-06 10:40:57 +02:00
else if ( fractureTemplate () -> orientationType () == RimFractureTemplate :: AZIMUTH )
2017-02-15 12:16:01 +01:00
{
2019-09-06 10:40:57 +02:00
m_azimuth . uiCapability () -> setUiReadOnly ( false );
2017-02-15 12:16:01 +01:00
}
2019-09-06 10:40:57 +02:00
if ( fractureTemplate () -> orientationType () == RimFractureTemplate :: ALONG_WELL_PATH )
2017-06-02 15:34:37 +02:00
{
2019-09-06 10:40:57 +02:00
m_perforationEfficiency . uiCapability () -> setUiHidden ( false );
m_perforationLength . uiCapability () -> setUiHidden ( false );
2017-06-02 15:34:37 +02:00
}
else
{
2019-09-06 10:40:57 +02:00
m_perforationEfficiency . uiCapability () -> setUiHidden ( true );
m_perforationLength . uiCapability () -> setUiHidden ( true );
2017-06-02 15:34:37 +02:00
}
2019-09-06 10:40:57 +02:00
if ( fractureTemplate () -> conductivityType () == RimFractureTemplate :: FINITE_CONDUCTIVITY )
2017-06-26 10:43:14 +02:00
{
2019-09-06 10:40:57 +02:00
m_wellDiameter . uiCapability () -> setUiHidden ( false );
2017-06-26 10:43:14 +02:00
}
2019-09-06 10:40:57 +02:00
else if ( fractureTemplate () -> conductivityType () == RimFractureTemplate :: INFINITE_CONDUCTIVITY )
2017-06-26 10:43:14 +02:00
{
2019-09-06 10:40:57 +02:00
m_wellDiameter . uiCapability () -> setUiHidden ( true );
2017-06-26 10:43:14 +02:00
}
2017-06-09 17:21:59 +02:00
RimFractureTemplate * fracTemplate = fractureTemplate ();
2019-09-06 10:40:57 +02:00
if ( dynamic_cast < RimStimPlanFractureTemplate *> ( fracTemplate ) )
2017-02-15 12:16:01 +01:00
{
2019-09-06 10:40:57 +02:00
m_stimPlanTimeIndexToPlot . uiCapability () -> setUiHidden ( false );
2018-01-12 13:20:54 +01:00
2019-09-06 10:40:57 +02:00
m_stimPlanTimeIndexToPlot . uiCapability () -> setUiReadOnly ( true );
2017-02-15 12:16:01 +01:00
}
else
{
2019-09-06 10:40:57 +02:00
m_stimPlanTimeIndexToPlot . uiCapability () -> setUiHidden ( true );
2017-02-15 12:16:01 +01:00
}
}
else
{
2019-09-06 10:40:57 +02:00
m_stimPlanTimeIndexToPlot . uiCapability () -> setUiHidden ( true );
2017-02-15 12:16:01 +01:00
}
2017-01-10 10:53:54 +01:00
}
2017-01-10 13:37:50 +01:00
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
2017-01-10 13:37:50 +01:00
//--------------------------------------------------------------------------------------------------
2019-09-06 10:40:57 +02:00
void RimFracture :: defineEditorAttribute ( const caf :: PdmFieldHandle * field ,
QString uiConfigName ,
caf :: PdmUiEditorAttribute * attribute )
2017-01-10 13:37:50 +01:00
{
2019-09-06 10:40:57 +02:00
if ( field == & m_azimuth )
2017-01-10 13:37:50 +01:00
{
2019-09-06 10:40:57 +02:00
caf :: PdmUiDoubleSliderEditorAttribute * myAttr = dynamic_cast < caf :: PdmUiDoubleSliderEditorAttribute *> ( attribute );
if ( myAttr )
2017-01-10 13:37:50 +01:00
{
myAttr -> m_minimum = 0 ;
myAttr -> m_maximum = 360 ;
}
}
2017-04-18 15:23:26 +02:00
2019-09-06 10:40:57 +02:00
if ( field == & m_perforationEfficiency )
2017-04-18 15:23:26 +02:00
{
2019-09-06 10:40:57 +02:00
caf :: PdmUiDoubleSliderEditorAttribute * myAttr = dynamic_cast < caf :: PdmUiDoubleSliderEditorAttribute *> ( attribute );
if ( myAttr )
2017-04-18 15:23:26 +02:00
{
myAttr -> m_minimum = 0 ;
myAttr -> m_maximum = 1.0 ;
}
}
2019-01-16 14:57:43 +01:00
2019-09-06 10:40:57 +02:00
if ( field == & m_createEllipseFractureTemplate )
2019-01-16 14:57:43 +01:00
{
2019-09-06 10:40:57 +02:00
auto myAttr = dynamic_cast < caf :: PdmUiPushButtonEditorAttribute *> ( attribute );
2019-01-16 14:57:43 +01:00
myAttr -> m_buttonText = "Ellipse Template" ;
}
2019-09-06 10:40:57 +02:00
if ( field == & m_createStimPlanFractureTemplate )
2019-01-16 14:57:43 +01:00
{
2019-09-06 10:40:57 +02:00
auto myAttr = dynamic_cast < caf :: PdmUiPushButtonEditorAttribute *> ( attribute );
2019-01-16 14:57:43 +01:00
myAttr -> m_buttonText = "StimPlan Template" ;
}
2017-01-10 13:37:50 +01:00
}
2017-02-15 11:29:44 +01:00
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
2017-01-19 10:43:23 +01:00
//--------------------------------------------------------------------------------------------------
2019-09-06 10:40:57 +02:00
void RimFracture :: setAnchorPosition ( const cvf :: Vec3d & pos )
2017-01-19 10:43:23 +01:00
{
m_anchorPosition = pos ;
2017-06-16 14:13:42 +02:00
}
2017-01-19 10:43:23 +01:00
2017-06-20 14:46:58 +02:00
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
2017-06-20 14:46:58 +02:00
//--------------------------------------------------------------------------------------------------
RiaEclipseUnitTools :: UnitSystem RimFracture :: fractureUnit () const
{
return m_fractureUnit ();
}
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
2017-06-20 14:46:58 +02:00
//--------------------------------------------------------------------------------------------------
2019-09-06 10:40:57 +02:00
void RimFracture :: setFractureUnit ( RiaEclipseUnitTools :: UnitSystem unitSystem )
2017-06-20 14:46:58 +02:00
{
m_fractureUnit = unitSystem ;
}
2017-06-20 11:18:19 +02:00
//--------------------------------------------------------------------------------------------------
2018-05-30 14:01:50 +02:00
///
2017-06-20 11:18:19 +02:00
//--------------------------------------------------------------------------------------------------
2019-09-06 10:40:57 +02:00
bool RimFracture :: isEclipseCellOpenForFlow ( const RigMainGrid * mainGrid ,
const std :: set < size_t >& reservoirCellIndicesOpenForFlow ,
size_t globalCellIndex ) const
2017-06-20 11:18:19 +02:00
{
2019-09-06 10:40:57 +02:00
CVF_ASSERT ( fractureTemplate () );
if ( ! fractureTemplate () -> fractureContainment () -> isEnabled () ) return true ;
2017-06-20 11:18:19 +02:00
2019-09-06 10:40:57 +02:00
return fractureTemplate () -> fractureContainment () -> isEclipseCellOpenForFlow ( mainGrid ,
globalCellIndex ,
reservoirCellIndicesOpenForFlow );
2017-06-20 11:18:19 +02:00
}
2017-01-19 10:43:23 +01:00
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
2017-01-19 10:43:23 +01:00
//--------------------------------------------------------------------------------------------------
2019-09-06 10:40:57 +02:00
void RimFracture :: setFractureTemplate ( RimFractureTemplate * fractureTemplate )
2017-01-19 10:43:23 +01:00
{
2019-09-06 10:40:57 +02:00
setFractureTemplateNoUpdate ( fractureTemplate );
2017-02-23 09:22:19 +01:00
2019-09-06 10:40:57 +02:00
if ( ! fractureTemplate )
2018-01-03 11:50:34 +01:00
{
return ;
}
2019-09-06 10:40:57 +02:00
RimStimPlanFractureTemplate * stimPlanFracTemplate = dynamic_cast < RimStimPlanFractureTemplate *> ( fractureTemplate );
if ( stimPlanFracTemplate )
2017-02-23 09:22:19 +01:00
{
2018-01-12 10:21:10 +01:00
m_stimPlanTimeIndexToPlot = stimPlanFracTemplate -> activeTimeStepIndex ();
2017-02-23 09:22:19 +01:00
}
2019-09-06 10:40:57 +02:00
if ( fractureTemplate -> orientationType () == RimFractureTemplate :: AZIMUTH )
2017-06-29 15:06:44 +02:00
{
2018-02-08 11:34:18 +01:00
m_azimuth = fractureTemplate -> azimuthAngle ();
2017-06-29 15:06:44 +02:00
}
else
{
this -> updateAzimuthBasedOnWellAzimuthAngle ();
}
2018-08-10 15:04:56 +02:00
this -> m_wellDiameter = fractureTemplate -> wellDiameter ();
2018-02-21 10:10:22 +01:00
this -> m_perforationLength = fractureTemplate -> perforationLength ();
2018-08-15 09:44:27 +02:00
clearCachedNonDarcyProperties ();
2017-01-19 10:43:23 +01:00
}
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
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
//--------------------------------------------------------------------------------------------------
2018-08-10 15:04:56 +02:00
///
2017-01-19 07:28:04 +01:00
//--------------------------------------------------------------------------------------------------
RivWellFracturePartMgr * RimFracture :: fracturePartManager ()
{
2019-09-06 10:40:57 +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
}