OPM-163: Use EclipseState instead of Deck for PvtInterface

This commit is contained in:
chflo 2016-01-07 16:36:28 +01:00
parent 1a8b38dcc9
commit ca60041332
3 changed files with 15 additions and 28 deletions

View File

@ -128,7 +128,7 @@ namespace Opm
{ {
// retrieve the cell specific PVT table index from the deck // retrieve the cell specific PVT table index from the deck
// and using the grid... // and using the grid...
extractPvtTableIndex(cellPvtRegionIdx_, deck, number_of_cells, global_cell); extractPvtTableIndex(cellPvtRegionIdx_, eclState, number_of_cells, global_cell);
if (init_rock){ if (init_rock){
rock_.init(eclState, number_of_cells, global_cell, cart_dims); rock_.init(eclState, number_of_cells, global_cell, cart_dims);
@ -156,7 +156,7 @@ namespace Opm
{ {
// retrieve the cell specific PVT table index from the deck // retrieve the cell specific PVT table index from the deck
// and using the grid... // and using the grid...
extractPvtTableIndex(cellPvtRegionIdx_, deck, number_of_cells, global_cell); extractPvtTableIndex(cellPvtRegionIdx_, eclState, number_of_cells, global_cell);
if(init_rock){ if(init_rock){
rock_.init(eclState, number_of_cells, global_cell, cart_dims); rock_.init(eclState, number_of_cells, global_cell, cart_dims);

View File

@ -46,33 +46,20 @@ namespace Opm
} }
void extractPvtTableIndex(std::vector<int> &pvtTableIdx, void extractPvtTableIndex(std::vector<int> &pvtTableIdx,
Opm::DeckConstPtr deck, Opm::EclipseStateConstPtr eclState,
size_t numCompressed, size_t numCompressed,
const int *compressedToCartesianCellIdx) const int *compressedToCartesianCellIdx)
{ {
if (deck->hasKeyword("PVTNUM")) { //Get the PVTNUM data
// we have a "real" multi-pvt deck. const std::vector<int>& pvtnumData = eclState->getIntGridProperty("PVTNUM")->getData();
// Convert this into an array of compressed cells
// get the PVT number from the deck // Eclipse uses Fortran-style indices which start at 1
Opm::DeckKeywordConstPtr pvtnumKeyword = deck->getKeyword("PVTNUM"); // instead of 0, we subtract 1.
const std::vector<int> &pvtnumData = pvtnumKeyword->getIntData(); pvtTableIdx.resize(numCompressed);
for (size_t cellIdx = 0; cellIdx < numCompressed; ++ cellIdx) {
// convert this into an array of compressed cells. since size_t cartesianCellIdx = compressedToCartesianCellIdx ? compressedToCartesianCellIdx[cellIdx]:cellIdx;
// Eclipse uses Fortran-style indices which start at 1 assert(cartesianCellIdx < pvtnumData.size());
// instead of 0, we subtract 1. pvtTableIdx[cellIdx] = pvtnumData[cartesianCellIdx] - 1;
pvtTableIdx.resize(numCompressed);
for (size_t cellIdx = 0; cellIdx < numCompressed; ++ cellIdx) {
size_t cartesianCellIdx = compressedToCartesianCellIdx?compressedToCartesianCellIdx[cellIdx]:cellIdx;
assert(cartesianCellIdx < pvtnumData.size());
pvtTableIdx[cellIdx] = pvtnumData[cartesianCellIdx] - 1;
}
}
else {
// create the pvtIdxArray: all cells use the one and only
// PVT table...
pvtTableIdx.resize(numCompressed);
std::fill(pvtTableIdx.begin(), pvtTableIdx.end(), 0);
} }
} }

View File

@ -21,7 +21,7 @@
#define OPM_PVTINTERFACE_HEADER_INCLUDED #define OPM_PVTINTERFACE_HEADER_INCLUDED
#include <opm/core/props/BlackoilPhases.hpp> #include <opm/core/props/BlackoilPhases.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp> #include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
namespace Opm namespace Opm
@ -175,7 +175,7 @@ namespace Opm
* implementations usually use compressed cells. * implementations usually use compressed cells.
*/ */
void extractPvtTableIndex(std::vector<int>& pvtTableIdx, void extractPvtTableIndex(std::vector<int>& pvtTableIdx,
Opm::DeckConstPtr deck, Opm::EclipseStateConstPtr eclState,
size_t numCompressed, size_t numCompressed,
const int* compressedToCartesianIdx); const int* compressedToCartesianIdx);