mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Constructors of *FromDeck classes now take an UnstructuredGrid.
This is a change from taking a vector containing the mapping to deck-consistent logical cartesian indices. The mapping is contained in the UnstructuredGrid::global_cell member, and may be null. The change therefore saves the overhead of constructing a vector as a copy of the data in the grid or (if null) as an identity mapping.
This commit is contained in:
parent
6ab7487218
commit
497c45b78b
@ -23,11 +23,11 @@ namespace Opm
|
||||
{
|
||||
|
||||
BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(const EclipseGridParser& deck,
|
||||
const std::vector<int>& global_cell)
|
||||
const UnstructuredGrid& grid)
|
||||
{
|
||||
rock_.init(deck, global_cell);
|
||||
rock_.init(deck, grid);
|
||||
pvt_.init(deck);
|
||||
satprops_.init(deck, global_cell);
|
||||
satprops_.init(deck, grid);
|
||||
if (pvt_.numPhases() != satprops_.numPhases()) {
|
||||
THROW("BlackoilPropertiesBasic::BlackoilPropertiesBasic() - Inconsistent number of phases in pvt data ("
|
||||
<< pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_.numPhases() << ").");
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include <opm/core/fluid/SaturationPropsFromDeck.hpp>
|
||||
#include <opm/core/eclipse/EclipseGridParser.hpp>
|
||||
|
||||
struct UnstructuredGrid;
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
@ -35,12 +37,13 @@ namespace Opm
|
||||
class BlackoilPropertiesFromDeck : public BlackoilPropertiesInterface
|
||||
{
|
||||
public:
|
||||
/// Construct from deck and cell mapping.
|
||||
/// \param deck eclipse input parser
|
||||
/// \param global_cell mapping from cell indices (typically from a processed grid)
|
||||
/// 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.
|
||||
BlackoilPropertiesFromDeck(const EclipseGridParser& deck,
|
||||
const std::vector<int>& global_cell);
|
||||
const UnstructuredGrid& grid);
|
||||
|
||||
/// Destructor.
|
||||
virtual ~BlackoilPropertiesFromDeck();
|
||||
|
@ -27,11 +27,11 @@ namespace Opm
|
||||
{
|
||||
|
||||
IncompPropertiesFromDeck::IncompPropertiesFromDeck(const EclipseGridParser& deck,
|
||||
const std::vector<int>& global_cell)
|
||||
const UnstructuredGrid& grid)
|
||||
{
|
||||
rock_.init(deck, global_cell);
|
||||
rock_.init(deck, grid);
|
||||
pvt_.init(deck);
|
||||
satprops_.init(deck, global_cell);
|
||||
satprops_.init(deck, grid);
|
||||
if (pvt_.numPhases() != satprops_.numPhases()) {
|
||||
THROW("IncompPropertiesFromDeck::IncompPropertiesFromDeck() - Inconsistent number of phases in pvt data ("
|
||||
<< pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_.numPhases() << ").");
|
||||
|
@ -26,6 +26,8 @@
|
||||
#include <opm/core/fluid/SaturationPropsFromDeck.hpp>
|
||||
#include <opm/core/eclipse/EclipseGridParser.hpp>
|
||||
|
||||
struct UnstructuredGrid;
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
@ -43,12 +45,13 @@ namespace Opm
|
||||
class IncompPropertiesFromDeck : public IncompPropertiesInterface
|
||||
{
|
||||
public:
|
||||
/// Construct from deck and cell mapping.
|
||||
/// \param deck eclipse input parser
|
||||
/// \param global_cell mapping from cell indices (typically from a processed grid)
|
||||
/// 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.
|
||||
IncompPropertiesFromDeck(const EclipseGridParser& deck,
|
||||
const std::vector<int>& global_cell);
|
||||
const UnstructuredGrid& grid);
|
||||
|
||||
/// Destructor.
|
||||
virtual ~IncompPropertiesFromDeck();
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
|
||||
#include <opm/core/fluid/RockFromDeck.hpp>
|
||||
|
||||
#include <opm/core/grid.h>
|
||||
#include <tr1/array>
|
||||
|
||||
namespace Opm
|
||||
@ -53,28 +53,29 @@ namespace Opm
|
||||
|
||||
/// Initialize from deck and cell mapping.
|
||||
/// \param deck Deck input parser
|
||||
/// \param global_cell mapping from cell indices (typically from a processed grid)
|
||||
/// \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 RockFromDeck::init(const EclipseGridParser& deck,
|
||||
const std::vector<int>& global_cell)
|
||||
const UnstructuredGrid& grid)
|
||||
{
|
||||
assignPorosity(deck, global_cell);
|
||||
permfield_valid_.assign(global_cell.size(), false);
|
||||
assignPorosity(deck, grid);
|
||||
permfield_valid_.assign(grid.number_of_cells, false);
|
||||
const double perm_threshold = 0.0; // Maybe turn into parameter?
|
||||
assignPermeability(deck, global_cell, perm_threshold);
|
||||
assignPermeability(deck, grid, perm_threshold);
|
||||
}
|
||||
|
||||
|
||||
void RockFromDeck::assignPorosity(const EclipseGridParser& parser,
|
||||
const std::vector<int>& global_cell)
|
||||
const UnstructuredGrid& grid)
|
||||
{
|
||||
porosity_.assign(global_cell.size(), 1.0);
|
||||
|
||||
porosity_.assign(grid.number_of_cells, 1.0);
|
||||
const int* gc = grid.global_cell;
|
||||
if (parser.hasField("PORO")) {
|
||||
const std::vector<double>& poro = parser.getFloatingPointValue("PORO");
|
||||
|
||||
for (int c = 0; c < int(porosity_.size()); ++c) {
|
||||
porosity_[c] = poro[global_cell[c]];
|
||||
const int deck_pos = (gc == NULL) ? c : gc[c];
|
||||
porosity_[c] = poro[deck_pos];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -82,14 +83,16 @@ namespace Opm
|
||||
|
||||
|
||||
void RockFromDeck::assignPermeability(const EclipseGridParser& parser,
|
||||
const std::vector<int>& global_cell,
|
||||
const UnstructuredGrid& grid,
|
||||
double perm_threshold)
|
||||
{
|
||||
const int dim = 3;
|
||||
const int num_global_cells = numGlobalCells(parser);
|
||||
const int nc = grid.number_of_cells;
|
||||
|
||||
ASSERT (num_global_cells > 0);
|
||||
|
||||
permeability_.assign(dim * dim * global_cell.size(), 0.0);
|
||||
permeability_.assign(dim * dim * nc, 0.0);
|
||||
|
||||
std::vector<const std::vector<double>*> tensor;
|
||||
tensor.reserve(10);
|
||||
@ -111,13 +114,13 @@ namespace Opm
|
||||
// chosen) default value...
|
||||
//
|
||||
if (tensor.size() > 1) {
|
||||
const int nc = global_cell.size();
|
||||
int off = 0;
|
||||
const int* gc = grid.global_cell;
|
||||
int off = 0;
|
||||
|
||||
for (int c = 0; c < nc; ++c, off += dim*dim) {
|
||||
// SharedPermTensor K(dim, dim, &permeability_[off]);
|
||||
int kix = 0;
|
||||
const int glob = global_cell[c];
|
||||
const int glob = (gc == NULL) ? c : gc[c];
|
||||
|
||||
for (int i = 0; i < dim; ++i) {
|
||||
for (int j = 0; j < dim; ++j, ++kix) {
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <opm/core/eclipse/EclipseGridParser.hpp>
|
||||
#include <vector>
|
||||
|
||||
struct UnstructuredGrid;
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
@ -34,12 +35,13 @@ namespace Opm
|
||||
/// Default constructor.
|
||||
RockFromDeck();
|
||||
|
||||
/// Initialize from deck and cell mapping.
|
||||
/// Initialize from deck and grid.
|
||||
/// \param deck Deck input parser
|
||||
/// \param global_cell mapping from cell indices (typically from a processed grid)
|
||||
/// \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 std::vector<int>& global_cell);
|
||||
const UnstructuredGrid& grid);
|
||||
|
||||
/// \return D, the number of spatial dimensions. Always 3 for deck input.
|
||||
int numDimensions() const
|
||||
@ -69,9 +71,9 @@ namespace Opm
|
||||
|
||||
private:
|
||||
void assignPorosity(const EclipseGridParser& parser,
|
||||
const std::vector<int>& global_cell);
|
||||
const UnstructuredGrid& grid);
|
||||
void assignPermeability(const EclipseGridParser& parser,
|
||||
const std::vector<int>& global_cell,
|
||||
const UnstructuredGrid& grid,
|
||||
const double perm_threshold);
|
||||
|
||||
std::vector<double> porosity_;
|
||||
|
@ -25,6 +25,8 @@
|
||||
#include <opm/core/fluid/blackoil/BlackoilPhases.hpp>
|
||||
#include <vector>
|
||||
|
||||
struct UnstructuredGrid;
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
@ -34,10 +36,13 @@ namespace Opm
|
||||
/// Default constructor.
|
||||
SaturationPropsFromDeck();
|
||||
|
||||
/// Initialize from deck.
|
||||
/// global_cell maps from grid cells to their original logical Cartesian indices.
|
||||
/// 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 std::vector<int>& global_cell);
|
||||
const UnstructuredGrid& grid);
|
||||
|
||||
/// \return P, the number of phases.
|
||||
int numPhases() const;
|
||||
|
Loading…
Reference in New Issue
Block a user