add mpi serialization for OilVaporizationProperties

This commit is contained in:
Arne Morten Kvarving
2019-12-06 23:04:44 +01:00
parent f4c875ad3e
commit 1e145194c4
3 changed files with 64 additions and 0 deletions

View File

@@ -30,6 +30,7 @@
#include <opm/parser/eclipse/EclipseState/IOConfig/IOConfig.hpp> #include <opm/parser/eclipse/EclipseState/IOConfig/IOConfig.hpp>
#include <opm/parser/eclipse/EclipseState/IOConfig/RestartConfig.hpp> #include <opm/parser/eclipse/EclipseState/IOConfig/RestartConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Edit/EDITNNC.hpp> #include <opm/parser/eclipse/EclipseState/Edit/EDITNNC.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
#include <opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp> #include <opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp>
#include <opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp> #include <opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp>
@@ -865,6 +866,17 @@ std::size_t packSize(const WaterPvtThermal<Scalar>& data,
template std::size_t packSize(const WaterPvtThermal<double>& data, template std::size_t packSize(const WaterPvtThermal<double>& data,
Dune::MPIHelper::MPICommunicator comm); Dune::MPIHelper::MPICommunicator comm);
std::size_t packSize(const OilVaporizationProperties& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.getType(), comm) +
packSize(data.vap1(), comm) +
packSize(data.vap2(), comm) +
packSize(data.maxDRSDT(), comm) +
packSize(data.maxDRSDT_allCells(), comm) +
packSize(data.maxDRVDT(), comm);
}
////// pack routines ////// pack routines
template<class T> template<class T>
@@ -1740,6 +1752,18 @@ template void pack(const WaterPvtThermal<double>& data,
std::vector<char>& buffer, int& position, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm); Dune::MPIHelper::MPICommunicator comm);
void pack(const OilVaporizationProperties& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.getType(), buffer, position, comm);
pack(data.vap1(), buffer, position, comm);
pack(data.vap2(), buffer, position, comm);
pack(data.maxDRSDT(), buffer, position, comm);
pack(data.maxDRSDT_allCells(), buffer, position, comm);
pack(data.maxDRVDT(), buffer, position, comm);
}
/// unpack routines /// unpack routines
template<class T> template<class T>
@@ -2914,6 +2938,23 @@ template void unpack(WaterPvtThermal<double>& data,
std::vector<char>& buffer, int& position, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm); Dune::MPIHelper::MPICommunicator comm);
void unpack(OilVaporizationProperties& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
OilVaporizationProperties::OilVaporization type;
std::vector<double> vap1, vap2, maxDRSDT, maxDRVDT;
std::vector<bool> maxDRSDT_allCells;
unpack(type, buffer, position, comm);
unpack(vap1, buffer, position, comm);
unpack(vap2, buffer, position, comm);
unpack(maxDRSDT, buffer, position, comm);
unpack(maxDRSDT_allCells, buffer, position, comm);
unpack(maxDRVDT, buffer, position, comm);
data = OilVaporizationProperties(type, vap1, vap2, maxDRSDT,
maxDRSDT_allCells, maxDRVDT);
}
} // end namespace Mpi } // end namespace Mpi
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState, RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,
const std::vector<Opm::RestartKey>& solutionKeys, const std::vector<Opm::RestartKey>& solutionKeys,

View File

@@ -71,6 +71,7 @@ class IOConfig;
class JFunc; class JFunc;
class NNC; class NNC;
struct NNCdata; struct NNCdata;
class OilVaporizationProperties;
class Phases; class Phases;
class PlymwinjTable; class PlymwinjTable;
class PolyInjTable; class PolyInjTable;
@@ -509,6 +510,7 @@ ADD_PACK_PROTOTYPES(IOConfig)
ADD_PACK_PROTOTYPES(JFunc) ADD_PACK_PROTOTYPES(JFunc)
ADD_PACK_PROTOTYPES(NNC) ADD_PACK_PROTOTYPES(NNC)
ADD_PACK_PROTOTYPES(NNCdata) ADD_PACK_PROTOTYPES(NNCdata)
ADD_PACK_PROTOTYPES(OilVaporizationProperties)
ADD_PACK_PROTOTYPES(Phases) ADD_PACK_PROTOTYPES(Phases)
ADD_PACK_PROTOTYPES(PlymwinjTable) ADD_PACK_PROTOTYPES(PlymwinjTable)
ADD_PACK_PROTOTYPES(PolyInjTable) ADD_PACK_PROTOTYPES(PolyInjTable)

View File

@@ -36,6 +36,7 @@
#include <opm/parser/eclipse/EclipseState/InitConfig/InitConfig.hpp> #include <opm/parser/eclipse/EclipseState/InitConfig/InitConfig.hpp>
#include <opm/parser/eclipse/EclipseState/IOConfig/IOConfig.hpp> #include <opm/parser/eclipse/EclipseState/IOConfig/IOConfig.hpp>
#include <opm/parser/eclipse/EclipseState/IOConfig/RestartConfig.hpp> #include <opm/parser/eclipse/EclipseState/IOConfig/RestartConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
#include <opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp> #include <opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp>
#include <opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp> #include <opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp>
@@ -1165,6 +1166,26 @@ BOOST_AUTO_TEST_CASE(WaterPvtThermal)
} }
BOOST_AUTO_TEST_CASE(OilVaporizationProperties)
{
#ifdef HAVE_MPI
using VapType = Opm::OilVaporizationProperties::OilVaporization;
Opm::OilVaporizationProperties val1(VapType::VAPPARS,
{1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0},
{false, true}, {7.0, 8.0});
auto val2 = PackUnpack(val1);
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
BOOST_CHECK(val1 == std::get<0>(val2));
val1 = Opm::OilVaporizationProperties(VapType::DRDT,
{1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0},
{false, true}, {7.0, 8.0});
val2 = PackUnpack(val1);
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
BOOST_CHECK(val1 == std::get<0>(val2));
#endif
}
bool init_unit_test_func() bool init_unit_test_func()
{ {
return true; return true;