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

View File

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

View File

@ -55,31 +55,39 @@ namespace Opm
for (int pvtTableIdx = 0; pvtTableIdx < numTables; ++pvtTableIdx) {
const Opm::PvtgTable& pvtgTable = pvtgTables[pvtTableIdx];
// GAS, PVTG
const auto& saturatedPvtg = pvtgTable.getSaturatedTable( );
// GAS, P
// saturated_gas_table_[pvtTableIdx].resize(4);
// Adding one extra line to PVTG to store 1./(Bg*mu_g)
saturated_gas_table_[pvtTableIdx].resize(5);
saturated_gas_table_[pvtTableIdx][0] = pvtgTable.getOuterTable()->getPressureColumn(); // Pressure
saturated_gas_table_[pvtTableIdx][1] = pvtgTable.getOuterTable()->getGasFormationFactorColumn(); // Bg
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
for (int k=0; k<5; ++k) {
saturated_gas_table_[pvtTableIdx][k].resize(saturatedPvtg.numRows());
}
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);
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][0] = undersatTable.getOilSolubilityColumn(); // Rv
undersat_gas_tables_[pvtTableIdx][i][1] = undersatTable.getGasFormationFactorColumn(); // Bg
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 j=0; j < 4; j++) {
undersat_gas_tables_[pvtTableIdx][i][j].resize( undersatTable.numRows() );
}
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

View File

@ -41,46 +41,46 @@ namespace Opm
undersat_oil_tables_.resize(numTables);
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
// saturated_oil_table_[pvtTableIdx].resize(4);
// adding a extra colummn to the PVTO to store 1/(B*mu)
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<5; ++k) {
saturated_oil_table_[pvtTableIdx][k].resize(sz);
}
for (int i=0; i<sz; ++i) {
saturated_oil_table_[pvtTableIdx][0][i] = saturatedPvto->getPressureColumn()[i]; // p
saturated_oil_table_[pvtTableIdx][1][i] = 1.0/saturatedPvto->getOilFormationFactorColumn()[i]; // 1/Bo
saturated_oil_table_[pvtTableIdx][2][i] = saturatedPvto->getOilViscosityColumn()[i]; // mu_o
saturated_oil_table_[pvtTableIdx][3][i] = 1.0 / (saturatedPvto->getOilFormationFactorColumn()[i]
* saturatedPvto->getOilViscosityColumn()[i]); // 1/(Bo*mu_o)
saturated_oil_table_[pvtTableIdx][4][i] = saturatedPvto->getGasSolubilityColumn()[i]; // Rs
saturated_oil_table_[pvtTableIdx][0][i] = saturatedPvto.get("P" , i); // P
saturated_oil_table_[pvtTableIdx][1][i] = 1.0/saturatedPvto.get("BO" , i); // BO
saturated_oil_table_[pvtTableIdx][2][i] = saturatedPvto.get("MU" , i); // MU
saturated_oil_table_[pvtTableIdx][3][i] = 1.0 / (saturatedPvto.get("BO" , i)
* saturatedPvto.get("MU" , i));; // 1/(Bo*mu_o)
saturated_oil_table_[pvtTableIdx][4][i] = saturatedPvto.get("RS" , i); // RS
}
undersat_oil_tables_[pvtTableIdx].resize(sz);
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);
// adding a extra colummn to the PVTO to store 1/(B*mu)
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][1].resize(tsize);
undersat_oil_tables_[pvtTableIdx][i][2].resize(tsize);
undersat_oil_tables_[pvtTableIdx][i][3].resize(tsize);
for (int j=0; j<tsize; ++j) {
undersat_oil_tables_[pvtTableIdx][i][0][j] = undersaturatedPvto->getPressureColumn()[j]; // p
undersat_oil_tables_[pvtTableIdx][i][1][j] = 1.0/undersaturatedPvto->getOilFormationFactorColumn()[j]; // 1/Bo
undersat_oil_tables_[pvtTableIdx][i][2][j] = undersaturatedPvto->getOilViscosityColumn()[j]; // mu_o
undersat_oil_tables_[pvtTableIdx][i][3][j] = 1.0 / (undersaturatedPvto->getOilFormationFactorColumn()[j] *
undersaturatedPvto->getOilViscosityColumn()[j]); // 1/(Bo*mu_o)
undersat_oil_tables_[pvtTableIdx][i][0][j] = undersaturatedPvto.get("P" , j); // P
undersat_oil_tables_[pvtTableIdx][i][1][j] = 1.0/undersaturatedPvto.get("BO" , j); // BO
undersat_oil_tables_[pvtTableIdx][i][2][j] = undersaturatedPvto.get("MU" , j); // MU
undersat_oil_tables_[pvtTableIdx][i][3][j] = 1.0 / (undersaturatedPvto.get("BO", j)*
undersaturatedPvto.get("MU", j)); // 1/(Bo*mu_o)
}
}
@ -125,10 +125,12 @@ namespace Opm
}
}
}
/// Destructor.
PvtLiveOil::~PvtLiveOil()
{
}
@ -137,8 +139,8 @@ namespace Opm
const int* pvtTableIdx,
const double* p,
const double* /*T*/,
const double* z,
double* output_mu) const
const double* z,
double* output_mu) const
{
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
@ -147,7 +149,7 @@ namespace Opm
double inverseB = miscible_oil(p[i], z + num_phases_*i, tableIdx, 1, false);
double inverseBMu = miscible_oil(p[i], z + num_phases_*i, tableIdx, 3, false);
output_mu[i] = inverseB / inverseBMu;
output_mu[i] = inverseB / inverseBMu;
}
}

View File

@ -50,9 +50,13 @@ namespace Opm
if (rocktabTables.size() != 1)
OPM_THROW(std::runtime_error, "Can only handle a single region in ROCKTAB.");
p_ = rocktabTable.getPressureColumn();
poromult_ = rocktabTable.getPoreVolumeMultiplierColumn();
transmult_ = rocktabTable.getTransmissibilityMultiplierColumn();
p_ = rocktabTable.getColumn("PO").vectorCopy( );
poromult_ = rocktabTable.getColumn("PV_MULT").vectorCopy();
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")) {
Opm::DeckKeywordConstPtr rockKeyword = deck->getKeyword("ROCK");
if (rockKeyword->size() != 1) {

View File

@ -541,27 +541,25 @@ namespace Opm{
if (fluidSystem_ == FluidSystem::BlackOil) {
if (satFamily_ == SaturationFunctionFamily::FamilyI) {
if (!sgofTables.empty()) {
auto sg = sgofTables.getTable<SgofTable>(satnumIdx).getSgColumn();
auto krog = sgofTables.getTable<SgofTable>(satnumIdx).getKrogColumn();
krog_value=Opm::linearInterpolation(sg, krog,unscaledEpsInfo_[satnumIdx].Sgl);
const auto& table = sgofTables.getTable<SgofTable>(satnumIdx);
krog_value = table.evaluate( "KROG" , unscaledEpsInfo_[satnumIdx].Sgl );
} else {
assert(!slgofTables.empty());
auto sl = slgofTables.getTable<SlgofTable>(satnumIdx).getSlColumn();
auto krog = slgofTables.getTable<SlgofTable>(satnumIdx).getKrogColumn();
krog_value=Opm::linearInterpolation(sl, krog, unscaledEpsInfo_[satnumIdx].Sgl);
const auto& table = slgofTables.getTable<SlgofTable>(satnumIdx);
krog_value = table.evaluate( "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) {
assert(!sof3Tables.empty());
const auto& table = sof3Tables.getTable<Sof3Table>(satnumIdx);
const double Sou = 1.- unscaledEpsInfo_[satnumIdx].Swl - unscaledEpsInfo_[satnumIdx].Sgl;
auto so = sof3Tables.getTable<Sof3Table>(satnumIdx).getSoColumn();
auto krow = sof3Tables.getTable<Sof3Table>(satnumIdx).getKrowColumn();
auto krog = sof3Tables.getTable<Sof3Table>(satnumIdx).getKrogColumn();
krow_value = Opm::linearInterpolation(so, krow, Sou);
krog_value = Opm::linearInterpolation(so, krog, Sou);
krow_value = table.evaluate("KROW" , Sou);
krog_value = table.evaluate("KROG" , Sou);
}
if (krow_value != krog_value) {
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 (rsvdTables.size() > 0 && size_t(rec[i].live_oil_table_index) <= rsvdTables.size()) {
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,
cell,
rsvdTable.getDepthColumn(),
rsvdTable.getRsColumn()));
depthColumn , rsColumn));
} else {
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 (rvvdTables.size() > 0 && size_t(rec[i].wet_gas_table_index) <= rvvdTables.size()) {
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,
cell,
rvvdTable.getDepthColumn(),
rvvdTable.getRvColumn()));
depthColumn , rvColumn));
} else {
OPM_THROW(std::runtime_error, "Cannot initialise: RVVD table " << (rec[i].wet_gas_table_index) << " not available.");
}