#273 Undefined grid faults between cells where one or both are inactive is now sorted into a seaparate predefined fault section.

This commit is contained in:
Jacob Støren
2016-08-22 13:24:46 +02:00
parent 37099929d6
commit cf93a67b5e
6 changed files with 55 additions and 12 deletions

View File

@@ -44,7 +44,8 @@ public:
static bool isPerCellFaceResult(const QString& resultName); static bool isPerCellFaceResult(const QString& resultName);
static QString undefinedResultName() { return "None"; } static QString undefinedResultName() { return "None"; }
static QString undefinedGridFaultName() { return "Undefined grid faults"; } static QString undefinedGridFaultName() { return "Undefined Grid Faults"; }
static QString undefinedGridFaultWithInactiveName() { return "Undefined Grid Faults With Inactive"; }
static QString combinedTransmissibilityResultName() { return "TRANXYZ"; } static QString combinedTransmissibilityResultName() { return "TRANXYZ"; }
static QString ternarySaturationResultName() { return "TERNARY"; } static QString ternarySaturationResultName() { return "TERNARY"; }
static QString combinedMultResultName() { return "MULTXYZ"; } static QString combinedMultResultName() { return "MULTXYZ"; }

View File

@@ -299,11 +299,12 @@ void RimEclipseCase::computeCachedData()
pInf.incrementProgress(); pInf.incrementProgress();
pInf.setNextProgressIncrement(10); pInf.setNextProgressIncrement(10);
pInf.setProgressDescription("Calculating Cell Search Tree");
rigEclipseCase->mainGrid()->computeCachedData(); rigEclipseCase->mainGrid()->computeCachedData();
pInf.incrementProgress(); pInf.incrementProgress();
pInf.setProgressDescription("Calculating faults"); pInf.setProgressDescription("Calculating faults");
rigEclipseCase->mainGrid()->calculateFaults(); rigEclipseCase->mainGrid()->calculateFaults(rigEclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS));
pInf.incrementProgress(); pInf.incrementProgress();
} }
} }

View File

@@ -167,7 +167,7 @@ RigMainGrid* RimEclipseCaseCollection::registerCaseInGridCollection(RigCaseData*
// This is the first insertion of this grid, compute cached data // This is the first insertion of this grid, compute cached data
rigEclipseCase->mainGrid()->computeCachedData(); rigEclipseCase->mainGrid()->computeCachedData();
rigEclipseCase->mainGrid()->calculateFaults(); rigEclipseCase->mainGrid()->calculateFaults(rigEclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS));
equalGrid = rigEclipseCase->mainGrid(); equalGrid = rigEclipseCase->mainGrid();
} }

View File

@@ -198,21 +198,35 @@ void RimFaultCollection::syncronizeFaults()
std::sort(sortedFaults.begin(), sortedFaults.end(), faultComparator); std::sort(sortedFaults.begin(), sortedFaults.end(), faultComparator);
cvf::ref<RigFault> undefinedFaults; cvf::ref<RigFault> undefinedFaults;
cvf::ref<RigFault> undefinedFaultsWInactive;
for (size_t i = 0; i < sortedFaults.size(); i++) for (size_t i = 0; i < sortedFaults.size(); i++)
{ {
if (sortedFaults[i]->name().compare(RimDefines::undefinedGridFaultName(), Qt::CaseInsensitive) == 0) QString faultName = sortedFaults[i]->name();
if (faultName.compare(RimDefines::undefinedGridFaultName(), Qt::CaseInsensitive) == 0)
{ {
undefinedFaults = sortedFaults[i]; undefinedFaults = sortedFaults[i];
} }
if(faultName.startsWith(RimDefines::undefinedGridFaultName(), Qt::CaseInsensitive)
&& faultName.contains("Inactive"))
{
undefinedFaultsWInactive = sortedFaults[i];
}
} }
if (undefinedFaults.notNull()) if (undefinedFaults.notNull())
{ {
sortedFaults.erase(undefinedFaults.p()); sortedFaults.erase(undefinedFaults.p());
rigFaults.push_back(undefinedFaults.p()); rigFaults.push_back(undefinedFaults.p());
} }
if(undefinedFaultsWInactive.notNull())
{
sortedFaults.erase(undefinedFaultsWInactive.p());
rigFaults.push_back(undefinedFaultsWInactive.p());
}
for (size_t i = 0; i < sortedFaults.size(); i++) for (size_t i = 0; i < sortedFaults.size(); i++)
{ {
rigFaults.push_back(sortedFaults[i].p()); rigFaults.push_back(sortedFaults[i].p());

View File

@@ -24,6 +24,7 @@
#include "RimDefines.h" #include "RimDefines.h"
#include "RigFault.h" #include "RigFault.h"
#include "cvfBoundingBoxTree.h" #include "cvfBoundingBoxTree.h"
#include "RigActiveCellInfo.h"
RigMainGrid::RigMainGrid(void) RigMainGrid::RigMainGrid(void)
@@ -218,8 +219,9 @@ void RigMainGrid::setFaults(const cvf::Collection<RigFault>& faults)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigMainGrid::calculateFaults() void RigMainGrid::calculateFaults(const RigActiveCellInfo* activeCellInfo)
{ {
{
m_faultsPrCellAcc = new RigFaultsPrCellAccumulator(m_cells.size()); m_faultsPrCellAcc = new RigFaultsPrCellAccumulator(m_cells.size());
// Spread fault idx'es on the cells from the faults // Spread fault idx'es on the cells from the faults
@@ -234,6 +236,9 @@ void RigMainGrid::calculateFaults()
RigFault * unNamedFault = new RigFault; RigFault * unNamedFault = new RigFault;
int unNamedFaultIdx = static_cast<int>(m_faults.size()); int unNamedFaultIdx = static_cast<int>(m_faults.size());
RigFault * unNamedFaultWithInactive = new RigFault;
int unNamedFaultWithInactiveIdx = static_cast<int>(m_faults.size());
const std::vector<cvf::Vec3d>& vxs = m_mainGrid->nodes(); const std::vector<cvf::Vec3d>& vxs = m_mainGrid->nodes();
for (int gcIdx = 0 ; gcIdx < static_cast<int>(m_cells.size()); ++gcIdx) for (int gcIdx = 0 ; gcIdx < static_cast<int>(m_cells.size()); ++gcIdx)
@@ -248,6 +253,7 @@ void RigMainGrid::calculateFaults()
size_t i, j, k; size_t i, j, k;
RigGridBase* hostGrid = NULL; RigGridBase* hostGrid = NULL;
bool firstNO_FAULTFaceForCell = true; bool firstNO_FAULTFaceForCell = true;
bool isCellActive = true;
for (char faceIdx = 0; faceIdx < 6; ++faceIdx) for (char faceIdx = 0; faceIdx < 6; ++faceIdx)
{ {
@@ -262,6 +268,8 @@ void RigMainGrid::calculateFaults()
{ {
hostGrid = m_cells[gcIdx].hostGrid(); hostGrid = m_cells[gcIdx].hostGrid();
hostGrid->ijkFromCellIndex(m_cells[gcIdx].gridLocalCellIndex(), &i,&j, &k); hostGrid->ijkFromCellIndex(m_cells[gcIdx].gridLocalCellIndex(), &i,&j, &k);
isCellActive = activeCellInfo->isActive(gcIdx);
firstNO_FAULTFaceForCell = false; firstNO_FAULTFaceForCell = false;
} }
@@ -276,8 +284,9 @@ void RigMainGrid::calculateFaults()
continue; continue;
} }
bool isNeighborCellActive = activeCellInfo->isActive(neighborReservoirCellIdx);
double tolerance = 1e-6; double tolerance = 1e-6;
caf::SizeTArray4 faceIdxs; caf::SizeTArray4 faceIdxs;
m_cells[gcIdx].faceIndices(face, &faceIdxs); m_cells[gcIdx].faceIndices(face, &faceIdxs);
@@ -296,10 +305,12 @@ void RigMainGrid::calculateFaults()
continue; continue;
} }
// To avoid doing this calculation for the opposite face // To avoid doing this calculation for the opposite face
int faultIdx = unNamedFaultIdx;
if (!(isCellActive && isNeighborCellActive)) faultIdx = unNamedFaultWithInactiveIdx;
m_faultsPrCellAcc->setFaultIdx(gcIdx, face, unNamedFaultIdx); m_faultsPrCellAcc->setFaultIdx(gcIdx, face, faultIdx);
m_faultsPrCellAcc->setFaultIdx(neighborReservoirCellIdx, StructGridInterface::oppositeFace(face), unNamedFaultIdx); m_faultsPrCellAcc->setFaultIdx(neighborReservoirCellIdx, StructGridInterface::oppositeFace(face), faultIdx);
// Add as fault face only if the grid index is less than the neighbors // Add as fault face only if the grid index is less than the neighbors
@@ -307,7 +318,14 @@ void RigMainGrid::calculateFaults()
{ {
{ {
RigFault::FaultFace ff(gcIdx, cvf::StructGridInterface::FaceType(faceIdx), neighborReservoirCellIdx); RigFault::FaultFace ff(gcIdx, cvf::StructGridInterface::FaceType(faceIdx), neighborReservoirCellIdx);
unNamedFault->faultFaces().push_back(ff); if(isCellActive && isNeighborCellActive)
{
unNamedFault->faultFaces().push_back(ff);
}
else
{
unNamedFaultWithInactive->faultFaces().push_back(ff);
}
} }
} }
@@ -325,6 +343,12 @@ void RigMainGrid::calculateFaults()
m_faults.push_back(unNamedFault); m_faults.push_back(unNamedFault);
} }
if(unNamedFaultWithInactive->faultFaces().size())
{
unNamedFaultWithInactive->setName(RimDefines::undefinedGridFaultWithInactiveName());
m_faults.push_back(unNamedFaultWithInactive);
}
}
// Distribute nnc's to the faults // Distribute nnc's to the faults
const std::vector<RigConnection>& nncs = this->nncData()->connections(); const std::vector<RigConnection>& nncs = this->nncData()->connections();

View File

@@ -30,11 +30,14 @@
#include <QtGlobal> #include <QtGlobal>
#include "RigNNCData.h" #include "RigNNCData.h"
class RigActiveCellInfo;
namespace cvf namespace cvf
{ {
class BoundingBoxTree; class BoundingBoxTree;
} }
class RigMainGrid : public RigGridBase class RigMainGrid : public RigGridBase
{ {
public: public:
@@ -57,7 +60,7 @@ public:
RigNNCData* nncData(); RigNNCData* nncData();
void setFaults(const cvf::Collection<RigFault>& faults); void setFaults(const cvf::Collection<RigFault>& faults);
const cvf::Collection<RigFault>& faults() { return m_faults; } const cvf::Collection<RigFault>& faults() { return m_faults; }
void calculateFaults(); void calculateFaults(const RigActiveCellInfo* activeCellInfo);
const RigFault* findFaultFromCellIndexAndCellFace(size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face) const; const RigFault* findFaultFromCellIndexAndCellFace(size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face) const;
bool isFaceNormalsOutwards() const; bool isFaceNormalsOutwards() const;