mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
adjust serialization for VFPInjTable
This commit is contained in:
parent
11e0e5b549
commit
649818730c
@ -1115,8 +1115,7 @@ std::size_t packSize(const VFPInjTable& data,
|
|||||||
packSize(data.getFloType(), comm) +
|
packSize(data.getFloType(), comm) +
|
||||||
packSize(data.getFloAxis(), comm) +
|
packSize(data.getFloAxis(), comm) +
|
||||||
packSize(data.getTHPAxis(), comm) +
|
packSize(data.getTHPAxis(), comm) +
|
||||||
data.getTable().num_elements() *
|
packSize(data.getTable(), comm);
|
||||||
packSize(double(), comm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t packSize(const VFPProdTable& data,
|
std::size_t packSize(const VFPProdTable& data,
|
||||||
@ -2851,8 +2850,7 @@ void pack(const VFPInjTable& data,
|
|||||||
pack(data.getFloType(), buffer, position, comm);
|
pack(data.getFloType(), buffer, position, comm);
|
||||||
pack(data.getFloAxis(), buffer, position, comm);
|
pack(data.getFloAxis(), buffer, position, comm);
|
||||||
pack(data.getTHPAxis(), buffer, position, comm);
|
pack(data.getTHPAxis(), buffer, position, comm);
|
||||||
for (size_t i = 0; i < data.getTable().num_elements(); ++i)
|
pack(data.getTable(), buffer, position, comm);
|
||||||
pack(*(data.getTable().data() + i), buffer, position, comm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void pack(const VFPProdTable& data,
|
void pack(const VFPProdTable& data,
|
||||||
@ -5042,12 +5040,7 @@ void unpack(VFPInjTable& data,
|
|||||||
unpack(floType, buffer, position, comm);
|
unpack(floType, buffer, position, comm);
|
||||||
unpack(floAxis, buffer, position, comm);
|
unpack(floAxis, buffer, position, comm);
|
||||||
unpack(thpAxis, buffer, position, comm);
|
unpack(thpAxis, buffer, position, comm);
|
||||||
VFPInjTable::extents extents;
|
unpack(table, buffer, position, comm);
|
||||||
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);
|
|
||||||
|
|
||||||
data = VFPInjTable(tableNum, datumDepth, floType,
|
data = VFPInjTable(tableNum, datumDepth, floType,
|
||||||
floAxis, thpAxis, table);
|
floAxis, thpAxis, table);
|
||||||
|
@ -449,7 +449,7 @@ inline VFPEvaluation interpolate(
|
|||||||
* which performs 5D interpolation, but here for the 2D case only
|
* which performs 5D interpolation, but here for the 2D case only
|
||||||
*/
|
*/
|
||||||
inline VFPEvaluation interpolate(
|
inline VFPEvaluation interpolate(
|
||||||
const VFPInjTable::array_type& array,
|
const VFPInjTable& table,
|
||||||
const InterpData& flo_i,
|
const InterpData& flo_i,
|
||||||
const InterpData& thp_i) {
|
const InterpData& thp_i) {
|
||||||
|
|
||||||
@ -466,7 +466,7 @@ inline VFPEvaluation interpolate(
|
|||||||
const int fi = flo_i.ind_[f];
|
const int fi = flo_i.ind_[f];
|
||||||
|
|
||||||
//Copy element
|
//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());
|
auto thp_i = detail::findInterpData(thp, table->getTHPAxis());
|
||||||
|
|
||||||
//Then perform the interpolation itself
|
//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;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,6 @@ double VFPInjProperties::thp(int table_id,
|
|||||||
const double& vapour,
|
const double& vapour,
|
||||||
const double& bhp_arg) const {
|
const double& bhp_arg) const {
|
||||||
const VFPInjTable* table = detail::getTable(m_tables, table_id);
|
const VFPInjTable* table = detail::getTable(m_tables, table_id);
|
||||||
const VFPInjTable::array_type& data = table->getTable();
|
|
||||||
|
|
||||||
//Find interpolation variables
|
//Find interpolation variables
|
||||||
double flo = detail::getFlo(aqua, liquid, vapour, table->getFloType());
|
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);
|
std::vector<double> bhp_array(nthp);
|
||||||
for (int i=0; i<nthp; ++i) {
|
for (int i=0; i<nthp; ++i) {
|
||||||
auto thp_i = detail::findInterpData(thp_array[i], thp_array);
|
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);
|
double retval = detail::findTHP(bhp_array, thp_array, bhp_arg);
|
||||||
|
@ -91,7 +91,7 @@ public:
|
|||||||
auto flo_i = detail::findInterpData(flo.value(), table->getFloAxis());
|
auto flo_i = detail::findInterpData(flo.value(), table->getFloAxis());
|
||||||
auto thp_i = detail::findInterpData( thp, table->getTHPAxis()); // assume constant
|
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 = bhp_val.dflo * flo;
|
||||||
bhp.setValue(bhp_val.value); // thp is assumed constant i.e.
|
bhp.setValue(bhp_val.value); // thp is assumed constant i.e.
|
||||||
|
@ -310,13 +310,9 @@ Opm::Well getFullWell()
|
|||||||
Opm::VFPInjTable getVFPInjTable()
|
Opm::VFPInjTable getVFPInjTable()
|
||||||
{
|
{
|
||||||
Opm::VFPInjTable::array_type table;
|
Opm::VFPInjTable::array_type table;
|
||||||
Opm::VFPInjTable::extents shape;
|
table.resize(3*2);
|
||||||
shape[0] = 3;
|
std::iota(table.begin(), table.end(), 1.0);
|
||||||
shape[1] = 2;
|
|
||||||
table.resize(shape);
|
|
||||||
double foo = 1.0;
|
|
||||||
for (size_t i = 0; i < table.num_elements(); ++i)
|
|
||||||
*(table.data() + i) = foo++;
|
|
||||||
return Opm::VFPInjTable(1, 2.0, Opm::VFPInjTable::FLO_WAT, {1.0, 2.0},
|
return Opm::VFPInjTable(1, 2.0, Opm::VFPInjTable::FLO_WAT, {1.0, 2.0},
|
||||||
{3.0, 4.0, 5.0}, table);
|
{3.0, 4.0, 5.0}, table);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user