#7609 Calculate and display Ensemble Fracture Statistics plot.

This commit is contained in:
Kristian Bendiksen 2021-04-28 13:45:04 +02:00
parent b662a87267
commit 01d88030d4
21 changed files with 937 additions and 13 deletions

View File

@ -168,8 +168,10 @@ ${CMAKE_CURRENT_LIST_DIR}/RicImportGridModelFromSummaryCurveFeature.cpp
if(Qt5Charts_FOUND)
list(APPEND SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicCreateEnsembleFractureStatisticsPlotFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCreateGridStatisticsPlotFeature.h)
list(APPEND SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicCreateEnsembleFractureStatisticsPlotFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCreateGridStatisticsPlotFeature.cpp)
endif()

View File

@ -0,0 +1,71 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicCreateEnsembleFractureStatisticsPlotFeature.h"
#include "RiaGuiApplication.h"
#include "RimEnsembleFractureStatisticsPlot.h"
#include "RimEnsembleFractureStatisticsPlotCollection.h"
#include "RimMainPlotCollection.h"
#include "RimProject.h"
#include "RiuPlotMainWindow.h"
#include "RiuPlotMainWindowTools.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicCreateEnsembleFractureStatisticsPlotFeature, "RicCreateEnsembleFractureStatisticsPlotFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicCreateEnsembleFractureStatisticsPlotFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateEnsembleFractureStatisticsPlotFeature::onActionTriggered( bool isChecked )
{
RimProject* project = RimProject::current();
RimEnsembleFractureStatisticsPlotCollection* collection =
project->mainPlotCollection()->ensembleFractureStatisticsPlotCollection();
RimEnsembleFractureStatisticsPlot* plot = new RimEnsembleFractureStatisticsPlot();
plot->zoomAll();
plot->updateConnectedEditors();
plot->setAsPlotMdiWindow();
plot->loadDataAndUpdate();
collection->addEnsembleFractureStatisticsPlot( plot );
collection->updateAllRequiredEditors();
RiaGuiApplication::instance()->getOrCreateAndShowMainPlotWindow();
RiuPlotMainWindowTools::selectAsCurrentItem( plot );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateEnsembleFractureStatisticsPlotFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Create Ensemble Fracture Statistics Plot" );
}

View File

@ -0,0 +1,34 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicCreateEnsembleFractureStatisticsPlotFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@ -311,12 +311,16 @@ ${CMAKE_CURRENT_LIST_DIR}/RimWellPathTieIn.cpp
if(Qt5Charts_FOUND)
list(APPEND SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RimStatisticsPlot.h
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleFractureStatisticsPlot.h
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleFractureStatisticsPlotCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimGridStatisticsPlotCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimGridStatisticsPlot.h)
list(APPEND SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimStatisticsPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleFractureStatisticsPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleFractureStatisticsPlotCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimGridStatisticsPlotCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimGridStatisticsPlot.cpp)
endif()

View File

@ -422,6 +422,14 @@ std::vector<QString> RimEnsembleFractureStatistics::computeStatistics()
return xmlFilePaths;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<cvf::ref<RigStimPlanFractureDefinition>> RimEnsembleFractureStatistics::readFractureDefinitions() const
{
return readFractureDefinitions( m_filePaths, RiaDefines::EclipseUnitSystem::UNITS_METRIC );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -96,6 +96,14 @@ public:
void addFilePath( const QString& filePath );
void loadAndUpdateData();
std::vector<cvf::ref<RigStimPlanFractureDefinition>> readFractureDefinitions() const;
static std::vector<cvf::cref<RigFractureGrid>>
createFractureGrids( const std::vector<cvf::ref<RigStimPlanFractureDefinition>>& stimPlanFractureDefinitions,
RiaDefines::EclipseUnitSystem unitSystem,
const QString& resultName,
MeshAlignmentType meshAlignmentType );
protected:
void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
@ -116,12 +124,6 @@ protected:
readFractureDefinitions( const std::vector<caf::FilePath>& filePaths,
RiaDefines::EclipseUnitSystem unitSystem ) const;
std::vector<cvf::cref<RigFractureGrid>>
createFractureGrids( const std::vector<cvf::ref<RigStimPlanFractureDefinition>>& stimPlanFractureDefinitions,
RiaDefines::EclipseUnitSystem unitSystem,
const QString& resultName,
MeshAlignmentType meshAlignmentType );
static std::set<std::pair<QString, QString>>
findAllResultNames( const std::vector<cvf::ref<RigStimPlanFractureDefinition>>& stimPlanFractureDefinitions );

View File

@ -653,10 +653,19 @@ WellFractureIntersectionData
//--------------------------------------------------------------------------------------------------
std::pair<QString, QString> RimStimPlanFractureTemplate::widthParameterNameAndUnit() const
{
if ( m_stimPlanFractureDefinitionData.notNull() )
return widthParameterNameAndUnit( m_stimPlanFractureDefinitionData );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::pair<QString, QString> RimStimPlanFractureTemplate::widthParameterNameAndUnit(
cvf::ref<RigStimPlanFractureDefinition> stimPlanFractureDefinitionData )
{
if ( stimPlanFractureDefinitionData.notNull() )
{
std::vector<std::pair<QString, QString>> propertyNamesUnitsOnFile =
m_stimPlanFractureDefinitionData->getStimPlanPropertyNamesUnits();
stimPlanFractureDefinitionData->getStimPlanPropertyNamesUnits();
for ( const auto& nameUnit : propertyNamesUnitsOnFile )
{

View File

@ -101,6 +101,8 @@ public:
double formationDip() const;
static std::pair<QString, QString> widthParameterNameAndUnit( cvf::ref<RigStimPlanFractureDefinition> def );
protected:
void initAfterRead() override;

View File

@ -152,6 +152,7 @@
#include "RimWellPltPlot.h"
#ifdef USE_QTCHARTS
#include "RimEnsembleFractureStatisticsPlotCollection.h"
#include "RimGridStatisticsPlotCollection.h"
#endif
@ -614,6 +615,10 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
{
menuBuilder << "RicCreateGridStatisticsPlotFeature";
}
else if ( dynamic_cast<RimEnsembleFractureStatisticsPlotCollection*>( firstUiItem ) )
{
menuBuilder << "RicCreateEnsembleFractureStatisticsPlotFeature";
}
#endif
else if ( dynamic_cast<RimGridCrossPlot*>( firstUiItem ) )
{

View File

@ -0,0 +1,161 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimEnsembleFractureStatisticsPlot.h"
#include "RigEnsembleFractureStatisticsCalculator.h"
#include "RimEnsembleFractureStatistics.h"
#include "RimPlot.h"
#include "RimProject.h"
#include "RigHistogramData.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmObjectScriptingCapability.h"
#include "cafPdmUiComboBoxEditor.h"
#include "cvfAssert.h"
#include <cmath>
CAF_PDM_SOURCE_INIT( RimEnsembleFractureStatisticsPlot, "EnsembleFractureStatisticsPlot" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEnsembleFractureStatisticsPlot::RimEnsembleFractureStatisticsPlot()
{
CAF_PDM_InitObject( "Ensemble Fracture Statistics Plot", "", "", "A Plot of Ensemble Fracture Statistics" );
CAF_PDM_InitFieldNoDefault( &m_ensembleFractureStatistics,
"EnsembleFractureStatistics",
"Ensemble Fracture Statistics",
"",
"",
"" );
m_ensembleFractureStatistics.uiCapability()->setUiTreeChildrenHidden( true );
CAF_PDM_InitFieldNoDefault( &m_property, "Property", "Property", "", "", "" );
m_plotLegendsHorizontal.uiCapability()->setUiHidden( true );
setDefaults();
setDeletable( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEnsembleFractureStatisticsPlot::~RimEnsembleFractureStatisticsPlot()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleFractureStatisticsPlot::setDefaults()
{
std::vector<RimEnsembleFractureStatistics*> esfItems;
RimProject::current()->descendantsIncludingThisOfType( esfItems );
if ( !esfItems.empty() ) m_ensembleFractureStatistics = esfItems.front();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleFractureStatisticsPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
RimPlotWindow::fieldChangedByUi( changedField, oldValue, newValue );
loadDataAndUpdate();
updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleFractureStatisticsPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_ensembleFractureStatistics );
uiOrdering.add( &m_property );
caf::PdmUiGroup* plotLayoutGroup = uiOrdering.addNewGroup( "Plot Layout" );
RimPlotWindow::uiOrderingForPlotLayout( uiConfigName, *plotLayoutGroup );
uiOrdering.skipRemainingFields( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo>
RimEnsembleFractureStatisticsPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly )
{
QList<caf::PdmOptionItemInfo> options = RimPlotWindow::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
if ( fieldNeedingOptions == &m_ensembleFractureStatistics )
{
std::vector<RimEnsembleFractureStatistics*> esfItems;
RimProject::current()->descendantsIncludingThisOfType( esfItems );
for ( auto item : esfItems )
{
options.push_back( caf::PdmOptionItemInfo( item->name(), item ) );
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEnsembleFractureStatisticsPlot::hasStatisticsData() const
{
return ( m_viewer && m_ensembleFractureStatistics );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigHistogramData RimEnsembleFractureStatisticsPlot::createStatisticsData() const
{
RigHistogramData histogramData =
RigEnsembleFractureStatisticsCalculator::createStatisticsData( m_ensembleFractureStatistics(), m_property() );
return histogramData;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEnsembleFractureStatisticsPlot::createAutoName() const
{
if ( m_ensembleFractureStatistics() == nullptr )
{
return "Undefined";
}
QStringList nameTags;
nameTags += m_ensembleFractureStatistics()->name();
nameTags += caf::AppEnum<RigEnsembleFractureStatisticsCalculator::PropertyType>::uiText( m_property() );
return nameTags.join( ", " );
}

View File

@ -0,0 +1,62 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RiaDefines.h"
#include "RigEnsembleFractureStatisticsCalculator.h"
#include "RimEnsembleFractureStatistics.h"
#include "RimStatisticsPlot.h"
#include "cafAppEnum.h"
#include "cafPdmField.h"
#include "cafPdmPtrField.h"
class RimEnsembleFractureStatistics;
//==================================================================================================
///
///
//==================================================================================================
class RimEnsembleFractureStatisticsPlot : public RimStatisticsPlot
{
CAF_PDM_HEADER_INIT;
public:
RimEnsembleFractureStatisticsPlot();
~RimEnsembleFractureStatisticsPlot() override;
protected:
// Overridden PDM methods
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
QString createAutoName() const override;
void setDefaults();
bool hasStatisticsData() const override;
RigHistogramData createStatisticsData() const override;
protected:
caf::PdmPtrField<RimEnsembleFractureStatistics*> m_ensembleFractureStatistics;
caf::PdmField<caf::AppEnum<RigEnsembleFractureStatisticsCalculator::PropertyType>> m_property;
};

View File

@ -0,0 +1,73 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimEnsembleFractureStatisticsPlotCollection.h"
#include "RimEnsembleFractureStatisticsPlot.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmObjectScriptingCapability.h"
CAF_PDM_SOURCE_INIT( RimEnsembleFractureStatisticsPlotCollection, "EnsembleFractureStatisticsPlotCollection" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEnsembleFractureStatisticsPlotCollection::RimEnsembleFractureStatisticsPlotCollection()
{
CAF_PDM_InitScriptableObject( "Ensemble Fracture Statistics Plots", ":/WellLogPlots16x16.png", "", "" );
CAF_PDM_InitScriptableFieldNoDefault( &m_ensembleFractureStatisticsPlots, "EnsembleFractureStatisticsPlots", "", "", "", "" );
m_ensembleFractureStatisticsPlots.uiCapability()->setUiHidden( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleFractureStatisticsPlotCollection::reloadAllPlots()
{
for ( const auto& w : m_ensembleFractureStatisticsPlots() )
{
w->loadDataAndUpdate();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleFractureStatisticsPlotCollection::addEnsembleFractureStatisticsPlot( RimEnsembleFractureStatisticsPlot* newPlot )
{
m_ensembleFractureStatisticsPlots.push_back( newPlot );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimEnsembleFractureStatisticsPlot*>
RimEnsembleFractureStatisticsPlotCollection::ensembleFractureStatisticsPlots() const
{
return m_ensembleFractureStatisticsPlots.childObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleFractureStatisticsPlotCollection::deleteAllPlots()
{
m_ensembleFractureStatisticsPlots.deleteAllChildObjects();
}

View File

@ -0,0 +1,48 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmChildArrayField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
class RimEnsembleFractureStatisticsPlot;
//==================================================================================================
///
///
//==================================================================================================
class RimEnsembleFractureStatisticsPlotCollection : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimEnsembleFractureStatisticsPlotCollection();
void addEnsembleFractureStatisticsPlot( RimEnsembleFractureStatisticsPlot* newPlot );
std::vector<RimEnsembleFractureStatisticsPlot*> ensembleFractureStatisticsPlots() const;
void reloadAllPlots();
void deleteAllPlots();
private:
caf::PdmChildArrayField<RimEnsembleFractureStatisticsPlot*> m_ensembleFractureStatisticsPlots;
};

View File

@ -44,6 +44,8 @@
#include "RimWellRftPlot.h"
#ifdef USE_QTCHARTS
#include "RimEnsembleFractureStatisticsPlot.h"
#include "RimEnsembleFractureStatisticsPlotCollection.h"
#include "RimGridStatisticsPlot.h"
#include "RimGridStatisticsPlotCollection.h"
#endif
@ -109,6 +111,14 @@ RimMainPlotCollection::RimMainPlotCollection()
#ifdef USE_QTCHARTS
CAF_PDM_InitFieldNoDefault( &m_gridStatisticsPlotCollection, "GridStatisticsPlotCollection", "", "", "", "" );
m_gridStatisticsPlotCollection.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_ensembleFractureStatisticsPlotCollection,
"EnsembleFractureStatisticsPlotCollection",
"",
"",
"",
"" );
m_ensembleFractureStatisticsPlotCollection.uiCapability()->setUiHidden( true );
#endif
m_wellLogPlotCollection = new RimWellLogPlotCollection();
@ -125,7 +135,8 @@ RimMainPlotCollection::RimMainPlotCollection()
m_stimPlanModelPlotCollection = new RimStimPlanModelPlotCollection;
m_vfpPlotCollection = new RimVfpPlotCollection();
#ifdef USE_QTCHARTS
m_gridStatisticsPlotCollection = new RimGridStatisticsPlotCollection;
m_gridStatisticsPlotCollection = new RimGridStatisticsPlotCollection;
m_ensembleFractureStatisticsPlotCollection = new RimEnsembleFractureStatisticsPlotCollection;
#endif
}
@ -265,6 +276,14 @@ RimGridStatisticsPlotCollection* RimMainPlotCollection::gridStatisticsPlotCollec
{
return m_gridStatisticsPlotCollection();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEnsembleFractureStatisticsPlotCollection* RimMainPlotCollection::ensembleFractureStatisticsPlotCollection()
{
return m_ensembleFractureStatisticsPlotCollection();
}
#endif
//--------------------------------------------------------------------------------------------------
@ -287,6 +306,7 @@ void RimMainPlotCollection::deleteAllContainedObjects()
m_stimPlanModelPlotCollection()->deleteAllPlots();
#ifdef USE_QTCHARTS
m_gridStatisticsPlotCollection()->deleteAllPlots();
m_ensembleFractureStatisticsPlotCollection()->deleteAllPlots();
#endif
}
@ -364,6 +384,15 @@ void RimMainPlotCollection::updatePlotsWithFormations()
gridStatisticsPlot->loadDataAndUpdate();
}
}
if ( m_ensembleFractureStatisticsPlotCollection )
{
for ( RimEnsembleFractureStatisticsPlot* ensembleFractureStatisticsPlot :
m_ensembleFractureStatisticsPlotCollection->ensembleFractureStatisticsPlots() )
{
ensembleFractureStatisticsPlot->loadDataAndUpdate();
}
}
#endif
}

View File

@ -45,6 +45,7 @@ class RimVfpPlotCollection;
#ifdef USE_QTCHARTS
class RimGridStatisticsPlotCollection;
class RimEnsembleFractureStatisticsPlotCollection;
#endif
//==================================================================================================
@ -74,7 +75,8 @@ public:
RimVfpPlotCollection* vfpPlotCollection();
#ifdef USE_QTCHARTS
RimGridStatisticsPlotCollection* gridStatisticsPlotCollection();
RimGridStatisticsPlotCollection* gridStatisticsPlotCollection();
RimEnsembleFractureStatisticsPlotCollection* ensembleFractureStatisticsPlotCollection();
#endif
void deleteAllContainedObjects();
@ -105,7 +107,8 @@ private:
caf::PdmChildField<RimStimPlanModelPlotCollection*> m_stimPlanModelPlotCollection;
caf::PdmChildField<RimVfpPlotCollection*> m_vfpPlotCollection;
#ifdef USE_QTCHARTS
caf::PdmChildField<RimGridStatisticsPlotCollection*> m_gridStatisticsPlotCollection;
caf::PdmChildField<RimGridStatisticsPlotCollection*> m_gridStatisticsPlotCollection;
caf::PdmChildField<RimEnsembleFractureStatisticsPlotCollection*> m_ensembleFractureStatisticsPlotCollection;
#endif
caf::PdmField<bool> m_show;

View File

@ -91,6 +91,8 @@
#include "RimWellPathCollection.h"
#ifdef USE_QTCHARTS
#include "RimEnsembleFractureStatisticsPlot.h"
#include "RimEnsembleFractureStatisticsPlotCollection.h"
#include "RimGridStatisticsPlot.h"
#include "RimGridStatisticsPlotCollection.h"
#endif
@ -1465,9 +1467,15 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q
itemCollection->add( mainPlotCollection->vfpPlotCollection() );
}
#ifdef USE_QTCHARTS
if ( mainPlotCollection->gridStatisticsPlotCollection() )
if ( mainPlotCollection->gridStatisticsPlotCollection() ||
mainPlotCollection->ensembleFractureStatisticsPlotCollection() )
{
itemCollection->add( mainPlotCollection->gridStatisticsPlotCollection() );
auto statisticsItemCollection = itemCollection->add( "Statistics Plots", ":/Folder.png" );
if ( mainPlotCollection->gridStatisticsPlotCollection() )
statisticsItemCollection->add( mainPlotCollection->gridStatisticsPlotCollection() );
if ( mainPlotCollection->ensembleFractureStatisticsPlotCollection() )
statisticsItemCollection->add( mainPlotCollection->ensembleFractureStatisticsPlotCollection() );
}
#endif
}

View File

@ -81,6 +81,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RigNncConnection.h
${CMAKE_CURRENT_LIST_DIR}/RigWellDiskData.h
${CMAKE_CURRENT_LIST_DIR}/RigGocadData.h
${CMAKE_CURRENT_LIST_DIR}/RigElasticProperties.h
${CMAKE_CURRENT_LIST_DIR}/RigEnsembleFractureStatisticsCalculator.h
${CMAKE_CURRENT_LIST_DIR}/RigHistogramData.h
${CMAKE_CURRENT_LIST_DIR}/RigVisibleTracerFilter.h
${CMAKE_CURRENT_LIST_DIR}/RigTracerPoint.h
@ -165,6 +166,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RigNncConnection.cpp
${CMAKE_CURRENT_LIST_DIR}/RigWellDiskData.cpp
${CMAKE_CURRENT_LIST_DIR}/RigGocadData.cpp
${CMAKE_CURRENT_LIST_DIR}/RigElasticProperties.cpp
${CMAKE_CURRENT_LIST_DIR}/RigEnsembleFractureStatisticsCalculator.cpp
${CMAKE_CURRENT_LIST_DIR}/RigHistogramData.cpp
${CMAKE_CURRENT_LIST_DIR}/RigVisibleTracerFilter.cpp
${CMAKE_CURRENT_LIST_DIR}/RigTracerPoint.cpp

View File

@ -0,0 +1,324 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RigEnsembleFractureStatisticsCalculator.h"
#include "RiaDefines.h"
#include "RiaWeightedMeanCalculator.h"
#include "RigFractureCell.h"
#include "RigFractureGrid.h"
#include "RigHistogramData.h"
#include "RigStatisticsMath.h"
#include "RigStimPlanFractureDefinition.h"
#include "RigTransmissibilityEquations.h"
#include "RimEnsembleFractureStatistics.h"
#include "RimStimPlanFractureTemplate.h"
#include "cafAppEnum.h"
#include "cvfObject.h"
#include <limits>
namespace caf
{
template <>
void caf::AppEnum<RigEnsembleFractureStatisticsCalculator::PropertyType>::setUp()
{
addItem( RigEnsembleFractureStatisticsCalculator::PropertyType::HEIGHT, "HEIGHT", "Height" );
addItem( RigEnsembleFractureStatisticsCalculator::PropertyType::AREA, "AREA", "Area" );
addItem( RigEnsembleFractureStatisticsCalculator::PropertyType::WIDTH, "WIDTH", "Width" );
addItem( RigEnsembleFractureStatisticsCalculator::PropertyType::XF, "XF", "Xf" );
addItem( RigEnsembleFractureStatisticsCalculator::PropertyType::KFWF, "KFWF", "KfWf" );
addItem( RigEnsembleFractureStatisticsCalculator::PropertyType::PERMEABILITY, "PERMEABILITY", "Permeability" );
setDefault( RigEnsembleFractureStatisticsCalculator::PropertyType::HEIGHT );
}
}; // namespace caf
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigHistogramData RigEnsembleFractureStatisticsCalculator::createStatisticsData( RimEnsembleFractureStatistics* esf,
PropertyType propertyType )
{
std::vector<cvf::ref<RigStimPlanFractureDefinition>> defs = esf->readFractureDefinitions();
std::vector<double> samples;
if ( propertyType == PropertyType::HEIGHT )
{
samples = calculateGridStatistics( defs, &RigEnsembleFractureStatisticsCalculator::calculateHeight );
}
else if ( propertyType == PropertyType::AREA )
{
samples = calculateGridStatistics( defs, &RigEnsembleFractureStatisticsCalculator::calculateArea );
}
else if ( propertyType == PropertyType::WIDTH )
{
samples =
calculateAreaWeightedStatistics( defs, &RigEnsembleFractureStatisticsCalculator::calculateAreaWeightedWidth );
}
else if ( propertyType == PropertyType::PERMEABILITY )
{
samples =
calculateAreaWeightedStatistics( defs,
&RigEnsembleFractureStatisticsCalculator::calculateAreaWeightedPermeability );
}
else if ( propertyType == PropertyType::XF )
{
samples = calculateGridStatistics( defs, &RigEnsembleFractureStatisticsCalculator::calculateXf );
}
else if ( propertyType == PropertyType::KFWF )
{
samples = calculateGridStatistics( defs, &RigEnsembleFractureStatisticsCalculator::calculateKfWf );
}
RigHistogramData histogramData;
double sum;
double range;
double dev;
RigStatisticsMath::calculateBasicStatistics( samples,
&histogramData.min,
&histogramData.max,
&sum,
&range,
&histogramData.mean,
&dev );
double p50;
double mean;
RigStatisticsMath::calculateStatisticsCurves( samples, &histogramData.p10, &p50, &histogramData.p90, &mean );
// TODO: this leaks memory: api assume the the histogram is owned by someone else (which is kind-of-strange)
std::vector<size_t>* histogram = new std::vector<size_t>();
RigHistogramCalculator histogramCalculator( histogramData.min, histogramData.max, 20, histogram );
for ( auto s : samples )
histogramCalculator.addValue( s );
histogramData.histogram = histogram;
return histogramData;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RigEnsembleFractureStatisticsCalculator::calculateGridStatistics(
const std::vector<cvf::ref<RigStimPlanFractureDefinition>>& defs,
double( func )( cvf::cref<RigFractureGrid> ) )
{
std::vector<double> samples;
if ( defs.empty() ) return samples;
// TODO: heuristic to find conductivity name?
QString conductivityResultName = defs[0]->conductivityResultNames()[0];
std::vector<cvf::cref<RigFractureGrid>> grids =
RimEnsembleFractureStatistics::createFractureGrids( defs,
RiaDefines::EclipseUnitSystem::UNITS_METRIC,
conductivityResultName,
RimEnsembleFractureStatistics::MeshAlignmentType::PERFORATION_DEPTH );
for ( auto grid : grids )
{
double result = func( grid );
samples.push_back( result );
}
return samples;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigEnsembleFractureStatisticsCalculator::calculateHeight( cvf::cref<RigFractureGrid> fractureGrid )
{
double longestRange = 0.0;
for ( size_t i = 0; i < fractureGrid->iCellCount(); i++ )
{
double currentAggregatedDistanceY = 0.0;
for ( size_t j = 0; j < fractureGrid->jCellCount(); j++ )
{
size_t idx = fractureGrid->getGlobalIndexFromIJ( i, j );
auto fractureCell = fractureGrid->cellFromIndex( idx );
double conductivityValue = fractureCell.getConductivityValue();
if ( conductivityValue > 0.0 )
{
currentAggregatedDistanceY += fractureCell.cellSizeZ();
}
else
{
longestRange = std::max( longestRange, currentAggregatedDistanceY );
currentAggregatedDistanceY = 0.0;
}
}
longestRange = std::max( longestRange, currentAggregatedDistanceY );
}
return longestRange;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigEnsembleFractureStatisticsCalculator::calculateArea( cvf::cref<RigFractureGrid> fractureGrid )
{
double sum = 0.0;
for ( auto fractureCell : fractureGrid->fractureCells() )
{
double value = fractureCell.getConductivityValue();
if ( !std::isinf( value ) && value > 0.0 )
{
sum += fractureCell.area();
}
}
return sum;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigEnsembleFractureStatisticsCalculator::calculateKfWf( cvf::cref<RigFractureGrid> fractureGrid )
{
RiaWeightedMeanCalculator<double> calc;
for ( auto fractureCell : fractureGrid->fractureCells() )
{
double value = fractureCell.getConductivityValue();
if ( !std::isinf( value ) && value > 0.0 )
{
double area = fractureCell.area();
calc.addValueAndWeight( value, area );
}
}
return calc.weightedMean();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RigEnsembleFractureStatisticsCalculator::calculateAreaWeightedStatistics(
const std::vector<cvf::ref<RigStimPlanFractureDefinition>>& defs,
double( func )( cvf::cref<RigFractureGrid>, cvf::cref<RigFractureGrid> ) )
{
std::vector<double> samples;
if ( defs.empty() ) return samples;
// TODO: heuristic to find conductivity name?
QString conductivityResultName = defs[0]->conductivityResultNames()[0];
std::vector<cvf::cref<RigFractureGrid>> grids =
RimEnsembleFractureStatistics::createFractureGrids( defs,
RiaDefines::EclipseUnitSystem::UNITS_METRIC,
conductivityResultName,
RimEnsembleFractureStatistics::MeshAlignmentType::PERFORATION_DEPTH );
QString widthResultName = RimStimPlanFractureTemplate::widthParameterNameAndUnit( defs[0] ).first;
std::vector<cvf::cref<RigFractureGrid>> widthGrids =
RimEnsembleFractureStatistics::createFractureGrids( defs,
RiaDefines::EclipseUnitSystem::UNITS_METRIC,
widthResultName,
RimEnsembleFractureStatistics::MeshAlignmentType::PERFORATION_DEPTH );
CAF_ASSERT( grids.size() == widthGrids.size() );
for ( size_t i = 0; i < grids.size(); i++ )
{
double result = func( grids[i], widthGrids[i] );
samples.push_back( result );
}
return samples;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigEnsembleFractureStatisticsCalculator::calculateAreaWeightedWidth( cvf::cref<RigFractureGrid> conductivityGrid,
cvf::cref<RigFractureGrid> widthGrid )
{
RiaWeightedMeanCalculator<double> calc;
const std::vector<RigFractureCell>& conductivityCells = conductivityGrid->fractureCells();
const std::vector<RigFractureCell>& widthCells = widthGrid->fractureCells();
CAF_ASSERT( conductivityCells.size() == widthCells.size() );
for ( size_t i = 0; i < conductivityCells.size(); i++ )
{
double value = conductivityCells[i].getConductivityValue();
if ( !std::isinf( value ) && value > 0.0 )
{
double cellArea = conductivityCells[i].area();
// TODO: conductivity is misleading here
double widthValue = widthCells[i].getConductivityValue();
calc.addValueAndWeight( widthValue, cellArea );
}
}
return calc.weightedMean();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigEnsembleFractureStatisticsCalculator::calculateAreaWeightedPermeability( cvf::cref<RigFractureGrid> conductivityGrid,
cvf::cref<RigFractureGrid> widthGrid )
{
RiaWeightedMeanCalculator<double> calc;
const std::vector<RigFractureCell>& conductivityCells = conductivityGrid->fractureCells();
const std::vector<RigFractureCell>& widthCells = widthGrid->fractureCells();
CAF_ASSERT( conductivityCells.size() == widthCells.size() );
for ( size_t i = 0; i < conductivityCells.size(); i++ )
{
double conductivity = conductivityCells[i].getConductivityValue();
if ( !std::isinf( conductivity ) && conductivity > 0.0 )
{
double cellArea = conductivityCells[i].area();
// TODO: conductivity is misleading here
double width = widthCells[i].getConductivityValue();
double permeability = RigTransmissibilityEquations::permeability( conductivity, width );
calc.addValueAndWeight( permeability, cellArea );
}
}
return calc.weightedMean();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigEnsembleFractureStatisticsCalculator::calculateXf( cvf::cref<RigFractureGrid> fractureGrid )
{
double height = calculateHeight( fractureGrid );
double area = calculateArea( fractureGrid );
if ( height > 0.0 )
{
double length = area / height;
double halfLength = length / 2.0;
return halfLength;
}
return 0.0;
}

View File

@ -0,0 +1,68 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RigHistogramData.h"
#include "cvfObject.h"
#include <functional>
#include <vector>
class RimEnsembleFractureStatistics;
class RigFractureGrid;
class RigStimPlanFractureDefinition;
//==================================================================================================
///
///
//==================================================================================================
class RigEnsembleFractureStatisticsCalculator
{
public:
enum class PropertyType
{
HEIGHT,
AREA,
WIDTH,
XF,
KFWF,
PERMEABILITY
};
static RigHistogramData createStatisticsData( RimEnsembleFractureStatistics* esf, PropertyType propertyType );
private:
static std::vector<double> calculateGridStatistics( const std::vector<cvf::ref<RigStimPlanFractureDefinition>>& defs,
double( func )( cvf::cref<RigFractureGrid> ) );
static std::vector<double>
calculateAreaWeightedStatistics( const std::vector<cvf::ref<RigStimPlanFractureDefinition>>& defs,
double( func )( cvf::cref<RigFractureGrid>, cvf::cref<RigFractureGrid> ) );
static double calculateHeight( cvf::cref<RigFractureGrid> fractureGrid );
static double calculateArea( cvf::cref<RigFractureGrid> fractureGrid );
static double calculateXf( cvf::cref<RigFractureGrid> fractureGrid );
static double calculateKfWf( cvf::cref<RigFractureGrid> fractureGrid );
static double calculateAreaWeightedWidth( cvf::cref<RigFractureGrid> conductivityGrid,
cvf::cref<RigFractureGrid> widthGrid );
static double calculateAreaWeightedPermeability( cvf::cref<RigFractureGrid> conductivityGrid,
cvf::cref<RigFractureGrid> widthGrid );
};

View File

@ -99,3 +99,11 @@ double RigFractureCell::cellSizeZ() const
if ( m_polygon.size() > 2 ) return ( m_polygon[2] - m_polygon[1] ).length();
return cvf::UNDEFINED_DOUBLE;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigFractureCell::area() const
{
return cellSizeX() * cellSizeZ();
}

View File

@ -41,6 +41,7 @@ public:
double cellSizeX() const;
double cellSizeZ() const;
double area() const;
private:
std::vector<cvf::Vec3d> m_polygon;