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:
jonjenssen authored and GitHub committed 2023-09-19 18:03:36 +02:00
1 parent 9b797fdd36
commit 5d3fb8ceb9
17 files changed
+346 -109

No files matched your search

@@ -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 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(){};
};