From eb656c60ecebf150dff1a619c17eb9d04e5f566c Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Thu, 17 Apr 2014 11:50:23 +0200 Subject: [PATCH] add opm-parser variants for the incompressible property classes --- opm/core/props/IncompPropertiesFromDeck.cpp | 13 ++++- opm/core/props/IncompPropertiesFromDeck.hpp | 10 +++- .../props/pvt/PvtPropertiesIncompFromDeck.cpp | 55 +++++++++++++++++++ .../props/pvt/PvtPropertiesIncompFromDeck.hpp | 5 +- .../props/satfunc/SaturationPropsFromDeck.hpp | 28 ++++------ .../satfunc/SaturationPropsFromDeck_impl.hpp | 24 ++++---- 6 files changed, 104 insertions(+), 31 deletions(-) diff --git a/opm/core/props/IncompPropertiesFromDeck.cpp b/opm/core/props/IncompPropertiesFromDeck.cpp index 3296df647..04306b285 100644 --- a/opm/core/props/IncompPropertiesFromDeck.cpp +++ b/opm/core/props/IncompPropertiesFromDeck.cpp @@ -26,7 +26,6 @@ namespace Opm { - IncompPropertiesFromDeck::IncompPropertiesFromDeck(const EclipseGridParser& deck, const UnstructuredGrid& grid) { @@ -39,6 +38,18 @@ namespace Opm } } + IncompPropertiesFromDeck::IncompPropertiesFromDeck(Opm::DeckConstPtr newParserDeck, + const UnstructuredGrid& grid) + { + rock_.init(newParserDeck, grid.number_of_cells, grid.global_cell, grid.cartdims); + pvt_.init(newParserDeck); + satprops_.init(newParserDeck, grid, 200); + if (pvt_.numPhases() != satprops_.numPhases()) { + OPM_THROW(std::runtime_error, "IncompPropertiesFromDeck::IncompPropertiesFromDeck() - Inconsistent number of phases in pvt data (" + << pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_.numPhases() << ")."); + } + } + IncompPropertiesFromDeck::~IncompPropertiesFromDeck() { } diff --git a/opm/core/props/IncompPropertiesFromDeck.hpp b/opm/core/props/IncompPropertiesFromDeck.hpp index 0ca78b95a..83718aac9 100644 --- a/opm/core/props/IncompPropertiesFromDeck.hpp +++ b/opm/core/props/IncompPropertiesFromDeck.hpp @@ -20,11 +20,11 @@ #ifndef OPM_INCOMPPROPERTIESFROMDECK_HEADER_INCLUDED #define OPM_INCOMPPROPERTIESFROMDECK_HEADER_INCLUDED +#include #include #include #include #include -#include struct UnstructuredGrid; @@ -53,6 +53,14 @@ namespace Opm IncompPropertiesFromDeck(const EclipseGridParser& deck, const UnstructuredGrid& 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(Opm::DeckConstPtr newParserDeck, + const UnstructuredGrid& grid); + /// Destructor. virtual ~IncompPropertiesFromDeck(); diff --git a/opm/core/props/pvt/PvtPropertiesIncompFromDeck.cpp b/opm/core/props/pvt/PvtPropertiesIncompFromDeck.cpp index a1fa2aff2..330941266 100644 --- a/opm/core/props/pvt/PvtPropertiesIncompFromDeck.cpp +++ b/opm/core/props/pvt/PvtPropertiesIncompFromDeck.cpp @@ -88,6 +88,61 @@ namespace Opm } } + void PvtPropertiesIncompFromDeck::init(Opm::DeckConstPtr newParserDeck ) + { + // If we need multiple regions, this class and the SinglePvt* classes must change. + int region_number = 0; + + PhaseUsage phase_usage = phaseUsageFromDeck(newParserDeck); + if (phase_usage.phase_used[PhaseUsage::Vapour] || + !phase_usage.phase_used[PhaseUsage::Aqua] || + !phase_usage.phase_used[PhaseUsage::Liquid]) { + OPM_THROW(std::runtime_error, "PvtPropertiesIncompFromDeck::init() -- must have gas and oil phases (only) in deck input.\n"); + } + + // Surface densities. Accounting for different orders in eclipse and our code. + if (newParserDeck->hasKeyword("DENSITY")) { + Opm::DeckRecordConstPtr densityRecord = newParserDeck->getKeyword("DENSITY")->getRecord(region_number); + surface_density_[phase_usage.phase_pos[PhaseUsage::Aqua]] = densityRecord->getItem("OIL")->getSIDouble(0); + surface_density_[phase_usage.phase_pos[PhaseUsage::Liquid]] = densityRecord->getItem("WATER")->getSIDouble(0); + } else { + OPM_THROW(std::runtime_error, "Input is missing DENSITY\n"); + } + + // Make reservoir densities the same as surface densities initially. + // We will modify them with formation volume factors if found. + reservoir_density_ = surface_density_; + + // Water viscosity. + if (newParserDeck->hasKeyword("PVTW")) { + Opm::DeckRecordConstPtr pvtwRecord = newParserDeck->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"); + } + + // Oil viscosity. + if (newParserDeck->hasKeyword("PVCDO")) { + Opm::DeckRecordConstPtr pvcdoRecord = newParserDeck->getKeyword("PVCDO")->getRecord(region_number); + + if (pvcdoRecord->getItem("OIL_COMPRESSIBILITY")->getSIDouble(0) != 0.0 || + pvcdoRecord->getItem("OIL_VISCOSIBILITY")->getSIDouble(0) != 0.0) { + OPM_MESSAGE("Compressibility effects in PVCDO are ignored."); + } + reservoir_density_[phase_usage.phase_pos[PhaseUsage::Liquid]] /= pvcdoRecord->getItem("OIL_VOL_FACTOR")->getSIDouble(0); + viscosity_[phase_usage.phase_pos[PhaseUsage::Liquid]] = pvcdoRecord->getItem("OIL_VISCOSITY")->getSIDouble(0); + } else { + OPM_THROW(std::runtime_error, "Input is missing PVCDO\n"); + } + } + const double* PvtPropertiesIncompFromDeck::surfaceDensities() const { return surface_density_.data(); diff --git a/opm/core/props/pvt/PvtPropertiesIncompFromDeck.hpp b/opm/core/props/pvt/PvtPropertiesIncompFromDeck.hpp index 9bc75e8e5..4ffe9864a 100644 --- a/opm/core/props/pvt/PvtPropertiesIncompFromDeck.hpp +++ b/opm/core/props/pvt/PvtPropertiesIncompFromDeck.hpp @@ -20,8 +20,8 @@ #ifndef OPM_PVTPROPERTIESINCOMPFROMDECK_HEADER_INCLUDED #define OPM_PVTPROPERTIESINCOMPFROMDECK_HEADER_INCLUDED - #include +#include #include namespace Opm @@ -41,6 +41,9 @@ namespace Opm /// Initialize from deck. void init(const EclipseGridParser& deck); + /// Initialize from deck. + void init(Opm::DeckConstPtr newParserDeck); + /// Number of active phases. int numPhases() const; diff --git a/opm/core/props/satfunc/SaturationPropsFromDeck.hpp b/opm/core/props/satfunc/SaturationPropsFromDeck.hpp index bf52b3061..8f662b684 100644 --- a/opm/core/props/satfunc/SaturationPropsFromDeck.hpp +++ b/opm/core/props/satfunc/SaturationPropsFromDeck.hpp @@ -63,6 +63,18 @@ namespace Opm const UnstructuredGrid& grid, const int samples); + /// Initialize from deck and grid. + /// \param[in] deck Deck input parser + /// \param[in] 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. + /// \param[in] samples Number of uniform sample points for saturation tables. + /// NOTE: samples will only be used with the SatFuncSetUniform template argument. + void init(Opm::DeckConstPtr newParserDeck, + const UnstructuredGrid& grid, + const int samples); + + /// Initialize from deck and grid. /// \param[in] deck Deck input parser /// \param[in] number_of_cells The number of cells of the grid to which property @@ -84,23 +96,7 @@ namespace Opm const T& begin_cell_centroids, int dimensions, const int samples); - - /// Initialize from deck and grid. - /// \param[in] newParserDeck Deck input parser - /// \param[in] 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. - /// \param[in] samples Number of uniform sample points for saturation tables. - /// NOTE: samples will only be used with the SatFuncSetUniform template argument. - void init(Opm::DeckConstPtr newParserDeck, - const UnstructuredGrid& grid, - const int samples); - /// Initialize from deck and grid. - /// \param[in] newParserDeck Deck input parser - /// \param[in] number_of_cells The number of cells of the 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. /// \param[in] global_cell The mapping from local cell indices of the grid to diff --git a/opm/core/props/satfunc/SaturationPropsFromDeck_impl.hpp b/opm/core/props/satfunc/SaturationPropsFromDeck_impl.hpp index cf340e7ec..e9901ba91 100644 --- a/opm/core/props/satfunc/SaturationPropsFromDeck_impl.hpp +++ b/opm/core/props/satfunc/SaturationPropsFromDeck_impl.hpp @@ -57,6 +57,18 @@ namespace Opm grid.dimensions, samples); } + + /// Initialize from deck. + template + void SaturationPropsFromDeck::init(Opm::DeckConstPtr newParserDeck, + const UnstructuredGrid& grid, + const int samples) + { + init(newParserDeck, grid.number_of_cells, + grid.global_cell, grid.cell_centroids, + grid.dimensions, samples); + } + /// Initialize from deck. template template< class T> @@ -157,18 +169,6 @@ namespace Opm } } - - /// Initialize from deck. - template - void SaturationPropsFromDeck::init(Opm::DeckConstPtr newParserDeck, - const UnstructuredGrid& grid, - const int samples) - { - this->template init(newParserDeck, grid.number_of_cells, - grid.global_cell, grid.cell_centroids, - grid.dimensions, samples); - } - /// Initialize from deck. template template