mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fixed Problem regarding negative riTrans values
The reason was a bit sloppy detection of whether the surface normals was pointing outwards or inwards in a cell. The cells can be turned inside out due to depth/Z or mapaxis conditions.
This commit is contained in:
@@ -363,9 +363,39 @@ void RigMainGrid::calculateFaults()
|
||||
/// The cell is normally inverted due to Depth becoming -Z at import,
|
||||
/// but if (only) one of the flipX/Y is done, the cell is back to normal
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigMainGrid::faceNormalsIsOutwards() const
|
||||
bool RigMainGrid::isFaceNormalsOutwards() const
|
||||
{
|
||||
return m_flipXAxis ^ m_flipYAxis;
|
||||
|
||||
for (int gcIdx = 0 ; gcIdx < static_cast<int>(m_cells.size()); ++gcIdx)
|
||||
{
|
||||
if (!m_cells[gcIdx].isInvalid())
|
||||
{
|
||||
cvf::Vec3d cellCenter = m_cells[gcIdx].center();
|
||||
cvf::Vec3d faceCenter = m_cells[gcIdx].faceCenter(StructGridInterface::POS_I);
|
||||
cvf::Vec3d faceNormal = m_cells[gcIdx].faceNormalWithAreaLenght(StructGridInterface::POS_I);
|
||||
|
||||
double typicalIJCellSize = characteristicIJCellSize();
|
||||
double dummy, dummy2, typicalKSize;
|
||||
characteristicCellSizes(&dummy, &dummy2, &typicalKSize);
|
||||
|
||||
if ( (faceCenter - cellCenter).length() > 0.2 * typicalIJCellSize
|
||||
&& (faceNormal.length() > (0.2 * typicalIJCellSize * 0.2* typicalKSize)))
|
||||
{
|
||||
// Cell is assumed ok to use, so calculate whether the normals are outwards or inwards
|
||||
|
||||
if ((faceCenter - cellCenter) * faceNormal >= 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user