Skip to content

Commit

Permalink
Fault Reactivation: use data nodes when extracting values for INP file.
Browse files Browse the repository at this point in the history
  • Loading branch information
kriben committed Dec 21, 2023
1 parent 9b36fe4 commit cf453ac
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ std::vector<double> RimFaultReactivationDataAccess::extractModelData( const RigF

if ( nodeProperties.contains( property ) )
{
for ( auto& node : grid->globalNodes() )
for ( auto& node : grid->dataNodes() )
{
double value = accessor->valueAtPosition( node, model, gridPart );
values.push_back( value );
Expand All @@ -153,7 +153,7 @@ std::vector<double> RimFaultReactivationDataAccess::extractModelData( const RigF
size_t numElements = grid->elementIndices().size();
for ( size_t elementIndex = 0; elementIndex < numElements; elementIndex++ )
{
std::vector<cvf::Vec3d> corners = grid->elementCorners( elementIndex );
std::vector<cvf::Vec3d> corners = grid->elementDataCorners( elementIndex );

// Move top of sea bed element down to end up inside top element
bool isTopElement = seabedElements.contains( static_cast<unsigned int>( elementIndex ) );
Expand Down
28 changes: 23 additions & 5 deletions ApplicationLibCode/ReservoirDataModel/RigGriddedPart3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,16 +608,34 @@ const std::vector<std::vector<unsigned int>>& RigGriddedPart3d::elementIndices()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<cvf::Vec3d> RigGriddedPart3d::elementCorners( size_t elementIndex ) const
std::vector<cvf::Vec3d> RigGriddedPart3d::elementCorners( size_t elementIndex ) const
{
if ( elementIndex >= m_elementIndices.size() ) return {};
return extractCornersForElement( m_elementIndices, m_nodes, elementIndex );
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<cvf::Vec3d> RigGriddedPart3d::elementDataCorners( size_t elementIndex ) const
{
return extractCornersForElement( m_elementIndices, m_dataNodes, elementIndex );
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<cvf::Vec3d> RigGriddedPart3d::extractCornersForElement( const std::vector<std::vector<unsigned int>>& elementIndices,
const std::vector<cvf::Vec3d>& nodes,
size_t elementIndex )
{
if ( elementIndex >= elementIndices.size() ) return {};

std::vector<cvf::Vec3d> corners;

for ( auto nodeIdx : m_elementIndices[elementIndex] )
for ( auto nodeIdx : elementIndices[elementIndex] )
{
if ( nodeIdx >= m_nodes.size() ) continue;
corners.push_back( m_nodes[nodeIdx] );
if ( nodeIdx >= nodes.size() ) continue;
corners.push_back( nodes[nodeIdx] );
}

return corners;
Expand Down
8 changes: 6 additions & 2 deletions ApplicationLibCode/ReservoirDataModel/RigGriddedPart3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ class RigGriddedPart3d : public cvf::Object
const std::map<Boundary, std::vector<unsigned int>>& boundaryNodes() const;
const std::map<ElementSets, std::vector<unsigned int>>& elementSets() const;
const std::vector<int> elementKLayer() const;
const std::vector<cvf::Vec3d> elementCorners( size_t elementIndex ) const;
std::vector<cvf::Vec3d> elementCorners( size_t elementIndex ) const;
std::vector<cvf::Vec3d> elementDataCorners( size_t elementIndex ) const;
const std::vector<std::pair<double, double>> layers( ElementSets elementSet ) const;

protected:
Expand All @@ -95,7 +96,10 @@ class RigGriddedPart3d : public cvf::Object
UpperOverburden
};

static std::vector<Regions> allRegions();
static std::vector<Regions> allRegions();
static std::vector<cvf::Vec3d> extractCornersForElement( const std::vector<std::vector<unsigned int>>& elementIndices,
const std::vector<cvf::Vec3d>& nodes,
size_t elementIndex );

private:
bool m_useLocalCoordinates;
Expand Down

0 comments on commit cf453ac

Please sign in to comment.