Fault Reactivation: Add minimum cell height limit (#11036)

Fault Reactivation: Add minimum cell height limit
This commit is contained in:
jonjenssen 2024-01-10 08:14:37 +01:00 committed by GitHub
parent ce9a65ee41
commit 6d225a9da3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 84 additions and 3 deletions

View File

@ -105,6 +105,7 @@ RimFaultReactivationModel::RimFaultReactivationModel()
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_minReservoirCellHeight, "MinReservoirCellHeight", 0.5, "Min. Reservoir Cell Height" );
CAF_PDM_InitField( &m_cellHeightGrowFactor, "CellHeightGrowFactor", 1.05, "Cell Height Grow Factor" );
CAF_PDM_InitField( &m_minReservoirCellWidth, "MinReservoirCellWidth", 20.0, "Reservoir Cell Width" );
@ -326,7 +327,11 @@ void RimFaultReactivationModel::updateVisualization()
generator->setModelSize( m_modelMinZ, m_modelBelowSize, m_modelExtentFromAnchor );
generator->setFaultBufferDepth( m_faultExtendUpwards, m_faultExtendDownwards );
generator->setModelThickness( m_modelThickness );
generator->setModelGriddingOptions( m_maxReservoirCellHeight, m_cellHeightGrowFactor, m_minReservoirCellWidth, m_cellWidthGrowFactor );
generator->setModelGriddingOptions( m_minReservoirCellHeight,
m_maxReservoirCellHeight,
m_cellHeightGrowFactor,
m_minReservoirCellWidth,
m_cellWidthGrowFactor );
generator->setupLocalCoordinateTransform();
generator->setUseLocalCoordinates( m_useLocalCoordinates );
@ -452,6 +457,7 @@ void RimFaultReactivationModel::defineUiOrdering( QString uiConfigName, caf::Pdm
faultGrp->add( &m_faultExtendDownwards );
auto gridModelGrp = modelGrp->addNewGroup( "Grid Definition" );
gridModelGrp->add( &m_minReservoirCellHeight );
gridModelGrp->add( &m_maxReservoirCellHeight );
gridModelGrp->add( &m_cellHeightGrowFactor );

View File

@ -168,6 +168,7 @@ private:
caf::PdmField<double> m_faultExtendDownwards;
caf::PdmField<double> m_maxReservoirCellHeight;
caf::PdmField<double> m_minReservoirCellHeight;
caf::PdmField<double> m_cellHeightGrowFactor;
caf::PdmField<double> m_minReservoirCellWidth;
caf::PdmField<double> m_cellWidthGrowFactor;

View File

@ -48,6 +48,7 @@ RigFaultReactivationModelGenerator::RigFaultReactivationModelGenerator( cvf::Vec
, m_useLocalCoordinates( false )
, m_cellSizeHeightFactor( 1.0 )
, m_cellSizeWidthFactor( 1.0 )
, m_minCellHeight( 0.5 )
, m_maxCellHeight( 20.0 )
, m_minCellWidth( 20.0 )
{
@ -122,11 +123,13 @@ void RigFaultReactivationModelGenerator::setUseLocalCoordinates( bool useLocalCo
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFaultReactivationModelGenerator::setModelGriddingOptions( double maxCellHeight,
void RigFaultReactivationModelGenerator::setModelGriddingOptions( double minCellHeight,
double maxCellHeight,
double cellSizeFactorHeight,
double minCellWidth,
double cellSizeFactorWidth )
{
m_minCellHeight = minCellHeight;
m_maxCellHeight = maxCellHeight;
m_cellSizeHeightFactor = cellSizeFactorHeight;
m_minCellWidth = minCellWidth;
@ -476,6 +479,9 @@ void RigFaultReactivationModelGenerator::generateGeometry( size_t
}
m_topFault = top_point;
mergeTinyLayers( zPositionsFront, kLayersFront, m_minCellHeight );
mergeTinyLayers( zPositionsBack, kLayersBack, m_minCellHeight );
splitLargeLayers( zPositionsFront, kLayersFront, m_maxCellHeight );
splitLargeLayers( zPositionsBack, kLayersBack, m_maxCellHeight );
@ -565,6 +571,68 @@ cvf::Vec3d RigFaultReactivationModelGenerator::extrapolatePoint( cvf::Vec3d star
return endPoint + ( buffer * direction );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFaultReactivationModelGenerator::mergeTinyLayers( std::map<double, cvf::Vec3d>& layers, std::vector<int>& kLayers, double minHeight )
{
std::vector<int> newKLayers;
std::vector<cvf::Vec3d> newLayers;
const int nLayers = (int)layers.size();
std::vector<double> keys;
std::vector<cvf::Vec3d> vals;
for ( auto& layer : layers )
{
keys.push_back( layer.first );
vals.push_back( layer.second );
}
// bottom layer must always be included
newLayers.push_back( vals.front() );
newKLayers.push_back( kLayers.front() );
// remove any layer that is less than minHeight above the previous layer, starting at the bottom
for ( int k = 1; k < nLayers - 1; k++ )
{
if ( std::abs( keys[k] - keys[k - 1] ) < minHeight )
{
continue;
}
newKLayers.push_back( kLayers[k] );
newLayers.push_back( vals[k] );
}
// top layer must always be included
newLayers.push_back( vals.back() );
// make sure the top two layers aren't too close, if so, remove the second topmost
const int nNewLayers = (int)newLayers.size();
if ( nNewLayers > 2 )
{
if ( std::abs( newLayers[nNewLayers - 1].z() - newLayers[nNewLayers - 2].z() ) < minHeight )
{
newKLayers.pop_back();
newLayers.pop_back();
newLayers.pop_back();
newLayers.push_back( vals.back() );
}
}
layers.clear();
for ( auto& p : newLayers )
{
layers[p.z()] = p;
}
kLayers.clear();
for ( auto k : newKLayers )
{
kLayers.push_back( k );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -46,7 +46,11 @@ public:
void setFaultBufferDepth( double aboveFault, double belowFault );
void setModelSize( double startDepth, double depthBelowFault, double horzExtentFromFault );
void setModelThickness( double thickness );
void setModelGriddingOptions( double maxCellHeight, double cellSizeFactorHeight, double minCellWidth, double cellSizeFactorWidth );
void setModelGriddingOptions( double minCellHeight,
double maxCellHeight,
double cellSizeFactorHeight,
double minCellWidth,
double cellSizeFactorWidth );
void setUseLocalCoordinates( bool useLocalCoordinates );
void setupLocalCoordinateTransform();
@ -71,6 +75,7 @@ protected:
static cvf::Vec3d lineIntersect( const cvf::Plane& plane, cvf::Vec3d lineA, cvf::Vec3d lineB );
static cvf::Vec3d extrapolatePoint( cvf::Vec3d startPoint, cvf::Vec3d endPoint, double stopDepth );
static void splitLargeLayers( std::map<double, cvf::Vec3d>& layers, std::vector<int>& kLayers, double maxHeight );
static void mergeTinyLayers( std::map<double, cvf::Vec3d>& layers, std::vector<int>& kLayers, double minHeight );
std::map<double, cvf::Vec3d> elementLayers( cvf::StructGridInterface::FaceType face, std::vector<size_t>& cellIndexColumn );
std::vector<int> elementKLayers( const std::vector<size_t>& cellIndexColumn );
@ -102,6 +107,7 @@ private:
double m_horzExtentFromFault;
double m_modelThickness;
double m_minCellHeight;
double m_maxCellHeight;
double m_cellSizeHeightFactor;
double m_minCellWidth;