mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5379 Surface : Offset coords by a delta to avoid numerical instability
When creating a surface from top layer coords, we end up with a lot of geometrical operations in the same geometrical plane. Adjust the location of the surface coords to avoid these issues.
This commit is contained in:
@@ -212,6 +212,34 @@ bool RimGridCaseSurface::updateSurfaceDataFromGridCase()
|
||||
if ( !tringleIndices.empty() )
|
||||
{
|
||||
surfaceData = new RigSurface;
|
||||
|
||||
{
|
||||
// Modify the z-value slightly to avoid geometrical numerical issues when the surface intersects exactly at
|
||||
// the cell face
|
||||
|
||||
double delta = 1.0e-5;
|
||||
|
||||
cvf::Vec3d offset = cvf::Vec3d::ZERO;
|
||||
|
||||
if ( m_sliceDirection == RiaDefines::GridCaseAxis::AXIS_I )
|
||||
{
|
||||
offset.x() += delta;
|
||||
}
|
||||
else if ( m_sliceDirection == RiaDefines::GridCaseAxis::AXIS_J )
|
||||
{
|
||||
offset.y() += delta;
|
||||
}
|
||||
if ( m_sliceDirection == RiaDefines::GridCaseAxis::AXIS_K )
|
||||
{
|
||||
offset.z() += delta;
|
||||
}
|
||||
|
||||
for ( auto& v : vertices )
|
||||
{
|
||||
v += offset;
|
||||
}
|
||||
}
|
||||
|
||||
surfaceData->setTriangleData( tringleIndices, vertices );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user