From eb532f0872ae85c1f8e0d9a809777dc464787644 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Tue, 8 Sep 2020 11:59:51 +0200 Subject: [PATCH] #6425 Fracture Model: Export Asymmetric.frk file. --- .../FileInterface/CMakeLists_files.cmake | 2 + .../RifFractureModelAsymmetricFrkExporter.cpp | 106 ++++++++++++++++++ .../RifFractureModelAsymmetricFrkExporter.h | 43 +++++++ .../RifFractureModelPlotExporter.cpp | 4 +- .../Completions/RimFractureModel.cpp | 65 +++++++++++ .../Completions/RimFractureModel.h | 13 +++ 6 files changed, 232 insertions(+), 1 deletion(-) create mode 100644 ApplicationCode/FileInterface/RifFractureModelAsymmetricFrkExporter.cpp create mode 100644 ApplicationCode/FileInterface/RifFractureModelAsymmetricFrkExporter.h diff --git a/ApplicationCode/FileInterface/CMakeLists_files.cmake b/ApplicationCode/FileInterface/CMakeLists_files.cmake index 2563ca3a0a..38042d29e8 100644 --- a/ApplicationCode/FileInterface/CMakeLists_files.cmake +++ b/ApplicationCode/FileInterface/CMakeLists_files.cmake @@ -58,6 +58,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RifFractureModelPlotExporter.h ${CMAKE_CURRENT_LIST_DIR}/RifFractureModelGeologicalFrkExporter.h ${CMAKE_CURRENT_LIST_DIR}/RifFractureModelDeviationFrkExporter.h ${CMAKE_CURRENT_LIST_DIR}/RifFractureModelPerfsFrkExporter.h +${CMAKE_CURRENT_LIST_DIR}/RifFractureModelAsymmetricFrkExporter.h ${CMAKE_CURRENT_LIST_DIR}/RifSurfaceExporter.h @@ -122,6 +123,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RifFractureModelPlotExporter.cpp ${CMAKE_CURRENT_LIST_DIR}/RifFractureModelGeologicalFrkExporter.cpp ${CMAKE_CURRENT_LIST_DIR}/RifFractureModelDeviationFrkExporter.cpp ${CMAKE_CURRENT_LIST_DIR}/RifFractureModelPerfsFrkExporter.cpp +${CMAKE_CURRENT_LIST_DIR}/RifFractureModelAsymmetricFrkExporter.cpp ${CMAKE_CURRENT_LIST_DIR}/RifSurfaceExporter.cpp # HDF5 file reader is directly included in ResInsight main CmakeList.txt diff --git a/ApplicationCode/FileInterface/RifFractureModelAsymmetricFrkExporter.cpp b/ApplicationCode/FileInterface/RifFractureModelAsymmetricFrkExporter.cpp new file mode 100644 index 0000000000..e3e7150da0 --- /dev/null +++ b/ApplicationCode/FileInterface/RifFractureModelAsymmetricFrkExporter.cpp @@ -0,0 +1,106 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2020- Equinor 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RifFractureModelAsymmetricFrkExporter.h" + +#include "RimFractureModel.h" +#include "RimFractureModelPlot.h" + +#include +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RifFractureModelAsymmetricFrkExporter::writeToFile( RimFractureModelPlot* plot, const QString& filepath ) +{ + RimFractureModel* fractureModel = plot->fractureModel(); + if ( !fractureModel ) + { + return false; + } + + QFile data( filepath ); + if ( !data.open( QFile::WriteOnly | QFile::Truncate ) ) + { + return false; + } + + QTextStream stream( &data ); + appendHeaderToStream( stream ); + + double bedDipDeg = fractureModel->formationDip(); + bool hasBarrier = fractureModel->hasBarrier(); + double distanceToBarrier = fractureModel->distanceToBarrier(); + double barrierDip = fractureModel->barrierDip(); + int wellPenetrationLayer = fractureModel->wellPenetrationLayer(); + + appendBarrierDataToStream( stream, + bedDipDeg, + hasBarrier, + RiaEclipseUnitTools::meterToFeet( distanceToBarrier ), + barrierDip, + wellPenetrationLayer ); + + appendFooterToStream( stream ); + + return true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifFractureModelAsymmetricFrkExporter::appendHeaderToStream( QTextStream& stream ) +{ + stream << "" << endl << "" << endl; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifFractureModelAsymmetricFrkExporter::appendBarrierDataToStream( QTextStream& stream, + double bedDipDeg, + bool hasBarrier, + double distanceToBarrier, + double barrierDipDeg, + int wellPenetrationLayer ) +{ + stream << "" << endl + << bedDipDeg << endl + << "" << endl + << "" << endl + << static_cast( hasBarrier ) << endl + << "" << endl + << "" << endl + << barrierDipDeg << endl + << "" << endl + << "" << endl + << distanceToBarrier << endl + << "" << endl + << "" << endl + << wellPenetrationLayer << endl + << "" << endl; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifFractureModelAsymmetricFrkExporter::appendFooterToStream( QTextStream& stream ) +{ + stream << "" << endl; +} diff --git a/ApplicationCode/FileInterface/RifFractureModelAsymmetricFrkExporter.h b/ApplicationCode/FileInterface/RifFractureModelAsymmetricFrkExporter.h new file mode 100644 index 0000000000..74fa553fcb --- /dev/null +++ b/ApplicationCode/FileInterface/RifFractureModelAsymmetricFrkExporter.h @@ -0,0 +1,43 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2020- Equinor 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +class RimFractureModelPlot; + +class QString; +class QTextStream; + +//================================================================================================== +// +//================================================================================================== +class RifFractureModelAsymmetricFrkExporter +{ +public: + static bool writeToFile( RimFractureModelPlot* plot, const QString& filepath ); + +private: + static void appendHeaderToStream( QTextStream& stream ); + static void appendBarrierDataToStream( QTextStream& stream, + double bedDipDeg, + bool hasBarrier, + double distanceToBarrier, + double barrierDipDeg, + int wellPenetrationLayer ); + static void appendFooterToStream( QTextStream& stream ); +}; diff --git a/ApplicationCode/FileInterface/RifFractureModelPlotExporter.cpp b/ApplicationCode/FileInterface/RifFractureModelPlotExporter.cpp index 6391b3f610..cd736dbea5 100644 --- a/ApplicationCode/FileInterface/RifFractureModelPlotExporter.cpp +++ b/ApplicationCode/FileInterface/RifFractureModelPlotExporter.cpp @@ -18,6 +18,7 @@ #include "RifFractureModelPlotExporter.h" +#include "RifFractureModelAsymmetricFrkExporter.h" #include "RifFractureModelDeviationFrkExporter.h" #include "RifFractureModelGeologicalFrkExporter.h" #include "RifFractureModelPerfsFrkExporter.h" @@ -33,5 +34,6 @@ bool RifFractureModelPlotExporter::writeToDirectory( RimFractureModelPlot* plot, { return RifFractureModelGeologicalFrkExporter::writeToFile( plot, useDetailedFluidLoss, directoryPath + "/Geological.frk" ) && RifFractureModelDeviationFrkExporter::writeToFile( plot, directoryPath + "/Deviation.frk" ) && - RifFractureModelPerfsFrkExporter::writeToFile( plot, directoryPath + "/Perfs.frk" ); + RifFractureModelPerfsFrkExporter::writeToFile( plot, directoryPath + "/Perfs.frk" ) && + RifFractureModelAsymmetricFrkExporter::writeToFile( plot, directoryPath + "/Asymmetric.frk" ); } diff --git a/ApplicationCode/ProjectDataModel/Completions/RimFractureModel.cpp b/ApplicationCode/ProjectDataModel/Completions/RimFractureModel.cpp index fb5a52770a..7ae9d5aba4 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimFractureModel.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimFractureModel.cpp @@ -226,6 +226,14 @@ RimFractureModel::RimFractureModel() "", "" ); + CAF_PDM_InitScriptableField( &m_formationDip, "FormationDip", 0.0, "Formation Dip", "", "", "" ); + m_formationDip.uiCapability()->setUiReadOnly( true ); + + CAF_PDM_InitScriptableField( &m_hasBarrier, "Barrier", true, "Barrier", "", "", "" ); + CAF_PDM_InitScriptableField( &m_distanceToBarrier, "DistanceToBarrier", 0.0, "Distance To Barrier [m]", "", "", "" ); + CAF_PDM_InitScriptableField( &m_barrierDip, "BarrierDip", 0.0, "Barrier Dip", "", "", "" ); + CAF_PDM_InitScriptableField( &m_wellPenetrationLayer, "WellPenetrationLayer", 0, "Well Penetration Layer", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_elasticProperties, "ElasticProperties", "Elastic Properties", "", "", "" ); m_elasticProperties.uiCapability()->setUiHidden( true ); m_elasticProperties.uiCapability()->setUiTreeHidden( true ); @@ -452,6 +460,7 @@ void RimFractureModel::updateThicknessDirection() } m_thicknessDirection = direction; + m_formationDip = calculateFormationDip( direction ); if ( m_thicknessDirectionWellPath ) { @@ -581,6 +590,13 @@ void RimFractureModel::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin caf::PdmUiOrdering* perforationGroup = uiOrdering.addNewGroup( "Perforation" ); perforationGroup->add( &m_perforationLength ); perforationGroup->add( &m_fractureOrientation ); + + caf::PdmUiOrdering* asymmetricGroup = uiOrdering.addNewGroup( "Asymmetric" ); + asymmetricGroup->add( &m_formationDip ); + asymmetricGroup->add( &m_hasBarrier ); + asymmetricGroup->add( &m_distanceToBarrier ); + asymmetricGroup->add( &m_barrierDip ); + asymmetricGroup->add( &m_wellPenetrationLayer ); } //-------------------------------------------------------------------------------------------------- @@ -669,6 +685,15 @@ void RimFractureModel::findThicknessTargetPoints( cvf::Vec3d& topPosition, cvf:: RiaLogging::info( QString( "Bottom: %1" ).arg( RimFractureModel::vecToString( bottomPosition ) ) ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimFractureModel::calculateFormationDip( const cvf::Vec3d& direction ) +{ + // Formation dip is inclination of a plane from horizontal. + return cvf::Math::toDegrees( cvf::GeometryTools::getAngle( direction, -cvf::Vec3d::Z_AXIS ) ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1059,3 +1084,43 @@ RimFractureModel::FractureOrientation RimFractureModel::fractureOrientation() co { return m_fractureOrientation(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimFractureModel::formationDip() const +{ + return m_formationDip; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimFractureModel::hasBarrier() const +{ + return m_hasBarrier; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimFractureModel::distanceToBarrier() const +{ + return m_distanceToBarrier; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimFractureModel::barrierDip() const +{ + return m_barrierDip; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RimFractureModel::wellPenetrationLayer() const +{ + return m_wellPenetrationLayer; +} diff --git a/ApplicationCode/ProjectDataModel/Completions/RimFractureModel.h b/ApplicationCode/ProjectDataModel/Completions/RimFractureModel.h index 3eab348acc..f216ee1114 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimFractureModel.h +++ b/ApplicationCode/ProjectDataModel/Completions/RimFractureModel.h @@ -101,6 +101,12 @@ public: double perforationLength() const; FractureOrientation fractureOrientation() const; + double formationDip() const; + bool hasBarrier() const; + double distanceToBarrier() const; + double barrierDip() const; + int wellPenetrationLayer() const; + // RimWellPathCompletionsInterface overrides. RiaDefines::WellPathComponentType componentType() const override; QString componentLabel() const override; @@ -141,6 +147,7 @@ private: void updateThicknessDirection(); cvf::Vec3d calculateTSTDirection() const; void findThicknessTargetPoints( cvf::Vec3d& topPosition, cvf::Vec3d& bottomPosition ); + static double calculateFormationDip( const cvf::Vec3d& direction ); static QString vecToString( const cvf::Vec3d& vec ); void updateThicknessDirectionWellPathName(); static double computeDefaultStressDepth(); @@ -184,4 +191,10 @@ protected: caf::PdmField> m_fractureOrientation; caf::PdmField m_perforationLength; + + caf::PdmField m_formationDip; + caf::PdmField m_hasBarrier; + caf::PdmField m_distanceToBarrier; + caf::PdmField m_barrierDip; + caf::PdmField m_wellPenetrationLayer; };