mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Work in progress
This commit is contained in:
parent
596ab564c8
commit
9483c9054d
@ -75,24 +75,54 @@ bool RifReaderOpmCommonActive::importGrid( RigMainGrid* /* mainGrid*/, RigEclips
|
||||
else if ( gridUnitStr.starts_with( 'C' ) )
|
||||
m_gridUnit = 3;
|
||||
|
||||
auto totalCellCount = opmGrid.totalActiveCells() + 1; // add one inactive cell used as placeholder for all inactive cells
|
||||
auto globalMatrixActiveSize = opmGrid.activeCells();
|
||||
auto globalFractureActiveSize = opmGrid.activeFracCells();
|
||||
|
||||
const auto& lgr_names = opmGrid.list_of_lgrs();
|
||||
m_gridNames.clear();
|
||||
m_gridNames.push_back( "global" );
|
||||
m_gridNames.insert( m_gridNames.end(), lgr_names.begin(), lgr_names.end() );
|
||||
const auto& lgr_parent_names = opmGrid.list_of_lgr_parents();
|
||||
const int numLGRs = (int)lgr_names.size();
|
||||
|
||||
std::vector<Opm::EclIO::EGrid> lgrGrids; // lgrs not supported here for now
|
||||
std::vector<Opm::EclIO::EGrid> lgrGrids;
|
||||
|
||||
// init LGR grids
|
||||
for ( int lgrIdx = 0; lgrIdx < numLGRs; lgrIdx++ )
|
||||
{
|
||||
lgrGrids.emplace_back( Opm::EclIO::EGrid( m_gridFileName, lgr_names[lgrIdx] ) );
|
||||
RigLocalGrid* localGrid = new RigLocalGrid( activeGrid );
|
||||
|
||||
const auto& lgrDims = lgrGrids[lgrIdx].dimension();
|
||||
localGrid->setGridPointDimensions( cvf::Vec3st( lgrDims[0] + 1, lgrDims[1] + 1, lgrDims[2] + 1 ) );
|
||||
localGrid->setGridId( lgrIdx + 1 );
|
||||
localGrid->setGridName( lgr_names[lgrIdx] );
|
||||
activeGrid->addLocalGrid( localGrid );
|
||||
|
||||
localGrid->setIndexToStartOfCells( totalCellCount );
|
||||
|
||||
totalCellCount += lgrGrids[lgrIdx].totalActiveCells();
|
||||
}
|
||||
|
||||
// active cell information
|
||||
{
|
||||
auto task = progInfo.task( "Getting Active Cell Information", 1 );
|
||||
|
||||
for ( int lgrIdx = 0; lgrIdx < numLGRs; lgrIdx++ )
|
||||
{
|
||||
globalMatrixActiveSize += lgrGrids[lgrIdx].activeCells();
|
||||
globalFractureActiveSize += lgrGrids[lgrIdx].activeFracCells();
|
||||
}
|
||||
|
||||
// in case init file and grid file disagrees with number of active cells, read extra porv information from init file to correct this
|
||||
if ( !verifyActiveCellInfo( globalMatrixActiveSize, globalFractureActiveSize ) )
|
||||
{
|
||||
updateActiveCellInfo( eclipseCaseData, opmGrid, lgrGrids, activeGrid );
|
||||
}
|
||||
|
||||
// TODO - loop over all grids
|
||||
|
||||
activeGrid->transferActiveInformation( eclipseCaseData,
|
||||
opmGrid.totalActiveCells(),
|
||||
opmGrid.activeCells(),
|
||||
|
@ -38,28 +38,37 @@ RigActiveCellGrid::~RigActiveCellGrid()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigActiveCellGrid::transferActiveInformation( RigEclipseCaseData* eclipseCaseData,
|
||||
void RigActiveCellGrid::transferActiveInformation( int gridIndex,
|
||||
RigEclipseCaseData* eclipseCaseData,
|
||||
size_t totalActiveCells,
|
||||
size_t matrixActiveCells,
|
||||
size_t fractureActiveCells,
|
||||
const std::vector<int>& activeMatrixIndexes,
|
||||
const std::vector<int>& activeFracIndexes )
|
||||
{
|
||||
if ( gridIndex == 0 )
|
||||
{
|
||||
m_globalToActiveMap.clear();
|
||||
}
|
||||
|
||||
const auto totalCells = activeMatrixIndexes.size();
|
||||
|
||||
m_globalToActiveMap.resize( totalCells );
|
||||
size_t activeCells = 0;
|
||||
size_t anInactiveCellIdx = 0;
|
||||
const auto cellStartIndex = m_globalToActiveMap.size();
|
||||
|
||||
m_globalToActiveMap.resize( cellStartIndex + totalCells );
|
||||
size_t activeCells = cellStartIndex;
|
||||
size_t anInactiveCellIdx = cellStartIndex;
|
||||
|
||||
for ( size_t i = 0; i < totalCells; i++ )
|
||||
{
|
||||
const auto globalCellIndex = cellStartIndex + i;
|
||||
if ( ( activeMatrixIndexes[i] < 0 ) && ( activeFracIndexes[i] < 0 ) )
|
||||
{
|
||||
m_globalToActiveMap[i] = totalActiveCells;
|
||||
anInactiveCellIdx = i;
|
||||
m_globalToActiveMap[globalCellIndex] = totalActiveCells;
|
||||
anInactiveCellIdx = globalCellIndex;
|
||||
continue;
|
||||
}
|
||||
m_activeToGlobalMap.push_back( i );
|
||||
m_activeToGlobalMap.push_back( globalCellIndex );
|
||||
m_globalToActiveMap[i] = activeCells++;
|
||||
}
|
||||
m_activeToGlobalMap.push_back( anInactiveCellIdx );
|
||||
@ -67,19 +76,21 @@ void RigActiveCellGrid::transferActiveInformation( RigEclipseCaseData* eclip
|
||||
RigActiveCellInfo* activeCellInfo = eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL );
|
||||
RigActiveCellInfo* fractureActiveCellInfo = eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::FRACTURE_MODEL );
|
||||
|
||||
activeCellInfo->setReservoirCellCount( totalActiveCells + 1 );
|
||||
fractureActiveCellInfo->setReservoirCellCount( totalActiveCells + 1 );
|
||||
activeCellInfo->setReservoirCellCount( activeCellInfo->reservoirCellCount() + totalActiveCells + 1 );
|
||||
fractureActiveCellInfo->setReservoirCellCount( fractureActiveCellInfo->reservoirCellCount() + totalActiveCells + 1 );
|
||||
|
||||
activeCellInfo->setGridCount( 1 );
|
||||
fractureActiveCellInfo->setGridCount( 1 );
|
||||
activeCellInfo->setGridCount( gridIndex + 1 );
|
||||
fractureActiveCellInfo->setGridCount( gridIndex + 1 );
|
||||
|
||||
activeCellInfo->setGridActiveCellCounts( 0, matrixActiveCells );
|
||||
fractureActiveCellInfo->setGridActiveCellCounts( 0, fractureActiveCells );
|
||||
activeCellInfo->setGridActiveCellCounts( gridIndex, matrixActiveCells );
|
||||
fractureActiveCellInfo->setGridActiveCellCounts( gridIndex, fractureActiveCells );
|
||||
|
||||
// TODO - update indexes here
|
||||
|
||||
#pragma omp parallel for
|
||||
for ( int opmCellIndex = 0; opmCellIndex < (int)totalCells; opmCellIndex++ )
|
||||
{
|
||||
auto activeCellIndex = m_globalToActiveMap[opmCellIndex];
|
||||
auto activeCellIndex = m_globalToActiveMap[cellStartIndex + opmCellIndex];
|
||||
|
||||
// active cell index
|
||||
int matrixActiveIndex = activeMatrixIndexes[opmCellIndex];
|
||||
|
@ -28,7 +28,8 @@ public:
|
||||
RigActiveCellGrid();
|
||||
~RigActiveCellGrid() override;
|
||||
|
||||
void transferActiveInformation( RigEclipseCaseData* eclipseCaseData,
|
||||
void transferActiveInformation( int gridIndex, // 0 - main grid, 1 - first LGR...
|
||||
RigEclipseCaseData* eclipseCaseData,
|
||||
size_t totalActiveCells,
|
||||
size_t matrixActiveCells,
|
||||
size_t fractureActiveCells,
|
||||
|
Loading…
Reference in New Issue
Block a user