diff --git a/ApplicationLibCode/ReservoirDataModel/RigGriddedPart3d.cpp b/ApplicationLibCode/ReservoirDataModel/RigGriddedPart3d.cpp index cc7ac64de7..b97143418a 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigGriddedPart3d.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigGriddedPart3d.cpp @@ -35,6 +35,7 @@ RigGriddedPart3d::RigGriddedPart3d() : m_useLocalCoordinates( false ) , m_topHeight( 0.0 ) + , m_faultSafetyDistance( 1.0 ) { } @@ -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(); @@ -268,7 +270,9 @@ void RigGriddedPart3d::generateGeometry( const std::array& 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; @@ -331,6 +335,9 @@ void RigGriddedPart3d::generateGeometry( const std::array& 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 } ); @@ -341,6 +348,16 @@ void RigGriddedPart3d::generateGeometry( const std::array& 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 ); @@ -520,6 +537,16 @@ const std::vector& 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& RigGriddedPart3d::dataNodes() const +{ + return m_dataNodes; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -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 /// diff --git a/ApplicationLibCode/ReservoirDataModel/RigGriddedPart3d.h b/ApplicationLibCode/ReservoirDataModel/RigGriddedPart3d.h index 410bbccab7..84535e16c4 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigGriddedPart3d.h +++ b/ApplicationLibCode/ReservoirDataModel/RigGriddedPart3d.h @@ -58,8 +58,12 @@ public: bool useLocalCoordinates() const; double topHeight() const; + void setFaultSafetyDistance( double distance ); + double faultSafetyDistance() const; + const std::vector& nodes() const; const std::vector& globalNodes() const; + const std::vector& dataNodes() const; const std::vector>& elementIndices() const; const std::map>& borderSurfaceElements() const; @@ -97,8 +101,10 @@ private: bool m_useLocalCoordinates; double m_topHeight; + double m_faultSafetyDistance; std::vector m_nodes; + std::vector m_dataNodes; std::vector m_localNodes; std::vector> m_elementIndices; std::vector m_elementKLayer;