From f8b1bef974e8c1cf56ab4668e49764203b6c1b5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Kvalsvik?= Date: Tue, 6 Dec 2016 13:43:35 +0100 Subject: [PATCH] Read PVTW from EclipseState Read the PVTW table entries from EclipseState rather than manually through the Deck object. --- opm/core/props/IncompPropertiesFromDeck.cpp | 2 +- .../props/pvt/PvtPropertiesIncompFromDeck.cpp | 26 +++++++------------ .../props/pvt/PvtPropertiesIncompFromDeck.hpp | 4 ++- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/opm/core/props/IncompPropertiesFromDeck.cpp b/opm/core/props/IncompPropertiesFromDeck.cpp index 98b33ebc3..167c6d12f 100644 --- a/opm/core/props/IncompPropertiesFromDeck.cpp +++ b/opm/core/props/IncompPropertiesFromDeck.cpp @@ -32,7 +32,7 @@ namespace Opm const UnstructuredGrid& grid) { rock_.init(eclState, grid.number_of_cells, grid.global_cell, grid.cartdims); - pvt_.init(deck); + pvt_.init(eclState, deck); auto materialLawManager = std::make_shared(); std::vector compressedToCartesianIdx(grid.number_of_cells); diff --git a/opm/core/props/pvt/PvtPropertiesIncompFromDeck.cpp b/opm/core/props/pvt/PvtPropertiesIncompFromDeck.cpp index dfb072c55..c713170c8 100644 --- a/opm/core/props/pvt/PvtPropertiesIncompFromDeck.cpp +++ b/opm/core/props/pvt/PvtPropertiesIncompFromDeck.cpp @@ -21,12 +21,10 @@ #include "config.h" #include #include +#include #include #include #include -#include -#include -#include namespace Opm @@ -36,7 +34,7 @@ namespace Opm { } - void PvtPropertiesIncompFromDeck::init(const Opm::Deck& deck) + void PvtPropertiesIncompFromDeck::init(const EclipseState& es, const Opm::Deck& deck) { // So far, this class only supports a single PVT region. TODO? int region_number = 0; @@ -61,21 +59,15 @@ namespace Opm // We will modify them with formation volume factors if found. reservoir_density_ = surface_density_; - // Water viscosity. - if (deck.hasKeyword("PVTW")) { - const auto& pvtwRecord = deck.getKeyword("PVTW").getRecord(region_number); - if (pvtwRecord.getItem("WATER_COMPRESSIBILITY").getSIDouble(0) != 0.0 || - pvtwRecord.getItem("WATER_VISCOSIBILITY").getSIDouble(0) != 0.0) { - OPM_MESSAGE("Compressibility effects in PVTW are ignored."); - } - reservoir_density_[phase_usage.phase_pos[PhaseUsage::Aqua]] /= pvtwRecord.getItem("WATER_VOL_FACTOR").getSIDouble(0); - viscosity_[phase_usage.phase_pos[PhaseUsage::Aqua]] = pvtwRecord.getItem("WATER_VISCOSITY").getSIDouble(0); - } else { - // Eclipse 100 default. - // viscosity_[phase_usage.phase_pos[PhaseUsage::Aqua]] = 0.5*Opm::prefix::centi*Opm::unit::Poise; - OPM_THROW(std::runtime_error, "Input is missing PVTW\n"); + const auto& pvtw = es.getTableManager().getPvtwTable().at( region_number ); + + if (pvtw.compressibility != 0.0 || pvtw.viscosibility != 0.0) { + OPM_MESSAGE("Compressibility effects in PVTW are ignored."); } + reservoir_density_[phase_usage.phase_pos[PhaseUsage::Aqua]] /= pvtw.volume_factor; + viscosity_[phase_usage.phase_pos[PhaseUsage::Aqua]] = pvtw.viscosity; + // Oil viscosity. if (deck.hasKeyword("PVCDO")) { const auto& pvcdoRecord = deck.getKeyword("PVCDO").getRecord(region_number); diff --git a/opm/core/props/pvt/PvtPropertiesIncompFromDeck.hpp b/opm/core/props/pvt/PvtPropertiesIncompFromDeck.hpp index b64c42c0b..17325f4f7 100644 --- a/opm/core/props/pvt/PvtPropertiesIncompFromDeck.hpp +++ b/opm/core/props/pvt/PvtPropertiesIncompFromDeck.hpp @@ -21,6 +21,8 @@ #define OPM_PVTPROPERTIESINCOMPFROMDECK_HEADER_INCLUDED #include +#include + #include namespace Opm @@ -38,7 +40,7 @@ namespace Opm PvtPropertiesIncompFromDeck(); /// Initialize from deck. - void init(const Opm::Deck& deck); + void init(const EclipseState&, const Opm::Deck& deck); /// Number of active phases. int numPhases() const;