mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#6007 Reload facies properties when project is reopened.
This commit is contained in:
parent
38ec6e5069
commit
466827e7d0
@ -52,6 +52,8 @@
|
|||||||
#include "RimEclipseView.h"
|
#include "RimEclipseView.h"
|
||||||
#include "RimFlowPlotCollection.h"
|
#include "RimFlowPlotCollection.h"
|
||||||
#include "RimFormationNamesCollection.h"
|
#include "RimFormationNamesCollection.h"
|
||||||
|
#include "RimFractureModel.h"
|
||||||
|
#include "RimFractureModelCollection.h"
|
||||||
#include "RimFractureTemplateCollection.h"
|
#include "RimFractureTemplateCollection.h"
|
||||||
#include "RimGeoMechCase.h"
|
#include "RimGeoMechCase.h"
|
||||||
#include "RimGeoMechCellColors.h"
|
#include "RimGeoMechCellColors.h"
|
||||||
@ -93,6 +95,7 @@
|
|||||||
#include "RimWellPathFracture.h"
|
#include "RimWellPathFracture.h"
|
||||||
#include "RimWellPltPlot.h"
|
#include "RimWellPltPlot.h"
|
||||||
#include "RimWellRftPlot.h"
|
#include "RimWellRftPlot.h"
|
||||||
|
#include "RimWellPath.h"
|
||||||
|
|
||||||
#include "Riu3DMainWindowTools.h"
|
#include "Riu3DMainWindowTools.h"
|
||||||
#include "RiuViewer.h"
|
#include "RiuViewer.h"
|
||||||
@ -514,6 +517,17 @@ bool RiaApplication::loadProject( const QString& projectFileName,
|
|||||||
{
|
{
|
||||||
oilField->wellPathCollection->loadDataAndUpdate();
|
oilField->wellPathCollection->loadDataAndUpdate();
|
||||||
oilField->wellPathCollection->readWellPathFormationFiles();
|
oilField->wellPathCollection->readWellPathFormationFiles();
|
||||||
|
for ( RimWellPath* wellPath : oilField->wellPathCollection->wellPaths() )
|
||||||
|
{
|
||||||
|
RimFractureModelCollection* fractureModelCollection = wellPath->fractureModelCollection();
|
||||||
|
if ( fractureModelCollection )
|
||||||
|
{
|
||||||
|
for ( RimFractureModel* fractureModel : fractureModelCollection->allFractureModels() )
|
||||||
|
{
|
||||||
|
fractureModel->loadDataAndUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +65,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicDeleteWellMeasurementFilePathFeature.h
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/RicReloadWellMeasurementsFeature.h
|
${CMAKE_CURRENT_LIST_DIR}/RicReloadWellMeasurementsFeature.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicWellMeasurementImportTools.h
|
${CMAKE_CURRENT_LIST_DIR}/RicWellMeasurementImportTools.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicImportFaciesPropertiesFeature.h
|
${CMAKE_CURRENT_LIST_DIR}/RicImportFaciesPropertiesFeature.h
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RicFaciesPropertiesImportTools.h
|
||||||
|
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicCloseSourSimDataFeature.h
|
${CMAKE_CURRENT_LIST_DIR}/RicCloseSourSimDataFeature.h
|
||||||
|
|
||||||
@ -157,6 +158,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicDeleteWellMeasurementFilePathFeature.cpp
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/RicReloadWellMeasurementsFeature.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicReloadWellMeasurementsFeature.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicWellMeasurementImportTools.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicWellMeasurementImportTools.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicImportFaciesPropertiesFeature.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicImportFaciesPropertiesFeature.cpp
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RicFaciesPropertiesImportTools.cpp
|
||||||
|
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicCloseSourSimDataFeature.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicCloseSourSimDataFeature.cpp
|
||||||
|
|
||||||
|
107
ApplicationCode/Commands/RicFaciesPropertiesImportTools.cpp
Normal file
107
ApplicationCode/Commands/RicFaciesPropertiesImportTools.cpp
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "RicFaciesPropertiesImportTools.h"
|
||||||
|
|
||||||
|
#include "RiaLogging.h"
|
||||||
|
|
||||||
|
#include "RimFractureModel.h"
|
||||||
|
#include "RimFaciesProperties.h"
|
||||||
|
|
||||||
|
#include "RifFaciesPropertiesReader.h"
|
||||||
|
#include "RifFileParseTools.h"
|
||||||
|
|
||||||
|
#include "RigFaciesProperties.h"
|
||||||
|
|
||||||
|
#include <set>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicFaciesPropertiesImportTools::importFaciesPropertiesFromFile( const QString& filePath,
|
||||||
|
RimFractureModel* fractureModel )
|
||||||
|
{
|
||||||
|
typedef std::tuple<QString, QString, QString> FaciesKey;
|
||||||
|
|
||||||
|
// Read the facies properties from file
|
||||||
|
std::vector<RifFaciesProperties> rifFaciesProperties;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
QStringList filePaths;
|
||||||
|
filePaths << filePath;
|
||||||
|
RifFaciesPropertiesReader::readFaciesProperties( rifFaciesProperties, filePaths );
|
||||||
|
}
|
||||||
|
catch ( FileParseException& exception )
|
||||||
|
{
|
||||||
|
RiaLogging::warning( QString( "Facies properties import failed: '%1'." ).arg( exception.message ) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Find the unique facies keys (combination of field, formation and facies names)
|
||||||
|
std::set<FaciesKey> faciesKeys;
|
||||||
|
for ( RifFaciesProperties item : rifFaciesProperties )
|
||||||
|
{
|
||||||
|
FaciesKey faciesKey = std::make_tuple( item.fieldName, item.formationName, item.faciesName );
|
||||||
|
faciesKeys.insert( faciesKey );
|
||||||
|
}
|
||||||
|
|
||||||
|
RimFaciesProperties* rimFaciesProperties = new RimFaciesProperties;
|
||||||
|
// rimFaciesProperties->setFilePath();
|
||||||
|
for ( FaciesKey key : faciesKeys )
|
||||||
|
{
|
||||||
|
std::vector<RifFaciesProperties> matchingFacies;
|
||||||
|
|
||||||
|
QString fieldName = std::get<0>( key );
|
||||||
|
QString formationName = std::get<1>( key );
|
||||||
|
QString faciesName = std::get<2>( key );
|
||||||
|
|
||||||
|
// Group the items with a given facies key
|
||||||
|
for ( RifFaciesProperties item : rifFaciesProperties )
|
||||||
|
{
|
||||||
|
if ( item.fieldName == fieldName && item.formationName == formationName && item.faciesName == faciesName )
|
||||||
|
{
|
||||||
|
matchingFacies.push_back( item );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort the matching items by porosity
|
||||||
|
std::sort( matchingFacies.begin(),
|
||||||
|
matchingFacies.end(),
|
||||||
|
[]( const RifFaciesProperties& a, const RifFaciesProperties& b ) { return a.porosity < b.porosity; } );
|
||||||
|
|
||||||
|
// Finally add the values
|
||||||
|
RigFaciesProperties rigFaciesProperties( fieldName, formationName, faciesName );
|
||||||
|
for ( RifFaciesProperties item : matchingFacies )
|
||||||
|
{
|
||||||
|
rigFaciesProperties.appendValues( item.porosity,
|
||||||
|
item.youngsModulus,
|
||||||
|
item.poissonsRatio,
|
||||||
|
item.K_Ic,
|
||||||
|
item.proppantEmbedment );
|
||||||
|
}
|
||||||
|
|
||||||
|
rimFaciesProperties->setPropertiesForFacies( key, rigFaciesProperties );
|
||||||
|
}
|
||||||
|
|
||||||
|
rimFaciesProperties->setFilePath( filePath );
|
||||||
|
fractureModel->setFaciesProperties( rimFaciesProperties );
|
||||||
|
fractureModel->updateConnectedEditors();
|
||||||
|
}
|
36
ApplicationCode/Commands/RicFaciesPropertiesImportTools.h
Normal file
36
ApplicationCode/Commands/RicFaciesPropertiesImportTools.h
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
class RimFractureModel;
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
class RicFaciesPropertiesImportTools
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static void importFaciesPropertiesFromFile( const QString& filePath, RimFractureModel* fractureModel );
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Hidden to avoid instantiation
|
||||||
|
RicFaciesPropertiesImportTools();
|
||||||
|
};
|
@ -19,14 +19,9 @@
|
|||||||
#include "RicImportFaciesPropertiesFeature.h"
|
#include "RicImportFaciesPropertiesFeature.h"
|
||||||
|
|
||||||
#include "RiaApplication.h"
|
#include "RiaApplication.h"
|
||||||
#include "RiaLogging.h"
|
|
||||||
|
|
||||||
#include "RifFaciesPropertiesReader.h"
|
#include "RicFaciesPropertiesImportTools.h"
|
||||||
#include "RifFileParseTools.h"
|
|
||||||
|
|
||||||
#include "RigFaciesProperties.h"
|
|
||||||
|
|
||||||
#include "RimFaciesProperties.h"
|
|
||||||
#include "RimFractureModel.h"
|
#include "RimFractureModel.h"
|
||||||
|
|
||||||
#include "Riu3DMainWindowTools.h"
|
#include "Riu3DMainWindowTools.h"
|
||||||
@ -36,9 +31,6 @@
|
|||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
|
||||||
#include <set>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
CAF_CMD_SOURCE_INIT( RicImportFaciesPropertiesFeature, "RicImportFaciesPropertiesFeature" );
|
CAF_CMD_SOURCE_INIT( RicImportFaciesPropertiesFeature, "RicImportFaciesPropertiesFeature" );
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -70,71 +62,7 @@ void RicImportFaciesPropertiesFeature::onActionTriggered( bool isChecked )
|
|||||||
// Remember the path to next time
|
// Remember the path to next time
|
||||||
app->setLastUsedDialogDirectory( "FACIES_DIR", QFileInfo( filePath ).absolutePath() );
|
app->setLastUsedDialogDirectory( "FACIES_DIR", QFileInfo( filePath ).absolutePath() );
|
||||||
|
|
||||||
typedef std::tuple<QString, QString, QString> FaciesKey;
|
RicFaciesPropertiesImportTools::importFaciesPropertiesFromFile( filePath, fractureModel );
|
||||||
|
|
||||||
// Read the facies properties from file
|
|
||||||
std::vector<RifFaciesProperties> rifFaciesProperties;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
QStringList filePaths;
|
|
||||||
filePaths << filePath;
|
|
||||||
RifFaciesPropertiesReader::readFaciesProperties( rifFaciesProperties, filePaths );
|
|
||||||
}
|
|
||||||
catch ( FileParseException& exception )
|
|
||||||
{
|
|
||||||
RiaLogging::warning( QString( "Facies properties import failed: '%1'." ).arg( exception.message ) );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find the unique facies keys (combination of field, formation and facies names)
|
|
||||||
std::set<FaciesKey> faciesKeys;
|
|
||||||
for ( RifFaciesProperties item : rifFaciesProperties )
|
|
||||||
{
|
|
||||||
FaciesKey faciesKey = std::make_tuple( item.fieldName, item.formationName, item.faciesName );
|
|
||||||
faciesKeys.insert( faciesKey );
|
|
||||||
}
|
|
||||||
|
|
||||||
RimFaciesProperties* rimFaciesProperties = new RimFaciesProperties;
|
|
||||||
// rimFaciesProperties->setFilePath();
|
|
||||||
for ( FaciesKey key : faciesKeys )
|
|
||||||
{
|
|
||||||
std::vector<RifFaciesProperties> matchingFacies;
|
|
||||||
|
|
||||||
QString fieldName = std::get<0>( key );
|
|
||||||
QString formationName = std::get<1>( key );
|
|
||||||
QString faciesName = std::get<2>( key );
|
|
||||||
|
|
||||||
// Group the items with a given facies key
|
|
||||||
for ( RifFaciesProperties item : rifFaciesProperties )
|
|
||||||
{
|
|
||||||
if ( item.fieldName == fieldName && item.formationName == formationName && item.faciesName == faciesName )
|
|
||||||
{
|
|
||||||
matchingFacies.push_back( item );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sort the matching items by porosity
|
|
||||||
std::sort( matchingFacies.begin(),
|
|
||||||
matchingFacies.end(),
|
|
||||||
[]( const RifFaciesProperties& a, const RifFaciesProperties& b ) { return a.porosity < b.porosity; } );
|
|
||||||
|
|
||||||
// Finally add the values
|
|
||||||
RigFaciesProperties rigFaciesProperties( fieldName, formationName, faciesName );
|
|
||||||
for ( RifFaciesProperties item : matchingFacies )
|
|
||||||
{
|
|
||||||
rigFaciesProperties.appendValues( item.porosity,
|
|
||||||
item.youngsModulus,
|
|
||||||
item.poissonsRatio,
|
|
||||||
item.K_Ic,
|
|
||||||
item.proppantEmbedment );
|
|
||||||
}
|
|
||||||
|
|
||||||
rimFaciesProperties->setPropertiesForFacies( key, rigFaciesProperties );
|
|
||||||
}
|
|
||||||
|
|
||||||
rimFaciesProperties->setFilePath( filePath );
|
|
||||||
fractureModel->setFaciesProperties( rimFaciesProperties );
|
|
||||||
fractureModel->updateConnectedEditors();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -472,3 +472,14 @@ void RimFractureModel::setFaciesProperties( RimFaciesProperties* faciesPropertie
|
|||||||
{
|
{
|
||||||
m_faciesProperties = faciesProperties;
|
m_faciesProperties = faciesProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimFractureModel::loadDataAndUpdate()
|
||||||
|
{
|
||||||
|
if ( m_faciesProperties )
|
||||||
|
{
|
||||||
|
m_faciesProperties->loadDataAndUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -71,6 +71,8 @@ public:
|
|||||||
|
|
||||||
RimWellPath* wellPath() const;
|
RimWellPath* wellPath() const;
|
||||||
|
|
||||||
|
void loadDataAndUpdate();
|
||||||
|
|
||||||
RimModeledWellPath* thicknessDirectionWellPath() const;
|
RimModeledWellPath* thicknessDirectionWellPath() const;
|
||||||
void setThicknessDirectionWellPath( RimModeledWellPath* thicknessDirectionWellPath );
|
void setThicknessDirectionWellPath( RimModeledWellPath* thicknessDirectionWellPath );
|
||||||
void setFaciesProperties( RimFaciesProperties* faciesProperties );
|
void setFaciesProperties( RimFaciesProperties* faciesProperties );
|
||||||
|
@ -18,6 +18,10 @@
|
|||||||
|
|
||||||
#include "RimFaciesProperties.h"
|
#include "RimFaciesProperties.h"
|
||||||
|
|
||||||
|
#include "RimFractureModel.h"
|
||||||
|
|
||||||
|
#include "RicFaciesPropertiesImportTools.h"
|
||||||
|
|
||||||
#include "cafPdmUiLineEditor.h"
|
#include "cafPdmUiLineEditor.h"
|
||||||
#include "cafPdmUiTextEditor.h"
|
#include "cafPdmUiTextEditor.h"
|
||||||
|
|
||||||
@ -170,3 +174,16 @@ QString RimFaciesProperties::generatePropertiesTable()
|
|||||||
|
|
||||||
return header + body + footer;
|
return header + body + footer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimFaciesProperties::loadDataAndUpdate()
|
||||||
|
{
|
||||||
|
if ( !m_filePath().path().isEmpty() )
|
||||||
|
{
|
||||||
|
RimFractureModel* fractureModel;
|
||||||
|
firstAncestorOrThisOfType( fractureModel );
|
||||||
|
RicFaciesPropertiesImportTools::importFaciesPropertiesFromFile( m_filePath().path(), fractureModel );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -48,6 +48,8 @@ public:
|
|||||||
bool hasPropertiesForFacies( FaciesKey& key ) const;
|
bool hasPropertiesForFacies( FaciesKey& key ) const;
|
||||||
const RigFaciesProperties& propertiesForFacies( FaciesKey& key ) const;
|
const RigFaciesProperties& propertiesForFacies( FaciesKey& key ) const;
|
||||||
|
|
||||||
|
void loadDataAndUpdate();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||||
QString uiConfigName,
|
QString uiConfigName,
|
||||||
|
Loading…
Reference in New Issue
Block a user