Updated opm-core to use new EclipseState API in opm-parser

This commit is contained in:
Pål Grønås Drange 2016-04-08 16:30:01 +02:00
parent 730f1e88b7
commit 8a7bf1ef3c
9 changed files with 61 additions and 57 deletions

View File

@ -25,6 +25,7 @@
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/TableManager.hpp>
namespace Opm
@ -37,14 +38,15 @@ namespace Opm
PhaseUsage pu;
std::fill(pu.phase_used, pu.phase_used + BlackoilPhases::MaxNumPhases, 0);
const auto& tm = eclipseState->getTableManager();
// Discover phase usage.
if (eclipseState->hasPhase(Phase::PhaseEnum::WATER)) {
if (tm.hasPhase(Phase::PhaseEnum::WATER)) {
pu.phase_used[BlackoilPhases::Aqua] = 1;
}
if (eclipseState->hasPhase(Phase::PhaseEnum::OIL)) {
if (tm.hasPhase(Phase::PhaseEnum::OIL)) {
pu.phase_used[BlackoilPhases::Liquid] = 1;
}
if (eclipseState->hasPhase(Phase::PhaseEnum::GAS)) {
if (tm.hasPhase(Phase::PhaseEnum::GAS)) {
pu.phase_used[BlackoilPhases::Vapour] = 1;
}
pu.num_phases = 0;

View File

@ -45,8 +45,8 @@ namespace Opm
: pref_(0.0),
rock_comp_(0.0)
{
const auto tables = eclipseState->getTableManager();
const auto& rocktabTables = tables->getRocktabTables();
const auto& tables = eclipseState->getTableManager();
const auto& rocktabTables = tables.getRocktabTables();
if (rocktabTables.size() > 0) {
const auto& rocktabTable = rocktabTables.getTable<RocktabTable>(0);
if (rocktabTables.size() != 1)

View File

@ -183,16 +183,17 @@ namespace Opm
/// Invalid invalid set of components given.
PermeabilityKind classifyPermeability(Opm::EclipseStateConstPtr eclState)
{
const bool xx = eclState->hasDeckDoubleGridProperty("PERMX" );
const bool xy = eclState->hasDeckDoubleGridProperty("PERMXY");
auto& props = eclState->getEclipseProperties();
const bool xx = props.hasDeckDoubleGridProperty("PERMX" );
const bool xy = props.hasDeckDoubleGridProperty("PERMXY");
const bool yx = xy;
const bool yy = eclState->hasDeckDoubleGridProperty("PERMY" );
const bool yz = eclState->hasDeckDoubleGridProperty("PERMYZ");
const bool yy = props.hasDeckDoubleGridProperty("PERMY" );
const bool yz = props.hasDeckDoubleGridProperty("PERMYZ");
const bool zy = yz;
const bool zz = eclState->hasDeckDoubleGridProperty("PERMZ" );
const bool zx = eclState->hasDeckDoubleGridProperty("PERMZX");
const bool zz = props.hasDeckDoubleGridProperty("PERMZ" );
const bool zx = props.hasDeckDoubleGridProperty("PERMZX");
const bool xz = zx;
int num_cross_comp = xy + xz + yx + yz + zx + zy;
@ -309,7 +310,7 @@ namespace Opm
// -----------------------------------------------------------
// 1st row: [ kxx, kxy ], kxz handled in kzx
if (eclState->hasDeckDoubleGridProperty("PERMX" )) {
if (eclState->getEclipseProperties().hasDeckDoubleGridProperty("PERMX" )) {
kmap[xx] = tensor.size();
tensor.push_back(extractPermComponent(eclState, "PERMX", global_cell));
@ -322,7 +323,7 @@ namespace Opm
// -----------------------------------------------------------
// 2nd row: [ kyy, kyz ], kyx handled in kxy
if (eclState->hasDeckDoubleGridProperty("PERMY" )) {
if (eclState->getEclipseProperties().hasDeckDoubleGridProperty("PERMY" )) {
kmap[yy] = tensor.size();
tensor.push_back(extractPermComponent(eclState, "PERMY", global_cell));
@ -339,7 +340,7 @@ namespace Opm
kmap[zx] = kmap[xz] = tensor.size(); // Enforce symmetry.
tensor.push_back(extractPermComponent(eclState, "PERMZX", global_cell));
}
if (eclState->hasDeckDoubleGridProperty("PERMZ" )) {
if (eclState->getEclipseProperties().hasDeckDoubleGridProperty("PERMZ" )) {
kmap[zz] = tensor.size();
tensor.push_back(extractPermComponent(eclState, "PERMZ", global_cell));

View File

@ -107,14 +107,14 @@ namespace Opm{
void RelpermDiagnostics::satFamilyCheck_(Opm::EclipseStateConstPtr eclState)
{
const auto& tableManager = eclState->getTableManager();
const TableContainer& swofTables = tableManager->getSwofTables();
const TableContainer& slgofTables= tableManager->getSlgofTables();
const TableContainer& sgofTables = tableManager->getSgofTables();
const TableContainer& swfnTables = tableManager->getSwfnTables();
const TableContainer& sgfnTables = tableManager->getSgfnTables();
const TableContainer& sof3Tables = tableManager->getSof3Tables();
const TableContainer& sof2Tables = tableManager->getSof2Tables();
const TableContainer& sgwfnTables= tableManager->getSgwfnTables();
const TableContainer& swofTables = tableManager.getSwofTables();
const TableContainer& slgofTables= tableManager.getSlgofTables();
const TableContainer& sgofTables = tableManager.getSgofTables();
const TableContainer& swfnTables = tableManager.getSwfnTables();
const TableContainer& sgfnTables = tableManager.getSgfnTables();
const TableContainer& sof3Tables = tableManager.getSof3Tables();
const TableContainer& sof2Tables = tableManager.getSof2Tables();
const TableContainer& sgwfnTables= tableManager.getSgwfnTables();
bool family1 = (!sgofTables.empty() || !slgofTables.empty()) && !swofTables.empty();
@ -161,19 +161,19 @@ namespace Opm{
std::cout << msg << std::endl;
streamLog_->addMessage(Log::MessageType::Info, msg);
const auto& tableManager = eclState->getTableManager();
const TableContainer& swofTables = tableManager->getSwofTables();
const TableContainer& slgofTables= tableManager->getSlgofTables();
const TableContainer& sgofTables = tableManager->getSgofTables();
const TableContainer& swfnTables = tableManager->getSwfnTables();
const TableContainer& sgfnTables = tableManager->getSgfnTables();
const TableContainer& sof3Tables = tableManager->getSof3Tables();
const TableContainer& sof2Tables = tableManager->getSof2Tables();
const TableContainer& sgwfnTables= tableManager->getSgwfnTables();
const TableContainer& sgcwmisTables = tableManager->getSgcwmisTables();
const TableContainer& sorwmisTables = tableManager->getSorwmisTables();
const TableContainer& ssfnTables = tableManager->getSsfnTables();
const TableContainer& miscTables = tableManager->getMiscTables();
const TableContainer& msfnTables = tableManager->getMsfnTables();
const TableContainer& swofTables = tableManager.getSwofTables();
const TableContainer& slgofTables = tableManager.getSlgofTables();
const TableContainer& sgofTables = tableManager.getSgofTables();
const TableContainer& swfnTables = tableManager.getSwfnTables();
const TableContainer& sgfnTables = tableManager.getSgfnTables();
const TableContainer& sof3Tables = tableManager.getSof3Tables();
const TableContainer& sof2Tables = tableManager.getSof2Tables();
const TableContainer& sgwfnTables = tableManager.getSgwfnTables();
const TableContainer& sgcwmisTables = tableManager.getSgcwmisTables();
const TableContainer& sorwmisTables = tableManager.getSorwmisTables();
const TableContainer& ssfnTables = tableManager.getSsfnTables();
const TableContainer& miscTables = tableManager.getMiscTables();
const TableContainer& msfnTables = tableManager.getMsfnTables();
for (int satnumIdx = 0; satnumIdx < numSatRegions; ++satnumIdx) {
if (deck->hasKeyword("SWOF")) {
@ -724,11 +724,11 @@ namespace Opm{
const int numSatRegions = deck->getKeyword("TABDIMS").getRecord(0).getItem("NTSFUN").get< int >(0);
unscaledEpsInfo_.resize(numSatRegions);
const auto tables = eclState->getTableManager();
const TableContainer& swofTables = tables->getSwofTables();
const TableContainer& sgofTables = tables->getSgofTables();
const TableContainer& slgofTables = tables->getSlgofTables();
const TableContainer& sof3Tables = tables->getSof3Tables();
const auto& tables = eclState->getTableManager();
const TableContainer& swofTables = tables.getSwofTables();
const TableContainer& sgofTables = tables.getSgofTables();
const TableContainer& slgofTables = tables.getSlgofTables();
const TableContainer& sof3Tables = tables.getSof3Tables();
// std::cout << "***************\nEnd-Points In all the Tables\n";
for (int satnumIdx = 0; satnumIdx < numSatRegions; ++satnumIdx) {

View File

@ -83,11 +83,11 @@ namespace Opm {
scaledEpsInfo_.resize(nc);
EclEpsGridProperties epsGridProperties;
epsGridProperties.initFromDeck(deck, eclState, /*imbibition=*/false);
const auto satnum = eclState->getIntGridProperty("SATNUM");
const auto& satnum = eclState->getEclipseProperties().getIntGridProperty("SATNUM");
for (int c = 0; c < nc; ++c) {
const int cartIdx = compressedToCartesianIdx[c];
const std::string satnumIdx = std::to_string(satnum->iget(cartIdx));
const std::string satnumIdx = std::to_string(satnum.iget(cartIdx));
std::array<int, 3> ijk;
ijk[0] = cartIdx % dims[0];
ijk[1] = (cartIdx / dims[0]) % dims[1];

View File

@ -221,7 +221,7 @@ namespace Opm
const int nc = UgGridHelpers::numCells(G);
eqlnum.resize(nc);
const std::vector<int>& e =
eclipseState->getIntGridProperty("EQLNUM")->getData();
eclipseState->getEclipseProperties().getIntGridProperty("EQLNUM").getData();
const int* gc = UgGridHelpers::globalCell(G);
for (int cell = 0; cell < nc; ++cell) {
const int deck_pos = (gc == NULL) ? cell : gc[cell];
@ -255,14 +255,14 @@ namespace Opm
{
// Get the equilibration records.
const std::vector<EquilRecord> rec = getEquil(*eclipseState);
std::shared_ptr<const TableManager> tables = eclipseState->getTableManager();
const auto& tables = eclipseState->getTableManager();
// Create (inverse) region mapping.
const RegionMapping<> eqlmap(equilnum(deck, eclipseState, G));
// Create Rs functions.
rs_func_.reserve(rec.size());
if (deck->hasKeyword("DISGAS")) {
const TableContainer& rsvdTables = tables->getRsvdTables();
const TableContainer& rsvdTables = tables.getRsvdTables();
for (size_t i = 0; i < rec.size(); ++i) {
const int cell = *(eqlmap.cells(i).begin());
if (!rec[i].liveOilInitConstantRs()) {
@ -295,7 +295,7 @@ namespace Opm
rv_func_.reserve(rec.size());
if (deck->hasKeyword("VAPOIL")) {
const TableContainer& rvvdTables = tables->getRvvdTables();
const TableContainer& rvvdTables = tables.getRvvdTables();
for (size_t i = 0; i < rec.size(); ++i) {
const int cell = *(eqlmap.cells(i).begin());
if (!rec[i].wetGasInitConstantRv()) {
@ -332,7 +332,8 @@ namespace Opm
// Check for presence of kw SWATINIT
if (deck->hasKeyword("SWATINIT")) {
const std::vector<double>& swat_init = eclipseState->getDoubleGridProperty("SWATINIT")->getData();
const std::vector<double>& swat_init = eclipseState->
getEclipseProperties().getDoubleGridProperty("SWATINIT").getData();
const int nc = UgGridHelpers::numCells(G);
swat_init_.resize(nc);
const int* gc = UgGridHelpers::globalCell(G);

View File

@ -110,7 +110,7 @@ namespace Opm {
HasProperty<int>::p(PropertyContainer& ecl,
const std::string& kw)
{
return ecl->hasDeckIntGridProperty(kw);
return ecl->getEclipseProperties().hasDeckIntGridProperty(kw);
}
/**
@ -145,7 +145,7 @@ namespace Opm {
HasProperty<double>::p(PropertyContainer& ecl,
const std::string& kw)
{
return ecl->hasDeckDoubleGridProperty(kw);
return ecl->getEclipseProperties().hasDeckDoubleGridProperty(kw);
}
/**

View File

@ -32,7 +32,7 @@ void extractPvtTableIndex(std::vector<int> &pvtTableIdx,
const int *compressedToCartesianCellIdx)
{
//Get the PVTNUM data
const std::vector<int>& pvtnumData = eclState->getIntGridProperty("PVTNUM")->getData();
const std::vector<int>& pvtnumData = eclState->getEclipseProperties().getIntGridProperty("PVTNUM").getData();
// Convert this into an array of compressed cells
// Eclipse uses Fortran-style indices which start at 1
// instead of 0, we subtract 1.

View File

@ -55,8 +55,8 @@ void computeMaxDp(std::map<std::pair<int, int>, double>& maxDp,
const PhaseUsage& pu = props.phaseUsage();
std::shared_ptr<const GridProperty<int>> eqlnum = eclipseState->getIntGridProperty("EQLNUM");
const auto& eqlnumData = eqlnum->getData();
const auto& eqlnum = eclipseState->getEclipseProperties().getIntGridProperty("EQLNUM");
const auto& eqlnumData = eqlnum.getData();
const int numPhases = initialState.numPhases();
const int numCells = UgGridHelpers::numCells(grid);
@ -100,7 +100,7 @@ void computeMaxDp(std::map<std::pair<int, int>, double>& maxDp,
// Fortran indices.
const int* gc = UgGridHelpers::globalCell(grid);
std::vector<int> pvtRegion(numCells);
const auto& cartPvtRegion = eclipseState->getIntGridProperty("PVTNUM")->getData();
const auto& cartPvtRegion = eclipseState->getEclipseProperties().getIntGridProperty("PVTNUM").getData();
for (int cellIdx = 0; cellIdx < numCells; ++cellIdx) {
const int cartCellIdx = gc ? gc[cellIdx] : cellIdx;
pvtRegion[cellIdx] = std::max(0, cartPvtRegion[cartCellIdx] - 1);
@ -323,8 +323,8 @@ void computeMaxDp(std::map<std::pair<int, int>, double>& maxDp,
std::vector<double> thpres_vals;
if (simulationConfig->hasThresholdPressure()) {
std::shared_ptr<const ThresholdPressure> thresholdPressure = simulationConfig->getThresholdPressure();
std::shared_ptr<const GridProperty<int>> eqlnum = eclipseState->getIntGridProperty("EQLNUM");
const auto& eqlnumData = eqlnum->getData();
const auto& eqlnum = eclipseState->getEclipseProperties().getIntGridProperty("EQLNUM");
const auto& eqlnumData = eqlnum.getData();
// Set threshold pressure values for each cell face.
const int num_faces = UgGridHelpers::numFaces(grid);
@ -381,8 +381,8 @@ void computeMaxDp(std::map<std::pair<int, int>, double>& maxDp,
std::vector<double> thpres_vals;
if (simulationConfig->hasThresholdPressure()) {
std::shared_ptr<const ThresholdPressure> thresholdPressure = simulationConfig->getThresholdPressure();
std::shared_ptr<const GridProperty<int>> eqlnum = eclipseState->getIntGridProperty("EQLNUM");
auto eqlnumData = eqlnum->getData();
const auto& eqlnum = eclipseState->getEclipseProperties().getIntGridProperty("EQLNUM");
const auto& eqlnumData = eqlnum.getData();
// Set values for each NNC