adjust serialization for VFPInjTable

This commit is contained in:
Arne Morten Kvarving 2020-02-12 15:03:58 +01:00
parent 11e0e5b549
commit 649818730c
5 changed files with 11 additions and 23 deletions

View File

@ -1115,8 +1115,7 @@ std::size_t packSize(const VFPInjTable& data,
packSize(data.getFloType(), comm) +
packSize(data.getFloAxis(), comm) +
packSize(data.getTHPAxis(), comm) +
data.getTable().num_elements() *
packSize(double(), comm);
packSize(data.getTable(), comm);
}
std::size_t packSize(const VFPProdTable& data,
@ -2851,8 +2850,7 @@ void pack(const VFPInjTable& data,
pack(data.getFloType(), buffer, position, comm);
pack(data.getFloAxis(), buffer, position, comm);
pack(data.getTHPAxis(), buffer, position, comm);
for (size_t i = 0; i < data.getTable().num_elements(); ++i)
pack(*(data.getTable().data() + i), buffer, position, comm);
pack(data.getTable(), buffer, position, comm);
}
void pack(const VFPProdTable& data,
@ -5042,12 +5040,7 @@ void unpack(VFPInjTable& data,
unpack(floType, buffer, position, comm);
unpack(floAxis, buffer, position, comm);
unpack(thpAxis, buffer, position, comm);
VFPInjTable::extents extents;
extents[0] = thpAxis.size();
extents[1] = floAxis.size();
table.resize(extents);
for (size_t i = 0; i < table.num_elements(); ++i)
unpack(*(table.data() + i), buffer, position, comm);
unpack(table, buffer, position, comm);
data = VFPInjTable(tableNum, datumDepth, floType,
floAxis, thpAxis, table);

View File

@ -449,7 +449,7 @@ inline VFPEvaluation interpolate(
* which performs 5D interpolation, but here for the 2D case only
*/
inline VFPEvaluation interpolate(
const VFPInjTable::array_type& array,
const VFPInjTable& table,
const InterpData& flo_i,
const InterpData& thp_i) {
@ -466,7 +466,7 @@ inline VFPEvaluation interpolate(
const int fi = flo_i.ind_[f];
//Copy element
nn[t][f].value = array[ti][fi];
nn[t][f].value = table(ti,fi);
}
}
@ -544,7 +544,7 @@ inline VFPEvaluation bhp(const VFPInjTable* table,
auto thp_i = detail::findInterpData(thp, table->getTHPAxis());
//Then perform the interpolation itself
detail::VFPEvaluation retval = detail::interpolate(table->getTable(), flo_i, thp_i);
detail::VFPEvaluation retval = detail::interpolate(*table, flo_i, thp_i);
return retval;
}

View File

@ -67,7 +67,6 @@ double VFPInjProperties::thp(int table_id,
const double& vapour,
const double& bhp_arg) const {
const VFPInjTable* table = detail::getTable(m_tables, table_id);
const VFPInjTable::array_type& data = table->getTable();
//Find interpolation variables
double flo = detail::getFlo(aqua, liquid, vapour, table->getFloType());
@ -84,7 +83,7 @@ double VFPInjProperties::thp(int table_id,
std::vector<double> bhp_array(nthp);
for (int i=0; i<nthp; ++i) {
auto thp_i = detail::findInterpData(thp_array[i], thp_array);
bhp_array[i] = detail::interpolate(data, flo_i, thp_i).value;
bhp_array[i] = detail::interpolate(*table, flo_i, thp_i).value;
}
double retval = detail::findTHP(bhp_array, thp_array, bhp_arg);

View File

@ -91,7 +91,7 @@ public:
auto flo_i = detail::findInterpData(flo.value(), table->getFloAxis());
auto thp_i = detail::findInterpData( thp, table->getTHPAxis()); // assume constant
detail::VFPEvaluation bhp_val = detail::interpolate(table->getTable(), flo_i, thp_i);
detail::VFPEvaluation bhp_val = detail::interpolate(*table, flo_i, thp_i);
bhp = bhp_val.dflo * flo;
bhp.setValue(bhp_val.value); // thp is assumed constant i.e.

View File

@ -310,13 +310,9 @@ Opm::Well getFullWell()
Opm::VFPInjTable getVFPInjTable()
{
Opm::VFPInjTable::array_type table;
Opm::VFPInjTable::extents shape;
shape[0] = 3;
shape[1] = 2;
table.resize(shape);
double foo = 1.0;
for (size_t i = 0; i < table.num_elements(); ++i)
*(table.data() + i) = foo++;
table.resize(3*2);
std::iota(table.begin(), table.end(), 1.0);
return Opm::VFPInjTable(1, 2.0, Opm::VFPInjTable::FLO_WAT, {1.0, 2.0},
{3.0, 4.0, 5.0}, table);
}