Results from a case with Coarse cells is now finally ok.

p4#: 20344
This commit is contained in:
Jacob Støren 2013-02-01 15:33:21 +01:00
parent e9b3759263
commit 3c9ac23534
7 changed files with 89 additions and 40 deletions

View File

@ -111,6 +111,8 @@ bool transferGridCellData(RigMainGrid* mainGrid, RigGridBase* localGrid, const e
cell.setInvalid(invalid);
cell.setCellIndex(gIdx);
// Active cell index
int matrixActiveIndex = ecl_grid_get_active_index1(localEclGrid, gIdx);
if (matrixActiveIndex != -1)
{
@ -131,6 +133,8 @@ bool transferGridCellData(RigMainGrid* mainGrid, RigGridBase* localGrid, const e
cell.setActiveIndexInFractureModel(cvf::UNDEFINED_SIZE_T);
}
// Parent cell index
int parentCellIndex = ecl_grid_get_parent_cell1(localEclGrid, gIdx);
if (parentCellIndex == -1)
{
@ -141,6 +145,10 @@ bool transferGridCellData(RigMainGrid* mainGrid, RigGridBase* localGrid, const e
cell.setParentCellIndex(parentCellIndex);
}
// Coarse cell info
ecl_coarse_cell_type * coarseCellData = ecl_grid_get_cell_coarse_group1( localEclGrid , gIdx);
cell.setInCoarseCell(coarseCellData != NULL);
// Corner coordinates
int cIdx;
for (cIdx = 0; cIdx < 8; ++cIdx)
@ -160,6 +168,7 @@ bool transferGridCellData(RigMainGrid* mainGrid, RigGridBase* localGrid, const e
cell.setSubGrid(static_cast<RigLocalGrid*>(mainGrid->gridByIndex(subGridFileIndex)));
}
// Mark inactive long pyramid looking cells as invalid
if (!cell.isActiveInMatrixModel() && !cell.isActiveInFractureModel() && !invalid)
{
cell.setInvalid(cell.isLongPyramidCell());
@ -281,18 +290,33 @@ bool RifReaderEclipseOutput::transferGeometry(const ecl_grid_type* mainEclGrid,
size_t globalMatrixActiveSize = ecl_grid_get_nactive(mainEclGrid);
size_t globalFractureActiveSize = ecl_grid_get_nactive_fracture(mainEclGrid);
mainGrid->setMatrixModelActiveCellCount(globalMatrixActiveSize);
mainGrid->setFractureModelActiveCellCount(globalFractureActiveSize);
for (lgrIdx = 0; lgrIdx < numLGRs; ++lgrIdx)
{
progInfo.setProgressDescription("LGR number " + QString::number(lgrIdx+1));
ecl_grid_type* localEclGrid = ecl_grid_iget_lgr(mainEclGrid, lgrIdx);
transferGridCellData(mainGrid, static_cast<RigLocalGrid*>(mainGrid->gridByIndex(lgrIdx+1)), localEclGrid, globalMatrixActiveSize, globalFractureActiveSize);
globalMatrixActiveSize += ecl_grid_get_nactive(localEclGrid);
globalFractureActiveSize += ecl_grid_get_nactive_fracture(localEclGrid);
RigLocalGrid* localGrid = static_cast<RigLocalGrid*>(mainGrid->gridByIndex(lgrIdx+1));
transferGridCellData(mainGrid, localGrid, localEclGrid, globalMatrixActiveSize, globalFractureActiveSize);
int activeCellCount = ecl_grid_get_nactive(localEclGrid);
localGrid->setMatrixModelActiveCellCount(activeCellCount);
globalMatrixActiveSize += activeCellCount;
activeCellCount = ecl_grid_get_nactive_fracture(localEclGrid);
localGrid->setFractureModelActiveCellCount(activeCellCount);
globalFractureActiveSize += activeCellCount;
progInfo.setProgress(3 + lgrIdx);
}
mainGrid->setGlobalMatrixModelActiveCellCount(globalMatrixActiveSize);
mainGrid->setGlobalFractureModelActiveCellCount(globalFractureActiveSize);
return true;
}

View File

@ -42,7 +42,8 @@ RigCell::RigCell() :
m_isWellCell(false),
m_activeIndexInMatrixModel(cvf::UNDEFINED_SIZE_T),
m_activeIndexInFractureModel(cvf::UNDEFINED_SIZE_T),
m_cellIndex(cvf::UNDEFINED_SIZE_T)
m_cellIndex(cvf::UNDEFINED_SIZE_T),
m_isInCoarseCell(false)
{
memcpy(m_cornerIndices.m_array, undefinedCornersArray, 8*sizeof(size_t));

View File

@ -66,6 +66,9 @@ public:
size_t mainGridCellIndex() const { return m_mainGridCellIndex; }
void setMainGridCellIndex(size_t mainGridCellContainingThisCell) { m_mainGridCellIndex = mainGridCellContainingThisCell; }
bool isInCoarseCell() const { return m_isInCoarseCell; }
void setInCoarseCell(bool isInCoarseCell) { m_isInCoarseCell = isInCoarseCell; }
void setCellFaceFault(cvf::StructGridInterface::FaceType face) { m_cellFaceFaults[face] = true; }
bool isCellFaceFault(cvf::StructGridInterface::FaceType face) const { return m_cellFaceFaults[face]; }
@ -86,7 +89,7 @@ private:
RigGridBase* m_hostGrid;
size_t m_parentCellIndex; ///< Grid cell index of the cell in the parent grid containing this cell
size_t m_mainGridCellIndex;
bool m_isInCoarseCell;
size_t m_activeIndexInMatrixModel; ///< This cell's running index of all the active calls (matrix) in the reservoir
size_t m_activeIndexInFractureModel; ///< This cell's running index of all the active calls (fracture) in the reservoir

View File

@ -473,13 +473,6 @@ double RigGridBase::characteristicCellSize()
//--------------------------------------------------------------------------------------------------
size_t RigGridBase::matrixModelActiveCellCount()
{
if (m_matrixModelActiveCellCount == cvf::UNDEFINED_SIZE_T)
{
computeMatrixAndFractureModelActiveCellCount();
}
CVF_ASSERT(m_matrixModelActiveCellCount != cvf::UNDEFINED_SIZE_T);
return m_matrixModelActiveCellCount;
}
@ -488,16 +481,9 @@ size_t RigGridBase::matrixModelActiveCellCount()
//--------------------------------------------------------------------------------------------------
size_t RigGridBase::fractureModelActiveCellCount()
{
if (m_fractureModelActiveCellCount == cvf::UNDEFINED_SIZE_T)
{
computeMatrixAndFractureModelActiveCellCount();
}
CVF_ASSERT(m_fractureModelActiveCellCount != cvf::UNDEFINED_SIZE_T);
return m_fractureModelActiveCellCount;
}
/*
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -506,20 +492,38 @@ void RigGridBase::computeMatrixAndFractureModelActiveCellCount()
m_matrixModelActiveCellCount = 0;
m_fractureModelActiveCellCount = 0;
size_t higestActiveIndexInMM = 0;
size_t higestActiveIndexInFM = 0;
bool firstMMActiveCell = true;
bool firstFMActiveCell = true;
for (size_t i = 0; i < cellCount(); i++)
{
const RigCell& c = cell(i);
if (c.isActiveInMatrixModel())
{
if (c.activeIndexInMatrixModel() > higestActiveIndexInMM || firstMMActiveCell)
{
m_matrixModelActiveCellCount++;
higestActiveIndexInMM = c.activeIndexInMatrixModel();
firstMMActiveCell = false;
}
}
if (c.isActiveInFractureModel())
{
if (c.activeIndexInFractureModel() > higestActiveIndexInFM || firstFMActiveCell)
{
m_fractureModelActiveCellCount++;
higestActiveIndexInFM = c.activeIndexInFractureModel();
firstFMActiveCell = false;
}
}
}
*/
//--------------------------------------------------------------------------------------------------
@ -537,6 +541,27 @@ cvf::ref<RigGridScalarDataAccess> RigGridBase::dataAccessObject(RifReaderInterfa
return NULL;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigGridBase::setFractureModelActiveCellCount(size_t activeFractureModelCellCount)
{
m_fractureModelActiveCellCount = activeFractureModelCellCount;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigGridBase::setMatrixModelActiveCellCount(size_t activeMatrixModelCellCount)
{
m_matrixModelActiveCellCount = activeMatrixModelCellCount;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -62,8 +62,10 @@ public:
RigMainGrid* mainGrid() const { return m_mainGrid; }
size_t matrixModelActiveCellCount();
void setMatrixModelActiveCellCount(size_t activeMatrixModelCellCount);
size_t fractureModelActiveCellCount();
void computeMatrixAndFractureModelActiveCellCount();
void setFractureModelActiveCellCount(size_t activeFractureModelCellCount);
//void computeMatrixAndFractureModelActiveCellCount();
protected:
friend class RigMainGrid;//::initAllSubGridsParentGridPointer();

View File

@ -85,11 +85,8 @@ void RigMainGrid::initAllSubCellsMainGridCellIndex()
//--------------------------------------------------------------------------------------------------
size_t RigMainGrid::globalMatrixModelActiveCellCount()
{
if (m_globalMatrixModelActiveCellCount != cvf::UNDEFINED_SIZE_T) return m_globalMatrixModelActiveCellCount;
computeGlobalActiveCellCount();
return m_globalMatrixModelActiveCellCount;
}
//--------------------------------------------------------------------------------------------------
@ -97,10 +94,6 @@ size_t RigMainGrid::globalMatrixModelActiveCellCount()
//--------------------------------------------------------------------------------------------------
size_t RigMainGrid::globalFractureModelActiveCellCount()
{
if (m_globalFractureModelActiveCellCount != cvf::UNDEFINED_SIZE_T) return m_globalFractureModelActiveCellCount;
computeGlobalActiveCellCount();
return m_globalFractureModelActiveCellCount;
}
@ -248,7 +241,6 @@ void RigMainGrid::computeCachedData()
initAllSubCellsMainGridCellIndex();
computeActiveAndValidCellRanges();
computeBoundingBox();
computeActiveCellCountForAllGrids();
}
//--------------------------------------------------------------------------------------------------
@ -345,7 +337,7 @@ const RigGridBase* RigMainGrid::gridByIndex(size_t localGridIndex) const
CVF_ASSERT(localGridIndex - 1 < m_localGrids.size()) ;
return m_localGrids[localGridIndex-1].p();
}
/*
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -359,23 +351,24 @@ void RigMainGrid::computeActiveCellCountForAllGrids()
m_localGrids[i]->computeMatrixAndFractureModelActiveCellCount();
}
}
*/
/*
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigMainGrid::computeGlobalActiveCellCount()
{
m_globalMatrixModelActiveCellCount = 0;
m_globalFractureModelActiveCellCount = 0;
m_globalMatrixModelActiveCellCount = this->matrixModelActiveCellCount();
m_globalFractureModelActiveCellCount = this->fractureModelActiveCellCount();
size_t i;
for (i = 0; i < m_cells.size(); i++)
for (i = 0; i < m_localGrids.size(); i++)
{
if (m_cells[i].isActiveInMatrixModel()) m_globalMatrixModelActiveCellCount++;
if (m_cells[i].isActiveInFractureModel()) m_globalFractureModelActiveCellCount++;
m_globalMatrixModelActiveCellCount += m_localGrids[i]->matrixModelActiveCellCount() ;
m_globalFractureModelActiveCellCount += m_localGrids[i]->fractureModelActiveCellCount() ;
}
}
*/
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -401,3 +394,4 @@ const RigReservoirCellResults* RigMainGrid::results(RifReaderInterface::Porosity
return m_fractureModelResults.p();
}

View File

@ -47,6 +47,8 @@ public:
size_t globalMatrixModelActiveCellCount();
size_t globalFractureModelActiveCellCount();
void setGlobalMatrixModelActiveCellCount (size_t globalMatrixModelActiveCellCount) { m_globalMatrixModelActiveCellCount = globalMatrixModelActiveCellCount; }
void setGlobalFractureModelActiveCellCount(size_t globalFractureModelActiveCellCount) { m_globalFractureModelActiveCellCount = globalFractureModelActiveCellCount;}
void matrixModelActiveCellsBoundingBox(cvf::Vec3st& min, cvf::Vec3st& max) const;
void validCellsBoundingBox(cvf::Vec3st& min, cvf::Vec3st& max) const;
@ -76,8 +78,6 @@ private:
void initAllSubCellsMainGridCellIndex();
void computeActiveAndValidCellRanges();
void computeBoundingBox();
void computeGlobalActiveCellCount();
void computeActiveCellCountForAllGrids();
private:
std::vector<cvf::Vec3d> m_nodes; ///< Global vertex table