Add specialiced active cell subgrids

This commit is contained in:
jonjenssen 2024-10-24 01:35:44 +02:00 committed by jonjenssen
parent 88118ee4e1
commit 78d82acb41
5 changed files with 91 additions and 3 deletions

View File

@ -25,6 +25,7 @@
#include "RigActiveCellGrid.h" #include "RigActiveCellGrid.h"
#include "RigActiveCellInfo.h" #include "RigActiveCellInfo.h"
#include "RigActiveCellLocalGrid.h"
#include "RigEclipseCaseData.h" #include "RigEclipseCaseData.h"
#include "cafProgressInfo.h" #include "cafProgressInfo.h"
@ -93,7 +94,7 @@ bool RifReaderOpmCommonActive::importGrid( RigMainGrid* /* mainGrid*/, RigEclips
for ( int lgrIdx = 0; lgrIdx < numLGRs; lgrIdx++ ) for ( int lgrIdx = 0; lgrIdx < numLGRs; lgrIdx++ )
{ {
lgrGrids.emplace_back( Opm::EclIO::EGrid( m_gridFileName, lgr_names[lgrIdx] ) ); lgrGrids.emplace_back( Opm::EclIO::EGrid( m_gridFileName, lgr_names[lgrIdx] ) );
RigLocalGrid* localGrid = new RigLocalGrid( activeGrid ); RigActiveCellLocalGrid* localGrid = new RigActiveCellLocalGrid( activeGrid );
const auto& lgrDims = lgrGrids[lgrIdx].dimension(); const auto& lgrDims = lgrGrids[lgrIdx].dimension();
localGrid->setGridPointDimensions( cvf::Vec3st( lgrDims[0] + 1, lgrDims[1] + 1, lgrDims[2] + 1 ) ); localGrid->setGridPointDimensions( cvf::Vec3st( lgrDims[0] + 1, lgrDims[1] + 1, lgrDims[2] + 1 ) );
@ -179,7 +180,7 @@ bool RifReaderOpmCommonActive::importGrid( RigMainGrid* /* mainGrid*/, RigEclips
RigGridBase* parentGrid = hasParentInfo ? activeGrid->gridByName( lgr_parent_names[lgrIdx] ) : activeGrid; RigGridBase* parentGrid = hasParentInfo ? activeGrid->gridByName( lgr_parent_names[lgrIdx] ) : activeGrid;
RigLocalGrid* localGrid = static_cast<RigLocalGrid*>( activeGrid->gridById( lgrIdx + 1 ) ); RigActiveCellLocalGrid* localGrid = static_cast<RigActiveCellLocalGrid*>( activeGrid->gridById( lgrIdx + 1 ) );
localGrid->setParentGrid( parentGrid ); localGrid->setParentGrid( parentGrid );
transferActiveGeometry( opmGrid, lgrGrids[lgrIdx], activeGrid, localGrid, eclipseCaseData ); transferActiveGeometry( opmGrid, lgrGrids[lgrIdx], activeGrid, localGrid, eclipseCaseData );

View File

@ -23,6 +23,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RigLocalGrid.h ${CMAKE_CURRENT_LIST_DIR}/RigLocalGrid.h
${CMAKE_CURRENT_LIST_DIR}/RigMainGrid.h ${CMAKE_CURRENT_LIST_DIR}/RigMainGrid.h
${CMAKE_CURRENT_LIST_DIR}/RigActiveCellGrid.h ${CMAKE_CURRENT_LIST_DIR}/RigActiveCellGrid.h
${CMAKE_CURRENT_LIST_DIR}/RigActiveCellLocalGrid.h
${CMAKE_CURRENT_LIST_DIR}/RigReservoirBuilderMock.h ${CMAKE_CURRENT_LIST_DIR}/RigReservoirBuilderMock.h
${CMAKE_CURRENT_LIST_DIR}/RigCaseCellResultsData.h ${CMAKE_CURRENT_LIST_DIR}/RigCaseCellResultsData.h
${CMAKE_CURRENT_LIST_DIR}/RigSimWellData.h ${CMAKE_CURRENT_LIST_DIR}/RigSimWellData.h
@ -130,6 +131,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RigLocalGrid.cpp ${CMAKE_CURRENT_LIST_DIR}/RigLocalGrid.cpp
${CMAKE_CURRENT_LIST_DIR}/RigMainGrid.cpp ${CMAKE_CURRENT_LIST_DIR}/RigMainGrid.cpp
${CMAKE_CURRENT_LIST_DIR}/RigActiveCellGrid.cpp ${CMAKE_CURRENT_LIST_DIR}/RigActiveCellGrid.cpp
${CMAKE_CURRENT_LIST_DIR}/RigActiveCellLocalGrid.cpp
${CMAKE_CURRENT_LIST_DIR}/RigReservoirBuilderMock.cpp ${CMAKE_CURRENT_LIST_DIR}/RigReservoirBuilderMock.cpp
${CMAKE_CURRENT_LIST_DIR}/RigCaseCellResultsData.cpp ${CMAKE_CURRENT_LIST_DIR}/RigCaseCellResultsData.cpp
${CMAKE_CURRENT_LIST_DIR}/RigSimWellData.cpp ${CMAKE_CURRENT_LIST_DIR}/RigSimWellData.cpp

View File

@ -0,0 +1,47 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2024 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RigActiveCellLocalGrid.h"
#include "RigActiveCellGrid.h"
RigActiveCellLocalGrid::RigActiveCellLocalGrid( RigActiveCellGrid* mainGrid )
: RigLocalGrid( mainGrid )
, m_mainActiveGrid( mainGrid )
{
}
RigActiveCellLocalGrid::~RigActiveCellLocalGrid()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigCell& RigActiveCellLocalGrid::cell( size_t gridLocalCellIndex )
{
return m_mainActiveGrid->cell( m_indexToStartOfCells + gridLocalCellIndex );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RigCell& RigActiveCellLocalGrid::cell( size_t gridLocalCellIndex ) const
{
return m_mainActiveGrid->cell( m_indexToStartOfCells + gridLocalCellIndex );
}

View File

@ -0,0 +1,36 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2024 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RigLocalGrid.h"
class RigActiveCellGrid;
class RigActiveCellLocalGrid : public RigLocalGrid
{
public:
explicit RigActiveCellLocalGrid( RigActiveCellGrid* mainGrid );
~RigActiveCellLocalGrid() override;
RigCell& cell( size_t gridLocalCellIndex ) override;
const RigCell& cell( size_t gridLocalCellIndex ) const override;
private:
RigActiveCellGrid* m_mainActiveGrid;
};

View File

@ -114,11 +114,13 @@ public:
bool cellIJKNeighbor( size_t i, size_t j, size_t k, FaceType face, size_t* neighborCellIndex ) const override; bool cellIJKNeighbor( size_t i, size_t j, size_t k, FaceType face, size_t* neighborCellIndex ) const override;
void cellIJKNeighborUnguarded( size_t i, size_t j, size_t k, FaceType face, size_t* neighborCellIndex ) const; void cellIJKNeighborUnguarded( size_t i, size_t j, size_t k, FaceType face, size_t* neighborCellIndex ) const;
protected:
size_t m_indexToStartOfCells; ///< Index into the global cell array stored in main-grid where this grids cells starts.
private: private:
std::string m_gridName; std::string m_gridName;
cvf::Vec3st m_gridPointDimensions; cvf::Vec3st m_gridPointDimensions;
cvf::Vec3st m_cellCount; cvf::Vec3st m_cellCount;
size_t m_indexToStartOfCells; ///< Index into the global cell array stored in main-grid where this grids cells starts.
size_t m_gridIndex; ///< The LGR index of this grid. Starts with 1. Main grid has index 0. size_t m_gridIndex; ///< The LGR index of this grid. Starts with 1. Main grid has index 0.
int m_gridId; ///< The LGR id of this grid. Main grid has id 0. int m_gridId; ///< The LGR id of this grid. Main grid has id 0.
RigMainGrid* m_mainGrid; RigMainGrid* m_mainGrid;