diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index d4301395a..e4abf4283 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -865,6 +866,17 @@ std::size_t packSize(const WaterPvtThermal& data, template std::size_t packSize(const WaterPvtThermal& data, 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 template @@ -1740,6 +1752,18 @@ template void pack(const WaterPvtThermal& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); +void pack(const OilVaporizationProperties& data, + std::vector& 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 template @@ -2914,6 +2938,23 @@ template void unpack(WaterPvtThermal& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); +void unpack(OilVaporizationProperties& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + OilVaporizationProperties::OilVaporization type; + std::vector vap1, vap2, maxDRSDT, maxDRVDT; + std::vector 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 RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState, const std::vector& solutionKeys, diff --git a/opm/simulators/utils/ParallelRestart.hpp b/opm/simulators/utils/ParallelRestart.hpp index 47e7f77d2..d43d8b4e3 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -71,6 +71,7 @@ class IOConfig; class JFunc; class NNC; struct NNCdata; +class OilVaporizationProperties; class Phases; class PlymwinjTable; class PolyInjTable; @@ -509,6 +510,7 @@ ADD_PACK_PROTOTYPES(IOConfig) ADD_PACK_PROTOTYPES(JFunc) ADD_PACK_PROTOTYPES(NNC) ADD_PACK_PROTOTYPES(NNCdata) +ADD_PACK_PROTOTYPES(OilVaporizationProperties) ADD_PACK_PROTOTYPES(Phases) ADD_PACK_PROTOTYPES(PlymwinjTable) ADD_PACK_PROTOTYPES(PolyInjTable) diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index 5275822d9..a00908a1e 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -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() { return true;