Using TableManager to get tables.
This commit is contained in:
1 parent
943a5d1e4c
commit
f3151a9abe
9 files changed
+76
-66
No files matched your search
@@ -79,54 +79,58 @@ namespace Opm
|
||||
|
||||
props_[phase_usage_.phase_pos[Aqua]] = pvtw;
|
||||
}
|
||||
// Oil PVT
|
||||
if (phase_usage_.phase_used[Liquid]) {
|
||||
// for oil, we support the "PVDO", "PVTO" and "PVCDO"
|
||||
// keywords...
|
||||
const auto &pvdoTables = eclipseState->getPvdoTables();
|
||||
const auto &pvtoTables = eclipseState->getPvtoTables();
|
||||
if (pvdoTables.size() > 0) {
|
||||
if (numSamples > 0) {
|
||||
auto splinePvt = std::shared_ptr<PvtDeadSpline>(new PvtDeadSpline);
|
||||
splinePvt->initFromOil(pvdoTables, numSamples);
|
||||
props_[phase_usage_.phase_pos[Liquid]] = splinePvt;
|
||||
} else {
|
||||
auto deadPvt = std::shared_ptr<PvtDead>(new PvtDead);
|
||||
deadPvt->initFromOil(pvdoTables);
|
||||
props_[phase_usage_.phase_pos[Liquid]] = deadPvt;
|
||||
}
|
||||
} else if (pvtoTables.size() > 0) {
|
||||
props_[phase_usage_.phase_pos[Liquid]].reset(new PvtLiveOil(pvtoTables));
|
||||
} else if (deck->hasKeyword("PVCDO")) {
|
||||
std::shared_ptr<PvtConstCompr> pvcdo(new PvtConstCompr);
|
||||
pvcdo->initFromOil(deck->getKeyword("PVCDO"));
|
||||
|
||||
props_[phase_usage_.phase_pos[Liquid]] = pvcdo;
|
||||
} else {
|
||||
OPM_THROW(std::runtime_error, "Input is missing PVDO, PVCDO or PVTO\n");
|
||||
{
|
||||
auto tables = eclipseState->getTableManager();
|
||||
// Oil PVT
|
||||
if (phase_usage_.phase_used[Liquid]) {
|
||||
// for oil, we support the "PVDO", "PVTO" and "PVCDO"
|
||||
// keywords...
|
||||
const auto &pvdoTables = tables->getPvdoTables();
|
||||
const auto &pvtoTables = tables->getPvtoTables();
|
||||
if (pvdoTables.size() > 0) {
|
||||
if (numSamples > 0) {
|
||||
auto splinePvt = std::shared_ptr<PvtDeadSpline>(new PvtDeadSpline);
|
||||
splinePvt->initFromOil(pvdoTables, numSamples);
|
||||
props_[phase_usage_.phase_pos[Liquid]] = splinePvt;
|
||||
} else {
|
||||
auto deadPvt = std::shared_ptr<PvtDead>(new PvtDead);
|
||||
deadPvt->initFromOil(pvdoTables);
|
||||
props_[phase_usage_.phase_pos[Liquid]] = deadPvt;
|
||||
}
|
||||
} else if (pvtoTables.size() > 0) {
|
||||
props_[phase_usage_.phase_pos[Liquid]].reset(new PvtLiveOil(pvtoTables));
|
||||
} else if (deck->hasKeyword("PVCDO")) {
|
||||
std::shared_ptr<PvtConstCompr> pvcdo(new PvtConstCompr);
|
||||
pvcdo->initFromOil(deck->getKeyword("PVCDO"));
|
||||
|
||||
props_[phase_usage_.phase_pos[Liquid]] = pvcdo;
|
||||
} else {
|
||||
OPM_THROW(std::runtime_error, "Input is missing PVDO, PVCDO or PVTO\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
// Gas PVT
|
||||
if (phase_usage_.phase_used[Vapour]) {
|
||||
// gas can be specified using the "PVDG" or "PVTG" keywords...
|
||||
const auto &pvdgTables = eclipseState->getPvdgTables();
|
||||
const auto &pvtgTables = eclipseState->getPvtgTables();
|
||||
if (pvdgTables.size() > 0) {
|
||||
if (numSamples > 0) {
|
||||
std::shared_ptr<PvtDeadSpline> splinePvt(new PvtDeadSpline);
|
||||
splinePvt->initFromGas(pvdgTables, numSamples);
|
||||
// Gas PVT
|
||||
if (phase_usage_.phase_used[Vapour]) {
|
||||
// gas can be specified using the "PVDG" or "PVTG" keywords...
|
||||
const auto &pvdgTables = tables->getPvdgTables();
|
||||
const auto &pvtgTables = tables->getPvtgTables();
|
||||
if (pvdgTables.size() > 0) {
|
||||
if (numSamples > 0) {
|
||||
std::shared_ptr<PvtDeadSpline> splinePvt(new PvtDeadSpline);
|
||||
splinePvt->initFromGas(pvdgTables, numSamples);
|
||||
|
||||
props_[phase_usage_.phase_pos[Vapour]] = splinePvt;
|
||||
props_[phase_usage_.phase_pos[Vapour]] = splinePvt;
|
||||
} else {
|
||||
std::shared_ptr<PvtDead> deadPvt(new PvtDead);
|
||||
deadPvt->initFromGas(pvdgTables);
|
||||
|
||||
props_[phase_usage_.phase_pos[Vapour]] = deadPvt;
|
||||
}
|
||||
} else if (pvtgTables.size() > 0) {
|
||||
props_[phase_usage_.phase_pos[Vapour]].reset(new PvtLiveGas(pvtgTables));
|
||||
} else {
|
||||
std::shared_ptr<PvtDead> deadPvt(new PvtDead);
|
||||
deadPvt->initFromGas(pvdgTables);
|
||||
|
||||
props_[phase_usage_.phase_pos[Vapour]] = deadPvt;
|
||||
OPM_THROW(std::runtime_error, "Input is missing PVDG or PVTG\n");
|
||||
}
|
||||
} else if (pvtgTables.size() > 0) {
|
||||
props_[phase_usage_.phase_pos[Vapour]].reset(new PvtLiveGas(pvtgTables));
|
||||
} else {
|
||||
OPM_THROW(std::runtime_error, "Input is missing PVDG or PVTG\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,18 +44,18 @@ namespace Opm
|
||||
Opm::EclipseStateConstPtr eclipseState)
|
||||
{
|
||||
isothermalPvt_ = isothermalPvt;
|
||||
|
||||
auto tables = eclipseState->getTableManager();
|
||||
int numRegions;
|
||||
if (deck->hasKeyword("PVTG"))
|
||||
numRegions = eclipseState->getPvtgTables().size();
|
||||
numRegions = tables->getPvtgTables().size();
|
||||
else if (deck->hasKeyword("PVDG"))
|
||||
numRegions = eclipseState->getPvdgTables().size();
|
||||
numRegions = tables->getPvdgTables().size();
|
||||
else
|
||||
OPM_THROW(std::runtime_error, "Gas phase was not initialized using a known way");
|
||||
|
||||
// viscosity
|
||||
if (deck->hasKeyword("GASVISCT")) {
|
||||
gasvisctTables_ = &eclipseState->getGasvisctTables();
|
||||
gasvisctTables_ = &tables->getGasvisctTables();
|
||||
assert(int(gasvisctTables_->size()) == numRegions);
|
||||
|
||||
gasCompIdx_ = deck->getKeyword("GCOMPIDX")->getRecord(0)->getItem("GAS_COMPONENT_INDEX")->getInt(0) - 1;
|
||||
|
||||
@@ -46,10 +46,12 @@ namespace Opm
|
||||
isothermalPvt_ = isothermalPvt;
|
||||
|
||||
int numRegions;
|
||||
auto tables = eclipseState->getTableManager();
|
||||
|
||||
if (deck->hasKeyword("PVTO"))
|
||||
numRegions = eclipseState->getPvtoTables().size();
|
||||
numRegions = tables->getPvtoTables().size();
|
||||
else if (deck->hasKeyword("PVDO"))
|
||||
numRegions = eclipseState->getPvdoTables().size();
|
||||
numRegions = tables->getPvdoTables().size();
|
||||
else if (deck->hasKeyword("PVCDO"))
|
||||
numRegions = deck->getKeyword("PVCDO")->size();
|
||||
else
|
||||
@@ -57,7 +59,7 @@ namespace Opm
|
||||
|
||||
// viscosity
|
||||
if (deck->hasKeyword("VISCREF")) {
|
||||
oilvisctTables_ = &eclipseState->getOilvisctTables();
|
||||
oilvisctTables_ = &tables->getOilvisctTables();
|
||||
Opm::DeckKeywordConstPtr viscrefKeyword = deck->getKeyword("VISCREF");
|
||||
|
||||
assert(int(oilvisctTables_->size()) == numRegions);
|
||||
|
||||
@@ -65,7 +65,8 @@ namespace Opm
|
||||
// quantities required for the temperature dependence of the viscosity
|
||||
// (basically we expect well-behaved VISCREF and WATVISCT keywords.)
|
||||
if (deck->hasKeyword("VISCREF")) {
|
||||
watvisctTables_ = &eclipseState->getWatvisctTables();
|
||||
auto tables = eclipseState->getTableManager();
|
||||
watvisctTables_ = &tables->getWatvisctTables();
|
||||
Opm::DeckKeywordConstPtr viscrefKeyword = deck->getKeyword("VISCREF");
|
||||
|
||||
assert(int(watvisctTables_->size()) == numRegions);
|
||||
|
||||
@@ -43,7 +43,8 @@ namespace Opm
|
||||
: pref_(0.0),
|
||||
rock_comp_(0.0)
|
||||
{
|
||||
const auto& rocktabTables = eclipseState->getRocktabTables();
|
||||
const auto tables = eclipseState->getTableManager();
|
||||
const auto& rocktabTables = tables->getRocktabTables();
|
||||
if (rocktabTables.size() > 0) {
|
||||
if (rocktabTables.size() != 1)
|
||||
OPM_THROW(std::runtime_error, "Can only handle a single region in ROCKTAB.");
|
||||
|
||||
@@ -117,8 +117,7 @@ namespace Opm
|
||||
TableType krow_;
|
||||
TableType pcow_;
|
||||
TableType krg_;
|
||||
TableType krog_;
|
||||
TableType pcog_;
|
||||
TableType krog_; TableType pcog_;
|
||||
double krocw_; // = krow_(s_wc)
|
||||
|
||||
private:
|
||||
@@ -137,11 +136,12 @@ namespace Opm
|
||||
const PhaseUsage phase_usg,
|
||||
const int samples)
|
||||
{
|
||||
std::shared_ptr<const TableManager> tables = eclipseState->getTableManager();
|
||||
phase_usage = phase_usg;
|
||||
double swco = 0.0;
|
||||
double swmax = 1.0;
|
||||
if (phase_usage.phase_used[Aqua]) {
|
||||
const Opm::SwofTable& swof(eclipseState->getSwofTables()[table_num]);
|
||||
const Opm::SwofTable& swof(tables->getSwofTables()[table_num]);
|
||||
const std::vector<double>& sw = swof.getSwColumn();
|
||||
const std::vector<double>& krw = swof.getKrwColumn();
|
||||
const std::vector<double>& krow = swof.getKrowColumn();
|
||||
@@ -196,7 +196,7 @@ namespace Opm
|
||||
pcwmax_ = pcow.front();
|
||||
}
|
||||
if (phase_usage.phase_used[Vapour]) {
|
||||
const Opm::SgofTable& sgof = eclipseState->getSgofTables()[table_num];
|
||||
const Opm::SgofTable& sgof = tables->getSgofTables()[table_num];
|
||||
const std::vector<double>& sg = sgof.getSgColumn();
|
||||
const std::vector<double>& krg = sgof.getKrgColumn();
|
||||
const std::vector<double>& krog = sgof.getKrogColumn();
|
||||
|
||||
@@ -594,6 +594,7 @@ namespace Opm
|
||||
std::vector<std::vector<double> > param_col;
|
||||
std::vector<std::vector<double> > depth_col;
|
||||
std::vector<std::string> col_names;
|
||||
std::shared_ptr<const TableManager> tables = eclipseState->getTableManager();
|
||||
|
||||
// Active keyword assigned default values for each cell (in case of possible box-wise assignment)
|
||||
if ((keyword[0] == 'S' && (useStateKeyword || hasENPTVD)) || (keyword[1] == 'S' && useStateKeyword) ) {
|
||||
@@ -602,7 +603,7 @@ namespace Opm
|
||||
scaleparam.resize(number_of_cells);
|
||||
}
|
||||
if (!useKeyword && itab > 0) {
|
||||
const auto& enptvdTables = eclipseState->getEnptvdTables();
|
||||
const auto& enptvdTables = tables->getEnptvdTables();
|
||||
int num_tables = enptvdTables.size();
|
||||
param_col.resize(num_tables);
|
||||
depth_col.resize(num_tables);
|
||||
@@ -667,7 +668,7 @@ namespace Opm
|
||||
OPM_THROW(std::runtime_error, " -- unknown keyword: '" << keyword << "'");
|
||||
}
|
||||
if (!useKeyword && itab > 0) {
|
||||
const auto& enkrvdTables = eclipseState->getEnkrvdTables();
|
||||
const auto& enkrvdTables = tables->getEnkrvdTables();
|
||||
int num_tables = enkrvdTables.size();
|
||||
param_col.resize(num_tables);
|
||||
depth_col.resize(num_tables);
|
||||
|
||||
@@ -281,14 +281,14 @@ namespace Opm
|
||||
{
|
||||
// Get the equilibration records.
|
||||
const std::vector<EquilRecord> rec = getEquil(deck);
|
||||
|
||||
std::shared_ptr<const TableManager> 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 std::vector<RsvdTable>& rsvdTables = eclipseState->getRsvdTables();
|
||||
const std::vector<RsvdTable>& rsvdTables = tables->getRsvdTables();
|
||||
for (size_t i = 0; i < rec.size(); ++i) {
|
||||
const int cell = *(eqlmap.cells(i).begin());
|
||||
if (rec[i].live_oil_table_index > 0) {
|
||||
@@ -320,7 +320,7 @@ namespace Opm
|
||||
|
||||
rv_func_.reserve(rec.size());
|
||||
if (deck->hasKeyword("VAPOIL")) {
|
||||
const std::vector<RvvdTable>& rvvdTables = eclipseState->getRvvdTables();
|
||||
const std::vector<RvvdTable>& 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) {
|
||||
|
||||
Reference in new issue
Block a user