mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fault reactivation (#10624)
Update result to generate well paths based on information from model generator. Store settings in JSON file. Add method to access local coordinate system definition
This commit is contained in:
@@ -24,6 +24,8 @@
|
||||
#include "RifFaultReactivationModelExporter.h"
|
||||
|
||||
#include "RimFaultReactivationModel.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimProcess.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
@@ -66,9 +68,9 @@ void RicRunFaultReactModelingFeature::onActionTriggered( bool isChecked )
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !model->extractModelData() )
|
||||
if ( !model->extractAndExportModelData() )
|
||||
{
|
||||
QMessageBox::critical( nullptr, frmTitle, "Unable to get necessary data from the input model." );
|
||||
QMessageBox::critical( nullptr, frmTitle, "Unable to get necessary data from the input case." );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -115,6 +117,24 @@ void RicRunFaultReactModelingFeature::onActionTriggered( bool isChecked )
|
||||
runProgress.incrementProgress();
|
||||
runProgress.setProgressDescription( "Loading modeling results." );
|
||||
|
||||
for ( auto gCase : RimProject::current()->geoMechCases() )
|
||||
{
|
||||
if ( model->outputOdbFilename() == gCase->gridFileName() )
|
||||
{
|
||||
gCase->reloadDataAndUpdate();
|
||||
auto& views = gCase->geoMechViews();
|
||||
if ( views.size() > 0 )
|
||||
{
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( views[0] );
|
||||
}
|
||||
else
|
||||
{
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( gCase );
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
if ( !app->openOdbCaseFromFile( model->outputOdbFilename() ) )
|
||||
{
|
||||
|
||||
@@ -417,8 +417,7 @@ void RiuWellImportWizard::updateFieldsModel()
|
||||
QStringList fields;
|
||||
QStringList edmIds;
|
||||
|
||||
ResInsightInternalJson::JsonReader jsonReader;
|
||||
QMap<QString, QVariant> jsonMap = jsonReader.decodeFile( fileName );
|
||||
QMap<QString, QVariant> jsonMap = ResInsightInternalJson::JsonReader::decodeFile( fileName );
|
||||
QVariantList variantList = ResInsightInternalJson::JsonReader::getVariantList( jsonMap );
|
||||
for ( const auto& listItem : variantList )
|
||||
{
|
||||
@@ -632,8 +631,7 @@ void RiuWellImportWizard::parseWellsResponse( RimOilFieldEntry* oilFieldEntry )
|
||||
|
||||
if ( caf::Utils::fileExists( oilFieldEntry->wellsFilePath ) )
|
||||
{
|
||||
ResInsightInternalJson::JsonReader jsonReader;
|
||||
QMap<QString, QVariant> jsonMap = jsonReader.decodeFile( oilFieldEntry->wellsFilePath );
|
||||
QMap<QString, QVariant> jsonMap = ResInsightInternalJson::JsonReader::decodeFile( oilFieldEntry->wellsFilePath );
|
||||
QVariantList variantList = ResInsightInternalJson::JsonReader::getVariantList( jsonMap );
|
||||
for ( const auto& listItem : variantList )
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <QtCore/QJsonDocument>
|
||||
#include <QtCore/QJsonObject>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QTextStream>
|
||||
|
||||
namespace ResInsightInternalJson
|
||||
{
|
||||
@@ -30,10 +31,14 @@ QMap<QString, QVariant> JsonReader::decodeFile( QString filePath )
|
||||
{
|
||||
QFile file;
|
||||
file.setFileName( filePath );
|
||||
file.open( QIODevice::ReadOnly );
|
||||
if ( file.open( QIODevice::ReadOnly ) )
|
||||
{
|
||||
QByteArray byteArray = file.readAll();
|
||||
file.close();
|
||||
return Json::decode( byteArray );
|
||||
}
|
||||
|
||||
return QMap<QString, QVariant>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -53,6 +58,25 @@ QString JsonReader::rootKeyText()
|
||||
return "root";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool JsonWriter::encodeFile( QString filePath, QMap<QString, QVariant> map )
|
||||
{
|
||||
QFile file;
|
||||
file.setFileName( filePath );
|
||||
if ( file.open( QIODevice::ReadWrite | QIODevice::Text ) )
|
||||
{
|
||||
QString content = Json::encode( map, true );
|
||||
QTextStream out( &file );
|
||||
out << content;
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -28,12 +28,24 @@ namespace ResInsightInternalJson
|
||||
class JsonReader
|
||||
{
|
||||
public:
|
||||
QMap<QString, QVariant> decodeFile( QString filePath );
|
||||
static QMap<QString, QVariant> decodeFile( QString filePath );
|
||||
|
||||
// Get a variant list from a map
|
||||
static QVariantList getVariantList( const QMap<QString, QVariant>& map );
|
||||
|
||||
static QString rootKeyText();
|
||||
|
||||
private:
|
||||
JsonReader(){};
|
||||
};
|
||||
|
||||
class JsonWriter
|
||||
{
|
||||
public:
|
||||
static bool encodeFile( QString filePath, QMap<QString, QVariant> map );
|
||||
|
||||
private:
|
||||
JsonWriter(){};
|
||||
};
|
||||
|
||||
class Json
|
||||
|
||||
@@ -124,8 +124,7 @@ bool RifWellPathImporter::isJsonFile( const QString& filePath )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifWellPathImporter::WellMetaData RifWellPathImporter::readJsonWellMetaData( const QString& filePath )
|
||||
{
|
||||
ResInsightInternalJson::JsonReader jsonReader;
|
||||
QMap<QString, QVariant> jsonMap = jsonReader.decodeFile( filePath );
|
||||
QMap<QString, QVariant> jsonMap = ResInsightInternalJson::JsonReader::decodeFile( filePath );
|
||||
WellMetaData metadata;
|
||||
|
||||
metadata.m_id = jsonMap["id"].toString();
|
||||
@@ -151,8 +150,7 @@ RifWellPathImporter::WellMetaData RifWellPathImporter::readJsonWellMetaData( con
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifWellPathImporter::WellData RifWellPathImporter::readJsonWellData( const QString& filePath )
|
||||
{
|
||||
ResInsightInternalJson::JsonReader jsonReader;
|
||||
QMap<QString, QVariant> jsonMap = jsonReader.decodeFile( filePath );
|
||||
QMap<QString, QVariant> jsonMap = ResInsightInternalJson::JsonReader::decodeFile( filePath );
|
||||
|
||||
double datumElevation = jsonMap["datumElevation"].toDouble();
|
||||
QList<QVariant> pathList = jsonMap["path"].toList();
|
||||
|
||||
@@ -3,6 +3,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultInViewCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultReactivationModel.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultReactivationModelCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultReactivationTools.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -10,6 +11,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultInViewCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultReactivationModel.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultReactivationModelCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultReactivationTools.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include "RiaPreferencesGeoMech.h"
|
||||
#include "RiaQDateTimeTools.h"
|
||||
|
||||
#include "RifJsonEncodeDecode.h"
|
||||
|
||||
#include "RigBasicPlane.h"
|
||||
#include "RigFaultReactivationModel.h"
|
||||
#include "RigPolyLinesData.h"
|
||||
@@ -39,6 +41,7 @@
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimFaultInView.h"
|
||||
#include "RimFaultInViewCollection.h"
|
||||
#include "RimFaultReactivationTools.h"
|
||||
#include "RimPolylineTarget.h"
|
||||
#include "RimTimeStepFilter.h"
|
||||
#include "RimTools.h"
|
||||
@@ -52,6 +55,8 @@
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QDir>
|
||||
#include <QMap>
|
||||
#include <QVariant>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimFaultReactivationModel, "FaultReactivationModel" );
|
||||
|
||||
@@ -364,6 +369,17 @@ bool RimFaultReactivationModel::showModel() const
|
||||
return m_showModelPlane;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<cvf::Vec3d, cvf::Vec3d> RimFaultReactivationModel::localCoordSysNormalsXY() const
|
||||
{
|
||||
cvf::Vec3d yNormal = m_modelPlane->normal();
|
||||
cvf::Vec3d xNormal = yNormal ^ cvf::Vec3d::Z_AXIS;
|
||||
|
||||
return std::make_pair( xNormal, yNormal );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -503,9 +519,7 @@ void RimFaultReactivationModel::updateTimeSteps()
|
||||
{
|
||||
m_availableTimeSteps.clear();
|
||||
const auto eCase = eclipseCase();
|
||||
if ( eCase == nullptr ) return;
|
||||
|
||||
m_availableTimeSteps = eCase->timeStepDates();
|
||||
if ( eCase != nullptr ) m_availableTimeSteps = eCase->timeStepDates();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -548,6 +562,15 @@ QString RimFaultReactivationModel::inputFilename() const
|
||||
return directory.absoluteFilePath( baseFilename() + ".inp" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultReactivationModel::settingsFilename() const
|
||||
{
|
||||
QDir directory( baseDir() );
|
||||
return directory.absoluteFilePath( baseFilename() + ".settings.json" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -568,8 +591,32 @@ QString RimFaultReactivationModel::baseFilename() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimFaultReactivationModel::extractModelData()
|
||||
bool RimFaultReactivationModel::exportModelSettings()
|
||||
{
|
||||
if ( m_faultPlane.isNull() ) return false;
|
||||
|
||||
QMap<QString, QVariant> settings;
|
||||
|
||||
auto [topPosition, bottomPosition] = m_faultPlane->intersectTopBottomLine();
|
||||
auto faultNormal = m_faultPlane->normal();
|
||||
|
||||
// make sure we move horizontally
|
||||
faultNormal.z() = 0.0;
|
||||
faultNormal.normalize();
|
||||
|
||||
RimFaultReactivationTools::addSettingsToMap( settings, faultNormal, topPosition, bottomPosition );
|
||||
|
||||
QDir directory( baseDir() );
|
||||
return ResInsightInternalJson::JsonWriter::encodeFile( settingsFilename(), settings );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimFaultReactivationModel::extractAndExportModelData()
|
||||
{
|
||||
exportModelSettings();
|
||||
|
||||
// TODO - get values from eclipse and geomech models here
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,9 @@ public:
|
||||
cvf::ref<RigFaultReactivationModel> model() const;
|
||||
bool showModel() const;
|
||||
|
||||
bool extractModelData();
|
||||
std::pair<cvf::Vec3d, cvf::Vec3d> localCoordSysNormalsXY() const;
|
||||
|
||||
bool extractAndExportModelData();
|
||||
|
||||
QString baseDir() const;
|
||||
void setBaseDir( QString path );
|
||||
@@ -100,8 +102,10 @@ public:
|
||||
std::vector<QDateTime> selectedTimeSteps() const;
|
||||
|
||||
QStringList commandParameters() const;
|
||||
|
||||
QString outputOdbFilename() const;
|
||||
QString inputFilename() const;
|
||||
QString settingsFilename() const;
|
||||
|
||||
void updateTimeSteps();
|
||||
|
||||
@@ -119,6 +123,8 @@ protected:
|
||||
|
||||
QString baseFilename() const;
|
||||
|
||||
bool exportModelSettings();
|
||||
|
||||
private:
|
||||
std::shared_ptr<RicPolylineTargetsPickEventHandler> m_pickTargetsEventHandler;
|
||||
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023 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 "RimFaultReactivationTools.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RimFaultReactivationTools::normalVector( QMap<QString, QVariant> settings )
|
||||
{
|
||||
double x = settings.value( "faultNormal_X", 0.0 ).toDouble();
|
||||
double y = settings.value( "faultNormal_Y", 0.0 ).toDouble();
|
||||
double z = settings.value( "faultNormal_Z", 0.0 ).toDouble();
|
||||
|
||||
return cvf::Vec3d( x, y, z );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RimFaultReactivationTools::topFaultPosition( QMap<QString, QVariant> settings )
|
||||
{
|
||||
double x = settings.value( "faultTop_X", 0.0 ).toDouble();
|
||||
double y = settings.value( "faultTop_Y", 0.0 ).toDouble();
|
||||
double z = settings.value( "faultTop_Z", 0.0 ).toDouble();
|
||||
|
||||
return cvf::Vec3d( x, y, z );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RimFaultReactivationTools::bottomFaultPosition( QMap<QString, QVariant> settings )
|
||||
{
|
||||
double x = settings.value( "faultBottom_X", 0.0 ).toDouble();
|
||||
double y = settings.value( "faultBottom_Y", 0.0 ).toDouble();
|
||||
double z = settings.value( "faultBottom_Z", 0.0 ).toDouble();
|
||||
|
||||
return cvf::Vec3d( x, y, z );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationTools::addSettingsToMap( QMap<QString, QVariant>& map,
|
||||
cvf::Vec3d normalVector,
|
||||
cvf::Vec3d topFaultPosition,
|
||||
cvf::Vec3d bottomFaultPosition )
|
||||
{
|
||||
map["faultTop_X"] = topFaultPosition.x();
|
||||
map["faultTop_Y"] = topFaultPosition.y();
|
||||
map["faultTop_Z"] = topFaultPosition.z();
|
||||
|
||||
map["faultBottom_X"] = bottomFaultPosition.x();
|
||||
map["faultBottom_Y"] = bottomFaultPosition.y();
|
||||
map["faultBottom_Z"] = bottomFaultPosition.z();
|
||||
|
||||
map["faultNormal_X"] = normalVector.x();
|
||||
map["faultNormal_Y"] = normalVector.y();
|
||||
map["faultNormal_Z"] = normalVector.z();
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023 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 <QMap>
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
|
||||
#include "cvfVector3.h"
|
||||
|
||||
class RimFaultReactivationTools
|
||||
{
|
||||
public:
|
||||
static cvf::Vec3d normalVector( QMap<QString, QVariant> settings );
|
||||
static cvf::Vec3d topFaultPosition( QMap<QString, QVariant> settings );
|
||||
static cvf::Vec3d bottomFaultPosition( QMap<QString, QVariant> settings );
|
||||
|
||||
static void
|
||||
addSettingsToMap( QMap<QString, QVariant>& map, cvf::Vec3d normalVector, cvf::Vec3d topFaultPosition, cvf::Vec3d bottomFaultPosition );
|
||||
|
||||
private:
|
||||
RimFaultReactivationTools(){};
|
||||
};
|
||||
@@ -25,15 +25,17 @@
|
||||
#include "WellLogCommands/RicNewWellLogPlotFeatureImpl.h"
|
||||
#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h"
|
||||
|
||||
#include "RifJsonEncodeDecode.h"
|
||||
|
||||
#include "RigFemPartCollection.h"
|
||||
#include "RigGeoMechCaseData.h"
|
||||
#include "RigHexIntersectionTools.h"
|
||||
#include "RigReservoirGridTools.h"
|
||||
|
||||
#include "RimFaultReactivationTools.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimModeledWellPath.h"
|
||||
#include "RimWellLogCalculatedCurve.h"
|
||||
@@ -55,26 +57,29 @@
|
||||
|
||||
#include <array>
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QMap>
|
||||
#include <QVariant>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimGeoMechFaultReactivationResult, "RimGeoMechFaultReactivationResult" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechFaultReactivationResult::RimGeoMechFaultReactivationResult()
|
||||
: m_bHaveValidData( false )
|
||||
{
|
||||
// TODO: Update icon
|
||||
CAF_PDM_InitObject( "Fault Reactivation Result", ":/GeoMechCase24x24.png" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_intersection, "Intersection", "Intersection" );
|
||||
CAF_PDM_InitField( &m_distanceFromFault, "DistanceFromFault", 5.0, "Distance From Fault" );
|
||||
|
||||
CAF_PDM_InitField( &m_distanceFromIntersection,
|
||||
"FaceDistanceFromIntersection",
|
||||
m_defaultDistanceFromIntersection,
|
||||
"Face Distance From Intersection" );
|
||||
CAF_PDM_InitField( &m_widthOutsideIntersection, "FaceWidthOutsideIntersection", 0.0, "Face Width Outside Intersection" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_createFaultReactivationPlot, "CreateReactivationPlot", "" );
|
||||
caf::PdmUiPushButtonEditor::configureEditorForField( &m_createFaultReactivationPlot );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_createFaultReactivationResult, "CreateReactivationResult", "" );
|
||||
caf::PdmUiPushButtonEditor::configureEditorForField( &m_createFaultReactivationResult );
|
||||
CAF_PDM_InitFieldNoDefault( &m_faultNormal, "FaultNormal", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_faultTopPosition, "FaultTopPosition", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_faultBottomPosition, "FaultBottomPosition", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_faceAWellPath, "FaceAWellPath", "Face A Well Path" );
|
||||
m_faceAWellPath.uiCapability()->setUiHidden( true );
|
||||
@@ -94,8 +99,6 @@ RimGeoMechFaultReactivationResult::RimGeoMechFaultReactivationResult()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechFaultReactivationResult::~RimGeoMechFaultReactivationResult()
|
||||
{
|
||||
delete m_faceAWellPath;
|
||||
delete m_faceBWellPath;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -103,6 +106,27 @@ RimGeoMechFaultReactivationResult::~RimGeoMechFaultReactivationResult()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechFaultReactivationResult::onLoadDataAndUpdate()
|
||||
{
|
||||
auto geomCase = geoMechCase();
|
||||
if ( geomCase == nullptr ) return;
|
||||
|
||||
auto filename = geomCase->gridFileName();
|
||||
QFileInfo fi( filename );
|
||||
auto folder = fi.path();
|
||||
auto basename = fi.baseName();
|
||||
|
||||
QDir workDir( folder );
|
||||
auto modelSettingsFilename = workDir.absoluteFilePath( basename + ".settings.json" );
|
||||
|
||||
auto map = ResInsightInternalJson::JsonReader::decodeFile( modelSettingsFilename );
|
||||
if ( !map.isEmpty() )
|
||||
{
|
||||
m_faultNormal = RimFaultReactivationTools::normalVector( map );
|
||||
m_faultTopPosition = RimFaultReactivationTools::topFaultPosition( map );
|
||||
m_faultBottomPosition = RimFaultReactivationTools::bottomFaultPosition( map );
|
||||
|
||||
m_bHaveValidData = true;
|
||||
}
|
||||
|
||||
createWellGeometry();
|
||||
createWellLogCurves();
|
||||
}
|
||||
@@ -114,22 +138,6 @@ QList<caf::PdmOptionItemInfo> RimGeoMechFaultReactivationResult::calculateValueO
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if ( fieldNeedingOptions == &m_intersection )
|
||||
{
|
||||
RimGridView* activeView = RiaApplication::instance()->activeGridView();
|
||||
if ( !activeView || !activeView->intersectionCollection() ) return options;
|
||||
|
||||
for ( auto* intersection : activeView->intersectionCollection()->intersections() )
|
||||
{
|
||||
// Only utilize polyline intersections with two points
|
||||
if ( intersection && intersection->type() == RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYLINE &&
|
||||
!intersection->polyLines().empty() && intersection->polyLines()[0].size() == 2 )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( intersection->name(), intersection ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
@@ -139,14 +147,10 @@ QList<caf::PdmOptionItemInfo> RimGeoMechFaultReactivationResult::calculateValueO
|
||||
void RimGeoMechFaultReactivationResult::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
caf::PdmUiGroup* group = uiOrdering.addNewGroup( "Fault Reactivation Result" );
|
||||
group->add( &m_intersection );
|
||||
group->add( &m_distanceFromIntersection );
|
||||
group->add( &m_widthOutsideIntersection );
|
||||
group->add( &m_createFaultReactivationResult );
|
||||
group->add( &m_faceAWellPath );
|
||||
group->add( &m_faceBWellPath );
|
||||
group->add( &m_faceAWellPathPartIndex );
|
||||
group->add( &m_faceBWellPathPartIndex );
|
||||
group->add( &m_distanceFromFault );
|
||||
group->add( &m_createFaultReactivationPlot );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -156,11 +160,11 @@ void RimGeoMechFaultReactivationResult::fieldChangedByUi( const caf::PdmFieldHan
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == &m_distanceFromIntersection || changedField == &m_widthOutsideIntersection )
|
||||
if ( changedField == &m_distanceFromFault )
|
||||
{
|
||||
createWellGeometry();
|
||||
}
|
||||
if ( changedField == &m_createFaultReactivationResult && m_intersection() )
|
||||
if ( changedField == &m_createFaultReactivationPlot )
|
||||
{
|
||||
createWellGeometry();
|
||||
createWellLogCurves();
|
||||
@@ -174,7 +178,7 @@ void RimGeoMechFaultReactivationResult::defineEditorAttribute( const caf::PdmFie
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( field == &m_createFaultReactivationResult )
|
||||
if ( field == &m_createFaultReactivationPlot )
|
||||
{
|
||||
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
|
||||
if ( attrib )
|
||||
@@ -189,14 +193,16 @@ void RimGeoMechFaultReactivationResult::defineEditorAttribute( const caf::PdmFie
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechFaultReactivationResult::createWellGeometry()
|
||||
{
|
||||
RimGeoMechCase* geomCase = firstAncestorOrThisOfTypeAsserted<RimGeoMechCase>();
|
||||
if ( !m_bHaveValidData ) return;
|
||||
|
||||
auto geomCase = geoMechCase();
|
||||
if ( !geomCase || !geomCase->geoMechData() ) return;
|
||||
RigFemPartCollection* geoMechPartCollection = geomCase->geoMechData()->femParts();
|
||||
if ( !geoMechPartCollection ) return;
|
||||
RimWellPathCollection* wellPathCollection = RimProject::current()->activeOilField()->wellPathCollection();
|
||||
if ( !wellPathCollection ) return;
|
||||
|
||||
// Create well paths if not existing collection
|
||||
// Create well paths if not existing in collection
|
||||
const auto allWellPaths = wellPathCollection->allWellPaths();
|
||||
if ( !m_faceAWellPath ||
|
||||
( m_faceAWellPath && std::find( allWellPaths.begin(), allWellPaths.end(), m_faceAWellPath ) == allWellPaths.end() ) )
|
||||
@@ -221,41 +227,14 @@ void RimGeoMechFaultReactivationResult::createWellGeometry()
|
||||
m_faceAWellPath->geometryDefinition()->deleteAllTargets();
|
||||
m_faceBWellPath->geometryDefinition()->deleteAllTargets();
|
||||
|
||||
// Using first two points from first polyline
|
||||
const auto polyLines = m_intersection()->polyLines();
|
||||
if ( polyLines.size() != 1 || polyLines[0].size() != 2 )
|
||||
{
|
||||
RiaLogging::error( "Polyline intersection for fault face must be defined with only 2 points!" );
|
||||
return;
|
||||
}
|
||||
const std::vector<cvf::Vec3d> points = { polyLines[0][0], polyLines[0][1] };
|
||||
|
||||
// Create vector for well path defined by point a and b
|
||||
const cvf::Vec3d a = points[0];
|
||||
const cvf::Vec3d b = points[1];
|
||||
const cvf::Vec3d wellVector = b - a;
|
||||
|
||||
// Cross product of well path vector and z-axis (New vector must be normalized)
|
||||
const cvf::Vec3d normVector = wellVector ^ cvf::Vector3<double>::Z_AXIS;
|
||||
const cvf::Vec3d distanceVector = m_distanceFromIntersection() * normVector.getNormalized();
|
||||
|
||||
// Get normalized vector along well to adjust point a and b outside of defined intersection
|
||||
const auto normalizedWellVector = wellVector.getNormalized();
|
||||
const cvf::Vec3d widthAdjustedA = a - ( normalizedWellVector * m_widthOutsideIntersection() );
|
||||
const cvf::Vec3d widthAdjustedB = b + ( normalizedWellVector * m_widthOutsideIntersection() );
|
||||
|
||||
// Create well points for face A and B
|
||||
const std::pair<cvf::Vec3d, cvf::Vec3d> faceAWellStartAndEnd = { widthAdjustedA + distanceVector, widthAdjustedB + distanceVector };
|
||||
const std::pair<cvf::Vec3d, cvf::Vec3d> faceBWellStartAndEnd = { widthAdjustedA - distanceVector, widthAdjustedB - distanceVector };
|
||||
|
||||
// Get center point between face well points to detect which part fault faces are in
|
||||
auto centerpoint = []( const cvf::Vec3d& a, const cvf::Vec3d& b ) -> cvf::Vec3d { return ( a + b ) / 2.0; };
|
||||
const cvf::Vec3d faceAWellPathCenter = centerpoint( faceAWellStartAndEnd.first, faceAWellStartAndEnd.second );
|
||||
const cvf::Vec3d faceBWellPathCenter = centerpoint( faceBWellStartAndEnd.first, faceBWellStartAndEnd.second );
|
||||
cvf::Vec3d partATop = m_faultTopPosition() + m_faultNormal() * m_distanceFromFault;
|
||||
cvf::Vec3d partABottom = m_faultBottomPosition() + m_faultNormal() * m_distanceFromFault;
|
||||
cvf::Vec3d partBTop = m_faultTopPosition() - m_faultNormal() * m_distanceFromFault;
|
||||
cvf::Vec3d partBBottom = m_faultBottomPosition() - m_faultNormal() * m_distanceFromFault;
|
||||
|
||||
// Update the well path target values
|
||||
const std::vector<cvf::Vec3d> faceAWellPoints = { faceAWellStartAndEnd.first, faceAWellPathCenter, faceAWellStartAndEnd.second };
|
||||
const std::vector<cvf::Vec3d> faceBWellPoints = { faceBWellStartAndEnd.first, faceBWellPathCenter, faceBWellStartAndEnd.second };
|
||||
const std::vector<cvf::Vec3d> faceAWellPoints = { partATop, partABottom };
|
||||
const std::vector<cvf::Vec3d> faceBWellPoints = { partBTop, partBBottom };
|
||||
m_faceAWellPath->geometryDefinition()->createAndInsertTargets( faceAWellPoints );
|
||||
m_faceBWellPath->geometryDefinition()->createAndInsertTargets( faceBWellPoints );
|
||||
m_faceAWellPath->geometryDefinition()->setUseAutoGeneratedTargetAtSeaLevel( false );
|
||||
@@ -264,8 +243,8 @@ void RimGeoMechFaultReactivationResult::createWellGeometry()
|
||||
m_faceBWellPath->createWellPathGeometry();
|
||||
|
||||
// Detect which part well path centers are in
|
||||
m_faceAWellPathPartIndex = getPartIndexFromPoint( geoMechPartCollection, faceAWellPathCenter );
|
||||
m_faceBWellPathPartIndex = getPartIndexFromPoint( geoMechPartCollection, faceBWellPathCenter );
|
||||
m_faceAWellPathPartIndex = getPartIndexFromPoint( geoMechPartCollection, partATop );
|
||||
m_faceBWellPathPartIndex = getPartIndexFromPoint( geoMechPartCollection, partBTop );
|
||||
|
||||
// Update UI
|
||||
wellPathCollection->uiCapability()->updateConnectedEditors();
|
||||
@@ -277,7 +256,9 @@ void RimGeoMechFaultReactivationResult::createWellGeometry()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechFaultReactivationResult::createWellLogCurves()
|
||||
{
|
||||
RimGeoMechCase* geomCase = firstAncestorOrThisOfTypeAsserted<RimGeoMechCase>();
|
||||
if ( !m_bHaveValidData ) return;
|
||||
|
||||
auto geomCase = geoMechCase();
|
||||
if ( !geomCase ) return;
|
||||
Rim3dView* view = RiaApplication::instance()->activeMainOrComparisonGridView();
|
||||
if ( !view ) return;
|
||||
@@ -375,8 +356,9 @@ RimWellLogExtractionCurve* RimGeoMechFaultReactivationResult::createWellLogExtra
|
||||
RimModeledWellPath* wellPath,
|
||||
int partId )
|
||||
{
|
||||
RimGeoMechCase* geomCase = firstAncestorOrThisOfTypeAsserted<RimGeoMechCase>();
|
||||
auto geomCase = geoMechCase();
|
||||
if ( !geomCase ) return nullptr;
|
||||
|
||||
Rim3dView* view = RiaApplication::instance()->activeMainOrComparisonGridView();
|
||||
if ( !view ) return nullptr;
|
||||
|
||||
@@ -412,3 +394,11 @@ QString RimGeoMechFaultReactivationResult::plotDescription() const
|
||||
|
||||
return count == 0 ? plotDescription : QString( "%1 %2" ).arg( plotDescription ).arg( count );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechCase* RimGeoMechFaultReactivationResult::geoMechCase() const
|
||||
{
|
||||
return firstAncestorOrThisOfTypeAsserted<RimGeoMechCase>();
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ class RigFemResultAddress;
|
||||
class RimModeledWellPath;
|
||||
class RimWellLogTrack;
|
||||
class RimWellLogExtractionCurve;
|
||||
class RimGeoMechCase;
|
||||
|
||||
class RimGeoMechFaultReactivationResult : public caf::PdmObject
|
||||
{
|
||||
@@ -44,9 +45,9 @@ public:
|
||||
RimGeoMechFaultReactivationResult();
|
||||
~RimGeoMechFaultReactivationResult() override;
|
||||
|
||||
private:
|
||||
void onLoadDataAndUpdate();
|
||||
|
||||
private:
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
@@ -64,13 +65,16 @@ private:
|
||||
|
||||
QString plotDescription() const;
|
||||
|
||||
RimGeoMechCase* geoMechCase() const;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimExtrudedCurveIntersection*> m_intersection;
|
||||
caf::PdmField<bool> m_createFaultReactivationPlot;
|
||||
|
||||
caf::PdmField<bool> m_createFaultReactivationResult;
|
||||
caf::PdmField<double> m_distanceFromFault;
|
||||
|
||||
caf::PdmField<double> m_distanceFromIntersection; // To move wells to each side of intersection
|
||||
caf::PdmField<double> m_widthOutsideIntersection; // To stretch well points outside intersection
|
||||
caf::PdmField<cvf::Vec3d> m_faultNormal;
|
||||
caf::PdmField<cvf::Vec3d> m_faultTopPosition;
|
||||
caf::PdmField<cvf::Vec3d> m_faultBottomPosition;
|
||||
|
||||
caf::PdmPtrField<RimModeledWellPath*> m_faceAWellPath;
|
||||
caf::PdmPtrField<RimModeledWellPath*> m_faceBWellPath;
|
||||
@@ -78,5 +82,5 @@ private:
|
||||
caf::PdmField<int> m_faceAWellPathPartIndex;
|
||||
caf::PdmField<int> m_faceBWellPathPartIndex;
|
||||
|
||||
const double m_defaultDistanceFromIntersection = 1.0; // [m] Default value from intersection and into each part
|
||||
bool m_bHaveValidData;
|
||||
};
|
||||
|
||||
@@ -201,6 +201,8 @@ void RimGeoMechView::onLoadDataAndUpdate()
|
||||
|
||||
if ( m_partsCollection ) m_partsCollection->syncWithCase( m_geomechCase );
|
||||
|
||||
if ( m_faultReactivationResult ) m_faultReactivationResult->onLoadDataAndUpdate();
|
||||
|
||||
scheduleCreateDisplayModelAndRedraw();
|
||||
|
||||
progress.incrementProgress();
|
||||
|
||||
@@ -67,6 +67,14 @@ void RigBasicPlane::setPlane( cvf::Vec3d anchorPoint, cvf::Vec3d normal )
|
||||
m_planeNormal = normal;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RigBasicPlane::normal() const
|
||||
{
|
||||
return m_planeNormal;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -53,6 +53,7 @@ public:
|
||||
|
||||
double maxDepth();
|
||||
std::pair<cvf::Vec3d, cvf::Vec3d> intersectTopBottomLine();
|
||||
cvf::Vec3d normal() const;
|
||||
|
||||
cvf::Vec3dArray rect() const;
|
||||
cvf::ref<cvf::TextureImage> texture() const;
|
||||
|
||||
@@ -270,6 +270,14 @@ void RigFaultReactivationModel::updateRects()
|
||||
generateGrids( points );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RigFaultReactivationModel::normal() const
|
||||
{
|
||||
return m_planeNormal;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -84,6 +84,8 @@ public:
|
||||
|
||||
void updateRects();
|
||||
|
||||
cvf::Vec3d normal() const;
|
||||
|
||||
void setPartColors( cvf::Color3f part1Color, cvf::Color3f part2Color );
|
||||
std::vector<cvf::Vec3d> rect( ModelParts part ) const;
|
||||
cvf::ref<cvf::TextureImage> texture( ModelParts part ) const;
|
||||
|
||||
Reference in New Issue
Block a user