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:
Jacob Støren
2014-09-23 12:24:48 +02:00
parent b58862ad93
commit 6e55ca82e2
8 changed files with 45 additions and 15 deletions

View File

@@ -351,7 +351,7 @@ cvf::Vec3d RigGridBase::displayModelOffset() const
//--------------------------------------------------------------------------------------------------
/// Returns the min size of the I and J charactristic cell sizes
//--------------------------------------------------------------------------------------------------
double RigGridBase::characteristicIJCellSize()
double RigGridBase::characteristicIJCellSize() const
{
double characteristicCellSize = HUGE_VAL;

View File

@@ -60,7 +60,7 @@ public:
void setGridId(int id) { m_gridId = id; }
int gridId() const { return m_gridId; }
double characteristicIJCellSize();
double characteristicIJCellSize() const;
std::string gridName() const;
void setGridName(const std::string& gridName);

View File

@@ -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;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -52,7 +52,7 @@ public:
const cvf::Collection<RigFault>& faults() { return m_faults; }
void calculateFaults();
const RigFault* findFaultFromCellIndexAndCellFace(size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face) const;
bool faceNormalsIsOutwards() const;
bool isFaceNormalsOutwards() const;
void computeCachedData();