mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-18 13:33:28 -06:00
d5f470cb68
This patch refactors (hopefully) all parts of opm-core that are needed by the fully implicite black oil solver in opm-autodiff and that inherently relied on UnstructuredGrid. We added a new simple grid interface consisting out of free functions that will allow us to use CpGrid without copying it to an UnstructuredGrid by the means of the GridAdapter. Using this interface we have add methods that allow specifying the grid information (global_cell, cartdims, etc.) wherever possible to prevent introducing grid parameters for the type of the grid. Unfortunately this was not possible everywhere.
103 lines
3.4 KiB
C++
103 lines
3.4 KiB
C++
/*
|
|
Copyright 2012 SINTEF ICT, Applied Mathematics.
|
|
|
|
This file is part of the Open Porous Media project (OPM).
|
|
|
|
OPM 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.
|
|
|
|
OPM 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 for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef OPM_ROCKFROMDECK_HEADER_INCLUDED
|
|
#define OPM_ROCKFROMDECK_HEADER_INCLUDED
|
|
|
|
|
|
#include <opm/core/io/eclipse/EclipseGridParser.hpp>
|
|
#include <vector>
|
|
|
|
struct UnstructuredGrid;
|
|
|
|
namespace Opm
|
|
{
|
|
|
|
class RockFromDeck
|
|
{
|
|
public:
|
|
/// Default constructor.
|
|
RockFromDeck();
|
|
|
|
/// Initialize from deck and grid.
|
|
/// \param deck Deck input parser
|
|
/// \param grid Grid to which property object applies, needed for the
|
|
/// mapping from cell indices (typically from a processed grid)
|
|
/// to logical cartesian indices consistent with the deck.
|
|
void init(const EclipseGridParser& deck,
|
|
const UnstructuredGrid& grid);
|
|
|
|
/// Initialize from deck and cell mapping.
|
|
/// \param deck Deck input parser
|
|
/// \param number_of_cells The number of cells in the grid.
|
|
/// \param global_cell The mapping fom local to global cell indices.
|
|
/// global_cell[i] is the corresponding global index of i.
|
|
/// \param cart_dims The size of the underlying cartesian grid.
|
|
void init(const EclipseGridParser& deck,
|
|
int number_of_cells, const int* global_cell,
|
|
const int* cart_dims);
|
|
|
|
/// \return D, the number of spatial dimensions. Always 3 for deck input.
|
|
int numDimensions() const
|
|
{
|
|
return 3;
|
|
}
|
|
|
|
/// \return N, the number of cells.
|
|
int numCells() const
|
|
{
|
|
return porosity_.size();
|
|
}
|
|
|
|
/// \return Array of N porosity values.
|
|
const double* porosity() const
|
|
{
|
|
return &porosity_[0];
|
|
}
|
|
|
|
/// \return Array of ND^2 permeability values.
|
|
/// The D^2 permeability values for a cell are organized as a matrix,
|
|
/// which is symmetric (so ordering does not matter).
|
|
const double* permeability() const
|
|
{
|
|
return &permeability_[0];
|
|
}
|
|
|
|
private:
|
|
void assignPorosity(const EclipseGridParser& parser,
|
|
int number_of_cells,
|
|
const int* global_cell);
|
|
void assignPermeability(const EclipseGridParser& parser,
|
|
int number_of_cells,
|
|
const int* global_cell,
|
|
const int* cart_dims,
|
|
const double perm_threshold);
|
|
|
|
std::vector<double> porosity_;
|
|
std::vector<double> permeability_;
|
|
std::vector<unsigned char> permfield_valid_;
|
|
};
|
|
|
|
|
|
|
|
} // namespace Opm
|
|
|
|
|
|
#endif // OPM_ROCKFROMDECK_HEADER_INCLUDED
|