diff --git a/opm/core/fluid/BlackoilPropertiesFromDeck.cpp b/opm/core/fluid/BlackoilPropertiesFromDeck.cpp index 0eb23cb07..004e6f88f 100644 --- a/opm/core/fluid/BlackoilPropertiesFromDeck.cpp +++ b/opm/core/fluid/BlackoilPropertiesFromDeck.cpp @@ -23,11 +23,11 @@ namespace Opm { BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(const EclipseGridParser& deck, - const std::vector& 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() << ")."); diff --git a/opm/core/fluid/BlackoilPropertiesFromDeck.hpp b/opm/core/fluid/BlackoilPropertiesFromDeck.hpp index 9c20b5683..a2a6c3de9 100644 --- a/opm/core/fluid/BlackoilPropertiesFromDeck.hpp +++ b/opm/core/fluid/BlackoilPropertiesFromDeck.hpp @@ -27,6 +27,8 @@ #include #include +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& global_cell); + const UnstructuredGrid& grid); /// Destructor. virtual ~BlackoilPropertiesFromDeck(); diff --git a/opm/core/fluid/IncompPropertiesFromDeck.cpp b/opm/core/fluid/IncompPropertiesFromDeck.cpp index e61e13c80..570154bf6 100644 --- a/opm/core/fluid/IncompPropertiesFromDeck.cpp +++ b/opm/core/fluid/IncompPropertiesFromDeck.cpp @@ -27,11 +27,11 @@ namespace Opm { IncompPropertiesFromDeck::IncompPropertiesFromDeck(const EclipseGridParser& deck, - const std::vector& 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() << ")."); diff --git a/opm/core/fluid/IncompPropertiesFromDeck.hpp b/opm/core/fluid/IncompPropertiesFromDeck.hpp index d17dd1b7d..68623e5cc 100644 --- a/opm/core/fluid/IncompPropertiesFromDeck.hpp +++ b/opm/core/fluid/IncompPropertiesFromDeck.hpp @@ -26,6 +26,8 @@ #include #include +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& global_cell); + const UnstructuredGrid& grid); /// Destructor. virtual ~IncompPropertiesFromDeck(); diff --git a/opm/core/fluid/RockFromDeck.cpp b/opm/core/fluid/RockFromDeck.cpp index 947779047..6568e8cc3 100644 --- a/opm/core/fluid/RockFromDeck.cpp +++ b/opm/core/fluid/RockFromDeck.cpp @@ -19,7 +19,7 @@ #include - +#include #include 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& 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& 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& 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& 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*> 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) { diff --git a/opm/core/fluid/RockFromDeck.hpp b/opm/core/fluid/RockFromDeck.hpp index abd9c14c3..65027e425 100644 --- a/opm/core/fluid/RockFromDeck.hpp +++ b/opm/core/fluid/RockFromDeck.hpp @@ -24,6 +24,7 @@ #include #include +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& 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& global_cell); + const UnstructuredGrid& grid); void assignPermeability(const EclipseGridParser& parser, - const std::vector& global_cell, + const UnstructuredGrid& grid, const double perm_threshold); std::vector porosity_; diff --git a/opm/core/fluid/SaturationPropsFromDeck.hpp b/opm/core/fluid/SaturationPropsFromDeck.hpp index 7c8be8d45..b83a12711 100644 --- a/opm/core/fluid/SaturationPropsFromDeck.hpp +++ b/opm/core/fluid/SaturationPropsFromDeck.hpp @@ -25,6 +25,8 @@ #include #include +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& global_cell); + const UnstructuredGrid& grid); /// \return P, the number of phases. int numPhases() const;