diff --git a/opm/core/props/pvt/PvtDead.cpp b/opm/core/props/pvt/PvtDead.cpp index a619309c..e2e42c2a 100644 --- a/opm/core/props/pvt/PvtDead.cpp +++ b/opm/core/props/pvt/PvtDead.cpp @@ -34,7 +34,7 @@ namespace Opm // Member functions //------------------------------------------------------------------------- /// Constructor - void PvtDead::initFromOil(const std::vector& pvdoTables) + void PvtDead::initFromOil(const TableContainer& pvdoTables) { int numRegions = pvdoTables.size(); @@ -44,7 +44,7 @@ namespace Opm inverseBmu_.resize(numRegions); for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) { - const Opm::PvdoTable& pvdoTable = pvdoTables[regionIdx]; + const Opm::PvdoTable& pvdoTable = pvdoTables.getTable(regionIdx); // Copy data const std::vector& press = pvdoTable.getPressureColumn(); @@ -69,7 +69,7 @@ namespace Opm } - void PvtDead::initFromGas(const std::vector& pvdgTables) + void PvtDead::initFromGas(const TableContainer& pvdgTables) { int numRegions = pvdgTables.size(); @@ -79,7 +79,7 @@ namespace Opm inverseBmu_.resize(numRegions); for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) { - const Opm::PvdgTable& pvdgTable = pvdgTables[regionIdx]; + const Opm::PvdgTable& pvdgTable = pvdgTables.getTable(regionIdx); // Copy data const std::vector& press = pvdgTable.getPressureColumn(); diff --git a/opm/core/props/pvt/PvtDead.hpp b/opm/core/props/pvt/PvtDead.hpp index b6f04c2c..b238909a 100644 --- a/opm/core/props/pvt/PvtDead.hpp +++ b/opm/core/props/pvt/PvtDead.hpp @@ -24,6 +24,7 @@ #include #include +#include #include @@ -46,8 +47,8 @@ namespace Opm public: PvtDead() {}; - void initFromOil(const std::vector& pvdoTables); - void initFromGas(const std::vector& pvdgTables); + void initFromOil(const TableContainer& pvdoTables); + void initFromGas(const TableContainer& pvdgTables); virtual ~PvtDead(); /// Viscosity as a function of p, T and z. diff --git a/opm/core/props/pvt/PvtDeadSpline.cpp b/opm/core/props/pvt/PvtDeadSpline.cpp index f49fb7b3..65cb3638 100644 --- a/opm/core/props/pvt/PvtDeadSpline.cpp +++ b/opm/core/props/pvt/PvtDeadSpline.cpp @@ -38,7 +38,7 @@ namespace Opm PvtDeadSpline::PvtDeadSpline() {} - void PvtDeadSpline::initFromOil(const std::vector& pvdoTables, + void PvtDeadSpline::initFromOil(const TableContainer& pvdoTables, int numSamples) { int numRegions = pvdoTables.size(); @@ -48,7 +48,7 @@ namespace Opm viscosity_.resize(numRegions); for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) { - const Opm::PvdoTable& pvdoTable = pvdoTables[regionIdx]; + const Opm::PvdoTable& pvdoTable = pvdoTables.getTable(regionIdx); int numRows = pvdoTable.numRows(); @@ -67,7 +67,7 @@ namespace Opm } } - void PvtDeadSpline::initFromGas(const std::vector& pvdgTables, + void PvtDeadSpline::initFromGas(const TableContainer& pvdgTables, int numSamples) { int numRegions = pvdgTables.size(); @@ -77,7 +77,7 @@ namespace Opm viscosity_.resize(numRegions); for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) { - const Opm::PvdgTable& pvdgTable = pvdgTables[regionIdx]; + const Opm::PvdgTable& pvdgTable = pvdgTables.getTable(regionIdx); int numRows = pvdgTable.numRows(); diff --git a/opm/core/props/pvt/PvtDeadSpline.hpp b/opm/core/props/pvt/PvtDeadSpline.hpp index 3f60f9f3..9c087127 100644 --- a/opm/core/props/pvt/PvtDeadSpline.hpp +++ b/opm/core/props/pvt/PvtDeadSpline.hpp @@ -24,6 +24,7 @@ #include #include +#include #include @@ -42,9 +43,9 @@ namespace Opm public: PvtDeadSpline(); - void initFromOil(const std::vector& pvdoTables, + void initFromOil(const TableContainer& pvdoTables, int numSamples); - void initFromGas(const std::vector& pvdgTables, + void initFromGas(const TableContainer& pvdgTables, int numSamples); virtual ~PvtDeadSpline(); diff --git a/opm/core/props/pvt/ThermalGasPvtWrapper.hpp b/opm/core/props/pvt/ThermalGasPvtWrapper.hpp index b1806e67..6c5e0285 100644 --- a/opm/core/props/pvt/ThermalGasPvtWrapper.hpp +++ b/opm/core/props/pvt/ThermalGasPvtWrapper.hpp @@ -102,8 +102,14 @@ namespace Opm // pressure dependence of gas. (This does not make much sense, but it // seems to be what the documentation for the GASVISCT keyword in the // RM says.) + + int regionIdx = getPvtRegionIndex_(pvtRegionIdx, i); - double muGasvisct = (*gasvisctTables_)[regionIdx].evaluate(gasvisctColumnName_, T[i]); + double muGasvisct; + { + const GasvisctTable& gasvisctTable = gasvisctTables_->getTable(regionIdx); + muGasvisct = gasvisctTable.evaluate(gasvisctColumnName_, T[i]); + } output_mu[i] = muGasvisct; output_dmudp[i] = 0.0; @@ -136,7 +142,11 @@ namespace Opm // seems to be what the documentation for the GASVISCT keyword in the // RM says.) int regionIdx = getPvtRegionIndex_(pvtRegionIdx, i); - double muGasvisct = (*gasvisctTables_)[regionIdx].evaluate(gasvisctColumnName_, T[i]); + double muGasvisct; + { + const GasvisctTable& gasvisctTable = gasvisctTables_->getTable(regionIdx); + muGasvisct = gasvisctTable.evaluate(gasvisctColumnName_, T[i]); + } output_mu[i] = muGasvisct; output_dmudp[i] = 0.0; @@ -297,7 +307,7 @@ namespace Opm // The PVT properties needed for temperature dependence of the viscosity. We need // to store one value per PVT region. - const std::vector* gasvisctTables_; + const TableContainer* gasvisctTables_; std::string gasvisctColumnName_; int gasCompIdx_; diff --git a/opm/core/props/pvt/ThermalOilPvtWrapper.hpp b/opm/core/props/pvt/ThermalOilPvtWrapper.hpp index 4225bbd4..31d8fe21 100644 --- a/opm/core/props/pvt/ThermalOilPvtWrapper.hpp +++ b/opm/core/props/pvt/ThermalOilPvtWrapper.hpp @@ -147,8 +147,12 @@ namespace Opm double muRef = muRef_[regionIdx]; // compute the viscosity deviation due to temperature - double muOilvisct = (*oilvisctTables_)[regionIdx].evaluate("Viscosity", T[i]); - double alpha = muOilvisct/muRef; + double alpha; + { + const OilvisctTable& oilvisctTable = oilvisctTables_->getTable(regionIdx); + double muOilvisct = oilvisctTable.evaluate("Viscosity", T[i]); + alpha = muOilvisct/muRef; + } output_mu[i] *= alpha; output_dmudp[i] *= alpha; @@ -183,9 +187,12 @@ namespace Opm double muRef = muRef_[regionIdx]; // compute the viscosity deviation due to temperature - double muOilvisct = (*oilvisctTables_)[regionIdx].evaluate("Viscosity", T[i]); - double alpha = muOilvisct/muRef; - + double alpha; + { + const OilvisctTable& oilvisctTable = oilvisctTables_->getTable(regionIdx); + double muOilvisct = oilvisctTable.evaluate("Viscosity", T[i]); + alpha = muOilvisct/muRef; + } output_mu[i] *= alpha; output_dmudp[i] *= alpha; output_dmudr[i] *= alpha; @@ -367,7 +374,7 @@ namespace Opm std::vector viscrefRs_; std::vector muRef_; - const std::vector* oilvisctTables_; + const TableContainer* oilvisctTables_; // The PVT properties needed for temperature dependence of the density. This is // specified as one value per EOS in the manual, but we unconditionally use the diff --git a/opm/core/props/pvt/ThermalWaterPvtWrapper.hpp b/opm/core/props/pvt/ThermalWaterPvtWrapper.hpp index fbc2661f..9d9738b0 100644 --- a/opm/core/props/pvt/ThermalWaterPvtWrapper.hpp +++ b/opm/core/props/pvt/ThermalWaterPvtWrapper.hpp @@ -142,8 +142,12 @@ namespace Opm double muRef = pvtwViscosity_[tableIdx]/(1.0 + x + 0.5*x*x); // compute the viscosity deviation due to temperature - double muWatvisct = (*watvisctTables_)[tableIdx].evaluate("Viscosity", T[i]); - double alpha = muWatvisct/muRef; + double alpha; + { + const WatvisctTable& watVisctTable = watvisctTables_->getTable(tableIdx); + double muWatvisct = watVisctTable.evaluate("Viscosity", T[i]); + alpha = muWatvisct/muRef; + } output_mu[i] *= alpha; output_dmudp[i] *= alpha; @@ -179,9 +183,12 @@ namespace Opm double muRef = pvtwViscosity_[tableIdx]/(1.0 + x + 0.5*x*x); // compute the viscosity deviation due to temperature - double muWatvisct = (*watvisctTables_)[tableIdx].evaluate("Viscosity", T[i]); - double alpha = muWatvisct/muRef; - + double alpha; + { + const WatvisctTable& watVisctTable = watvisctTables_->getTable(tableIdx); + double muWatvisct = watVisctTable.evaluate("Viscosity", T[i]); + alpha = muWatvisct/muRef; + } output_mu[i] *= alpha; output_dmudp[i] *= alpha; output_dmudr[i] *= alpha; @@ -382,7 +389,7 @@ namespace Opm std::vector pvtwViscosity_; std::vector pvtwViscosibility_; - const std::vector* watvisctTables_; + const TableContainer* watvisctTables_; }; } diff --git a/opm/core/props/rock/RockCompressibility.cpp b/opm/core/props/rock/RockCompressibility.cpp index e8d932cc..9e8d3eb0 100644 --- a/opm/core/props/rock/RockCompressibility.cpp +++ b/opm/core/props/rock/RockCompressibility.cpp @@ -46,12 +46,13 @@ namespace Opm const auto tables = eclipseState->getTableManager(); const auto& rocktabTables = tables->getRocktabTables(); if (rocktabTables.size() > 0) { + const auto& rocktabTable = rocktabTables.getTable(0); if (rocktabTables.size() != 1) OPM_THROW(std::runtime_error, "Can only handle a single region in ROCKTAB."); - p_ = rocktabTables[0].getPressureColumn(); - poromult_ = rocktabTables[0].getPoreVolumeMultiplierColumn(); - transmult_ = rocktabTables[0].getTransmissibilityMultiplierColumn(); + p_ = rocktabTable.getPressureColumn(); + poromult_ = rocktabTable.getPoreVolumeMultiplierColumn(); + transmult_ = rocktabTable.getTransmissibilityMultiplierColumn(); } else if (deck->hasKeyword("ROCK")) { Opm::DeckKeywordConstPtr rockKeyword = deck->getKeyword("ROCK"); if (rockKeyword->size() != 1) { diff --git a/opm/core/simulator/initStateEquil.hpp b/opm/core/simulator/initStateEquil.hpp index dc007100..70728740 100644 --- a/opm/core/simulator/initStateEquil.hpp +++ b/opm/core/simulator/initStateEquil.hpp @@ -288,15 +288,17 @@ namespace Opm // Create Rs functions. rs_func_.reserve(rec.size()); if (deck->hasKeyword("DISGAS")) { - const std::vector& rsvdTables = tables->getRsvdTables(); + const TableContainer& rsvdTables = tables->getRsvdTables(); for (size_t i = 0; i < rec.size(); ++i) { + const RsvdTable& rsvdTable = rsvdTables.getTable(i); const int cell = *(eqlmap.cells(i).begin()); if (rec[i].live_oil_table_index > 0) { if (rsvdTables.size() > 0 && size_t(rec[i].live_oil_table_index) <= rsvdTables.size()) { + rs_func_.push_back(std::make_shared(props, cell, - rsvdTables[i].getDepthColumn(), - rsvdTables[i].getRsColumn())); + rsvdTable.getDepthColumn(), + rsvdTable.getRsColumn())); } else { OPM_THROW(std::runtime_error, "Cannot initialise: RSVD table " << (rec[i].live_oil_table_index) << " not available."); } @@ -320,15 +322,16 @@ namespace Opm rv_func_.reserve(rec.size()); if (deck->hasKeyword("VAPOIL")) { - const std::vector& 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].wet_gas_table_index > 0) { if (rvvdTables.size() > 0 && size_t(rec[i].wet_gas_table_index) <= rvvdTables.size()) { + const RvvdTable& rvvdTable = rvvdTables.getTable(i); rv_func_.push_back(std::make_shared(props, cell, - rvvdTables[i].getDepthColumn(), - rvvdTables[i].getRvColumn())); + rvvdTable.getDepthColumn(), + rvvdTable.getRvColumn())); } else { OPM_THROW(std::runtime_error, "Cannot initialise: RVVD table " << (rec[i].wet_gas_table_index) << " not available."); }