Skip to content

Commit

Permalink
Fault reactivation updates (#11079)
Browse files Browse the repository at this point in the history
* Allow extending cell intersection lines outside cell
* Update default values, and clean up some things
* Populate fault zone element set
* Update to latest openzgy to fix typo
  • Loading branch information
jonjenssen authored Jan 19, 2024
1 parent a48faeb commit 251952e
Show file tree
Hide file tree
Showing 12 changed files with 80 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ std::pair<bool, std::string> RifFaultReactivationModelExporter::exportToStream(
{ RimFaultReactivation::ElementSets::IntraReservoir, "INTRA_RESERVOIR" },
{ RimFaultReactivation::ElementSets::Reservoir, "RESERVOIR" },
{ RimFaultReactivation::ElementSets::UnderBurden, "UNDERBURDEN" },
{ RimFaultReactivation::ElementSets::FaultZone, "FAULT_ZONE" },
};

bool useGridVoidRatio = rimModel.useGridVoidRatio();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "RigFaultReactivationModel.h"
#include "RigGriddedPart3d.h"

#include "RimFaultReactivationDataAccess.h"
#include "RimFaultReactivationModel.h"

#include <map>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ RimFaultReactivationDataAccess::RimFaultReactivationDataAccess( const RimFaultRe
std::vector<RimFaultReactivation::ElementSets> elementSets = { RimFaultReactivation::ElementSets::OverBurden,
RimFaultReactivation::ElementSets::UnderBurden,
RimFaultReactivation::ElementSets::Reservoir,
RimFaultReactivation::ElementSets::IntraReservoir };
RimFaultReactivation::ElementSets::IntraReservoir,
RimFaultReactivation::ElementSets::FaultZone };
for ( auto e : elementSets )
{
densities[e] = model.materialParameters( e )[2];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ enum class ElementSets
OverBurden,
UnderBurden,
Reservoir,
IntraReservoir
IntraReservoir,
FaultZone
};

enum class Property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ RimFaultReactivationModel::RimFaultReactivationModel()
CAF_PDM_InitFieldNoDefault( &m_baseDir, "BaseDirectory", "Working Folder" );
CAF_PDM_InitField( &m_modelThickness, "ModelThickness", 100.0, "Model Cell Thickness" );

CAF_PDM_InitField( &m_modelExtentFromAnchor, "ModelExtentFromAnchor", 3000.0, "Horz. Extent from Anchor" );
CAF_PDM_InitField( &m_modelExtentFromAnchor, "ModelExtentFromAnchor", 1000.0, "Horz. Extent from Anchor" );
CAF_PDM_InitField( &m_modelMinZ, "ModelMinZ", 0.0, "Seabed Depth" );
CAF_PDM_InitField( &m_modelBelowSize, "ModelBelowSize", 500.0, "Depth Below Fault" );

Expand All @@ -96,6 +96,8 @@ RimFaultReactivationModel::RimFaultReactivationModel()
CAF_PDM_InitField( &m_faultExtendDownwards, "FaultExtendDownwards", 0.0, "Below Reservoir" );
m_faultExtendDownwards.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );

CAF_PDM_InitField( &m_faultZoneCells, "FaultZoneCells", 0, "Fault Zone Width [cells]" );

CAF_PDM_InitField( &m_showModelPlane, "ShowModelPlane", true, "Show 2D Model" );

CAF_PDM_InitFieldNoDefault( &m_fault, "Fault", "Fault" );
Expand All @@ -104,14 +106,14 @@ RimFaultReactivationModel::RimFaultReactivationModel()
CAF_PDM_InitField( &m_modelPart1Color, "ModelPart1Color", cvf::Color3f( cvf::Color3f::GREEN ), "Part 1 Color" );
CAF_PDM_InitField( &m_modelPart2Color, "ModelPart2Color", cvf::Color3f( cvf::Color3f::BLUE ), "Part 2 Color" );

CAF_PDM_InitField( &m_maxReservoirCellHeight, "MaxReservoirCellHeight", 20.0, "Max. Reservoir Cell Height" );
CAF_PDM_InitField( &m_maxReservoirCellHeight, "MaxReservoirCellHeight", 5.0, "Max. Reservoir Cell Height" );
CAF_PDM_InitField( &m_minReservoirCellHeight, "MinReservoirCellHeight", 0.5, "Min. Reservoir Cell Height" );
CAF_PDM_InitField( &m_cellHeightGrowFactor, "CellHeightGrowFactor", 1.05, "Cell Height Grow Factor" );
CAF_PDM_InitField( &m_cellHeightGrowFactor, "CellHeightGrowFactor", 1.15, "Cell Height Grow Factor" );

CAF_PDM_InitField( &m_minReservoirCellWidth, "MinReservoirCellWidth", 20.0, "Reservoir Cell Width" );
CAF_PDM_InitField( &m_cellWidthGrowFactor, "CellWidthGrowFactor", 1.05, "Cell Width Grow Factor" );
CAF_PDM_InitField( &m_minReservoirCellWidth, "MinReservoirCellWidth", 5.0, "Reservoir Cell Width" );
CAF_PDM_InitField( &m_cellWidthGrowFactor, "CellWidthGrowFactor", 1.15, "Cell Width Grow Factor" );

CAF_PDM_InitField( &m_useLocalCoordinates, "UseLocalCoordinates", false, "Export Using Local Coordinates" );
CAF_PDM_InitField( &m_useLocalCoordinates, "UseLocalCoordinates", false, "Use Local Coordinates" );

// Time Step Selection
CAF_PDM_InitFieldNoDefault( &m_timeStepFilter, "TimeStepFilter", "Available Time Steps" );
Expand Down Expand Up @@ -321,14 +323,14 @@ void RimFaultReactivationModel::updateVisualization()
if ( !normal.normalize() ) return;

auto modelNormal = normal ^ cvf::Vec3d::Z_AXIS;
modelNormal.normalize();
if ( !modelNormal.normalize() ) return;

auto generator = std::make_shared<RigFaultReactivationModelGenerator>( m_targets[0]->targetPointXYZ(), modelNormal );
auto generator = std::make_shared<RigFaultReactivationModelGenerator>( m_targets[0]->targetPointXYZ(), modelNormal, normal );
generator->setFault( m_fault()->faultGeometry() );
generator->setGrid( eclipseCase()->mainGrid() );
generator->setActiveCellInfo( eclipseCase()->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ) );
generator->setModelSize( m_modelMinZ, m_modelBelowSize, m_modelExtentFromAnchor );
generator->setFaultBufferDepth( m_faultExtendUpwards, m_faultExtendDownwards );
generator->setFaultBufferDepth( m_faultExtendUpwards, m_faultExtendDownwards, m_faultZoneCells );
generator->setModelThickness( m_modelThickness );
generator->setModelGriddingOptions( m_minReservoirCellHeight,
m_maxReservoirCellHeight,
Expand Down Expand Up @@ -443,6 +445,7 @@ void RimFaultReactivationModel::defineUiOrdering( QString uiConfigName, caf::Pdm
sizeModelGrp->add( &m_modelExtentFromAnchor );
sizeModelGrp->add( &m_modelMinZ );
sizeModelGrp->add( &m_modelBelowSize );
sizeModelGrp->add( &m_faultZoneCells );

const bool hasGeoMechCase = ( m_geomechCase() != nullptr );

Expand Down Expand Up @@ -505,6 +508,8 @@ void RimFaultReactivationModel::defineUiOrdering( QString uiConfigName, caf::Pdm

propertiesGrp->add( &m_frictionAngleDeg );

uiOrdering.add( &m_targets );

uiOrdering.skipRemainingFields();
}

Expand Down Expand Up @@ -618,6 +623,15 @@ void RimFaultReactivationModel::updateTimeSteps()
m_availableTimeSteps.clear();
const auto eCase = eclipseCase();
if ( eCase != nullptr ) m_availableTimeSteps = eCase->timeStepDates();

if ( m_selectedTimeSteps().size() == 0 )
{
std::vector<QDateTime> newVal;
if ( m_availableTimeSteps.size() > 0 ) newVal.push_back( m_availableTimeSteps.front() );
if ( m_availableTimeSteps.size() > 1 ) newVal.push_back( m_availableTimeSteps.back() );

m_selectedTimeSteps.setValue( newVal );
}
}

//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -714,7 +728,8 @@ std::array<double, 3> RimFaultReactivationModel::materialParameters( ElementSets
static std::map<ElementSets, std::string> groupMap = { { ElementSets::OverBurden, "material_overburden" },
{ ElementSets::Reservoir, "material_reservoir" },
{ ElementSets::IntraReservoir, "material_intrareservoir" },
{ ElementSets::UnderBurden, "material_underburden" } };
{ ElementSets::UnderBurden, "material_underburden" },
{ ElementSets::FaultZone, "material_faultzone" } };

auto keyName = QString::fromStdString( groupMap[elementSet] );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ class RimFaultReactivationModel : public RimCheckableNamedObject, public RimPoly

caf::PdmField<double> m_faultExtendUpwards;
caf::PdmField<double> m_faultExtendDownwards;
caf::PdmField<int> m_faultZoneCells;

caf::PdmField<double> m_maxReservoirCellHeight;
caf::PdmField<double> m_minReservoirCellHeight;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "cvfColor3.h"
#include "cvfMatrix4.h"
#include "cvfObject.h"
#include "cvfPlane.h"
#include "cvfStructGrid.h"
#include "cvfTextureImage.h"
#include "cvfVector3.h"
Expand All @@ -37,7 +36,6 @@

class RigGriddedPart3d;
class RigMainGrid;
class RimFaultReactivationDataAccess;
class RigFaultReactivationModelGenerator;

class RigFRModelPart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFaultReactivationModelGenerator::RigFaultReactivationModelGenerator( cvf::Vec3d position, cvf::Vec3d normal )
RigFaultReactivationModelGenerator::RigFaultReactivationModelGenerator( cvf::Vec3d position, cvf::Vec3d normal, cvf::Vec3d modelDirection )
: m_startPosition( position )
, m_normal( normal )
, m_modelDirection( modelDirection )
, m_bufferAboveFault( 0.0 )
, m_bufferBelowFault( 0.0 )
, m_startDepth( 0.0 )
Expand All @@ -52,6 +53,7 @@ RigFaultReactivationModelGenerator::RigFaultReactivationModelGenerator( cvf::Vec
, m_minCellHeight( 0.5 )
, m_maxCellHeight( 20.0 )
, m_minCellWidth( 20.0 )
, m_faultZoneCells( 0 )
{
}

Expand Down Expand Up @@ -89,10 +91,11 @@ void RigFaultReactivationModelGenerator::setActiveCellInfo( const RigActiveCellI
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFaultReactivationModelGenerator::setFaultBufferDepth( double aboveFault, double belowFault )
void RigFaultReactivationModelGenerator::setFaultBufferDepth( double aboveFault, double belowFault, int faultZoneCells )
{
m_bufferAboveFault = aboveFault;
m_bufferBelowFault = belowFault;
m_faultZoneCells = faultZoneCells;
}

//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -142,10 +145,7 @@ void RigFaultReactivationModelGenerator::setModelGriddingOptions( double minCell
//--------------------------------------------------------------------------------------------------
std::pair<cvf::Vec3d, cvf::Vec3d> RigFaultReactivationModelGenerator::modelLocalNormalsXY()
{
cvf::Vec3d xNormal = m_normal ^ cvf::Vec3d::Z_AXIS;
xNormal.z() = 0.0;
xNormal.normalize();

cvf::Vec3d xNormal = m_modelDirection;
cvf::Vec3d yNormal = xNormal ^ cvf::Vec3d::Z_AXIS;

return std::make_pair( xNormal, yNormal );
Expand Down Expand Up @@ -197,8 +197,11 @@ const std::array<int, 4> RigFaultReactivationModelGenerator::faceIJCornerIndexes
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RigFaultReactivationModelGenerator::lineIntersect( const cvf::Plane& plane, cvf::Vec3d lineA, cvf::Vec3d lineB )
{
double dist = 0.0;
return caf::HexGridIntersectionTools::planeLineIntersectionForMC( plane, lineA, lineB, &dist );
double dist = 0.0;
cvf::Vec3d intersect;
caf::HexGridIntersectionTools::planeLineIntersect( plane, lineA, lineB, &intersect, &dist, 0.01 );

return intersect;
}

//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -292,14 +295,11 @@ void RigFaultReactivationModelGenerator::generatePointsFrontBack()
{
std::array<cvf::Vec3d, 24> points;

auto alongModel = m_normal ^ cvf::Vec3d::Z_AXIS;
alongModel.normalize();

double top_depth = -m_startDepth;
m_bottomDepth = m_bottomFault.z() - m_depthBelowFault;

cvf::Vec3d edge_front = m_startPosition - m_horzExtentFromFault * alongModel;
cvf::Vec3d edge_back = m_startPosition + m_horzExtentFromFault * alongModel;
cvf::Vec3d edge_front = m_startPosition - m_horzExtentFromFault * m_modelDirection;
cvf::Vec3d edge_back = m_startPosition + m_horzExtentFromFault * m_modelDirection;

points[8] = m_bottomFault;
points[8].z() = m_bottomDepth;
Expand Down Expand Up @@ -503,15 +503,19 @@ void RigFaultReactivationModelGenerator::generateGeometry( size_t
m_cellSizeHeightFactor,
m_horizontalPartition,
m_modelThickness,
m_topReservoirFront.z() );
m_topReservoirFront.z(),
m_normal,
m_faultZoneCells );
backPart->generateGeometry( m_backPoints,
backReservoirLayers,
kLayersBack,
m_maxCellHeight,
m_cellSizeHeightFactor,
m_horizontalPartition,
m_modelThickness,
m_topReservoirBack.z() );
m_topReservoirBack.z(),
m_normal,
m_faultZoneCells );

frontPart->generateLocalNodes( m_localCoordTransform );
backPart->generateLocalNodes( m_localCoordTransform );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ class RigActiveCellInfo;
class RigFaultReactivationModelGenerator : cvf::Object
{
public:
RigFaultReactivationModelGenerator( cvf::Vec3d position, cvf::Vec3d normal );
RigFaultReactivationModelGenerator( cvf::Vec3d position, cvf::Vec3d normal, cvf::Vec3d direction );
~RigFaultReactivationModelGenerator() override;

void setFault( const RigFault* fault );
void setGrid( const RigMainGrid* grid );
void setActiveCellInfo( const RigActiveCellInfo* activeCellInfo );
void setFaultBufferDepth( double aboveFault, double belowFault );
void setFaultBufferDepth( double aboveFault, double belowFault, int faultZoneCells );
void setModelSize( double startDepth, double depthBelowFault, double horzExtentFromFault );
void setModelThickness( double thickness );
void setModelGriddingOptions( double minCellHeight,
Expand Down Expand Up @@ -90,6 +90,7 @@ class RigFaultReactivationModelGenerator : cvf::Object
private:
cvf::Vec3d m_startPosition;
cvf::Vec3d m_normal;
cvf::Vec3d m_modelDirection;

std::array<cvf::Vec3d, 12> m_frontPoints;
std::array<cvf::Vec3d, 12> m_backPoints;
Expand All @@ -102,6 +103,7 @@ class RigFaultReactivationModelGenerator : cvf::Object

double m_bufferAboveFault;
double m_bufferBelowFault;
int m_faultZoneCells;

double m_startDepth;
double m_bottomDepth;
Expand Down
32 changes: 21 additions & 11 deletions ApplicationLibCode/ReservoirDataModel/RigGriddedPart3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ void RigGriddedPart3d::generateGeometry( const std::array<cvf::Vec3d, 12>& input
double cellSizeFactor,
const std::vector<double>& horizontalPartition,
double modelThickness,
double topHeight )
double topHeight,
cvf::Vec3d thicknessDirection,
int nFaultZoneCells )
{
reset();

Expand Down Expand Up @@ -266,9 +268,7 @@ void RigGriddedPart3d::generateGeometry( const std::array<cvf::Vec3d, 12>& input

const std::vector<double> m_thicknessFactors = { -1.0, 0.0, 1.0 };
const int nThicknessCells = 2;
cvf::Vec3d tVec = stepVector( inputPoints[0], inputPoints[6], 1 ) ^ cvf::Vec3d::Z_AXIS;
tVec.normalize();
tVec *= modelThickness;
cvf::Vec3d tVec = modelThickness * thicknessDirection;

size_t reserveSize = ( nVertCells + 1 ) * ( nHorzCells + 1 ) * ( nThicknessCells + 1 );
m_nodes.reserve( reserveSize );
Expand Down Expand Up @@ -391,6 +391,7 @@ void RigGriddedPart3d::generateGeometry( const std::array<cvf::Vec3d, 12>& input
m_elementSets[ElementSets::Reservoir] = {};
m_elementSets[ElementSets::IntraReservoir] = {};
m_elementSets[ElementSets::UnderBurden] = {};
m_elementSets[ElementSets::FaultZone] = {};

m_boundaryElements[Boundary::Bottom] = {};
m_boundaryElements[Boundary::FarSide] = {};
Expand All @@ -415,6 +416,8 @@ void RigGriddedPart3d::generateGeometry( const std::array<cvf::Vec3d, 12>& input
const int nThicknessOff = nThicknessCells + 1;
const int seaBedLayer = (int)( nVertCells - 2 );

const int nFaultZoneStart = (int)nHorzCells - nFaultZoneCells - 1;

for ( int v = 0; v < (int)nVertCells - 1; v++ )
{
if ( v >= nVertCellsLower ) currentSurfaceRegion = RimFaultReactivation::BorderSurface::FaultSurface;
Expand Down Expand Up @@ -452,21 +455,28 @@ void RigGriddedPart3d::generateGeometry( const std::array<cvf::Vec3d, 12>& input
m_boundaryElements[Boundary::FarSide].push_back( elementIdx );
}

bool inFaultZone = ( currentSurfaceRegion == RimFaultReactivation::BorderSurface::FaultSurface ) && ( h > nFaultZoneStart );

if ( inFaultZone ) m_elementSets[RimFaultReactivation::ElementSets::FaultZone].push_back( elementIdx );

if ( currentElementSet == RimFaultReactivation::ElementSets::Reservoir )
{
m_elementKLayer[elementIdx] = kLayers[kLayer];
if ( kLayers[kLayer] < 0 )
{
m_elementSets[RimFaultReactivation::ElementSets::IntraReservoir].push_back( elementIdx );
}
else
if ( !inFaultZone )
{
m_elementSets[currentElementSet].push_back( elementIdx );
if ( kLayers[kLayer] < 0 )
{
m_elementSets[RimFaultReactivation::ElementSets::IntraReservoir].push_back( elementIdx );
}
else
{
m_elementSets[currentElementSet].push_back( elementIdx );
}
}
}
else
{
m_elementSets[currentElementSet].push_back( elementIdx );
if ( !inFaultZone ) m_elementSets[currentElementSet].push_back( elementIdx );
m_elementKLayer[elementIdx] = -2000;
}
}
Expand Down
4 changes: 3 additions & 1 deletion ApplicationLibCode/ReservoirDataModel/RigGriddedPart3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ class RigGriddedPart3d : public cvf::Object
double cellSizeFactor,
const std::vector<double>& horizontalPartition,
double modelThickness,
double topHeight );
double topHeight,
cvf::Vec3d thicknessDirection,
int nFaultZoneCells );

void generateLocalNodes( const cvf::Mat4d transform );
void setUseLocalCoordinates( bool useLocalCoordinates );
Expand Down
2 changes: 1 addition & 1 deletion ThirdParty/openzgy
Submodule openzgy updated 1 files
+1 −1 CMakeLists.txt

0 comments on commit 251952e

Please sign in to comment.