From 9f0a6c62235f5ac628c231d1a64ec59c27591e7c Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Tue, 30 Jun 2020 07:18:07 +0200 Subject: [PATCH 1/8] #6038 Add support for overburden and underburden. --- .../RicNewFractureModelPlotFeature.cpp | 4 + .../Completions/RimFractureModel.cpp | 174 ++++++++++++++++++ .../Completions/RimFractureModel.h | 31 +++- .../RimElasticPropertiesCurve.cpp | 135 ++++++++++++-- .../RimElasticPropertiesCurve.h | 24 ++- .../RimFractureModelCurve.cpp | 81 ++++++++ .../ProjectDataModel/RimFractureModelCurve.h | 12 ++ .../ProjectDataModel/RimLayerCurve.cpp | 47 +++-- .../ProjectDataModel/RimWellLogTrack.cpp | 113 +++++++++++- .../ProjectDataModel/RimWellLogTrack.h | 8 + 10 files changed, 590 insertions(+), 39 deletions(-) diff --git a/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.cpp b/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.cpp index 2257aed67d..0c002319be 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.cpp @@ -215,6 +215,8 @@ void RicNewFractureModelPlotFeature::createFormationTrack( RimFractureModelPlot* formationTrack->setFormationCase( eclipseCase ); formationTrack->setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType::FORMATION_ANNOTATIONS ); formationTrack->setVisibleXRange( 0.0, 0.0 ); + formationTrack->setOverburdenHeight( fractureModel->overburdenHeight() ); + formationTrack->setUnderburdenHeight( fractureModel->underburdenHeight() ); formationTrack->setColSpan( RimPlot::ONE ); } @@ -232,6 +234,8 @@ void RicNewFractureModelPlotFeature::createFaciesTrack( RimFractureModelPlot* pl faciesTrack->setFormationCase( eclipseCase ); faciesTrack->setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType::RESULT_PROPERTY_ANNOTATIONS ); faciesTrack->setRegionPropertyResultType( RiaDefines::ResultCatType::INPUT_PROPERTY, defaultProperty ); + faciesTrack->setOverburdenHeight( fractureModel->overburdenHeight() ); + faciesTrack->setUnderburdenHeight( fractureModel->underburdenHeight() ); RimColorLegend* faciesColors = RimProject::current()->colorLegendCollection()->findByName( RiaDefines::faciesColorLegendName() ); diff --git a/ApplicationCode/ProjectDataModel/Completions/RimFractureModel.cpp b/ApplicationCode/ProjectDataModel/Completions/RimFractureModel.cpp index 182def720c..bd3e72afe4 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimFractureModel.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimFractureModel.cpp @@ -30,6 +30,9 @@ #include "RigWellPath.h" #include "Rim3dView.h" +#include "RimColorLegend.h" +#include "RimColorLegendCollection.h" +#include "RimColorLegendItem.h" #include "RimEclipseCase.h" #include "RimEclipseCellColors.h" #include "RimEclipseView.h" @@ -115,6 +118,18 @@ RimFractureModel::RimFractureModel() CAF_PDM_InitField( &m_verticalStressGradient, "VerticalStressGradient", 0.238, "Vertical Stress Gradient", "", "", "" ); CAF_PDM_InitField( &m_stressDepth, "StressDepth", 1000.0, "Stress Depth", "", "", "" ); + CAF_PDM_InitField( &m_overburdenHeight, "OverburdenHeight", 50.0, "Overburden Height", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_overburdenFormation, "OverburdenFormation", "Overburden Formation", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_overburdenFacies, "OverburdenFacies", "Overburden Facies", "", "", "" ); + CAF_PDM_InitField( &m_overburdenPorosity, "OverburdenPorosity", 0.0, "Overburden Porosity", "", "", "" ); + CAF_PDM_InitField( &m_overburdenPermeability, "OverburdenPermeability", 10.0e-6, "Overburden Permeability", "", "", "" ); + + CAF_PDM_InitField( &m_underburdenHeight, "UnderburdenHeight", 50.0, "Underburden Height", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_underburdenFormation, "UnderburdenFormation", "Underburden Formation", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_underburdenFacies, "UnderburdenFacies", "Underburden Facies", "", "", "" ); + CAF_PDM_InitField( &m_underburdenPorosity, "UnderburdenPorosity", 0.0, "Underburden Porosity", "", "", "" ); + CAF_PDM_InitField( &m_underburdenPermeability, "UnderburdenPermeability", 10.0e-6, "Underburden Permeability", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_elasticProperties, "ElasticProperties", "Elastic Properties", "", "", "" ); m_elasticProperties.uiCapability()->setUiHidden( true ); m_elasticProperties.uiCapability()->setUiTreeHidden( true ); @@ -176,6 +191,45 @@ void RimFractureModel::fieldChangedByUi( const caf::PdmFieldHandle* changedField } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList RimFractureModel::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, + bool* useOptionsOnly ) +{ + QList options; + + if ( fieldNeedingOptions == &m_overburdenFormation || fieldNeedingOptions == &m_underburdenFormation ) + { + // Find an eclipse case + RimProject* proj = RimProject::current(); + if ( proj->eclipseCases().empty() ) return options; + + RimEclipseCase* eclipseCase = proj->eclipseCases()[0]; + if ( !eclipseCase ) return options; + + RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData(); + if ( !eclipseCaseData ) return options; + + std::vector formationNames = eclipseCase->eclipseCaseData()->formationNames(); + for ( const QString& formationName : formationNames ) + { + options.push_back( caf::PdmOptionItemInfo( formationName, formationName ) ); + } + } + else if ( fieldNeedingOptions == &m_overburdenFacies || fieldNeedingOptions == &m_underburdenFacies ) + { + RimColorLegend* faciesColors = RimProject::current()->colorLegendCollection()->findByName( "Facies colors" ); + + for ( RimColorLegendItem* item : faciesColors->colorLegendItems() ) + { + options.push_back( caf::PdmOptionItemInfo( item->categoryName(), item->categoryName() ) ); + } + } + + return options; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -530,6 +584,46 @@ double RimFractureModel::getDefaultForMissingValue( const QString& keyword ) con } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimFractureModel::getDefaultForMissingOverburdenValue( const QString& keyword ) const +{ + if ( keyword == QString( "PORO" ) ) + { + return defaultOverburdenPorosity(); + } + else if ( keyword == QString( "PERMX" ) || keyword == QString( "PERMZ" ) ) + { + return defaultOverburdenPermeability(); + } + else + { + RiaLogging::error( QString( "Missing default overburden value for %1." ).arg( keyword ) ); + return std::numeric_limits::infinity(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimFractureModel::getDefaultForMissingUnderburdenValue( const QString& keyword ) const +{ + if ( keyword == QString( "PORO" ) ) + { + return defaultUnderburdenPorosity(); + } + else if ( keyword == QString( "PERMX" ) || keyword == QString( "PERMZ" ) ) + { + return defaultUnderburdenPermeability(); + } + else + { + RiaLogging::error( QString( "Missing default underburden value for %1." ).arg( keyword ) ); + return std::numeric_limits::infinity(); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -553,3 +647,83 @@ double RimFractureModel::stressDepth() const { return m_stressDepth; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimFractureModel::overburdenHeight() const +{ + return m_overburdenHeight; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimFractureModel::underburdenHeight() const +{ + return m_underburdenHeight; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimFractureModel::defaultOverburdenPorosity() const +{ + return m_overburdenPorosity; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimFractureModel::defaultUnderburdenPorosity() const +{ + return m_underburdenPorosity; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimFractureModel::defaultOverburdenPermeability() const +{ + return m_overburdenPermeability; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimFractureModel::defaultUnderburdenPermeability() const +{ + return m_underburdenPermeability; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimFractureModel::overburdenFormation() const +{ + return m_overburdenFormation; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimFractureModel::overburdenFacies() const +{ + return m_overburdenFacies; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimFractureModel::underburdenFormation() const +{ + return m_underburdenFormation; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimFractureModel::underburdenFacies() const +{ + return m_underburdenFacies; +} diff --git a/ApplicationCode/ProjectDataModel/Completions/RimFractureModel.h b/ApplicationCode/ProjectDataModel/Completions/RimFractureModel.h index 8a2c9f71ca..7e68929973 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimFractureModel.h +++ b/ApplicationCode/ProjectDataModel/Completions/RimFractureModel.h @@ -67,6 +67,21 @@ public: double verticalStressGradient() const; double stressDepth() const; + double overburdenHeight() const; + double underburdenHeight() const; + + double defaultOverburdenPorosity() const; + double defaultUnderburdenPorosity() const; + + double defaultOverburdenPermeability() const; + double defaultUnderburdenPermeability() const; + + QString overburdenFormation() const; + QString overburdenFacies() const; + + QString underburdenFormation() const; + QString underburdenFacies() const; + // RimWellPathCompletionsInterface overrides. RiaDefines::WellPathComponentType componentType() const override; QString componentLabel() const override; @@ -85,10 +100,14 @@ public: void setElasticProperties( RimElasticProperties* elasticProperties ); RimElasticProperties* elasticProperties() const; + double getDefaultForMissingOverburdenValue( const QString& keyword ) const; + double getDefaultForMissingUnderburdenValue( const QString& keyword ) const; double getDefaultForMissingValue( const QString& keyword ) const; protected: - void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, + bool* useOptionsOnly ) override; private: void updatePositionFromMeasuredDepth(); @@ -112,4 +131,14 @@ protected: caf::PdmField m_verticalStress; caf::PdmField m_verticalStressGradient; caf::PdmField m_stressDepth; + caf::PdmField m_overburdenHeight; + caf::PdmField m_overburdenPorosity; + caf::PdmField m_overburdenPermeability; + caf::PdmField m_overburdenFormation; + caf::PdmField m_overburdenFacies; + caf::PdmField m_underburdenHeight; + caf::PdmField m_underburdenPorosity; + caf::PdmField m_underburdenPermeability; + caf::PdmField m_underburdenFormation; + caf::PdmField m_underburdenFacies; }; diff --git a/ApplicationCode/ProjectDataModel/RimElasticPropertiesCurve.cpp b/ApplicationCode/ProjectDataModel/RimElasticPropertiesCurve.cpp index 2bea6dbafe..c73d257738 100644 --- a/ApplicationCode/ProjectDataModel/RimElasticPropertiesCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimElasticPropertiesCurve.cpp @@ -169,16 +169,11 @@ void RimElasticPropertiesCurve::performDataExtraction( bool* isUsingPseudoLength CurveSamplingPointData curveData = RimWellLogTrack::curveSamplingPointData( &eclExtractor, formationResultAccessor.p() ); + std::vector formationValues = curveData.data; + std::vector> yValues; std::vector formationNamesVector = RimWellLogTrack::formationNamesVector( eclipseCase ); - std::vector formationNamesToPlot; - RimWellLogTrack::findRegionNamesToPlot( curveData, - formationNamesVector, - RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH, - &formationNamesToPlot, - &yValues ); - // Extract facies data m_eclipseResultDefinition->setResultVariable( "OPERNUM_1" ); m_eclipseResultDefinition->setResultType( RiaDefines::ResultCatType::INPUT_PROPERTY ); @@ -229,12 +224,49 @@ void RimElasticPropertiesCurve::performDataExtraction( bool* isUsingPseudoLength return; } + double overburdenHeight = m_fractureModel->overburdenHeight(); + if ( overburdenHeight > 0.0 ) + { + double defaultPoroValue = m_fractureModel->defaultOverburdenPorosity(); + QString overburdenFormation = m_fractureModel->overburdenFormation(); + QString overburdenFacies = m_fractureModel->overburdenFacies(); + + addOverburden( formationNamesVector, + formationValues, + faciesValues, + tvDepthValues, + measuredDepthValues, + overburdenHeight, + defaultPoroValue, + overburdenFormation, + findFaciesValue( *colorLegend, overburdenFacies ) ); + } + + double underburdenHeight = m_fractureModel->underburdenHeight(); + if ( underburdenHeight > 0.0 ) + { + double defaultPoroValue = m_fractureModel->defaultUnderburdenPorosity(); + QString underburdenFormation = m_fractureModel->underburdenFormation(); + QString underburdenFacies = m_fractureModel->underburdenFacies(); + + addUnderburden( formationNamesVector, + formationValues, + faciesValues, + tvDepthValues, + measuredDepthValues, + underburdenHeight, + defaultPoroValue, + underburdenFormation, + findFaciesValue( *colorLegend, underburdenFacies ) ); + } + for ( size_t i = 0; i < tvDepthValues.size(); i++ ) { // TODO: get from somewhere?? QString fieldName = "Norne"; QString faciesName = findFaciesName( *colorLegend, faciesValues[i] ); - QString formationName = findFormationNameForDepth( formationNamesToPlot, yValues, tvDepthValues[i] ); + int idx = static_cast( formationValues[i] ); + QString formationName = formationNamesVector[idx]; double porosity = poroValues[i]; FaciesKey faciesKey = std::make_tuple( fieldName, formationName, faciesName ); @@ -344,22 +376,14 @@ QString RimElasticPropertiesCurve::findFaciesName( const RimColorLegend& colorLe //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RimElasticPropertiesCurve::findFormationNameForDepth( const std::vector& formationNames, - const std::vector>& depthRanges, - double depth ) +double RimElasticPropertiesCurve::findFaciesValue( const RimColorLegend& colorLegend, const QString& name ) { - // assert(formationNames.size() == depthRanges.size()); - for ( size_t i = 0; i < formationNames.size(); i++ ) + for ( auto item : colorLegend.colorLegendItems() ) { - double high = depthRanges[i].second; - double low = depthRanges[i].first; - if ( depth >= low && depth <= high ) - { - return formationNames[i]; - } + if ( item->categoryName() == name ) return item->categoryValue(); } - return "not found"; + return std::numeric_limits::infinity(); } //-------------------------------------------------------------------------------------------------- @@ -369,3 +393,74 @@ QString RimElasticPropertiesCurve::createCurveAutoName() { return caf::AppEnum::uiText( m_propertyType() ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimElasticPropertiesCurve::addOverburden( std::vector& formationNames, + std::vector& formationValues, + std::vector& faciesValues, + std::vector& tvDepthValues, + std::vector& measuredDepthValues, + double overburdenHeight, + double defaultPoroValue, + const QString& formationName, + double faciesValue ) +{ + if ( !faciesValues.empty() ) + { + // Prepend the new "fake" depth for start of overburden + double tvdTop = tvDepthValues[0]; + tvDepthValues.insert( tvDepthValues.begin(), tvdTop ); + tvDepthValues.insert( tvDepthValues.begin(), tvdTop - overburdenHeight ); + + // TODO: this is not always correct + double mdTop = measuredDepthValues[0]; + measuredDepthValues.insert( measuredDepthValues.begin(), mdTop ); + measuredDepthValues.insert( measuredDepthValues.begin(), mdTop - overburdenHeight ); + + formationNames.push_back( formationName ); + + formationValues.insert( formationValues.begin(), formationNames.size() - 1 ); + formationValues.insert( formationValues.begin(), formationNames.size() - 1 ); + + faciesValues.insert( faciesValues.begin(), faciesValue ); + faciesValues.insert( faciesValues.begin(), faciesValue ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimElasticPropertiesCurve::addUnderburden( std::vector& formationNames, + std::vector& formationValues, + std::vector& faciesValues, + std::vector& tvDepthValues, + std::vector& measuredDepthValues, + double underburdenHeight, + double defaultPoroValue, + const QString& formationName, + double faciesValue ) +{ + if ( !faciesValues.empty() ) + { + size_t lastIndex = tvDepthValues.size() - 1; + + double tvdBottom = tvDepthValues[lastIndex]; + tvDepthValues.push_back( tvdBottom ); + tvDepthValues.push_back( tvdBottom + underburdenHeight ); + + // TODO: this is not always correct + double mdBottom = measuredDepthValues[lastIndex]; + measuredDepthValues.push_back( mdBottom ); + measuredDepthValues.push_back( mdBottom + underburdenHeight ); + + formationNames.push_back( formationName ); + + formationValues.push_back( formationNames.size() - 1 ); + formationValues.push_back( formationNames.size() - 1 ); + + faciesValues.push_back( faciesValue ); + faciesValues.push_back( faciesValue ); + } +} diff --git a/ApplicationCode/ProjectDataModel/RimElasticPropertiesCurve.h b/ApplicationCode/ProjectDataModel/RimElasticPropertiesCurve.h index dffde03d7d..1d3a259fc2 100644 --- a/ApplicationCode/ProjectDataModel/RimElasticPropertiesCurve.h +++ b/ApplicationCode/ProjectDataModel/RimElasticPropertiesCurve.h @@ -67,9 +67,27 @@ protected: void performDataExtraction( bool* isUsingPseudoLength ) override; static QString findFaciesName( const RimColorLegend& colorLegend, double value ); - static QString findFormationNameForDepth( const std::vector& formationNames, - const std::vector>& depthRanges, - double depth ); + static double findFaciesValue( const RimColorLegend& colorLegend, const QString& name ); + + static void addOverburden( std::vector& formationNames, + std::vector& formationValues, + std::vector& faciesValues, + std::vector& tvDepthValues, + std::vector& measuredDepthValues, + double overburdenHeight, + double defaultPoroValue, + const QString& formationName, + double faciesValue ); + + static void addUnderburden( std::vector& formationNames, + std::vector& formationValues, + std::vector& faciesValues, + std::vector& tvDepthValues, + std::vector& measuredDepthValues, + double overburdenHeight, + double defaultPoroValue, + const QString& formationName, + double faciesValue ); caf::PdmPtrField m_fractureModel; caf::PdmField> m_propertyType; diff --git a/ApplicationCode/ProjectDataModel/RimFractureModelCurve.cpp b/ApplicationCode/ProjectDataModel/RimFractureModelCurve.cpp index b811b336d7..c1825fea71 100644 --- a/ApplicationCode/ProjectDataModel/RimFractureModelCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimFractureModelCurve.cpp @@ -154,6 +154,32 @@ void RimFractureModelCurve::performDataExtraction( bool* isUsingPseudoLength ) std::cerr << "RESULT ACCESSOR IS NULL" << std::endl; } + double overburdenHeight = m_fractureModel->overburdenHeight(); + if ( overburdenHeight > 0.0 ) + { + double defaultOverburdenValue = std::numeric_limits::infinity(); + if ( m_missingValueStrategy() == RimFractureModelCurve::MissingValueStrategy::DEFAULT_VALUE ) + { + defaultOverburdenValue = + m_fractureModel->getDefaultForMissingOverburdenValue( m_eclipseResultDefinition()->resultVariable() ); + } + + addOverburden( tvDepthValues, measuredDepthValues, values, overburdenHeight, defaultOverburdenValue ); + } + + double underburdenHeight = m_fractureModel->underburdenHeight(); + if ( underburdenHeight > 0.0 ) + { + double defaultUnderburdenValue = std::numeric_limits::infinity(); + if ( m_missingValueStrategy() == RimFractureModelCurve::MissingValueStrategy::DEFAULT_VALUE ) + { + defaultUnderburdenValue = + m_fractureModel->getDefaultForMissingUnderburdenValue( m_eclipseResultDefinition()->resultVariable() ); + } + + addUnderburden( tvDepthValues, measuredDepthValues, values, underburdenHeight, defaultUnderburdenValue ); + } + if ( hasMissingValues( values ) ) { if ( m_missingValueStrategy() == RimFractureModelCurve::MissingValueStrategy::DEFAULT_VALUE ) @@ -319,3 +345,58 @@ cvf::ref return nullptr; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFractureModelCurve::addOverburden( std::vector& tvDepthValues, + std::vector& measuredDepthValues, + std::vector& values, + double overburdenHeight, + double defaultOverburdenValue ) +{ + if ( !values.empty() ) + { + // Prepend the new "fake" depth for start of overburden + double tvdTop = tvDepthValues[0]; + tvDepthValues.insert( tvDepthValues.begin(), tvdTop ); + tvDepthValues.insert( tvDepthValues.begin(), tvdTop - overburdenHeight ); + + // TODO: this is not always correct + double mdTop = measuredDepthValues[0]; + measuredDepthValues.insert( measuredDepthValues.begin(), mdTop ); + measuredDepthValues.insert( measuredDepthValues.begin(), mdTop - overburdenHeight ); + + values.insert( values.begin(), defaultOverburdenValue ); + values.insert( values.begin(), defaultOverburdenValue ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFractureModelCurve::addUnderburden( std::vector& tvDepthValues, + std::vector& measuredDepthValues, + std::vector& values, + double underburdenHeight, + double defaultUnderburdenValue ) +{ + if ( !values.empty() ) + { + size_t lastIndex = tvDepthValues.size() - 1; + + // Append the new "fake" depth for start of underburden + double tvdBottom = tvDepthValues[lastIndex]; + tvDepthValues.push_back( tvdBottom ); + tvDepthValues.push_back( tvdBottom + underburdenHeight ); + + // Append the new "fake" md + // TODO: check if this is correct??? + double mdBottom = measuredDepthValues[lastIndex]; + measuredDepthValues.push_back( mdBottom ); + measuredDepthValues.push_back( mdBottom + underburdenHeight ); + + values.push_back( defaultUnderburdenValue ); + values.push_back( defaultUnderburdenValue ); + } +} diff --git a/ApplicationCode/ProjectDataModel/RimFractureModelCurve.h b/ApplicationCode/ProjectDataModel/RimFractureModelCurve.h index 56df242e99..ad70367187 100644 --- a/ApplicationCode/ProjectDataModel/RimFractureModelCurve.h +++ b/ApplicationCode/ProjectDataModel/RimFractureModelCurve.h @@ -69,6 +69,18 @@ protected: int timeStepIndex, RimEclipseResultDefinition* eclipseResultDefinition ); + static void addOverburden( std::vector& tvDepthValues, + std::vector& measuredDepthValues, + std::vector& values, + double overburdenHeight, + double defaultOverburdenValue ); + + static void addUnderburden( std::vector& tvDepthValues, + std::vector& measuredDepthValues, + std::vector& values, + double underburdenHeight, + double defaultUnderburdenValue ); + caf::PdmPtrField m_fractureModel; caf::PdmField> m_missingValueStrategy; }; diff --git a/ApplicationCode/ProjectDataModel/RimLayerCurve.cpp b/ApplicationCode/ProjectDataModel/RimLayerCurve.cpp index 0b2be77028..7473c5adbb 100644 --- a/ApplicationCode/ProjectDataModel/RimLayerCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimLayerCurve.cpp @@ -126,9 +126,7 @@ void RimLayerCurve::performDataExtraction( bool* isUsingPseudoLength ) m_fractureModel->thicknessDirectionWellPath()->wellPathGeometry(), "fracture model" ); - measuredDepthValues = eclExtractor.cellIntersectionMDs(); - tvDepthValues = eclExtractor.cellIntersectionTVDs(); - rkbDiff = eclExtractor.wellPathData()->rkbDiff(); + rkbDiff = eclExtractor.wellPathData()->rkbDiff(); // Extract formation data cvf::ref formationResultAccessor = RigResultAccessorFactory:: @@ -150,6 +148,21 @@ void RimLayerCurve::performDataExtraction( bool* isUsingPseudoLength ) std::vector> yValues; std::vector formationNamesVector = RimWellLogTrack::formationNamesVector( eclipseCase ); + double overburdenHeight = m_fractureModel->overburdenHeight(); + if ( overburdenHeight > 0.0 ) + { + RimWellLogTrack::addOverburden( formationNamesVector, curveData, overburdenHeight ); + } + + double underburdenHeight = m_fractureModel->underburdenHeight(); + if ( underburdenHeight > 0.0 ) + { + RimWellLogTrack::addUnderburden( formationNamesVector, curveData, underburdenHeight ); + } + + measuredDepthValues = curveData.md; + tvDepthValues = curveData.tvd; + std::vector formationNamesToPlot; RimWellLogTrack::findRegionNamesToPlot( curveData, formationNamesVector, @@ -177,23 +190,35 @@ void RimLayerCurve::performDataExtraction( bool* isUsingPseudoLength ) std::vector faciesValues; eclExtractor.curveData( faciesResultAccessor.p(), &faciesValues ); + if ( overburdenHeight > 0.0 ) + { + faciesValues.insert( faciesValues.begin(), std::numeric_limits::infinity() ); + faciesValues.insert( faciesValues.begin(), std::numeric_limits::infinity() ); + } + + if ( underburdenHeight > 0.0 ) + { + faciesValues.push_back( std::numeric_limits::infinity() ); + faciesValues.push_back( std::numeric_limits::infinity() ); + } + + assert( faciesValues.size() == curveData.data.size() ); values.resize( faciesValues.size() ); - int layerNo = 0; - QString previousFormationName = ""; - double previousFacies = -1.0; + int layerNo = 0; + double previousFormation = -1.0; + double previousFacies = -1.0; for ( size_t i = 0; i < faciesValues.size(); i++ ) { - QString formationName = findFormationNameForDepth( formationNamesToPlot, yValues, tvDepthValues[i] ); - if ( previousFormationName != formationName || previousFacies != faciesValues[i] ) + if ( previousFormation != curveData.data[i] || previousFacies != faciesValues[i] ) { layerNo++; } - values[i] = layerNo; - previousFormationName = formationName; - previousFacies = faciesValues[i]; + values[i] = layerNo; + previousFormation = curveData.data[i]; + previousFacies = faciesValues[i]; } RiaEclipseUnitTools::UnitSystem eclipseUnitsType = eclipseCase->eclipseCaseData()->unitsType(); diff --git a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp index c67ab1b23d..251783bfad 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp @@ -259,6 +259,11 @@ RimWellLogTrack::RimWellLogTrack() CAF_PDM_InitFieldNoDefault( &m_wellPathComponentSource, "AttributesWellPathSource", "Well Path", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_wellPathAttributeCollection, "AttributesCollection", "Well Attributes", "", "", "" ); + CAF_PDM_InitField( &m_overburdenHeight, "OverburdenHeight", 0.0, "Overburden Height", "", "", "" ); + m_overburdenHeight.uiCapability()->setUiHidden( true ); + CAF_PDM_InitField( &m_underburdenHeight, "UnderburdenHeight", 0.0, "Underburden Height", "", "", "" ); + m_underburdenHeight.uiCapability()->setUiHidden( true ); + CAF_PDM_InitFieldNoDefault( &m_resultDefinition, "ResultDefinition", "Result Definition", "", "", "" ); m_resultDefinition.uiCapability()->setUiHidden( true ); m_resultDefinition.uiCapability()->setUiTreeChildrenHidden( true ); @@ -2393,11 +2398,11 @@ void RimWellLogTrack::updateFormationNamesOnPlot() extractor = geoMechWellLogExtractor; } - // Attach water and rock base formations - const std::pair xRange = std::make_pair( m_visibleXRangeMin(), m_visibleXRangeMax() ); - if ( geoMechWellLogExtractor ) { + // Attach water and rock base formations + const std::pair xRange = std::make_pair( m_visibleXRangeMin(), m_visibleXRangeMax() ); + const caf::ColorTable waterAndRockColors = RiaColorTables::waterAndRockPaletteColors(); const std::vector> waterAndRockIntervals = waterAndRockRegions( plot->depthType(), extractor ); @@ -2419,9 +2424,21 @@ void RimWellLogTrack::updateFormationNamesOnPlot() m_formationCase == nullptr ) return; - std::vector> yValues; std::vector formationNamesVector = RimWellLogTrack::formationNamesVector( m_formationCase ); + std::cout << "Burden: over=" << m_overburdenHeight() << " under=" << m_underburdenHeight() << std::endl; + if ( m_overburdenHeight > 0.0 ) + { + addOverburden( formationNamesVector, curveData, m_overburdenHeight ); + } + + if ( m_underburdenHeight > 0.0 ) + { + addUnderburden( formationNamesVector, curveData, m_underburdenHeight ); + } + + std::vector> yValues; + std::vector formationNamesToPlot; RimWellLogTrack::findRegionNamesToPlot( curveData, formationNamesVector, @@ -2429,6 +2446,18 @@ void RimWellLogTrack::updateFormationNamesOnPlot() &formationNamesToPlot, &yValues ); + for ( auto n : formationNamesToPlot ) + { + std::cout << "Formation names: " << n.toStdString() << std::endl; + } + + for ( size_t i = 0; i < curveData.data.size(); i++ ) + { + std::cout << "Curve data[" << i << "]: " << curveData.tvd[i] << " " << curveData.data[i] << std::endl; + } + + const std::pair xRange = std::make_pair( m_visibleXRangeMin(), m_visibleXRangeMax() ); + caf::ColorTable colorTable( m_colorShadingLegend->colorArray() ); m_annotationTool->attachNamedRegions( m_plotWidget, formationNamesToPlot, @@ -2492,6 +2521,16 @@ void RimWellLogTrack::updateResultPropertyNamesOnPlot() namesVector.push_back( legendItem->categoryName() ); } + if ( m_overburdenHeight > 0.0 ) + { + addOverburden( namesVector, curveData, m_overburdenHeight ); + } + + if ( m_underburdenHeight > 0.0 ) + { + addUnderburden( namesVector, curveData, m_underburdenHeight ); + } + std::vector namesToPlot; std::vector> yValues; RimWellLogTrack::findRegionNamesToPlot( curveData, namesVector, plot->depthType(), &namesToPlot, &yValues ); @@ -2767,3 +2806,69 @@ void RimWellLogTrack::onChildDeleted( caf::PdmChildArrayFieldHandle* childA RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); mainPlotWindow->updateWellLogPlotToolBar(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogTrack::setOverburdenHeight( double overburdenHeight ) +{ + m_overburdenHeight = overburdenHeight; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogTrack::setUnderburdenHeight( double underburdenHeight ) +{ + m_underburdenHeight = underburdenHeight; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogTrack::addOverburden( std::vector& namesVector, CurveSamplingPointData& curveData, double height ) +{ + if ( !curveData.data.empty() ) + { + namesVector.push_back( "Overburden" ); + + // Prepend the new "fake" depth for start of overburden + double tvdTop = curveData.tvd[0]; + curveData.tvd.insert( curveData.tvd.begin(), tvdTop ); + curveData.tvd.insert( curveData.tvd.begin(), tvdTop - height ); + + // TODO: this is not always correct + double mdTop = curveData.md[0]; + curveData.md.insert( curveData.md.begin(), mdTop ); + curveData.md.insert( curveData.md.begin(), mdTop - height ); + + curveData.data.insert( curveData.data.begin(), namesVector.size() - 1 ); + curveData.data.insert( curveData.data.begin(), namesVector.size() - 1 ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogTrack::addUnderburden( std::vector& namesVector, CurveSamplingPointData& curveData, double height ) +{ + if ( !curveData.data.empty() ) + { + namesVector.push_back( "Underburden" ); + + size_t lastIndex = curveData.tvd.size() - 1; + + // Append the new "fake" depth for start of underburden + double tvdBottom = curveData.tvd[lastIndex]; + curveData.tvd.push_back( tvdBottom ); + curveData.tvd.push_back( tvdBottom + height ); + + // TODO: this is not always correct + double mdBottom = curveData.md[lastIndex]; + curveData.md.push_back( mdBottom ); + curveData.md.push_back( mdBottom + height ); + + curveData.data.push_back( namesVector.size() - 1 ); + curveData.data.push_back( namesVector.size() - 1 ); + } +} diff --git a/ApplicationCode/ProjectDataModel/RimWellLogTrack.h b/ApplicationCode/ProjectDataModel/RimWellLogTrack.h index 48583bd3a9..f93d0cd07d 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogTrack.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogTrack.h @@ -182,6 +182,9 @@ public: void setShowBothSidesOfWell( bool on ); void setWellPathAttributesSource( RimWellPath* wellPath ); + void setOverburdenHeight( double overburdenHeight ); + void setUnderburdenHeight( double underburdenHeight ); + RimWellPath* wellPathAttributeSource() const; caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override; @@ -222,6 +225,9 @@ public: static std::vector formationNamesVector( RimCase* rimCase ); + static void addOverburden( std::vector& namesVector, CurveSamplingPointData& curveData, double height ); + static void addUnderburden( std::vector& namesVector, CurveSamplingPointData& curveData, double height ); + protected: // RimViewWindow overrides void deleteViewWidget() override; @@ -331,6 +337,8 @@ private: caf::PdmPtrField m_wellPathComponentSource; caf::PdmPtrField m_wellPathAttributeCollection; caf::PdmChildField m_resultDefinition; + caf::PdmField m_overburdenHeight; + caf::PdmField m_underburdenHeight; caf::PdmField m_showFormations_OBSOLETE; caf::PdmField m_show_OBSOLETE; From 3425031e27c7839487dc2d948185e0f11ac55d9a Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Tue, 30 Jun 2020 14:10:44 +0200 Subject: [PATCH 2/8] #6038 Avoid crashing when facies colors does not exist. --- .../ProjectDataModel/Completions/RimFractureModel.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/Completions/RimFractureModel.cpp b/ApplicationCode/ProjectDataModel/Completions/RimFractureModel.cpp index bd3e72afe4..403299b2ce 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimFractureModel.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimFractureModel.cpp @@ -220,10 +220,12 @@ QList RimFractureModel::calculateValueOptions( const caf else if ( fieldNeedingOptions == &m_overburdenFacies || fieldNeedingOptions == &m_underburdenFacies ) { RimColorLegend* faciesColors = RimProject::current()->colorLegendCollection()->findByName( "Facies colors" ); - - for ( RimColorLegendItem* item : faciesColors->colorLegendItems() ) + if ( faciesColors ) { - options.push_back( caf::PdmOptionItemInfo( item->categoryName(), item->categoryName() ) ); + for ( RimColorLegendItem* item : faciesColors->colorLegendItems() ) + { + options.push_back( caf::PdmOptionItemInfo( item->categoryName(), item->categoryName() ) ); + } } } From 6744628fb0b04dba28c25a9180c3bf0d217d8da6 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Tue, 30 Jun 2020 15:12:22 +0200 Subject: [PATCH 3/8] Use values from facies curves when calculating layers. --- .../ProjectDataModel/RimFractureModelPlot.cpp | 17 +++++ .../ProjectDataModel/RimFractureModelPlot.h | 1 + .../ProjectDataModel/RimLayerCurve.cpp | 72 ++----------------- 3 files changed, 23 insertions(+), 67 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimFractureModelPlot.cpp b/ApplicationCode/ProjectDataModel/RimFractureModelPlot.cpp index 47a78744a1..7916eccc6f 100644 --- a/ApplicationCode/ProjectDataModel/RimFractureModelPlot.cpp +++ b/ApplicationCode/ProjectDataModel/RimFractureModelPlot.cpp @@ -106,6 +106,23 @@ void RimFractureModelPlot::getPorosityValues( std::vector& values ) cons } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFractureModelPlot::getFaciesValues( std::vector& values ) const +{ + std::vector curves; + descendantsIncludingThisOfType( curves ); + + for ( RimFractureModelCurve* curve : curves ) + { + if ( curve->eclipseResultVariable() == "OPERNUM_1" ) + { + values = curve->curveData()->xValues(); + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimFractureModelPlot.h b/ApplicationCode/ProjectDataModel/RimFractureModelPlot.h index 0fb0b26c36..92fee6d031 100644 --- a/ApplicationCode/ProjectDataModel/RimFractureModelPlot.h +++ b/ApplicationCode/ProjectDataModel/RimFractureModelPlot.h @@ -37,6 +37,7 @@ public: void setFractureModel( RimFractureModel* fractureModel ); void getPorosityValues( std::vector& values ) const; + void getFaciesValues( std::vector& values ) const; std::vector calculateTrueVerticalDepth() const; std::vector calculatePorosity() const; diff --git a/ApplicationCode/ProjectDataModel/RimLayerCurve.cpp b/ApplicationCode/ProjectDataModel/RimLayerCurve.cpp index 7473c5adbb..41a7ca0efd 100644 --- a/ApplicationCode/ProjectDataModel/RimLayerCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimLayerCurve.cpp @@ -145,7 +145,6 @@ void RimLayerCurve::performDataExtraction( bool* isUsingPseudoLength ) CurveSamplingPointData curveData = RimWellLogTrack::curveSamplingPointData( &eclExtractor, formationResultAccessor.p() ); - std::vector> yValues; std::vector formationNamesVector = RimWellLogTrack::formationNamesVector( eclipseCase ); double overburdenHeight = m_fractureModel->overburdenHeight(); @@ -163,44 +162,17 @@ void RimLayerCurve::performDataExtraction( bool* isUsingPseudoLength ) measuredDepthValues = curveData.md; tvDepthValues = curveData.tvd; - std::vector formationNamesToPlot; - RimWellLogTrack::findRegionNamesToPlot( curveData, - formationNamesVector, - RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH, - &formationNamesToPlot, - &yValues ); - // Extract facies data - m_eclipseResultDefinition->setResultVariable( "OPERNUM_1" ); - m_eclipseResultDefinition->setResultType( RiaDefines::ResultCatType::INPUT_PROPERTY ); - m_eclipseResultDefinition->setEclipseCase( eclipseCase ); - m_eclipseResultDefinition->loadResult(); - - cvf::ref faciesResultAccessor = - RigResultAccessorFactory::createFromResultDefinition( eclipseCase->eclipseCaseData(), - 0, - m_timeStep, - m_eclipseResultDefinition ); - - if ( !faciesResultAccessor.notNull() ) + RimFractureModelPlot* fractureModelPlot; + firstAncestorOrThisOfType( fractureModelPlot ); + if ( !fractureModelPlot ) { - RiaLogging::error( QString( "No facies result found." ) ); + RiaLogging::error( QString( "No facies data found for layer curve." ) ); return; } std::vector faciesValues; - eclExtractor.curveData( faciesResultAccessor.p(), &faciesValues ); - if ( overburdenHeight > 0.0 ) - { - faciesValues.insert( faciesValues.begin(), std::numeric_limits::infinity() ); - faciesValues.insert( faciesValues.begin(), std::numeric_limits::infinity() ); - } - - if ( underburdenHeight > 0.0 ) - { - faciesValues.push_back( std::numeric_limits::infinity() ); - faciesValues.push_back( std::numeric_limits::infinity() ); - } + fractureModelPlot->getFaciesValues( faciesValues ); assert( faciesValues.size() == curveData.data.size() ); @@ -256,40 +228,6 @@ void RimLayerCurve::performDataExtraction( bool* isUsingPseudoLength ) } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -// QString RimLayerCurve::findFaciesName( const RimColorLegend& colorLegend, double value ) -// { -// for ( auto item : colorLegend.colorLegendItems() ) -// { -// if ( item->categoryValue() == static_cast( value ) ) return item->categoryName(); -// } - -// return "not found"; -// } - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RimLayerCurve::findFormationNameForDepth( const std::vector& formationNames, - const std::vector>& depthRanges, - double depth ) -{ - // assert(formationNames.size() == depthRanges.size()); - for ( size_t i = 0; i < formationNames.size(); i++ ) - { - double high = depthRanges[i].second; - double low = depthRanges[i].first; - if ( depth >= low && depth <= high ) - { - return formationNames[i]; - } - } - - return "not found"; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- From 6bda75b38e5783346029234f17851790e7277502 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Tue, 30 Jun 2020 22:39:55 +0200 Subject: [PATCH 4/8] #6089 Display stress and stress gradient in fracture model plot. --- .../RicNewFractureModelPlotFeature.cpp | 50 +++++ .../RicNewFractureModelPlotFeature.h | 7 + .../ProjectDataModel/CMakeLists_files.cmake | 2 + .../RimFractureModelStressCurve.cpp | 192 ++++++++++++++++++ .../RimFractureModelStressCurve.h | 63 ++++++ 5 files changed, 314 insertions(+) create mode 100644 ApplicationCode/ProjectDataModel/RimFractureModelStressCurve.cpp create mode 100644 ApplicationCode/ProjectDataModel/RimFractureModelStressCurve.h diff --git a/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.cpp b/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.cpp index 0c002319be..3e335f76ad 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.cpp @@ -144,6 +144,12 @@ RimFractureModelPlot* } } + { + auto task = progInfo.task( "Creating stress track", 2 ); + createStressTrack( plot, fractureModel, eclipseCase, timeStep, RimFractureModelStressCurve::PropertyType::STRESS ); + createStressTrack( plot, fractureModel, eclipseCase, timeStep, RimFractureModelStressCurve::PropertyType::STRESS_GRADIENT ); + } + { auto task = progInfo.task( "Updating all tracks", 5 ); @@ -438,6 +444,50 @@ void RicNewFractureModelPlotFeature::createElasticPropertiesTrack( RimFractureMo RiuPlotMainWindowTools::showPlotMainWindow(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewFractureModelPlotFeature::createStressTrack( RimFractureModelPlot* plot, + RimFractureModel* fractureModel, + RimEclipseCase* eclipseCase, + int timeStep, + RimFractureModelStressCurve::PropertyType propertyType ) +{ + QString trackName = caf::AppEnum::uiText( propertyType ); + RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, trackName, plot ); + plotTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR ); + plotTrack->setLogarithmicScale( false ); + plotTrack->setShowRegionLabels( true ); + plotTrack->setShowWindow( true ); + plotTrack->setColSpan( RimPlot::TWO ); + + caf::ColorTable colors = RiaColorTables::wellLogPlotPaletteColors(); + + RimFractureModelStressCurve* curve = new RimFractureModelStressCurve; + curve->setPropertyType( propertyType ); + curve->setFractureModel( fractureModel ); + curve->setCase( eclipseCase ); + curve->setColor( colors.cycledColor3f( 0 ) ); + curve->setLineStyle( RiuQwtPlotCurve::STYLE_SOLID ); + curve->setLineThickness( 2 ); + curve->setUiName( trackName ); + curve->setAutoNameComponents( false, false, false, false, false ); + + plotTrack->addCurve( curve ); + plotTrack->setAutoScaleXEnabled( true ); + curve->loadDataAndUpdate( true ); + + curve->updateConnectedEditors(); + plotTrack->updateConnectedEditors(); + plot->updateConnectedEditors(); + + RiaApplication::instance()->project()->updateConnectedEditors(); + + RiaGuiApplication::instance()->getOrCreateMainPlotWindow(); + RiuPlotMainWindowTools::selectAsCurrentItem( curve ); + RiuPlotMainWindowTools::showPlotMainWindow(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.h b/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.h index 1cf82942e9..2e617afe5e 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.h +++ b/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.h @@ -24,6 +24,7 @@ #include "RimElasticPropertiesCurve.h" #include "RimFractureModelCurve.h" +#include "RimFractureModelStressCurve.h" class RimEclipseCase; class RimFractureModelPlot; @@ -71,6 +72,12 @@ private: int timeStep, RimElasticPropertiesCurve::PropertyType propertyType ); + static void createStressTrack( RimFractureModelPlot* plot, + RimFractureModel* fractureModel, + RimEclipseCase* eclipseCase, + int timeStep, + RimFractureModelStressCurve::PropertyType propertyType ); + static RimFractureModelPlot* createFractureModelPlot( bool showAfterCreation, const QString& plotDescription ); static RimFractureModelPlotCollection* fractureModelPlotCollection(); diff --git a/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake b/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake index 1c54674072..0f32a2902d 100644 --- a/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake +++ b/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake @@ -161,6 +161,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimFractureModelCurve.h ${CMAKE_CURRENT_LIST_DIR}/RimElasticProperties.h ${CMAKE_CURRENT_LIST_DIR}/RimElasticPropertiesCurve.h ${CMAKE_CURRENT_LIST_DIR}/RimLayerCurve.h +${CMAKE_CURRENT_LIST_DIR}/RimFractureModelStressCurve.h ) @@ -326,6 +327,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimFractureModelCurve.cpp ${CMAKE_CURRENT_LIST_DIR}/RimElasticProperties.cpp ${CMAKE_CURRENT_LIST_DIR}/RimElasticPropertiesCurve.cpp ${CMAKE_CURRENT_LIST_DIR}/RimLayerCurve.cpp +${CMAKE_CURRENT_LIST_DIR}/RimFractureModelStressCurve.cpp ) list(APPEND CODE_HEADER_FILES diff --git a/ApplicationCode/ProjectDataModel/RimFractureModelStressCurve.cpp b/ApplicationCode/ProjectDataModel/RimFractureModelStressCurve.cpp new file mode 100644 index 0000000000..e7d0139b6e --- /dev/null +++ b/ApplicationCode/ProjectDataModel/RimFractureModelStressCurve.cpp @@ -0,0 +1,192 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 "RimFractureModelStressCurve.h" + +#include "RiaDefines.h" +#include "RigEclipseCaseData.h" +#include "RigEclipseWellLogExtractor.h" +#include "RigResultAccessorFactory.h" +#include "RigWellLogCurveData.h" +#include "RigWellPath.h" +#include "RigWellPathGeometryTools.h" + +#include "RimCase.h" +#include "RimEclipseCase.h" +#include "RimFractureModel.h" +#include "RimFractureModelPlot.h" +#include "RimModeledWellPath.h" +#include "RimWellLogFile.h" +#include "RimWellLogPlot.h" +#include "RimWellPath.h" +#include "RimWellPathCollection.h" +#include "RimWellPlotTools.h" + +#include "RiaLogging.h" + +#include "cafPdmUiTreeOrdering.h" + +CAF_PDM_SOURCE_INIT( RimFractureModelStressCurve, "RimFractureModelStressCurve" ); + +namespace caf +{ +template <> +void AppEnum::setUp() +{ + addItem( RimFractureModelStressCurve::PropertyType::STRESS, "STRESS", "Stress" ); + addItem( RimFractureModelStressCurve::PropertyType::STRESS_GRADIENT, "STRESS_GRADIENT", "Stress Gradient" ); + setDefault( RimFractureModelStressCurve::PropertyType::STRESS ); +} +}; // namespace caf + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimFractureModelStressCurve::RimFractureModelStressCurve() +{ + CAF_PDM_InitObject( "Fracture Model Curve", "", "", "" ); + + CAF_PDM_InitFieldNoDefault( &m_fractureModel, "FractureModel", "Fracture Model", "", "", "" ); + m_fractureModel.uiCapability()->setUiTreeChildrenHidden( true ); + m_fractureModel.uiCapability()->setUiHidden( true ); + + CAF_PDM_InitFieldNoDefault( &m_propertyType, "PropertyType", "Property Type", "", "", "" ); + + m_wellPath = nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimFractureModelStressCurve::~RimFractureModelStressCurve() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFractureModelStressCurve::setPropertyType( PropertyType propertyType ) +{ + m_propertyType = propertyType; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFractureModelStressCurve::setFractureModel( RimFractureModel* fractureModel ) +{ + m_fractureModel = fractureModel; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFractureModelStressCurve::performDataExtraction( bool* isUsingPseudoLength ) +{ + std::vector values; + std::vector measuredDepthValues; + std::vector tvDepthValues; + double rkbDiff = 0.0; + + RiaDefines::DepthUnitType depthUnit = RiaDefines::DepthUnitType::UNIT_METER; + QString xUnits = RiaWellLogUnitTools::noUnitString(); + + *isUsingPseudoLength = false; + + // Extract porosity data: get the porosity values from parent + RimFractureModelPlot* fractureModelPlot; + firstAncestorOrThisOfType( fractureModelPlot ); + if ( !fractureModelPlot ) + { + RiaLogging::error( QString( "No fracture model plot found." ) ); + return; + } + + std::vector tvDepthInFeet = fractureModelPlot->calculateTrueVerticalDepth(); + for ( double f : tvDepthInFeet ) + { + tvDepthValues.push_back( RiaEclipseUnitTools::feetToMeter( f ) ); + } + + if ( m_propertyType() == PropertyType::STRESS ) + { + values = fractureModelPlot->calculateStress(); + } + else + { + values = fractureModelPlot->calculateStressGradient(); + } + + RimEclipseCase* eclipseCase = dynamic_cast( m_case.value() ); + if ( eclipseCase ) + { + RigWellPath* wellPathGeometry = m_fractureModel->thicknessDirectionWellPath()->wellPathGeometry(); + RigEclipseWellLogExtractor eclExtractor( eclipseCase->eclipseCaseData(), wellPathGeometry, "fracture model" ); + + rkbDiff = eclExtractor.wellPathData()->rkbDiff(); + + // Generate MD data by interpolation + const std::vector& mdValuesOfWellPath = wellPathGeometry->measureDepths(); + std::vector tvdValuesOfWellPath = wellPathGeometry->trueVerticalDepths(); + + measuredDepthValues = + RigWellPathGeometryTools::interpolateMdFromTvd( mdValuesOfWellPath, tvdValuesOfWellPath, tvDepthValues ); + CVF_ASSERT( measuredDepthValues.size() == tvDepthValues.size() ); + } + + RiaEclipseUnitTools::UnitSystem eclipseUnitsType = eclipseCase->eclipseCaseData()->unitsType(); + if ( eclipseUnitsType == RiaEclipseUnitTools::UnitSystem::UNITS_FIELD ) + { + // See https://github.com/OPM/ResInsight/issues/538 + + depthUnit = RiaDefines::DepthUnitType::UNIT_FEET; + } + + bool performDataSmoothing = false; + if ( !values.empty() && !measuredDepthValues.empty() ) + { + if ( tvDepthValues.empty() ) + { + this->setValuesAndDepths( values, + measuredDepthValues, + RiaDefines::DepthTypeEnum::MEASURED_DEPTH, + 0.0, + depthUnit, + !performDataSmoothing, + xUnits ); + } + else + { + this->setValuesWithMdAndTVD( values, + measuredDepthValues, + tvDepthValues, + rkbDiff, + depthUnit, + !performDataSmoothing, + xUnits ); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimFractureModelStressCurve::createCurveAutoName() +{ + return caf::AppEnum::uiText( m_propertyType() ); +} diff --git a/ApplicationCode/ProjectDataModel/RimFractureModelStressCurve.h b/ApplicationCode/ProjectDataModel/RimFractureModelStressCurve.h new file mode 100644 index 0000000000..4eeb125e47 --- /dev/null +++ b/ApplicationCode/ProjectDataModel/RimFractureModelStressCurve.h @@ -0,0 +1,63 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 + +#include "RimWellLogExtractionCurve.h" + +#include "RiuQwtSymbol.h" + +#include "cafPdmField.h" +#include "cafPdmPtrField.h" + +#include + +class RimWellPath; +class RimWellMeasurement; +class RimFractureModel; +class RimColorLegend; + +//================================================================================================== +/// +//================================================================================================== +class RimFractureModelStressCurve : public RimWellLogExtractionCurve +{ + CAF_PDM_HEADER_INIT; + +public: + enum class PropertyType + { + STRESS, + STRESS_GRADIENT + }; + + RimFractureModelStressCurve(); + ~RimFractureModelStressCurve() override; + + void setFractureModel( RimFractureModel* fractureModel ); + + void setPropertyType( PropertyType propertyType ); + +protected: + QString createCurveAutoName() override; + + void performDataExtraction( bool* isUsingPseudoLength ) override; + + caf::PdmPtrField m_fractureModel; + caf::PdmField> m_propertyType; +}; From 9ab2a4d279ccc19ec33cd279edfa47ccd0e7f03b Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Tue, 30 Jun 2020 22:53:59 +0200 Subject: [PATCH 5/8] Remove debug logging to stdout/stderr --- .../ProjectDataModel/RimFractureModelCurve.cpp | 2 +- ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimFractureModelCurve.cpp b/ApplicationCode/ProjectDataModel/RimFractureModelCurve.cpp index c1825fea71..561b85ebcd 100644 --- a/ApplicationCode/ProjectDataModel/RimFractureModelCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimFractureModelCurve.cpp @@ -151,7 +151,7 @@ void RimFractureModelCurve::performDataExtraction( bool* isUsingPseudoLength ) } else { - std::cerr << "RESULT ACCESSOR IS NULL" << std::endl; + RiaLogging::error( QString( "No result found for %1" ).arg( m_eclipseResultDefinition()->resultVariable() ) ); } double overburdenHeight = m_fractureModel->overburdenHeight(); diff --git a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp index 251783bfad..6e6edfe063 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp @@ -2426,7 +2426,6 @@ void RimWellLogTrack::updateFormationNamesOnPlot() std::vector formationNamesVector = RimWellLogTrack::formationNamesVector( m_formationCase ); - std::cout << "Burden: over=" << m_overburdenHeight() << " under=" << m_underburdenHeight() << std::endl; if ( m_overburdenHeight > 0.0 ) { addOverburden( formationNamesVector, curveData, m_overburdenHeight ); @@ -2446,16 +2445,6 @@ void RimWellLogTrack::updateFormationNamesOnPlot() &formationNamesToPlot, &yValues ); - for ( auto n : formationNamesToPlot ) - { - std::cout << "Formation names: " << n.toStdString() << std::endl; - } - - for ( size_t i = 0; i < curveData.data.size(); i++ ) - { - std::cout << "Curve data[" << i << "]: " << curveData.tvd[i] << " " << curveData.data[i] << std::endl; - } - const std::pair xRange = std::make_pair( m_visibleXRangeMin(), m_visibleXRangeMax() ); caf::ColorTable colorTable( m_colorShadingLegend->colorArray() ); From cac86077073295e76e5e608e2a19fa79322084c4 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Thu, 2 Jul 2020 14:00:43 +0200 Subject: [PATCH 6/8] Use defined string for facies colors legend name. --- .../ProjectDataModel/Completions/RimFractureModel.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ApplicationCode/ProjectDataModel/Completions/RimFractureModel.cpp b/ApplicationCode/ProjectDataModel/Completions/RimFractureModel.cpp index 403299b2ce..d4557dd3e0 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimFractureModel.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimFractureModel.cpp @@ -21,6 +21,7 @@ #include "RiaColorTables.h" #include "RiaCompletionTypeCalculationScheduler.h" #include "RiaEclipseUnitTools.h" +#include "RiaFractureDefines.h" #include "RiaLogging.h" #include "Riu3DMainWindowTools.h" @@ -219,7 +220,8 @@ QList RimFractureModel::calculateValueOptions( const caf } else if ( fieldNeedingOptions == &m_overburdenFacies || fieldNeedingOptions == &m_underburdenFacies ) { - RimColorLegend* faciesColors = RimProject::current()->colorLegendCollection()->findByName( "Facies colors" ); + RimColorLegend* faciesColors = + RimProject::current()->colorLegendCollection()->findByName( RiaDefines::faciesColorLegendName() ); if ( faciesColors ) { for ( RimColorLegendItem* item : faciesColors->colorLegendItems() ) From 3c2f54049275f4d464bbbac7c8fd6a39efd5e770 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Thu, 2 Jul 2020 13:53:39 +0200 Subject: [PATCH 7/8] #6113 Use enum to identify curves in RimFractureModelPlot. --- .../Application/CMakeLists_files.cmake | 2 + .../Application/RiaFractureModelDefines.cpp | 45 +++++++ .../Application/RiaFractureModelDefines.h | 47 +++++++ .../RicNewFractureModelPlotFeature.cpp | 69 +++++----- .../RicNewFractureModelPlotFeature.h | 24 ++-- .../ProjectDataModel/CMakeLists_files.cmake | 1 + .../RimElasticPropertiesCurve.cpp | 52 ++++---- .../RimElasticPropertiesCurve.h | 22 +--- .../RimFractureModelCurve.cpp | 19 +++ .../ProjectDataModel/RimFractureModelCurve.h | 11 +- .../ProjectDataModel/RimFractureModelPlot.cpp | 119 ++++++++---------- .../ProjectDataModel/RimFractureModelPlot.h | 28 ++++- .../RimFractureModelPropertyCurve.h | 35 ++++++ .../RimFractureModelStressCurve.cpp | 30 +++-- .../RimFractureModelStressCurve.h | 10 +- .../ProjectDataModel/RimLayerCurve.cpp | 35 +++--- .../ProjectDataModel/RimLayerCurve.h | 10 +- 17 files changed, 357 insertions(+), 202 deletions(-) create mode 100644 ApplicationCode/Application/RiaFractureModelDefines.cpp create mode 100644 ApplicationCode/Application/RiaFractureModelDefines.h create mode 100644 ApplicationCode/ProjectDataModel/RimFractureModelPropertyCurve.h diff --git a/ApplicationCode/Application/CMakeLists_files.cmake b/ApplicationCode/Application/CMakeLists_files.cmake index 4dfd8fc7ca..895a22a2ca 100644 --- a/ApplicationCode/Application/CMakeLists_files.cmake +++ b/ApplicationCode/Application/CMakeLists_files.cmake @@ -19,6 +19,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiaEclipseFileNameTools.h ${CMAKE_CURRENT_LIST_DIR}/RiaFeatureCommandContext.h ${CMAKE_CURRENT_LIST_DIR}/RiaStringListSerializer.h ${CMAKE_CURRENT_LIST_DIR}/RiaNncDefines.h +${CMAKE_CURRENT_LIST_DIR}/RiaFractureModelDefines.h ) set (SOURCE_GROUP_SOURCE_FILES @@ -42,6 +43,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiaEclipseFileNameTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaFeatureCommandContext.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaStringListSerializer.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaNncDefines.cpp +${CMAKE_CURRENT_LIST_DIR}/RiaFractureModelDefines.cpp ) list(APPEND CODE_HEADER_FILES diff --git a/ApplicationCode/Application/RiaFractureModelDefines.cpp b/ApplicationCode/Application/RiaFractureModelDefines.cpp new file mode 100644 index 0000000000..a576c401cc --- /dev/null +++ b/ApplicationCode/Application/RiaFractureModelDefines.cpp @@ -0,0 +1,45 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- 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 "RiaFractureModelDefines.h" + +namespace caf +{ +template <> +void AppEnum::setUp() +{ + addItem( RiaDefines::CurveProperty::FACIES, "FACIES", "Facies" ); + addItem( RiaDefines::CurveProperty::LAYERS, "LAYERS", "Layers" ); + addItem( RiaDefines::CurveProperty::POROSITY, "POROSITY", "Porosity" ); + addItem( RiaDefines::CurveProperty::PERMEABILITY_X, "PERMEABILITY_X", "Permeability Horizontal" ); + addItem( RiaDefines::CurveProperty::PERMEABILITY_Z, "PERMEABILITY_Z", "Permeability Vertical" ); + addItem( RiaDefines::CurveProperty::INITIAL_PRESSURE, "INITIAL_PRESSURE", "Initial Pressure" ); + addItem( RiaDefines::CurveProperty::PRESSURE, "PRESSURE", "Pressure" ); + addItem( RiaDefines::CurveProperty::STRESS, "STRESS", "Stress" ); + addItem( RiaDefines::CurveProperty::STRESS_GRADIENT, "STRESS_GRADIENT", "Stress Gradient" ); + addItem( RiaDefines::CurveProperty::YOUNGS_MODULUS, "YOUNGS_MODULUS", "Young's Modulus" ); + addItem( RiaDefines::CurveProperty::POISSONS_RATIO, "POISSONS_RATIO", "Poisson's Ratio" ); + addItem( RiaDefines::CurveProperty::K_IC, "K_IC", "K-Ic" ); + addItem( RiaDefines::CurveProperty::PROPPANT_EMBEDMENT, "PROPPANT_EMBEDMENT", "Proppant Embedment" ); + addItem( RiaDefines::CurveProperty::BIOT_COEFFICIENT, "BIOT_COEFFICIENT", "Biot Coefficient" ); + addItem( RiaDefines::CurveProperty::K0, "K0", "k0" ); + addItem( RiaDefines::CurveProperty::FLUID_LOSS_COEFFICIENT, "FLUID_LOSS_COEFFICIENT", "Fluid Loss Coefficient" ); + addItem( RiaDefines::CurveProperty::SPURT_LOSS, "SPURT_LOSS", "Spurt Loss" ); + setDefault( RiaDefines::CurveProperty::FACIES ); +} +}; // namespace caf diff --git a/ApplicationCode/Application/RiaFractureModelDefines.h b/ApplicationCode/Application/RiaFractureModelDefines.h new file mode 100644 index 0000000000..9affc3bb3b --- /dev/null +++ b/ApplicationCode/Application/RiaFractureModelDefines.h @@ -0,0 +1,47 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- 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 + +#include "RiaEclipseUnitTools.h" + +#include + +namespace RiaDefines +{ +enum class CurveProperty +{ + FACIES, + LAYERS, + POROSITY, + PERMEABILITY_X, + PERMEABILITY_Z, + INITIAL_PRESSURE, + PRESSURE, + STRESS, + STRESS_GRADIENT, + YOUNGS_MODULUS, + POISSONS_RATIO, + K_IC, + PROPPANT_EMBEDMENT, + BIOT_COEFFICIENT, + K0, + FLUID_LOSS_COEFFICIENT, + SPURT_LOSS +}; +}; // namespace RiaDefines diff --git a/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.cpp b/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.cpp index 3e335f76ad..f2a974107f 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.cpp @@ -95,25 +95,30 @@ RimFractureModelPlot* plots["Porosity"] = {std::make_tuple( "PORO", RiaDefines::ResultCatType::STATIC_NATIVE, RimFractureModelCurve::MissingValueStrategy::DEFAULT_VALUE, - false )}; + false, + RiaDefines::CurveProperty::POROSITY )}; plots["Pressure"] = {std::make_tuple( "PRESSURE", RiaDefines::ResultCatType::DYNAMIC_NATIVE, RimFractureModelCurve::MissingValueStrategy::LINEAR_INTERPOLATION, - false ), + false, + RiaDefines::CurveProperty::PRESSURE ), std::make_tuple( "PRESSURE", RiaDefines::ResultCatType::DYNAMIC_NATIVE, RimFractureModelCurve::MissingValueStrategy::LINEAR_INTERPOLATION, - true )}; + true, + RiaDefines::CurveProperty::INITIAL_PRESSURE )}; plots["Permeability"] = {std::make_tuple( "PERMX", RiaDefines::ResultCatType::STATIC_NATIVE, RimFractureModelCurve::MissingValueStrategy::DEFAULT_VALUE, - false ), + false, + RiaDefines::CurveProperty::PERMEABILITY_X ), std::make_tuple( "PERMZ", RiaDefines::ResultCatType::STATIC_NATIVE, RimFractureModelCurve::MissingValueStrategy::DEFAULT_VALUE, - false )}; + false, + RiaDefines::CurveProperty::PERMEABILITY_Z )}; std::set logarithmicPlots; logarithmicPlots.insert( "Permeability" ); @@ -128,15 +133,14 @@ RimFractureModelPlot* { auto task = progInfo.task( "Creating facies properties track", 15 ); - std::vector results = - {RimElasticPropertiesCurve::PropertyType::YOUNGS_MODULUS, - RimElasticPropertiesCurve::PropertyType::POISSONS_RATIO, - RimElasticPropertiesCurve::PropertyType::K_IC, - RimElasticPropertiesCurve::PropertyType::PROPPANT_EMBEDMENT, - RimElasticPropertiesCurve::PropertyType::BIOT_COEFFICIENT, - RimElasticPropertiesCurve::PropertyType::K0, - RimElasticPropertiesCurve::PropertyType::FLUID_LOSS_COEFFICIENT, - RimElasticPropertiesCurve::PropertyType::SPURT_LOSS}; + std::vector results = {RiaDefines::CurveProperty::YOUNGS_MODULUS, + RiaDefines::CurveProperty::POISSONS_RATIO, + RiaDefines::CurveProperty::K_IC, + RiaDefines::CurveProperty::PROPPANT_EMBEDMENT, + RiaDefines::CurveProperty::BIOT_COEFFICIENT, + RiaDefines::CurveProperty::K0, + RiaDefines::CurveProperty::FLUID_LOSS_COEFFICIENT, + RiaDefines::CurveProperty::SPURT_LOSS}; for ( auto result : results ) { @@ -146,8 +150,8 @@ RimFractureModelPlot* { auto task = progInfo.task( "Creating stress track", 2 ); - createStressTrack( plot, fractureModel, eclipseCase, timeStep, RimFractureModelStressCurve::PropertyType::STRESS ); - createStressTrack( plot, fractureModel, eclipseCase, timeStep, RimFractureModelStressCurve::PropertyType::STRESS_GRADIENT ); + createStressTrack( plot, fractureModel, eclipseCase, timeStep, RiaDefines::CurveProperty::STRESS ); + createStressTrack( plot, fractureModel, eclipseCase, timeStep, RiaDefines::CurveProperty::STRESS_GRADIENT ); } { @@ -257,6 +261,7 @@ void RicNewFractureModelPlotFeature::createFaciesTrack( RimFractureModelPlot* pl RimFractureModelCurve* curve = new RimFractureModelCurve; curve->setFractureModel( fractureModel ); + curve->setCurveProperty( RiaDefines::CurveProperty::FACIES ); curve->setCase( eclipseCase ); curve->setEclipseResultCategory( RiaDefines::ResultCatType::INPUT_PROPERTY ); curve->setEclipseResultVariable( defaultProperty ); @@ -307,6 +312,7 @@ void RicNewFractureModelPlotFeature::createLayersTrack( RimFractureModelPlot* pl caf::ColorTable colors = RiaColorTables::wellLogPlotPaletteColors(); RimLayerCurve* curve = new RimLayerCurve; + curve->setCurveProperty( RiaDefines::CurveProperty::LAYERS ); curve->setFractureModel( fractureModel ); curve->setCase( eclipseCase ); curve->setColor( colors.cycledColor3f( 0 ) ); @@ -353,9 +359,10 @@ void RicNewFractureModelPlotFeature::createParametersTrack( RimFractureModelPlot RiaDefines::ResultCatType resultCategoryType = std::get<1>( curveConfig ); RimFractureModelCurve::MissingValueStrategy missingValueStrategy = std::get<2>( curveConfig ); bool fixedInitialTimeStep = std::get<3>( curveConfig ); + RiaDefines::CurveProperty curveProperty = std::get<4>( curveConfig ); RimFractureModelCurve* curve = new RimFractureModelCurve; - + curve->setCurveProperty( curveProperty ); curve->setFractureModel( fractureModel ); curve->setCase( eclipseCase ); curve->setEclipseResultVariable( resultVariable ); @@ -402,13 +409,13 @@ void RicNewFractureModelPlotFeature::createParametersTrack( RimFractureModelPlot //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicNewFractureModelPlotFeature::createElasticPropertiesTrack( RimFractureModelPlot* plot, - RimFractureModel* fractureModel, - RimEclipseCase* eclipseCase, - int timeStep, - RimElasticPropertiesCurve::PropertyType propertyType ) +void RicNewFractureModelPlotFeature::createElasticPropertiesTrack( RimFractureModelPlot* plot, + RimFractureModel* fractureModel, + RimEclipseCase* eclipseCase, + int timeStep, + RiaDefines::CurveProperty propertyType ) { - QString trackName = caf::AppEnum::uiText( propertyType ); + QString trackName = caf::AppEnum::uiText( propertyType ); RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, trackName, plot ); plotTrack->setFormationWellPath( fractureModel->thicknessDirectionWellPath() ); plotTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR ); @@ -420,7 +427,7 @@ void RicNewFractureModelPlotFeature::createElasticPropertiesTrack( RimFractureMo caf::ColorTable colors = RiaColorTables::wellLogPlotPaletteColors(); RimElasticPropertiesCurve* curve = new RimElasticPropertiesCurve; - curve->setPropertyType( propertyType ); + curve->setCurveProperty( propertyType ); curve->setFractureModel( fractureModel ); curve->setCase( eclipseCase ); curve->setColor( colors.cycledColor3f( 0 ) ); @@ -447,13 +454,13 @@ void RicNewFractureModelPlotFeature::createElasticPropertiesTrack( RimFractureMo //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicNewFractureModelPlotFeature::createStressTrack( RimFractureModelPlot* plot, - RimFractureModel* fractureModel, - RimEclipseCase* eclipseCase, - int timeStep, - RimFractureModelStressCurve::PropertyType propertyType ) +void RicNewFractureModelPlotFeature::createStressTrack( RimFractureModelPlot* plot, + RimFractureModel* fractureModel, + RimEclipseCase* eclipseCase, + int timeStep, + RiaDefines::CurveProperty propertyType ) { - QString trackName = caf::AppEnum::uiText( propertyType ); + QString trackName = caf::AppEnum::uiText( propertyType ); RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, trackName, plot ); plotTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR ); plotTrack->setLogarithmicScale( false ); @@ -464,7 +471,7 @@ void RicNewFractureModelPlotFeature::createStressTrack( RimFractureModelPlot* caf::ColorTable colors = RiaColorTables::wellLogPlotPaletteColors(); RimFractureModelStressCurve* curve = new RimFractureModelStressCurve; - curve->setPropertyType( propertyType ); + curve->setCurveProperty( propertyType ); curve->setFractureModel( fractureModel ); curve->setCase( eclipseCase ); curve->setColor( colors.cycledColor3f( 0 ) ); diff --git a/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.h b/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.h index 2e617afe5e..805894ea10 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.h +++ b/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.h @@ -31,8 +31,8 @@ class RimFractureModelPlot; class RimFractureModelPlotCollection; class RimFractureModel; -typedef std::tuple PlotDef; -typedef std::vector PlotDefVector; +typedef std::tuple PlotDef; +typedef std::vector PlotDefVector; //================================================================================================== /// @@ -66,17 +66,17 @@ private: const PlotDefVector& curveConfiguration, bool isPlotLogarithmic ); - static void createElasticPropertiesTrack( RimFractureModelPlot* plot, - RimFractureModel* fractureModel, - RimEclipseCase* eclipseCase, - int timeStep, - RimElasticPropertiesCurve::PropertyType propertyType ); + static void createElasticPropertiesTrack( RimFractureModelPlot* plot, + RimFractureModel* fractureModel, + RimEclipseCase* eclipseCase, + int timeStep, + RiaDefines::CurveProperty propertyType ); - static void createStressTrack( RimFractureModelPlot* plot, - RimFractureModel* fractureModel, - RimEclipseCase* eclipseCase, - int timeStep, - RimFractureModelStressCurve::PropertyType propertyType ); + static void createStressTrack( RimFractureModelPlot* plot, + RimFractureModel* fractureModel, + RimEclipseCase* eclipseCase, + int timeStep, + RiaDefines::CurveProperty propertyType ); static RimFractureModelPlot* createFractureModelPlot( bool showAfterCreation, const QString& plotDescription ); diff --git a/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake b/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake index 0f32a2902d..0638c13aed 100644 --- a/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake +++ b/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake @@ -162,6 +162,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimElasticProperties.h ${CMAKE_CURRENT_LIST_DIR}/RimElasticPropertiesCurve.h ${CMAKE_CURRENT_LIST_DIR}/RimLayerCurve.h ${CMAKE_CURRENT_LIST_DIR}/RimFractureModelStressCurve.h +${CMAKE_CURRENT_LIST_DIR}/RimFractureModelPropertyCurve.h ) diff --git a/ApplicationCode/ProjectDataModel/RimElasticPropertiesCurve.cpp b/ApplicationCode/ProjectDataModel/RimElasticPropertiesCurve.cpp index c73d257738..498524cfd6 100644 --- a/ApplicationCode/ProjectDataModel/RimElasticPropertiesCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimElasticPropertiesCurve.cpp @@ -59,25 +59,6 @@ CAF_PDM_SOURCE_INIT( RimElasticPropertiesCurve, "ElasticPropertiesCurve" ); -namespace caf -{ -template <> -void AppEnum::setUp() -{ - addItem( RimElasticPropertiesCurve::PropertyType::YOUNGS_MODULUS, "YOUNGS_MODULUS", "Young's Modulus" ); - addItem( RimElasticPropertiesCurve::PropertyType::POISSONS_RATIO, "POISSONS_RATIO", "Poisson's Ratio" ); - addItem( RimElasticPropertiesCurve::PropertyType::K_IC, "K_IC", "K-Ic" ); - addItem( RimElasticPropertiesCurve::PropertyType::PROPPANT_EMBEDMENT, "PROPPANT_EMBEDMENT", "Proppant Embedment" ); - addItem( RimElasticPropertiesCurve::PropertyType::BIOT_COEFFICIENT, "BIOT_COEFFICIENT", "Biot Coefficient" ); - addItem( RimElasticPropertiesCurve::PropertyType::K0, "K0", "k0" ); - addItem( RimElasticPropertiesCurve::PropertyType::FLUID_LOSS_COEFFICIENT, - "FLUID_LOSS_COEFFICIENT", - "Fluid Loss Coefficient" ); - addItem( RimElasticPropertiesCurve::PropertyType::SPURT_LOSS, "SPURT_LOSS", "Spurt Loss" ); - setDefault( RimElasticPropertiesCurve::PropertyType::YOUNGS_MODULUS ); -} -}; // namespace caf - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -89,7 +70,8 @@ RimElasticPropertiesCurve::RimElasticPropertiesCurve() m_fractureModel.uiCapability()->setUiTreeChildrenHidden( true ); m_fractureModel.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_propertyType, "PropertyType", "Property Type", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_curveProperty, "CurveProperty", "Curve Property", "", "", "" ); + m_curveProperty.uiCapability()->setUiHidden( true ); m_wellPath = nullptr; } @@ -121,9 +103,17 @@ void RimElasticPropertiesCurve::setEclipseResultCategory( RiaDefines::ResultCatT //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimElasticPropertiesCurve::setPropertyType( PropertyType propertyType ) +void RimElasticPropertiesCurve::setCurveProperty( RiaDefines::CurveProperty curveProperty ) { - m_propertyType = propertyType; + m_curveProperty = curveProperty; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaDefines::CurveProperty RimElasticPropertiesCurve::curveProperty() const +{ + return m_curveProperty(); } //-------------------------------------------------------------------------------------------------- @@ -274,42 +264,42 @@ void RimElasticPropertiesCurve::performDataExtraction( bool* isUsingPseudoLength { const RigElasticProperties& rigElasticProperties = elasticProperties->propertiesForFacies( faciesKey ); - if ( m_propertyType() == PropertyType::YOUNGS_MODULUS ) + if ( m_curveProperty() == RiaDefines::CurveProperty::YOUNGS_MODULUS ) { double val = rigElasticProperties.getYoungsModulus( porosity ); values.push_back( val ); } - else if ( m_propertyType() == PropertyType::POISSONS_RATIO ) + else if ( m_curveProperty() == RiaDefines::CurveProperty::POISSONS_RATIO ) { double val = rigElasticProperties.getPoissonsRatio( porosity ); values.push_back( val ); } - else if ( m_propertyType() == PropertyType::K_IC ) + else if ( m_curveProperty() == RiaDefines::CurveProperty::K_IC ) { double val = rigElasticProperties.getK_Ic( porosity ); values.push_back( val ); } - else if ( m_propertyType() == PropertyType::PROPPANT_EMBEDMENT ) + else if ( m_curveProperty() == RiaDefines::CurveProperty::PROPPANT_EMBEDMENT ) { double val = rigElasticProperties.getProppantEmbedment( porosity ); values.push_back( val ); } - else if ( m_propertyType() == PropertyType::BIOT_COEFFICIENT ) + else if ( m_curveProperty() == RiaDefines::CurveProperty::BIOT_COEFFICIENT ) { double val = rigElasticProperties.getBiotCoefficient( porosity ); values.push_back( val ); } - else if ( m_propertyType() == PropertyType::K0 ) + else if ( m_curveProperty() == RiaDefines::CurveProperty::K0 ) { double val = rigElasticProperties.getK0( porosity ); values.push_back( val ); } - else if ( m_propertyType() == PropertyType::FLUID_LOSS_COEFFICIENT ) + else if ( m_curveProperty() == RiaDefines::CurveProperty::FLUID_LOSS_COEFFICIENT ) { double val = rigElasticProperties.getFluidLossCoefficient( porosity ); values.push_back( val ); } - else if ( m_propertyType() == PropertyType::SPURT_LOSS ) + else if ( m_curveProperty() == RiaDefines::CurveProperty::SPURT_LOSS ) { double val = rigElasticProperties.getSpurtLoss( porosity ); values.push_back( val ); @@ -391,7 +381,7 @@ double RimElasticPropertiesCurve::findFaciesValue( const RimColorLegend& colorLe //-------------------------------------------------------------------------------------------------- QString RimElasticPropertiesCurve::createCurveAutoName() { - return caf::AppEnum::uiText( m_propertyType() ); + return caf::AppEnum::uiText( m_curveProperty() ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimElasticPropertiesCurve.h b/ApplicationCode/ProjectDataModel/RimElasticPropertiesCurve.h index 1d3a259fc2..6e9e6343b7 100644 --- a/ApplicationCode/ProjectDataModel/RimElasticPropertiesCurve.h +++ b/ApplicationCode/ProjectDataModel/RimElasticPropertiesCurve.h @@ -18,6 +18,7 @@ #pragma once +#include "RimFractureModelPropertyCurve.h" #include "RimWellLogExtractionCurve.h" #include "RiuQwtSymbol.h" @@ -35,23 +36,11 @@ class RimColorLegend; //================================================================================================== /// //================================================================================================== -class RimElasticPropertiesCurve : public RimWellLogExtractionCurve +class RimElasticPropertiesCurve : public RimWellLogExtractionCurve, public RimFractureModelPropertyCurve { CAF_PDM_HEADER_INIT; public: - enum class PropertyType - { - YOUNGS_MODULUS, - POISSONS_RATIO, - K_IC, - PROPPANT_EMBEDMENT, - BIOT_COEFFICIENT, - K0, - FLUID_LOSS_COEFFICIENT, - SPURT_LOSS - }; - RimElasticPropertiesCurve(); ~RimElasticPropertiesCurve() override; @@ -59,7 +48,8 @@ public: void setEclipseResultCategory( RiaDefines::ResultCatType catType ); - void setPropertyType( PropertyType propertyType ); + void setCurveProperty( RiaDefines::CurveProperty ) override; + RiaDefines::CurveProperty curveProperty() const override; protected: QString createCurveAutoName() override; @@ -89,6 +79,6 @@ protected: const QString& formationName, double faciesValue ); - caf::PdmPtrField m_fractureModel; - caf::PdmField> m_propertyType; + caf::PdmPtrField m_fractureModel; + caf::PdmField> m_curveProperty; }; diff --git a/ApplicationCode/ProjectDataModel/RimFractureModelCurve.cpp b/ApplicationCode/ProjectDataModel/RimFractureModelCurve.cpp index 561b85ebcd..99e699b649 100644 --- a/ApplicationCode/ProjectDataModel/RimFractureModelCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimFractureModelCurve.cpp @@ -82,6 +82,9 @@ RimFractureModelCurve::RimFractureModelCurve() CAF_PDM_InitField( &m_missingValueStrategy, "MissingValueStrategy", defaultValue, "Missing Value Strategy", "", "", "" ); m_missingValueStrategy.uiCapability()->setUiHidden( true ); + CAF_PDM_InitFieldNoDefault( &m_curveProperty, "CurveProperty", "Curve Property", "", "", "" ); + m_curveProperty.uiCapability()->setUiHidden( true ); + m_wellPath = nullptr; } @@ -109,6 +112,22 @@ void RimFractureModelCurve::setEclipseResultCategory( RiaDefines::ResultCatType m_eclipseResultDefinition->setResultType( catType ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFractureModelCurve::setCurveProperty( RiaDefines::CurveProperty curveProperty ) +{ + m_curveProperty = curveProperty; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaDefines::CurveProperty RimFractureModelCurve::curveProperty() const +{ + return m_curveProperty(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimFractureModelCurve.h b/ApplicationCode/ProjectDataModel/RimFractureModelCurve.h index ad70367187..8f58e60947 100644 --- a/ApplicationCode/ProjectDataModel/RimFractureModelCurve.h +++ b/ApplicationCode/ProjectDataModel/RimFractureModelCurve.h @@ -18,6 +18,7 @@ #pragma once +#include "RimFractureModelPropertyCurve.h" #include "RimWellLogExtractionCurve.h" #include "RiuQwtSymbol.h" @@ -37,7 +38,7 @@ class RigResultAccessor; //================================================================================================== /// //================================================================================================== -class RimFractureModelCurve : public RimWellLogExtractionCurve +class RimFractureModelCurve : public RimWellLogExtractionCurve, public RimFractureModelPropertyCurve { CAF_PDM_HEADER_INIT; @@ -57,6 +58,9 @@ public: void setMissingValueStrategy( MissingValueStrategy strategy ); + void setCurveProperty( RiaDefines::CurveProperty ) override; + RiaDefines::CurveProperty curveProperty() const override; + protected: void performDataExtraction( bool* isUsingPseudoLength ) override; @@ -81,6 +85,7 @@ protected: double underburdenHeight, double defaultUnderburdenValue ); - caf::PdmPtrField m_fractureModel; - caf::PdmField> m_missingValueStrategy; + caf::PdmPtrField m_fractureModel; + caf::PdmField> m_missingValueStrategy; + caf::PdmField> m_curveProperty; }; diff --git a/ApplicationCode/ProjectDataModel/RimFractureModelPlot.cpp b/ApplicationCode/ProjectDataModel/RimFractureModelPlot.cpp index 7916eccc6f..0982824e05 100644 --- a/ApplicationCode/ProjectDataModel/RimFractureModelPlot.cpp +++ b/ApplicationCode/ProjectDataModel/RimFractureModelPlot.cpp @@ -25,6 +25,7 @@ #include "RimEclipseCase.h" #include "RimFractureModel.h" #include "RimFractureModelCurve.h" +#include "RimFractureModelPropertyCurve.h" #include "RimLayerCurve.h" #include "RigWellLogCurveData.h" @@ -94,15 +95,10 @@ void RimFractureModelPlot::applyDataSource() //-------------------------------------------------------------------------------------------------- void RimFractureModelPlot::getPorosityValues( std::vector& values ) const { - std::vector curves; - descendantsIncludingThisOfType( curves ); - - for ( RimFractureModelCurve* curve : curves ) + RimWellLogExtractionCurve* curve = findCurveByProperty( RiaDefines::CurveProperty::POROSITY ); + if ( curve ) { - if ( curve->eclipseResultVariable() == "PORO" ) - { - values = curve->curveData()->xValues(); - } + values = curve->curveData()->xValues(); } } @@ -111,15 +107,10 @@ void RimFractureModelPlot::getPorosityValues( std::vector& values ) cons //-------------------------------------------------------------------------------------------------- void RimFractureModelPlot::getFaciesValues( std::vector& values ) const { - std::vector curves; - descendantsIncludingThisOfType( curves ); - - for ( RimFractureModelCurve* curve : curves ) + RimWellLogExtractionCurve* curve = findCurveByProperty( RiaDefines::CurveProperty::FACIES ); + if ( curve ) { - if ( curve->eclipseResultVariable() == "OPERNUM_1" ) - { - values = curve->curveData()->xValues(); - } + values = curve->curveData()->xValues(); } } @@ -200,17 +191,16 @@ void RimFractureModelPlot::computeAverageByLayer( const std::vector curves; + std::vector curves; descendantsIncludingThisOfType( curves ); - for ( auto curve : curves ) + for ( RimFractureModelPropertyCurve* curve : curves ) { - // TODO: This will not work if the user has changed the name of the curve: do something smarter. - if ( curve->curveName() == curveName ) + if ( curve->curveProperty() == curveProperty ) { - return curve; + return dynamic_cast( curve ); } } @@ -240,12 +230,13 @@ std::vector RimFractureModelPlot::calculateTrueVerticalDepth() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimFractureModelPlot::findCurveAndComputeLayeredAverage( const QString& curveName ) const +std::vector RimFractureModelPlot::findCurveAndComputeLayeredAverage( RiaDefines::CurveProperty curveProperty ) const { - RimWellLogExtractionCurve* curve = findCurveByName( curveName ); + RimWellLogExtractionCurve* curve = findCurveByProperty( curveProperty ); if ( !curve ) { - RiaLogging::error( QString( "No curve named '%1' found" ).arg( curveName ) ); + QString curveName = caf::AppEnum::uiText( curveProperty ); + RiaLogging::error( QString( "No curve for '%1' found" ).arg( curveName ) ); return std::vector(); } @@ -265,7 +256,7 @@ std::vector RimFractureModelPlot::findCurveAndComputeLayeredAverage( con //-------------------------------------------------------------------------------------------------- std::vector RimFractureModelPlot::calculatePorosity() const { - return findCurveAndComputeLayeredAverage( "PORO" ); + return findCurveAndComputeLayeredAverage( RiaDefines::CurveProperty::POROSITY ); } //-------------------------------------------------------------------------------------------------- @@ -273,7 +264,7 @@ std::vector RimFractureModelPlot::calculatePorosity() const //-------------------------------------------------------------------------------------------------- std::vector RimFractureModelPlot::calculateReservoirPressure() const { - return findCurveAndComputeLayeredAverage( "PRESSURE" ); + return findCurveAndComputeLayeredAverage( RiaDefines::CurveProperty::PRESSURE ); } //-------------------------------------------------------------------------------------------------- @@ -281,7 +272,7 @@ std::vector RimFractureModelPlot::calculateReservoirPressure() const //-------------------------------------------------------------------------------------------------- std::vector RimFractureModelPlot::calculateHorizontalPermeability() const { - return findCurveAndComputeLayeredAverage( "PERMX" ); + return findCurveAndComputeLayeredAverage( RiaDefines::CurveProperty::PERMEABILITY_X ); } //-------------------------------------------------------------------------------------------------- @@ -289,7 +280,7 @@ std::vector RimFractureModelPlot::calculateHorizontalPermeability() cons //-------------------------------------------------------------------------------------------------- std::vector RimFractureModelPlot::calculateVerticalPermeability() const { - return findCurveAndComputeLayeredAverage( "PERMZ" ); + return findCurveAndComputeLayeredAverage( RiaDefines::CurveProperty::PERMEABILITY_Z ); } //-------------------------------------------------------------------------------------------------- @@ -303,6 +294,21 @@ std::vector RimFractureModelPlot::calculateStress() const return stress; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimFractureModelPlot::findCurveXValuesByProperty( RiaDefines::CurveProperty curveProperty ) const +{ + RimWellLogExtractionCurve* curve = findCurveByProperty( curveProperty ); + if ( !curve ) + { + QString curveName = caf::AppEnum::uiText( curveProperty ); + RiaLogging::error( QString( "%1 data not found." ).arg( curveName ) ); + return std::vector(); + } + return curve->curveData()->xValues(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -319,49 +325,26 @@ bool RimFractureModelPlot::calculateStressWithGradients( std::vector& st calculateLayers( layerBoundaryDepths, layerBoundaryIndexes ); // Biot coefficient - RimWellLogExtractionCurve* biotCurve = findCurveByName( "Biot Coefficient" ); - if ( !biotCurve ) - { - RiaLogging::error( "Biot coefficient data not found." ); - return false; - } - std::vector biotData = biotCurve->curveData()->xValues(); + std::vector biotData = findCurveXValuesByProperty( RiaDefines::CurveProperty::BIOT_COEFFICIENT ); - // Biot coefficient - RimWellLogExtractionCurve* k0Curve = findCurveByName( "k0" ); - if ( !k0Curve ) - { - RiaLogging::error( "k0 data not found." ); - return false; - } - std::vector k0Data = k0Curve->curveData()->xValues(); + // K0 + std::vector k0Data = findCurveXValuesByProperty( RiaDefines::CurveProperty::K0 ); // Pressure at the give time step - RimWellLogExtractionCurve* timeStepPressureCurve = findCurveByName( "PRESSURE" ); - if ( !timeStepPressureCurve ) - { - RiaLogging::error( "Pressure data for time step not found." ); - return false; - } - std::vector timeStepPressureData = timeStepPressureCurve->curveData()->xValues(); + std::vector timeStepPressureData = findCurveXValuesByProperty( RiaDefines::CurveProperty::PRESSURE ); // Initial pressure - RimWellLogExtractionCurve* initialPressureCurve = findCurveByName( "INITIAL PRESSURE" ); - if ( !initialPressureCurve ) - { - RiaLogging::error( "Initial pressure data not found." ); - return false; - } - std::vector initialPressureData = initialPressureCurve->curveData()->xValues(); + std::vector initialPressureData = findCurveXValuesByProperty( RiaDefines::CurveProperty::INITIAL_PRESSURE ); // Poissons ratio - RimWellLogExtractionCurve* poissonsRatioCurve = findCurveByName( "Poisson's Ratio" ); - if ( !poissonsRatioCurve ) + std::vector poissonsRatioData = findCurveXValuesByProperty( RiaDefines::CurveProperty::POISSONS_RATIO ); + + // Check that we have data from all curves + if ( biotData.empty() || k0Data.empty() || timeStepPressureData.empty() || initialPressureData.empty() || + poissonsRatioData.empty() ) { - RiaLogging::error( "Poisson's ratio data not found." ); return false; } - std::vector poissonsRatioData = poissonsRatioCurve->curveData()->xValues(); std::vector stressForGradients; std::vector pressureForGradients; @@ -448,7 +431,7 @@ std::vector RimFractureModelPlot::calculateStressGradient() const //-------------------------------------------------------------------------------------------------- std::vector RimFractureModelPlot::calculateYoungsModulus() const { - std::vector valuesGPa = findCurveAndComputeLayeredAverage( "Young's Modulus" ); + std::vector valuesGPa = findCurveAndComputeLayeredAverage( RiaDefines::CurveProperty::YOUNGS_MODULUS ); std::vector valuesMMpsi; for ( auto value : valuesGPa ) { @@ -463,7 +446,7 @@ std::vector RimFractureModelPlot::calculateYoungsModulus() const //-------------------------------------------------------------------------------------------------- std::vector RimFractureModelPlot::calculatePoissonsRatio() const { - return findCurveAndComputeLayeredAverage( "Poisson's Ratio" ); + return findCurveAndComputeLayeredAverage( RiaDefines::CurveProperty::POISSONS_RATIO ); } //-------------------------------------------------------------------------------------------------- @@ -471,7 +454,7 @@ std::vector RimFractureModelPlot::calculatePoissonsRatio() const //-------------------------------------------------------------------------------------------------- std::vector RimFractureModelPlot::calculateKIc() const { - return findCurveAndComputeLayeredAverage( "K-Ic" ); + return findCurveAndComputeLayeredAverage( RiaDefines::CurveProperty::K_IC ); } //-------------------------------------------------------------------------------------------------- @@ -479,7 +462,7 @@ std::vector RimFractureModelPlot::calculateKIc() const //-------------------------------------------------------------------------------------------------- std::vector RimFractureModelPlot::calculateFluidLossCoefficient() const { - return findCurveAndComputeLayeredAverage( "Fluid Loss Coefficient" ); + return findCurveAndComputeLayeredAverage( RiaDefines::CurveProperty::FLUID_LOSS_COEFFICIENT ); } //-------------------------------------------------------------------------------------------------- @@ -487,7 +470,7 @@ std::vector RimFractureModelPlot::calculateFluidLossCoefficient() const //-------------------------------------------------------------------------------------------------- std::vector RimFractureModelPlot::calculateSpurtLoss() const { - return findCurveAndComputeLayeredAverage( "Spurt Loss" ); + return findCurveAndComputeLayeredAverage( RiaDefines::CurveProperty::SPURT_LOSS ); } //-------------------------------------------------------------------------------------------------- @@ -495,5 +478,5 @@ std::vector RimFractureModelPlot::calculateSpurtLoss() const //-------------------------------------------------------------------------------------------------- std::vector RimFractureModelPlot::calculateProppandEmbedment() const { - return findCurveAndComputeLayeredAverage( "Proppant Embedment" ); + return findCurveAndComputeLayeredAverage( RiaDefines::CurveProperty::PROPPANT_EMBEDMENT ); } diff --git a/ApplicationCode/ProjectDataModel/RimFractureModelPlot.h b/ApplicationCode/ProjectDataModel/RimFractureModelPlot.h index 92fee6d031..89b11ffa46 100644 --- a/ApplicationCode/ProjectDataModel/RimFractureModelPlot.h +++ b/ApplicationCode/ProjectDataModel/RimFractureModelPlot.h @@ -19,6 +19,8 @@ #include "RimDepthTrackPlot.h" +#include "RiaFractureModelDefines.h" + #include "cafPdmField.h" #include "cafPdmPtrField.h" @@ -32,6 +34,26 @@ class RimFractureModelPlot : public RimDepthTrackPlot CAF_PDM_HEADER_INIT; public: + enum class PropertyType + { + FACIES, + LAYERS, + POROSITY, + PERMEABILITY_X, + PERMEABILITY_Z, + INITIAL_PRESSURE, + PRESSURE, + STRESS, + STRESS_GRADIENT, + YOUNGS_MODULUS, + POISSONS_RATIO, + K_IC, + PROPPANT_EMBEDMENT, + BIOT_COEFFICIENT, + K0, + FLUID_LOSS_COEFFICIENT, + }; + RimFractureModelPlot(); void setFractureModel( RimFractureModel* fractureModel ); @@ -54,10 +76,12 @@ public: std::vector calculateProppandEmbedment() const; protected: - std::vector findCurveAndComputeLayeredAverage( const QString& curveName ) const; + std::vector findCurveAndComputeLayeredAverage( RiaDefines::CurveProperty curveProperty ) const; + std::vector findCurveXValuesByProperty( RiaDefines::CurveProperty curveProperty ) const; + void calculateLayers( std::vector>& layerBoundaryDepths, std::vector>& layerBoundaryIndexes ) const; - RimWellLogExtractionCurve* findCurveByName( const QString& curveName ) const; + RimWellLogExtractionCurve* findCurveByProperty( RiaDefines::CurveProperty curveProperty ) const; bool calculateStressWithGradients( std::vector& stress, std::vector& stressGradients ) const; static double computeValueAtDepth( const std::vector& values, diff --git a/ApplicationCode/ProjectDataModel/RimFractureModelPropertyCurve.h b/ApplicationCode/ProjectDataModel/RimFractureModelPropertyCurve.h new file mode 100644 index 0000000000..0e4f7a8ef2 --- /dev/null +++ b/ApplicationCode/ProjectDataModel/RimFractureModelPropertyCurve.h @@ -0,0 +1,35 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 + +#include "RiaFractureModelDefines.h" + +#include "RimWellLogExtractionCurve.h" + +#include "cafPdmObject.h" + +//================================================================================================== +/// +//================================================================================================== +class RimFractureModelPropertyCurve +{ +public: + virtual void setCurveProperty( RiaDefines::CurveProperty ) = 0; + virtual RiaDefines::CurveProperty curveProperty() const = 0; +}; diff --git a/ApplicationCode/ProjectDataModel/RimFractureModelStressCurve.cpp b/ApplicationCode/ProjectDataModel/RimFractureModelStressCurve.cpp index e7d0139b6e..2fc894b526 100644 --- a/ApplicationCode/ProjectDataModel/RimFractureModelStressCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimFractureModelStressCurve.cpp @@ -43,17 +43,6 @@ CAF_PDM_SOURCE_INIT( RimFractureModelStressCurve, "RimFractureModelStressCurve" ); -namespace caf -{ -template <> -void AppEnum::setUp() -{ - addItem( RimFractureModelStressCurve::PropertyType::STRESS, "STRESS", "Stress" ); - addItem( RimFractureModelStressCurve::PropertyType::STRESS_GRADIENT, "STRESS_GRADIENT", "Stress Gradient" ); - setDefault( RimFractureModelStressCurve::PropertyType::STRESS ); -} -}; // namespace caf - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -65,7 +54,8 @@ RimFractureModelStressCurve::RimFractureModelStressCurve() m_fractureModel.uiCapability()->setUiTreeChildrenHidden( true ); m_fractureModel.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_propertyType, "PropertyType", "Property Type", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_curveProperty, "CurveProperty", "Curve Property", "", "", "" ); + m_curveProperty.uiCapability()->setUiHidden( true ); m_wellPath = nullptr; } @@ -80,9 +70,17 @@ RimFractureModelStressCurve::~RimFractureModelStressCurve() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimFractureModelStressCurve::setPropertyType( PropertyType propertyType ) +void RimFractureModelStressCurve::setCurveProperty( RiaDefines::CurveProperty curveProperty ) { - m_propertyType = propertyType; + m_curveProperty = curveProperty; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaDefines::CurveProperty RimFractureModelStressCurve::curveProperty() const +{ + return m_curveProperty(); } //-------------------------------------------------------------------------------------------------- @@ -123,7 +121,7 @@ void RimFractureModelStressCurve::performDataExtraction( bool* isUsingPseudoLeng tvDepthValues.push_back( RiaEclipseUnitTools::feetToMeter( f ) ); } - if ( m_propertyType() == PropertyType::STRESS ) + if ( m_curveProperty() == RiaDefines::CurveProperty::STRESS ) { values = fractureModelPlot->calculateStress(); } @@ -188,5 +186,5 @@ void RimFractureModelStressCurve::performDataExtraction( bool* isUsingPseudoLeng //-------------------------------------------------------------------------------------------------- QString RimFractureModelStressCurve::createCurveAutoName() { - return caf::AppEnum::uiText( m_propertyType() ); + return caf::AppEnum::uiText( m_curveProperty() ); } diff --git a/ApplicationCode/ProjectDataModel/RimFractureModelStressCurve.h b/ApplicationCode/ProjectDataModel/RimFractureModelStressCurve.h index 4eeb125e47..682ca78c44 100644 --- a/ApplicationCode/ProjectDataModel/RimFractureModelStressCurve.h +++ b/ApplicationCode/ProjectDataModel/RimFractureModelStressCurve.h @@ -18,6 +18,7 @@ #pragma once +#include "RimFractureModelPropertyCurve.h" #include "RimWellLogExtractionCurve.h" #include "RiuQwtSymbol.h" @@ -35,7 +36,7 @@ class RimColorLegend; //================================================================================================== /// //================================================================================================== -class RimFractureModelStressCurve : public RimWellLogExtractionCurve +class RimFractureModelStressCurve : public RimWellLogExtractionCurve, public RimFractureModelPropertyCurve { CAF_PDM_HEADER_INIT; @@ -51,13 +52,14 @@ public: void setFractureModel( RimFractureModel* fractureModel ); - void setPropertyType( PropertyType propertyType ); + void setCurveProperty( RiaDefines::CurveProperty ) override; + RiaDefines::CurveProperty curveProperty() const override; protected: QString createCurveAutoName() override; void performDataExtraction( bool* isUsingPseudoLength ) override; - caf::PdmPtrField m_fractureModel; - caf::PdmField> m_propertyType; + caf::PdmPtrField m_fractureModel; + caf::PdmField> m_curveProperty; }; diff --git a/ApplicationCode/ProjectDataModel/RimLayerCurve.cpp b/ApplicationCode/ProjectDataModel/RimLayerCurve.cpp index 41a7ca0efd..65a55a2211 100644 --- a/ApplicationCode/ProjectDataModel/RimLayerCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimLayerCurve.cpp @@ -69,6 +69,9 @@ RimLayerCurve::RimLayerCurve() m_fractureModel.uiCapability()->setUiTreeChildrenHidden( true ); m_fractureModel.uiCapability()->setUiHidden( true ); + CAF_PDM_InitFieldNoDefault( &m_curveProperty, "CurveProperty", "Curve Property", "", "", "" ); + m_curveProperty.uiCapability()->setUiHidden( true ); + m_wellPath = nullptr; } @@ -88,22 +91,6 @@ void RimLayerCurve::setFractureModel( RimFractureModel* fractureModel ) m_wellPath = fractureModel->thicknessDirectionWellPath(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -// void RimLayerCurve::setEclipseResultCategory( RiaDefines::ResultCatType catType ) -// { -// m_eclipseResultDefinition->setResultType( catType ); -// } - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -// void RimLayerCurve::setPropertyType( PropertyType propertyType ) -// { -// m_propertyType = propertyType; -// } - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -235,3 +222,19 @@ QString RimLayerCurve::createCurveAutoName() { return "Layers"; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimLayerCurve::setCurveProperty( RiaDefines::CurveProperty curveProperty ) +{ + m_curveProperty = curveProperty; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaDefines::CurveProperty RimLayerCurve::curveProperty() const +{ + return m_curveProperty(); +} diff --git a/ApplicationCode/ProjectDataModel/RimLayerCurve.h b/ApplicationCode/ProjectDataModel/RimLayerCurve.h index ebc5b2a61f..cdad953412 100644 --- a/ApplicationCode/ProjectDataModel/RimLayerCurve.h +++ b/ApplicationCode/ProjectDataModel/RimLayerCurve.h @@ -18,6 +18,7 @@ #pragma once +#include "RimFractureModelPropertyCurve.h" #include "RimWellLogExtractionCurve.h" #include "cafPdmField.h" @@ -29,7 +30,7 @@ class RimColorLegend; //================================================================================================== /// //================================================================================================== -class RimLayerCurve : public RimWellLogExtractionCurve +class RimLayerCurve : public RimWellLogExtractionCurve, public RimFractureModelPropertyCurve { CAF_PDM_HEADER_INIT; @@ -41,6 +42,9 @@ public: void setEclipseResultCategory( RiaDefines::ResultCatType catType ); + void setCurveProperty( RiaDefines::CurveProperty ) override; + RiaDefines::CurveProperty curveProperty() const override; + protected: QString createCurveAutoName() override; @@ -51,6 +55,6 @@ protected: const std::vector>& depthRanges, double depth ); - caf::PdmPtrField m_fractureModel; - // caf::PdmField> m_propertyType; + caf::PdmPtrField m_fractureModel; + caf::PdmField> m_curveProperty; }; From 71f2a6c73ef2d612f03d31aad8d83ddcce82a543 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Thu, 2 Jul 2020 18:47:58 +0200 Subject: [PATCH 8/8] Avoid hiding facies result curve to make stress calculation work. --- .../CompletionCommands/RicNewFractureModelPlotFeature.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.cpp b/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.cpp index f2a974107f..2539684ea2 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.cpp @@ -269,7 +269,6 @@ void RicNewFractureModelPlotFeature::createFaciesTrack( RimFractureModelPlot* pl curve->setLineStyle( RiuQwtPlotCurve::STYLE_SOLID ); curve->setLineThickness( 2 ); curve->setAutoNameComponents( false, true, false, false, false ); - curve->setCurveVisibility( false ); faciesTrack->addCurve( curve ); faciesTrack->setAutoScaleXEnabled( true );