Changed to use new table api from opm-parser.

This commit is contained in:
Joakim Hove 2016-01-05 12:12:29 +01:00
parent a566ac608d
commit a6deb02d04
7 changed files with 85 additions and 69 deletions

View File

@ -47,9 +47,9 @@ namespace Opm
const Opm::PvdoTable& pvdoTable = pvdoTables.getTable<PvdoTable>(regionIdx); const Opm::PvdoTable& pvdoTable = pvdoTables.getTable<PvdoTable>(regionIdx);
// Copy data // Copy data
const std::vector<double>& press = pvdoTable.getPressureColumn(); const auto& press = pvdoTable.getColumn("P");
const std::vector<double>& b_var = pvdoTable.getFormationFactorColumn(); const auto& b_var = pvdoTable.getColumn("BO");
const std::vector<double>& visc = pvdoTable.getViscosityColumn(); const auto& visc = pvdoTable.getColumn("MUO");
const int sz = b_var.size(); const int sz = b_var.size();
std::vector<double> inverseB(sz); std::vector<double> inverseB(sz);
@ -82,9 +82,9 @@ namespace Opm
const Opm::PvdgTable& pvdgTable = pvdgTables.getTable<PvdgTable>(regionIdx); const Opm::PvdgTable& pvdgTable = pvdgTables.getTable<PvdgTable>(regionIdx);
// Copy data // Copy data
const std::vector<double>& press = pvdgTable.getPressureColumn(); const auto& press = pvdgTable.getColumn("P");
const std::vector<double>& b = pvdgTable.getFormationFactorColumn(); const auto& b = pvdgTable.getColumn("BG");
const std::vector<double>& visc = pvdgTable.getViscosityColumn(); const auto& visc = pvdgTable.getColumn("MUG");
const int sz = b.size(); const int sz = b.size();
std::vector<double> inverseB(sz); std::vector<double> inverseB(sz);

View File

@ -53,9 +53,9 @@ namespace Opm
int numRows = pvdoTable.numRows(); int numRows = pvdoTable.numRows();
// Copy data // Copy data
const std::vector<double> &press = pvdoTable.getPressureColumn(); std::vector<double> press = pvdoTable.getColumn("P").vectorCopy();
const std::vector<double> &B_var = pvdoTable.getFormationFactorColumn(); std::vector<double> B_var = pvdoTable.getColumn("BO").vectorCopy();
const std::vector<double> &visc = pvdoTable.getViscosityColumn(); std::vector<double> visc = pvdoTable.getColumn("MUO").vectorCopy();
std::vector<double> B_inv(numRows); std::vector<double> B_inv(numRows);
for (int i = 0; i < numRows; ++i) { for (int i = 0; i < numRows; ++i) {
@ -82,9 +82,9 @@ namespace Opm
int numRows = pvdgTable.numRows(); int numRows = pvdgTable.numRows();
// Copy data // Copy data
const std::vector<double> &press = pvdgTable.getPressureColumn(); std::vector<double> press = pvdgTable.getColumn("P").vectorCopy();
const std::vector<double> &B = pvdgTable.getFormationFactorColumn(); std::vector<double> B = pvdgTable.getColumn("BG").vectorCopy();
const std::vector<double> &visc = pvdgTable.getViscosityColumn(); std::vector<double> visc = pvdgTable.getColumn("MUG").vectorCopy();
std::vector<double> B_inv(numRows); std::vector<double> B_inv(numRows);
for (int i = 0; i < numRows; ++i) { for (int i = 0; i < numRows; ++i) {

View File

@ -55,31 +55,39 @@ namespace Opm
for (int pvtTableIdx = 0; pvtTableIdx < numTables; ++pvtTableIdx) { for (int pvtTableIdx = 0; pvtTableIdx < numTables; ++pvtTableIdx) {
const Opm::PvtgTable& pvtgTable = pvtgTables[pvtTableIdx]; const Opm::PvtgTable& pvtgTable = pvtgTables[pvtTableIdx];
const auto& saturatedPvtg = pvtgTable.getSaturatedTable( );
// GAS, PVTG // GAS, P
// saturated_gas_table_[pvtTableIdx].resize(4); // saturated_gas_table_[pvtTableIdx].resize(4);
// Adding one extra line to PVTG to store 1./(Bg*mu_g) // Adding one extra line to PVTG to store 1./(Bg*mu_g)
saturated_gas_table_[pvtTableIdx].resize(5); saturated_gas_table_[pvtTableIdx].resize(5);
saturated_gas_table_[pvtTableIdx][0] = pvtgTable.getOuterTable()->getPressureColumn(); // Pressure for (int k=0; k<5; ++k) {
saturated_gas_table_[pvtTableIdx][1] = pvtgTable.getOuterTable()->getGasFormationFactorColumn(); // Bg saturated_gas_table_[pvtTableIdx][k].resize(saturatedPvtg.numRows());
saturated_gas_table_[pvtTableIdx][2] = pvtgTable.getOuterTable()->getGasViscosityColumn(); // mu_g }
// The number of the columns
int nRows = saturated_gas_table_[pvtTableIdx][2].size();
saturated_gas_table_[pvtTableIdx][3].resize(nRows); // allocate memory for 1/(Bg*mu_g)
saturated_gas_table_[pvtTableIdx][4] = pvtgTable.getOuterTable()->getOilSolubilityColumn(); // Rv
int sz = pvtgTable.getOuterTable()->numRows(); for (size_t row=0; row < saturatedPvtg.numRows(); row++) {
saturated_gas_table_[pvtTableIdx][0][row] = saturatedPvtg.get("PG" , row); // Pressure
saturated_gas_table_[pvtTableIdx][1][row] = saturatedPvtg.get("BG" , row); // Bg
saturated_gas_table_[pvtTableIdx][2][row] = saturatedPvtg.get("MUG" , row); // mu_g
// 1/Bg will go in [3]
saturated_gas_table_[pvtTableIdx][4][row] = saturatedPvtg.get("RV" , row); // Rv
}
int sz = saturatedPvtg.numRows();
undersat_gas_tables_[pvtTableIdx].resize(sz); undersat_gas_tables_[pvtTableIdx].resize(sz);
for (int i=0; i<sz; ++i) { for (int i=0; i<sz; ++i) {
const auto &undersatTable = *pvtgTable.getInnerTable(i); const auto &undersatTable = pvtgTable.getUnderSaturatedTable(i);
// undersat_gas_tables_[pvtTableIdx][i].resize(3);
undersat_gas_tables_[pvtTableIdx][i].resize(4); undersat_gas_tables_[pvtTableIdx][i].resize(4);
undersat_gas_tables_[pvtTableIdx][i][0] = undersatTable.getOilSolubilityColumn(); // Rv for (size_t j=0; j < 4; j++) {
undersat_gas_tables_[pvtTableIdx][i][1] = undersatTable.getGasFormationFactorColumn(); // Bg undersat_gas_tables_[pvtTableIdx][i][j].resize( undersatTable.numRows() );
undersat_gas_tables_[pvtTableIdx][i][2] = undersatTable.getGasViscosityColumn(); // mu_g }
int nUndersatRows = undersat_gas_tables_[pvtTableIdx][i][2].size();
undersat_gas_tables_[pvtTableIdx][i][3].resize(nUndersatRows); // allocate memory for 1/(Bg*mu_g) for (size_t row=0; row < undersatTable.numRows(); row++) {
undersat_gas_tables_[pvtTableIdx][i][0][row] = undersatTable.get("RV" , row); // Rv
undersat_gas_tables_[pvtTableIdx][i][1][row] = undersatTable.get("BG" , row); // Bg
undersat_gas_tables_[pvtTableIdx][i][2][row] = undersatTable.get("MUG" , row); // mu_g
}
} }
// Bg -> 1/Bg // Bg -> 1/Bg

View File

@ -41,46 +41,46 @@ namespace Opm
undersat_oil_tables_.resize(numTables); undersat_oil_tables_.resize(numTables);
for (int pvtTableIdx = 0; pvtTableIdx < numTables; ++pvtTableIdx) { for (int pvtTableIdx = 0; pvtTableIdx < numTables; ++pvtTableIdx) {
Opm::PvtoTable pvtoTable = pvtoTables[pvtTableIdx]; const Opm::PvtoTable& pvtoTable = pvtoTables[pvtTableIdx];
const auto saturatedPvto = pvtoTable.getOuterTable(); const auto& saturatedPvto = pvtoTable.getSaturatedTable();
// OIL, PVTO // OIL, PVTO
// saturated_oil_table_[pvtTableIdx].resize(4); // saturated_oil_table_[pvtTableIdx].resize(4);
// adding a extra colummn to the PVTO to store 1/(B*mu) // adding a extra colummn to the PVTO to store 1/(B*mu)
saturated_oil_table_[pvtTableIdx].resize(5); saturated_oil_table_[pvtTableIdx].resize(5);
const int sz = saturatedPvto->numRows(); const int sz = saturatedPvto.numRows();
// for (int k=0; k<4; ++k) { // for (int k=0; k<4; ++k) {
for (int k=0; k<5; ++k) { for (int k=0; k<5; ++k) {
saturated_oil_table_[pvtTableIdx][k].resize(sz); saturated_oil_table_[pvtTableIdx][k].resize(sz);
} }
for (int i=0; i<sz; ++i) { for (int i=0; i<sz; ++i) {
saturated_oil_table_[pvtTableIdx][0][i] = saturatedPvto->getPressureColumn()[i]; // p saturated_oil_table_[pvtTableIdx][0][i] = saturatedPvto.get("P" , i); // P
saturated_oil_table_[pvtTableIdx][1][i] = 1.0/saturatedPvto->getOilFormationFactorColumn()[i]; // 1/Bo saturated_oil_table_[pvtTableIdx][1][i] = 1.0/saturatedPvto.get("BO" , i); // BO
saturated_oil_table_[pvtTableIdx][2][i] = saturatedPvto->getOilViscosityColumn()[i]; // mu_o saturated_oil_table_[pvtTableIdx][2][i] = saturatedPvto.get("MU" , i); // MU
saturated_oil_table_[pvtTableIdx][3][i] = 1.0 / (saturatedPvto->getOilFormationFactorColumn()[i] saturated_oil_table_[pvtTableIdx][3][i] = 1.0 / (saturatedPvto.get("BO" , i)
* saturatedPvto->getOilViscosityColumn()[i]); // 1/(Bo*mu_o) * saturatedPvto.get("MU" , i));; // 1/(Bo*mu_o)
saturated_oil_table_[pvtTableIdx][4][i] = saturatedPvto->getGasSolubilityColumn()[i]; // Rs saturated_oil_table_[pvtTableIdx][4][i] = saturatedPvto.get("RS" , i); // RS
} }
undersat_oil_tables_[pvtTableIdx].resize(sz); undersat_oil_tables_[pvtTableIdx].resize(sz);
for (int i=0; i<sz; ++i) { for (int i=0; i<sz; ++i) {
const auto undersaturatedPvto = pvtoTable.getInnerTable(i); const auto& undersaturatedPvto = pvtoTable.getUnderSaturatedTable( i );
// undersat_oil_tables_[pvtTableIdx][i].resize(3); // undersat_oil_tables_[pvtTableIdx][i].resize(3);
// adding a extra colummn to the PVTO to store 1/(B*mu) // adding a extra colummn to the PVTO to store 1/(B*mu)
undersat_oil_tables_[pvtTableIdx][i].resize(4); undersat_oil_tables_[pvtTableIdx][i].resize(4);
int tsize = undersaturatedPvto->numRows(); int tsize = undersaturatedPvto.numRows();
undersat_oil_tables_[pvtTableIdx][i][0].resize(tsize); undersat_oil_tables_[pvtTableIdx][i][0].resize(tsize);
undersat_oil_tables_[pvtTableIdx][i][1].resize(tsize); undersat_oil_tables_[pvtTableIdx][i][1].resize(tsize);
undersat_oil_tables_[pvtTableIdx][i][2].resize(tsize); undersat_oil_tables_[pvtTableIdx][i][2].resize(tsize);
undersat_oil_tables_[pvtTableIdx][i][3].resize(tsize); undersat_oil_tables_[pvtTableIdx][i][3].resize(tsize);
for (int j=0; j<tsize; ++j) { for (int j=0; j<tsize; ++j) {
undersat_oil_tables_[pvtTableIdx][i][0][j] = undersaturatedPvto->getPressureColumn()[j]; // p undersat_oil_tables_[pvtTableIdx][i][0][j] = undersaturatedPvto.get("P" , j); // P
undersat_oil_tables_[pvtTableIdx][i][1][j] = 1.0/undersaturatedPvto->getOilFormationFactorColumn()[j]; // 1/Bo undersat_oil_tables_[pvtTableIdx][i][1][j] = 1.0/undersaturatedPvto.get("BO" , j); // BO
undersat_oil_tables_[pvtTableIdx][i][2][j] = undersaturatedPvto->getOilViscosityColumn()[j]; // mu_o undersat_oil_tables_[pvtTableIdx][i][2][j] = undersaturatedPvto.get("MU" , j); // MU
undersat_oil_tables_[pvtTableIdx][i][3][j] = 1.0 / (undersaturatedPvto->getOilFormationFactorColumn()[j] * undersat_oil_tables_[pvtTableIdx][i][3][j] = 1.0 / (undersaturatedPvto.get("BO", j)*
undersaturatedPvto->getOilViscosityColumn()[j]); // 1/(Bo*mu_o) undersaturatedPvto.get("MU", j)); // 1/(Bo*mu_o)
} }
} }
@ -126,9 +126,11 @@ namespace Opm
} }
} }
/// Destructor. /// Destructor.
PvtLiveOil::~PvtLiveOil() PvtLiveOil::~PvtLiveOil()
{ {
} }

View File

@ -50,9 +50,13 @@ namespace Opm
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_ = rocktabTable.getPressureColumn(); p_ = rocktabTable.getColumn("PO").vectorCopy( );
poromult_ = rocktabTable.getPoreVolumeMultiplierColumn(); poromult_ = rocktabTable.getColumn("PV_MULT").vectorCopy();
transmult_ = rocktabTable.getTransmissibilityMultiplierColumn(); if (rocktabTable.hasColumn("PV_MULT_TRAN")) {
transmult_ = rocktabTable.getColumn("PV_MULT_TRAN").vectorCopy();
} else {
transmult_ = rocktabTable.getColumn("PV_MULT_TRANX").vectorCopy();
}
} 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) {

View File

@ -541,27 +541,25 @@ namespace Opm{
if (fluidSystem_ == FluidSystem::BlackOil) { if (fluidSystem_ == FluidSystem::BlackOil) {
if (satFamily_ == SaturationFunctionFamily::FamilyI) { if (satFamily_ == SaturationFunctionFamily::FamilyI) {
if (!sgofTables.empty()) { if (!sgofTables.empty()) {
auto sg = sgofTables.getTable<SgofTable>(satnumIdx).getSgColumn(); const auto& table = sgofTables.getTable<SgofTable>(satnumIdx);
auto krog = sgofTables.getTable<SgofTable>(satnumIdx).getKrogColumn(); krog_value = table.evaluate( "KROG" , unscaledEpsInfo_[satnumIdx].Sgl );
krog_value=Opm::linearInterpolation(sg, krog,unscaledEpsInfo_[satnumIdx].Sgl);
} else { } else {
assert(!slgofTables.empty()); assert(!slgofTables.empty());
auto sl = slgofTables.getTable<SlgofTable>(satnumIdx).getSlColumn(); const auto& table = slgofTables.getTable<SlgofTable>(satnumIdx);
auto krog = slgofTables.getTable<SlgofTable>(satnumIdx).getKrogColumn(); krog_value = table.evaluate( "KROG" , unscaledEpsInfo_[satnumIdx].Sgl );
krog_value=Opm::linearInterpolation(sl, krog, unscaledEpsInfo_[satnumIdx].Sgl); }
{
const auto& table = swofTables.getTable<SwofTable>(satnumIdx);
krow_value = table.evaluate("KROW" , unscaledEpsInfo_[satnumIdx].Swl);
} }
auto sw = swofTables.getTable<SwofTable>(satnumIdx).getSwColumn();
auto krow = swofTables.getTable<SwofTable>(satnumIdx).getKrowColumn();
krow_value = Opm::linearInterpolation(sw, krow,unscaledEpsInfo_[satnumIdx].Swl);
} }
if (satFamily_ == SaturationFunctionFamily::FamilyII) { if (satFamily_ == SaturationFunctionFamily::FamilyII) {
assert(!sof3Tables.empty()); assert(!sof3Tables.empty());
const auto& table = sof3Tables.getTable<Sof3Table>(satnumIdx);
const double Sou = 1.- unscaledEpsInfo_[satnumIdx].Swl - unscaledEpsInfo_[satnumIdx].Sgl; const double Sou = 1.- unscaledEpsInfo_[satnumIdx].Swl - unscaledEpsInfo_[satnumIdx].Sgl;
auto so = sof3Tables.getTable<Sof3Table>(satnumIdx).getSoColumn();
auto krow = sof3Tables.getTable<Sof3Table>(satnumIdx).getKrowColumn(); krow_value = table.evaluate("KROW" , Sou);
auto krog = sof3Tables.getTable<Sof3Table>(satnumIdx).getKrogColumn(); krog_value = table.evaluate("KROG" , Sou);
krow_value = Opm::linearInterpolation(so, krow, Sou);
krog_value = Opm::linearInterpolation(so, krog, Sou);
} }
if (krow_value != krog_value) { if (krow_value != krog_value) {
std::string msg = "Warning: Krow(sSomax) should equal Krog(Somax)."; std::string msg = "Warning: Krow(sSomax) should equal Krog(Somax).";

View File

@ -294,10 +294,11 @@ namespace Opm
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()) {
const RsvdTable& rsvdTable = rsvdTables.getTable<RsvdTable>(i); const RsvdTable& rsvdTable = rsvdTables.getTable<RsvdTable>(i);
std::vector<double> depthColumn = rsvdTable.getColumn("DEPTH").vectorCopy();
std::vector<double> rsColumn = rsvdTable.getColumn("RS").vectorCopy();
rs_func_.push_back(std::make_shared<Miscibility::RsVD>(props, rs_func_.push_back(std::make_shared<Miscibility::RsVD>(props,
cell, cell,
rsvdTable.getDepthColumn(), depthColumn , rsColumn));
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.");
} }
@ -327,10 +328,13 @@ namespace Opm
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); const RvvdTable& rvvdTable = rvvdTables.getTable<RvvdTable>(i);
std::vector<double> depthColumn = rvvdTable.getColumn("DEPTH").vectorCopy();
std::vector<double> rvColumn = rvvdTable.getColumn("RV").vectorCopy();
rv_func_.push_back(std::make_shared<Miscibility::RvVD>(props, rv_func_.push_back(std::make_shared<Miscibility::RvVD>(props,
cell, cell,
rvvdTable.getDepthColumn(), depthColumn , rvColumn));
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.");
} }