Merge pull request #886 from joakim-hove/table-container
Changed Table code to use TableContainer
This commit is contained in:
commit
61d5e291d6
@ -34,7 +34,7 @@ namespace Opm
|
|||||||
// Member functions
|
// Member functions
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
/// Constructor
|
/// Constructor
|
||||||
void PvtDead::initFromOil(const std::vector<Opm::PvdoTable>& pvdoTables)
|
void PvtDead::initFromOil(const TableContainer& pvdoTables)
|
||||||
{
|
{
|
||||||
int numRegions = pvdoTables.size();
|
int numRegions = pvdoTables.size();
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ namespace Opm
|
|||||||
inverseBmu_.resize(numRegions);
|
inverseBmu_.resize(numRegions);
|
||||||
|
|
||||||
for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) {
|
for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) {
|
||||||
const Opm::PvdoTable& pvdoTable = pvdoTables[regionIdx];
|
const Opm::PvdoTable& pvdoTable = pvdoTables.getTable<PvdoTable>(regionIdx);
|
||||||
|
|
||||||
// Copy data
|
// Copy data
|
||||||
const std::vector<double>& press = pvdoTable.getPressureColumn();
|
const std::vector<double>& press = pvdoTable.getPressureColumn();
|
||||||
@ -69,7 +69,7 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PvtDead::initFromGas(const std::vector<Opm::PvdgTable>& pvdgTables)
|
void PvtDead::initFromGas(const TableContainer& pvdgTables)
|
||||||
{
|
{
|
||||||
int numRegions = pvdgTables.size();
|
int numRegions = pvdgTables.size();
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ namespace Opm
|
|||||||
inverseBmu_.resize(numRegions);
|
inverseBmu_.resize(numRegions);
|
||||||
|
|
||||||
for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) {
|
for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) {
|
||||||
const Opm::PvdgTable& pvdgTable = pvdgTables[regionIdx];
|
const Opm::PvdgTable& pvdgTable = pvdgTables.getTable<PvdgTable>(regionIdx);
|
||||||
|
|
||||||
// Copy data
|
// Copy data
|
||||||
const std::vector<double>& press = pvdgTable.getPressureColumn();
|
const std::vector<double>& press = pvdgTable.getPressureColumn();
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include <opm/core/utility/NonuniformTableLinear.hpp>
|
#include <opm/core/utility/NonuniformTableLinear.hpp>
|
||||||
|
|
||||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||||
|
#include <opm/parser/eclipse/EclipseState/Tables/TableContainer.hpp>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -46,8 +47,8 @@ namespace Opm
|
|||||||
public:
|
public:
|
||||||
PvtDead() {};
|
PvtDead() {};
|
||||||
|
|
||||||
void initFromOil(const std::vector<Opm::PvdoTable>& pvdoTables);
|
void initFromOil(const TableContainer& pvdoTables);
|
||||||
void initFromGas(const std::vector<Opm::PvdgTable>& pvdgTables);
|
void initFromGas(const TableContainer& pvdgTables);
|
||||||
virtual ~PvtDead();
|
virtual ~PvtDead();
|
||||||
|
|
||||||
/// Viscosity as a function of p, T and z.
|
/// Viscosity as a function of p, T and z.
|
||||||
|
@ -38,7 +38,7 @@ namespace Opm
|
|||||||
PvtDeadSpline::PvtDeadSpline()
|
PvtDeadSpline::PvtDeadSpline()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void PvtDeadSpline::initFromOil(const std::vector<Opm::PvdoTable>& pvdoTables,
|
void PvtDeadSpline::initFromOil(const TableContainer& pvdoTables,
|
||||||
int numSamples)
|
int numSamples)
|
||||||
{
|
{
|
||||||
int numRegions = pvdoTables.size();
|
int numRegions = pvdoTables.size();
|
||||||
@ -48,7 +48,7 @@ namespace Opm
|
|||||||
viscosity_.resize(numRegions);
|
viscosity_.resize(numRegions);
|
||||||
|
|
||||||
for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) {
|
for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) {
|
||||||
const Opm::PvdoTable& pvdoTable = pvdoTables[regionIdx];
|
const Opm::PvdoTable& pvdoTable = pvdoTables.getTable<PvdoTable>(regionIdx);
|
||||||
|
|
||||||
int numRows = pvdoTable.numRows();
|
int numRows = pvdoTable.numRows();
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PvtDeadSpline::initFromGas(const std::vector<Opm::PvdgTable>& pvdgTables,
|
void PvtDeadSpline::initFromGas(const TableContainer& pvdgTables,
|
||||||
int numSamples)
|
int numSamples)
|
||||||
{
|
{
|
||||||
int numRegions = pvdgTables.size();
|
int numRegions = pvdgTables.size();
|
||||||
@ -77,7 +77,7 @@ namespace Opm
|
|||||||
viscosity_.resize(numRegions);
|
viscosity_.resize(numRegions);
|
||||||
|
|
||||||
for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) {
|
for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) {
|
||||||
const Opm::PvdgTable& pvdgTable = pvdgTables[regionIdx];
|
const Opm::PvdgTable& pvdgTable = pvdgTables.getTable<PvdgTable>(regionIdx);
|
||||||
|
|
||||||
int numRows = pvdgTable.numRows();
|
int numRows = pvdgTable.numRows();
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include <opm/core/utility/UniformTableLinear.hpp>
|
#include <opm/core/utility/UniformTableLinear.hpp>
|
||||||
|
|
||||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||||
|
#include <opm/parser/eclipse/EclipseState/Tables/TableContainer.hpp>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -42,9 +43,9 @@ namespace Opm
|
|||||||
public:
|
public:
|
||||||
PvtDeadSpline();
|
PvtDeadSpline();
|
||||||
|
|
||||||
void initFromOil(const std::vector<Opm::PvdoTable>& pvdoTables,
|
void initFromOil(const TableContainer& pvdoTables,
|
||||||
int numSamples);
|
int numSamples);
|
||||||
void initFromGas(const std::vector<Opm::PvdgTable>& pvdgTables,
|
void initFromGas(const TableContainer& pvdgTables,
|
||||||
int numSamples);
|
int numSamples);
|
||||||
|
|
||||||
virtual ~PvtDeadSpline();
|
virtual ~PvtDeadSpline();
|
||||||
|
@ -102,8 +102,14 @@ namespace Opm
|
|||||||
// pressure dependence of gas. (This does not make much sense, but it
|
// pressure dependence of gas. (This does not make much sense, but it
|
||||||
// seems to be what the documentation for the GASVISCT keyword in the
|
// seems to be what the documentation for the GASVISCT keyword in the
|
||||||
// RM says.)
|
// RM says.)
|
||||||
|
|
||||||
|
|
||||||
int regionIdx = getPvtRegionIndex_(pvtRegionIdx, i);
|
int regionIdx = getPvtRegionIndex_(pvtRegionIdx, i);
|
||||||
double muGasvisct = (*gasvisctTables_)[regionIdx].evaluate(gasvisctColumnName_, T[i]);
|
double muGasvisct;
|
||||||
|
{
|
||||||
|
const GasvisctTable& gasvisctTable = gasvisctTables_->getTable<GasvisctTable>(regionIdx);
|
||||||
|
muGasvisct = gasvisctTable.evaluate(gasvisctColumnName_, T[i]);
|
||||||
|
}
|
||||||
|
|
||||||
output_mu[i] = muGasvisct;
|
output_mu[i] = muGasvisct;
|
||||||
output_dmudp[i] = 0.0;
|
output_dmudp[i] = 0.0;
|
||||||
@ -136,7 +142,11 @@ namespace Opm
|
|||||||
// seems to be what the documentation for the GASVISCT keyword in the
|
// seems to be what the documentation for the GASVISCT keyword in the
|
||||||
// RM says.)
|
// RM says.)
|
||||||
int regionIdx = getPvtRegionIndex_(pvtRegionIdx, i);
|
int regionIdx = getPvtRegionIndex_(pvtRegionIdx, i);
|
||||||
double muGasvisct = (*gasvisctTables_)[regionIdx].evaluate(gasvisctColumnName_, T[i]);
|
double muGasvisct;
|
||||||
|
{
|
||||||
|
const GasvisctTable& gasvisctTable = gasvisctTables_->getTable<GasvisctTable>(regionIdx);
|
||||||
|
muGasvisct = gasvisctTable.evaluate(gasvisctColumnName_, T[i]);
|
||||||
|
}
|
||||||
|
|
||||||
output_mu[i] = muGasvisct;
|
output_mu[i] = muGasvisct;
|
||||||
output_dmudp[i] = 0.0;
|
output_dmudp[i] = 0.0;
|
||||||
@ -297,7 +307,7 @@ namespace Opm
|
|||||||
|
|
||||||
// The PVT properties needed for temperature dependence of the viscosity. We need
|
// The PVT properties needed for temperature dependence of the viscosity. We need
|
||||||
// to store one value per PVT region.
|
// to store one value per PVT region.
|
||||||
const std::vector<Opm::GasvisctTable>* gasvisctTables_;
|
const TableContainer* gasvisctTables_;
|
||||||
std::string gasvisctColumnName_;
|
std::string gasvisctColumnName_;
|
||||||
int gasCompIdx_;
|
int gasCompIdx_;
|
||||||
|
|
||||||
|
@ -147,8 +147,12 @@ namespace Opm
|
|||||||
double muRef = muRef_[regionIdx];
|
double muRef = muRef_[regionIdx];
|
||||||
|
|
||||||
// compute the viscosity deviation due to temperature
|
// compute the viscosity deviation due to temperature
|
||||||
double muOilvisct = (*oilvisctTables_)[regionIdx].evaluate("Viscosity", T[i]);
|
double alpha;
|
||||||
double alpha = muOilvisct/muRef;
|
{
|
||||||
|
const OilvisctTable& oilvisctTable = oilvisctTables_->getTable<OilvisctTable>(regionIdx);
|
||||||
|
double muOilvisct = oilvisctTable.evaluate("Viscosity", T[i]);
|
||||||
|
alpha = muOilvisct/muRef;
|
||||||
|
}
|
||||||
|
|
||||||
output_mu[i] *= alpha;
|
output_mu[i] *= alpha;
|
||||||
output_dmudp[i] *= alpha;
|
output_dmudp[i] *= alpha;
|
||||||
@ -183,9 +187,12 @@ namespace Opm
|
|||||||
double muRef = muRef_[regionIdx];
|
double muRef = muRef_[regionIdx];
|
||||||
|
|
||||||
// compute the viscosity deviation due to temperature
|
// compute the viscosity deviation due to temperature
|
||||||
double muOilvisct = (*oilvisctTables_)[regionIdx].evaluate("Viscosity", T[i]);
|
double alpha;
|
||||||
double alpha = muOilvisct/muRef;
|
{
|
||||||
|
const OilvisctTable& oilvisctTable = oilvisctTables_->getTable<OilvisctTable>(regionIdx);
|
||||||
|
double muOilvisct = oilvisctTable.evaluate("Viscosity", T[i]);
|
||||||
|
alpha = muOilvisct/muRef;
|
||||||
|
}
|
||||||
output_mu[i] *= alpha;
|
output_mu[i] *= alpha;
|
||||||
output_dmudp[i] *= alpha;
|
output_dmudp[i] *= alpha;
|
||||||
output_dmudr[i] *= alpha;
|
output_dmudr[i] *= alpha;
|
||||||
@ -367,7 +374,7 @@ namespace Opm
|
|||||||
std::vector<double> viscrefRs_;
|
std::vector<double> viscrefRs_;
|
||||||
std::vector<double> muRef_;
|
std::vector<double> muRef_;
|
||||||
|
|
||||||
const std::vector<Opm::OilvisctTable>* oilvisctTables_;
|
const TableContainer* oilvisctTables_;
|
||||||
|
|
||||||
// The PVT properties needed for temperature dependence of the density. This is
|
// 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
|
// specified as one value per EOS in the manual, but we unconditionally use the
|
||||||
|
@ -142,8 +142,12 @@ namespace Opm
|
|||||||
double muRef = pvtwViscosity_[tableIdx]/(1.0 + x + 0.5*x*x);
|
double muRef = pvtwViscosity_[tableIdx]/(1.0 + x + 0.5*x*x);
|
||||||
|
|
||||||
// compute the viscosity deviation due to temperature
|
// compute the viscosity deviation due to temperature
|
||||||
double muWatvisct = (*watvisctTables_)[tableIdx].evaluate("Viscosity", T[i]);
|
double alpha;
|
||||||
double alpha = muWatvisct/muRef;
|
{
|
||||||
|
const WatvisctTable& watVisctTable = watvisctTables_->getTable<WatvisctTable>(tableIdx);
|
||||||
|
double muWatvisct = watVisctTable.evaluate("Viscosity", T[i]);
|
||||||
|
alpha = muWatvisct/muRef;
|
||||||
|
}
|
||||||
|
|
||||||
output_mu[i] *= alpha;
|
output_mu[i] *= alpha;
|
||||||
output_dmudp[i] *= alpha;
|
output_dmudp[i] *= alpha;
|
||||||
@ -179,9 +183,12 @@ namespace Opm
|
|||||||
double muRef = pvtwViscosity_[tableIdx]/(1.0 + x + 0.5*x*x);
|
double muRef = pvtwViscosity_[tableIdx]/(1.0 + x + 0.5*x*x);
|
||||||
|
|
||||||
// compute the viscosity deviation due to temperature
|
// compute the viscosity deviation due to temperature
|
||||||
double muWatvisct = (*watvisctTables_)[tableIdx].evaluate("Viscosity", T[i]);
|
double alpha;
|
||||||
double alpha = muWatvisct/muRef;
|
{
|
||||||
|
const WatvisctTable& watVisctTable = watvisctTables_->getTable<WatvisctTable>(tableIdx);
|
||||||
|
double muWatvisct = watVisctTable.evaluate("Viscosity", T[i]);
|
||||||
|
alpha = muWatvisct/muRef;
|
||||||
|
}
|
||||||
output_mu[i] *= alpha;
|
output_mu[i] *= alpha;
|
||||||
output_dmudp[i] *= alpha;
|
output_dmudp[i] *= alpha;
|
||||||
output_dmudr[i] *= alpha;
|
output_dmudr[i] *= alpha;
|
||||||
@ -382,7 +389,7 @@ namespace Opm
|
|||||||
std::vector<double> pvtwViscosity_;
|
std::vector<double> pvtwViscosity_;
|
||||||
std::vector<double> pvtwViscosibility_;
|
std::vector<double> pvtwViscosibility_;
|
||||||
|
|
||||||
const std::vector<Opm::WatvisctTable>* watvisctTables_;
|
const TableContainer* watvisctTables_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -46,12 +46,13 @@ namespace Opm
|
|||||||
const auto tables = eclipseState->getTableManager();
|
const auto tables = eclipseState->getTableManager();
|
||||||
const auto& rocktabTables = tables->getRocktabTables();
|
const auto& rocktabTables = tables->getRocktabTables();
|
||||||
if (rocktabTables.size() > 0) {
|
if (rocktabTables.size() > 0) {
|
||||||
|
const auto& rocktabTable = rocktabTables.getTable<RocktabTable>(0);
|
||||||
if (rocktabTables.size() != 1)
|
if (rocktabTables.size() != 1)
|
||||||
OPM_THROW(std::runtime_error, "Can only handle a single region in ROCKTAB.");
|
OPM_THROW(std::runtime_error, "Can only handle a single region in ROCKTAB.");
|
||||||
|
|
||||||
p_ = rocktabTables[0].getPressureColumn();
|
p_ = rocktabTable.getPressureColumn();
|
||||||
poromult_ = rocktabTables[0].getPoreVolumeMultiplierColumn();
|
poromult_ = rocktabTable.getPoreVolumeMultiplierColumn();
|
||||||
transmult_ = rocktabTables[0].getTransmissibilityMultiplierColumn();
|
transmult_ = rocktabTable.getTransmissibilityMultiplierColumn();
|
||||||
} else if (deck->hasKeyword("ROCK")) {
|
} else if (deck->hasKeyword("ROCK")) {
|
||||||
Opm::DeckKeywordConstPtr rockKeyword = deck->getKeyword("ROCK");
|
Opm::DeckKeywordConstPtr rockKeyword = deck->getKeyword("ROCK");
|
||||||
if (rockKeyword->size() != 1) {
|
if (rockKeyword->size() != 1) {
|
||||||
|
@ -288,15 +288,17 @@ namespace Opm
|
|||||||
// Create Rs functions.
|
// Create Rs functions.
|
||||||
rs_func_.reserve(rec.size());
|
rs_func_.reserve(rec.size());
|
||||||
if (deck->hasKeyword("DISGAS")) {
|
if (deck->hasKeyword("DISGAS")) {
|
||||||
const std::vector<RsvdTable>& rsvdTables = tables->getRsvdTables();
|
const TableContainer& rsvdTables = tables->getRsvdTables();
|
||||||
for (size_t i = 0; i < rec.size(); ++i) {
|
for (size_t i = 0; i < rec.size(); ++i) {
|
||||||
|
const RsvdTable& rsvdTable = rsvdTables.getTable<RsvdTable>(i);
|
||||||
const int cell = *(eqlmap.cells(i).begin());
|
const int cell = *(eqlmap.cells(i).begin());
|
||||||
if (rec[i].live_oil_table_index > 0) {
|
if (rec[i].live_oil_table_index > 0) {
|
||||||
if (rsvdTables.size() > 0 && size_t(rec[i].live_oil_table_index) <= rsvdTables.size()) {
|
if (rsvdTables.size() > 0 && size_t(rec[i].live_oil_table_index) <= rsvdTables.size()) {
|
||||||
|
|
||||||
rs_func_.push_back(std::make_shared<Miscibility::RsVD>(props,
|
rs_func_.push_back(std::make_shared<Miscibility::RsVD>(props,
|
||||||
cell,
|
cell,
|
||||||
rsvdTables[i].getDepthColumn(),
|
rsvdTable.getDepthColumn(),
|
||||||
rsvdTables[i].getRsColumn()));
|
rsvdTable.getRsColumn()));
|
||||||
} else {
|
} else {
|
||||||
OPM_THROW(std::runtime_error, "Cannot initialise: RSVD table " << (rec[i].live_oil_table_index) << " not available.");
|
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());
|
rv_func_.reserve(rec.size());
|
||||||
if (deck->hasKeyword("VAPOIL")) {
|
if (deck->hasKeyword("VAPOIL")) {
|
||||||
const std::vector<RvvdTable>& rvvdTables = tables->getRvvdTables();
|
const TableContainer& rvvdTables = tables->getRvvdTables();
|
||||||
for (size_t i = 0; i < rec.size(); ++i) {
|
for (size_t i = 0; i < rec.size(); ++i) {
|
||||||
const int cell = *(eqlmap.cells(i).begin());
|
const int cell = *(eqlmap.cells(i).begin());
|
||||||
if (rec[i].wet_gas_table_index > 0) {
|
if (rec[i].wet_gas_table_index > 0) {
|
||||||
if (rvvdTables.size() > 0 && size_t(rec[i].wet_gas_table_index) <= rvvdTables.size()) {
|
if (rvvdTables.size() > 0 && size_t(rec[i].wet_gas_table_index) <= rvvdTables.size()) {
|
||||||
|
const RvvdTable& rvvdTable = rvvdTables.getTable<RvvdTable>(i);
|
||||||
rv_func_.push_back(std::make_shared<Miscibility::RvVD>(props,
|
rv_func_.push_back(std::make_shared<Miscibility::RvVD>(props,
|
||||||
cell,
|
cell,
|
||||||
rvvdTables[i].getDepthColumn(),
|
rvvdTable.getDepthColumn(),
|
||||||
rvvdTables[i].getRvColumn()));
|
rvvdTable.getRvColumn()));
|
||||||
} else {
|
} else {
|
||||||
OPM_THROW(std::runtime_error, "Cannot initialise: RVVD table " << (rec[i].wet_gas_table_index) << " not available.");
|
OPM_THROW(std::runtime_error, "Cannot initialise: RVVD table " << (rec[i].wet_gas_table_index) << " not available.");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user