mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-21 22:13:25 -06:00
Merge pull request #6415 from OPM/stimplan-sprint8-fixes
Stimplan sprint8 fixes
This commit is contained in:
commit
2e88b9ba88
@ -54,6 +54,8 @@
|
||||
#include "RimFormationNamesCollection.h"
|
||||
#include "RimFractureModel.h"
|
||||
#include "RimFractureModelCollection.h"
|
||||
#include "RimFractureModelPlot.h"
|
||||
#include "RimFractureModelPlotCollection.h"
|
||||
#include "RimFractureTemplateCollection.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechCellColors.h"
|
||||
@ -1578,6 +1580,7 @@ void RiaApplication::loadAndUpdatePlotData()
|
||||
RimAnalysisPlotCollection* alsColl = nullptr;
|
||||
RimCorrelationPlotCollection* corrColl = nullptr;
|
||||
RimMultiPlotCollection* gpwColl = nullptr;
|
||||
RimFractureModelPlotCollection* frmColl = nullptr;
|
||||
|
||||
if ( m_project->mainPlotCollection() )
|
||||
{
|
||||
@ -1625,6 +1628,10 @@ void RiaApplication::loadAndUpdatePlotData()
|
||||
{
|
||||
gpwColl = m_project->mainPlotCollection()->multiPlotCollection();
|
||||
}
|
||||
if ( m_project->mainPlotCollection()->fractureModelPlotCollection() )
|
||||
{
|
||||
frmColl = m_project->mainPlotCollection()->fractureModelPlotCollection();
|
||||
}
|
||||
}
|
||||
|
||||
size_t plotCount = 0;
|
||||
@ -1639,6 +1646,7 @@ void RiaApplication::loadAndUpdatePlotData()
|
||||
plotCount += alsColl ? alsColl->plots().size() : 0;
|
||||
plotCount += corrColl ? corrColl->plots().size() + corrColl->reports().size() : 0;
|
||||
plotCount += gpwColl ? gpwColl->multiPlots().size() : 0;
|
||||
plotCount += frmColl ? frmColl->fractureModelPlots().size() : 0;
|
||||
|
||||
if ( plotCount > 0 )
|
||||
{
|
||||
@ -1744,6 +1752,15 @@ void RiaApplication::loadAndUpdatePlotData()
|
||||
plotProgress.incrementProgress();
|
||||
}
|
||||
}
|
||||
|
||||
if ( frmColl )
|
||||
{
|
||||
for ( const auto& fractureModelPlot : frmColl->fractureModelPlots() )
|
||||
{
|
||||
fractureModelPlot->loadDataAndUpdate();
|
||||
plotProgress.incrementProgress();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -175,6 +175,8 @@ RimFractureModelPlot*
|
||||
// Make sure the summary plot window is visible
|
||||
RiuPlotMainWindowTools::showPlotMainWindow();
|
||||
|
||||
plot->loadDataAndUpdate();
|
||||
|
||||
return plot;
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ void RicImportElasticPropertiesFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
// Open dialog box to select files
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString defaultDir = app->lastUsedDialogDirectory( "FACIES_DIR" );
|
||||
QString defaultDir = app->lastUsedDialogDirectoryWithFallbackToProjectFolder( "STIMPLAN_DIR" );
|
||||
QString filePath = QFileDialog::getOpenFileName( Riu3DMainWindowTools::mainWindowWidget(),
|
||||
"Import Elastic Properties",
|
||||
defaultDir,
|
||||
@ -60,7 +60,7 @@ void RicImportElasticPropertiesFeature::onActionTriggered( bool isChecked )
|
||||
if ( filePath.isNull() ) return;
|
||||
|
||||
// Remember the path to next time
|
||||
app->setLastUsedDialogDirectory( "FACIES_DIR", QFileInfo( filePath ).absolutePath() );
|
||||
app->setLastUsedDialogDirectory( "STIMPLAN_DIR", QFileInfo( filePath ).absolutePath() );
|
||||
|
||||
RicElasticPropertiesImportTools::importElasticPropertiesFromFile( filePath, fractureModel );
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ bool RicImportFaciesFeature::isCommandEnabled()
|
||||
void RicImportFaciesFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString defaultDir = app->lastUsedDialogDirectory( "ROFF_FILE" );
|
||||
QString defaultDir = app->lastUsedDialogDirectoryWithFallbackToProjectFolder( "STIMPLAN_DIR" );
|
||||
|
||||
QString filterText = QString( "Roff ascii file (*.roff);;All Files (*.*)" );
|
||||
|
||||
@ -65,7 +65,7 @@ void RicImportFaciesFeature::onActionTriggered( bool isChecked )
|
||||
if ( fileName.isEmpty() ) return;
|
||||
|
||||
// Remember the path to next time
|
||||
app->setLastUsedDialogDirectory( "ROFF_FILE", QFileInfo( fileName ).absolutePath() );
|
||||
app->setLastUsedDialogDirectory( "STIMPLAN_DIR", QFileInfo( fileName ).absolutePath() );
|
||||
|
||||
std::map<int, QString> codeNames;
|
||||
try
|
||||
@ -91,7 +91,8 @@ void RicImportFaciesFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
// Try to find a color from the rock type color legend by fuzzy matching names
|
||||
cvf::Color3f color;
|
||||
if ( !matchByName( it.second, rockTypeColorLegend, color ) )
|
||||
if ( !predefinedColorMatch( it.second, rockTypeColorLegend, color ) &&
|
||||
!matchByName( it.second, rockTypeColorLegend, color ) )
|
||||
{
|
||||
// No match use a random color
|
||||
color = colorTable.cycledColor3f( it.first );
|
||||
@ -118,7 +119,7 @@ void RicImportFaciesFeature::setupActionLook( QAction* actionToSetup )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicImportFaciesFeature::matchByName( const QString name, RimColorLegend* colorLegend, cvf::Color3f& color )
|
||||
bool RicImportFaciesFeature::matchByName( const QString& name, RimColorLegend* colorLegend, cvf::Color3f& color )
|
||||
{
|
||||
// No match if color legend does not exist
|
||||
if ( !colorLegend ) return false;
|
||||
@ -167,3 +168,24 @@ int RicImportFaciesFeature::computeEditDistance( const QString& a, const QString
|
||||
|
||||
return RiaStdStringTools::computeEditDistance( aSimplified.toStdString(), bSimplified.toStdString() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicImportFaciesFeature::predefinedColorMatch( const QString& name, RimColorLegend* colorLegend, cvf::Color3f& color )
|
||||
{
|
||||
// Calcite should use limestone color
|
||||
if ( name.toLower().trimmed() == QString( "calcite" ) )
|
||||
{
|
||||
for ( auto i : colorLegend->colorLegendItems() )
|
||||
{
|
||||
if ( i->categoryName() == QString( "Limestone" ) )
|
||||
{
|
||||
color = i->color();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ protected:
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
|
||||
private:
|
||||
int computeEditDistance( const QString& a, const QString& b );
|
||||
bool matchByName( const QString name, RimColorLegend* colorLegend, cvf::Color3f& color );
|
||||
static int computeEditDistance( const QString& a, const QString& b );
|
||||
static bool matchByName( const QString& name, RimColorLegend* colorLegend, cvf::Color3f& color );
|
||||
static bool predefinedColorMatch( const QString& name, RimColorLegend* colorLegend, cvf::Color3f& color );
|
||||
};
|
||||
|
@ -38,3 +38,7 @@ fracture_model_plot = fracture_model_plot_collection.new_fracture_model_plot(ecl
|
||||
|
||||
file_path = "/tmp/Geological.frk"
|
||||
fracture_model_plot.export_to_file(file_path=file_path)
|
||||
|
||||
|
||||
export_folder = "/tmp/"
|
||||
fracture_model_plot.export_snapshot(export_folder=export_folder)
|
||||
|
@ -98,10 +98,10 @@ RimFractureModel::RimFractureModel()
|
||||
"",
|
||||
"" );
|
||||
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_anchorPosition, "AnchorPosition", "Anchor Position", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_anchorPosition, "AnchorPosition", "Anchor Position", "", "", "" );
|
||||
m_anchorPosition.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_thicknessDirection, "ThicknessDirection", "Thickness Direction", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_thicknessDirection, "ThicknessDirection", "Thickness Direction", "", "", "" );
|
||||
m_thicknessDirection.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_thicknessDirectionWellPath,
|
||||
@ -120,15 +120,19 @@ RimFractureModel::RimFractureModel()
|
||||
// Stress unit: bar
|
||||
// Stress gradient unit: bar/m
|
||||
// Depth is meter
|
||||
CAF_PDM_InitScriptableField( &m_verticalStress, "VerticalStress", 879.0, "Vertical Stress", "", "", "" );
|
||||
double defaultStressGradient = 0.238;
|
||||
double defaultStressDepth = computeDefaultStressDepth();
|
||||
double defaultStress = defaultStressDepth * defaultStressGradient;
|
||||
|
||||
CAF_PDM_InitScriptableField( &m_verticalStress, "VerticalStress", defaultStress, "Vertical Stress", "", "", "" );
|
||||
CAF_PDM_InitScriptableField( &m_verticalStressGradient,
|
||||
"VerticalStressGradient",
|
||||
0.238,
|
||||
defaultStressGradient,
|
||||
"Vertical Stress Gradient",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
CAF_PDM_InitScriptableField( &m_stressDepth, "StressDepth", 1000.0, "Stress Depth", "", "", "" );
|
||||
CAF_PDM_InitScriptableField( &m_stressDepth, "StressDepth", defaultStressDepth, "Stress Depth", "", "", "" );
|
||||
|
||||
CAF_PDM_InitScriptableField( &m_overburdenHeight, "OverburdenHeight", 50.0, "Overburden Height", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_overburdenFormation, "OverburdenFormation", "Overburden Formation", "", "", "" );
|
||||
@ -283,17 +287,10 @@ QList<caf::PdmOptionItemInfo> RimFractureModel::calculateValueOptions( const caf
|
||||
|
||||
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();
|
||||
RigEclipseCaseData* eclipseCaseData = getEclipseCaseData();
|
||||
if ( !eclipseCaseData ) return options;
|
||||
|
||||
std::vector<QString> formationNames = eclipseCase->eclipseCaseData()->formationNames();
|
||||
std::vector<QString> formationNames = eclipseCaseData->formationNames();
|
||||
for ( const QString& formationName : formationNames )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( formationName, formationName ) );
|
||||
@ -458,15 +455,7 @@ cvf::Vec3d RimFractureModel::calculateTSTDirection() const
|
||||
{
|
||||
cvf::Vec3d defaultDirection = cvf::Vec3d( 0.0, 0.0, -1.0 );
|
||||
|
||||
// TODO: find a better way?
|
||||
// Find an eclipse case
|
||||
RimProject* proj = RimProject::current();
|
||||
if ( proj->eclipseCases().empty() ) return defaultDirection;
|
||||
|
||||
RimEclipseCase* eclipseCase = proj->eclipseCases()[0];
|
||||
if ( !eclipseCase ) return defaultDirection;
|
||||
|
||||
RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData();
|
||||
RigEclipseCaseData* eclipseCaseData = getEclipseCaseData();
|
||||
if ( !eclipseCaseData ) return defaultDirection;
|
||||
|
||||
RigMainGrid* mainGrid = eclipseCaseData->mainGrid();
|
||||
@ -565,14 +554,7 @@ QString RimFractureModel::vecToString( const cvf::Vec3d& vec )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFractureModel::findThicknessTargetPoints( cvf::Vec3d& topPosition, cvf::Vec3d& bottomPosition )
|
||||
{
|
||||
// TODO: duplicated and ugly!
|
||||
RimProject* proj = RimProject::current();
|
||||
if ( proj->eclipseCases().empty() ) return;
|
||||
|
||||
RimEclipseCase* eclipseCase = proj->eclipseCases()[0];
|
||||
if ( !eclipseCase ) return;
|
||||
|
||||
RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData();
|
||||
RigEclipseCaseData* eclipseCaseData = getEclipseCaseData();
|
||||
if ( !eclipseCaseData ) return;
|
||||
|
||||
const cvf::Vec3d& position = anchorPosition();
|
||||
@ -581,7 +563,7 @@ void RimFractureModel::findThicknessTargetPoints( cvf::Vec3d& topPosition, cvf::
|
||||
// Create a "fake" well path which from top to bottom of formation
|
||||
// passing through the point and with the given direction
|
||||
|
||||
const cvf::BoundingBox& geometryBoundingBox = eclipseCase->mainGrid()->boundingBox();
|
||||
const cvf::BoundingBox& geometryBoundingBox = eclipseCaseData->mainGrid()->boundingBox();
|
||||
|
||||
RiaLogging::info( QString( "All cells bounding box: %1 %2" )
|
||||
.arg( RimFractureModel::vecToString( geometryBoundingBox.min() ) )
|
||||
@ -942,3 +924,41 @@ double RimFractureModel::referenceTemperatureDepth() const
|
||||
{
|
||||
return m_referenceTemperatureDepth;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCase* RimFractureModel::getEclipseCase()
|
||||
{
|
||||
// Find an eclipse case
|
||||
RimProject* proj = RimProject::current();
|
||||
if ( proj->eclipseCases().empty() ) return nullptr;
|
||||
|
||||
return proj->eclipseCases()[0];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigEclipseCaseData* RimFractureModel::getEclipseCaseData()
|
||||
{
|
||||
// Find an eclipse case
|
||||
RimEclipseCase* eclipseCase = getEclipseCase();
|
||||
if ( !eclipseCase ) return nullptr;
|
||||
|
||||
return eclipseCase->eclipseCaseData();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RimFractureModel::computeDefaultStressDepth()
|
||||
{
|
||||
const double stressDepth = 1000.0;
|
||||
|
||||
RimEclipseCase* eclipseCase = getEclipseCase();
|
||||
if ( !eclipseCase ) return stressDepth;
|
||||
|
||||
// Use top of active cells as reference stress depth
|
||||
return -eclipseCase->activeCellsBoundingBox().max().z();
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ class RimEclipseCase;
|
||||
class RimWellPath;
|
||||
class RimModeledWellPath;
|
||||
class RimElasticProperties;
|
||||
class RigEclipseCaseData;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -133,6 +134,10 @@ private:
|
||||
void findThicknessTargetPoints( cvf::Vec3d& topPosition, cvf::Vec3d& bottomPosition );
|
||||
static QString vecToString( const cvf::Vec3d& vec );
|
||||
void updateThicknessDirectionWellPathName();
|
||||
static double computeDefaultStressDepth();
|
||||
|
||||
static RigEclipseCaseData* getEclipseCaseData();
|
||||
static RimEclipseCase* getEclipseCase();
|
||||
|
||||
protected:
|
||||
caf::PdmField<double> m_MD;
|
||||
|
Loading…
Reference in New Issue
Block a user