Skip to content

Commit

Permalink
Fault reactivation: Add dataNodes to be used for data extraction (#10961
Browse files Browse the repository at this point in the history
)

* Add dataNodes to be used for data extraction
  • Loading branch information
jonjenssen authored Dec 15, 2023
1 parent f767efd commit 595766a
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
45 changes: 44 additions & 1 deletion ApplicationLibCode/ReservoirDataModel/RigGriddedPart3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
RigGriddedPart3d::RigGriddedPart3d()
: m_useLocalCoordinates( false )
, m_topHeight( 0.0 )
, m_faultSafetyDistance( 1.0 )
{
}

Expand All @@ -54,6 +55,7 @@ void RigGriddedPart3d::reset()
m_boundaryNodes.clear();
m_borderSurfaceElements.clear();
m_nodes.clear();
m_dataNodes.clear();
m_localNodes.clear();
m_elementIndices.clear();
m_meshLines.clear();
Expand Down Expand Up @@ -268,7 +270,9 @@ void RigGriddedPart3d::generateGeometry( const std::array<cvf::Vec3d, 12>& input
tVec.normalize();
tVec *= modelThickness;

m_nodes.reserve( ( nVertCells + 1 ) * ( nHorzCells + 1 ) * ( nThicknessCells + 1 ) );
size_t reserveSize = ( nVertCells + 1 ) * ( nHorzCells + 1 ) * ( nThicknessCells + 1 );
m_nodes.reserve( reserveSize );
m_dataNodes.reserve( reserveSize );

unsigned int nodeIndex = 0;
unsigned int layer = 0;
Expand Down Expand Up @@ -331,6 +335,9 @@ void RigGriddedPart3d::generateGeometry( const std::array<cvf::Vec3d, 12>& input

cvf::Vec3d stepHorz = toPos - fromPos;
cvf::Vec3d p;
cvf::Vec3d safetyOffset = fromPos - toPos;
safetyOffset.normalize();
safetyOffset *= m_faultSafetyDistance;

m_meshLines.push_back( { fromPos, toPos } );

Expand All @@ -341,6 +348,16 @@ void RigGriddedPart3d::generateGeometry( const std::array<cvf::Vec3d, 12>& input
for ( int t = 0; t <= nThicknessCells; t++, nodeIndex++ )
{
m_nodes.push_back( p + m_thicknessFactors[t] * tVec );

if ( h == (int)nHorzCells )
{
m_dataNodes.push_back( p + safetyOffset );
}
else
{
m_dataNodes.push_back( p );
}

if ( layer == 0 )
{
m_boundaryNodes[Boundary::Bottom].push_back( nodeIndex );
Expand Down Expand Up @@ -520,6 +537,16 @@ const std::vector<cvf::Vec3d>& RigGriddedPart3d::globalNodes() const
return m_nodes;
}

//--------------------------------------------------------------------------------------------------
/// Returns nodes in global coordinates, adjusted to always extract data as if the model has no
/// thickness. Additionally, nodes closest to the fault are moved away from the fault
/// to make sure data results come from the correct side of the fault.
//--------------------------------------------------------------------------------------------------
const std::vector<cvf::Vec3d>& RigGriddedPart3d::dataNodes() const
{
return m_dataNodes;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand All @@ -544,6 +571,22 @@ double RigGriddedPart3d::topHeight() const
return m_topHeight;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigGriddedPart3d::setFaultSafetyDistance( double distance )
{
m_faultSafetyDistance = distance;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigGriddedPart3d::faultSafetyDistance() const
{
return m_faultSafetyDistance;
}

//--------------------------------------------------------------------------------------------------
/// Output elements will be of type HEX8
///
Expand Down
6 changes: 6 additions & 0 deletions ApplicationLibCode/ReservoirDataModel/RigGriddedPart3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@ class RigGriddedPart3d : public cvf::Object
bool useLocalCoordinates() const;
double topHeight() const;

void setFaultSafetyDistance( double distance );
double faultSafetyDistance() const;

const std::vector<cvf::Vec3d>& nodes() const;
const std::vector<cvf::Vec3d>& globalNodes() const;
const std::vector<cvf::Vec3d>& dataNodes() const;

const std::vector<std::vector<unsigned int>>& elementIndices() const;
const std::map<RimFaultReactivation::BorderSurface, std::vector<unsigned int>>& borderSurfaceElements() const;
Expand Down Expand Up @@ -97,8 +101,10 @@ class RigGriddedPart3d : public cvf::Object
bool m_useLocalCoordinates;

double m_topHeight;
double m_faultSafetyDistance;

std::vector<cvf::Vec3d> m_nodes;
std::vector<cvf::Vec3d> m_dataNodes;
std::vector<cvf::Vec3d> m_localNodes;
std::vector<std::vector<unsigned int>> m_elementIndices;
std::vector<int> m_elementKLayer;
Expand Down

0 comments on commit 595766a

Please sign in to comment.