diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index 64f29f1ec..ff0505f3f 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -799,6 +799,21 @@ std::size_t packSize(const OilPvtThermal& data, template std::size_t packSize(const OilPvtThermal& data, Dune::MPIHelper::MPICommunicator comm); +template +std::size_t packSize(const ConstantCompressibilityWaterPvt& data, + Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(data.waterReferenceDensity(), comm) + + packSize(data.waterReferencePressure(), comm) + + packSize(data.waterReferenceFormationVolumeFactor(), comm) + + packSize(data.waterCompressibility(), comm) + + packSize(data.waterViscosity(), comm) + + packSize(data.waterViscosibility(), comm); +} + +template std::size_t packSize(const ConstantCompressibilityWaterPvt& data, + Dune::MPIHelper::MPICommunicator comm); + ////// pack routines template @@ -1605,6 +1620,23 @@ template void pack(const OilPvtThermal& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); +template +void pack(const ConstantCompressibilityWaterPvt& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(data.waterReferenceDensity(), buffer, position, comm); + pack(data.waterReferencePressure(), buffer, position, comm); + pack(data.waterReferenceFormationVolumeFactor(), buffer, position, comm); + pack(data.waterCompressibility(), buffer, position, comm); + pack(data.waterViscosity(), buffer, position, comm); + pack(data.waterViscosibility(), buffer, position, comm); +} + +template void pack(const ConstantCompressibilityWaterPvt& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm); + /// unpack routines template @@ -2675,6 +2707,33 @@ template void unpack(OilPvtThermal& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); +template +void unpack(ConstantCompressibilityWaterPvt& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + std::vector waterReferenceDensity, waterReferencePressure, + waterReferenceFormationVolumeFactor, + waterCompressibility, waterViscosity, waterViscosibility; + + unpack(waterReferenceDensity, buffer, position, comm); + unpack(waterReferencePressure, buffer, position, comm); + unpack(waterReferenceFormationVolumeFactor, buffer, position, comm); + unpack(waterCompressibility, buffer, position, comm); + unpack(waterViscosity, buffer, position, comm); + unpack(waterViscosibility, buffer, position, comm); + data = ConstantCompressibilityWaterPvt(waterReferenceDensity, + waterReferencePressure, + waterReferenceFormationVolumeFactor, + waterCompressibility, + waterViscosity, + waterViscosibility); +} + +template void unpack(ConstantCompressibilityWaterPvt& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm); + } // 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 e66d4ede7..9b73ecb5f 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -200,6 +201,10 @@ std::size_t packSize(const LiveOilPvt& data, template std::size_t packSize(const OilPvtThermal& data, Dune::MPIHelper::MPICommunicator comm); +template +std::size_t packSize(const ConstantCompressibilityWaterPvt& data, + Dune::MPIHelper::MPICommunicator comm); + ////// pack routines template @@ -316,6 +321,11 @@ template void pack(const OilPvtThermal& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); +template +void pack(const ConstantCompressibilityWaterPvt& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm); + void pack(const char* str, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); @@ -432,6 +442,10 @@ template void unpack(OilPvtThermal& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); +template +void unpack(ConstantCompressibilityWaterPvt& data, std::vector& buffer, + int& position, Dune::MPIHelper::MPICommunicator comm); + void unpack(char* str, std::size_t length, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index 475261e85..01dd855bd 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -1136,6 +1136,18 @@ BOOST_AUTO_TEST_CASE(OilPvtThermal) } +BOOST_AUTO_TEST_CASE(ConstantCompressibilityWaterPvt) +{ +#ifdef HAVE_MPI + Opm::ConstantCompressibilityWaterPvt val1({1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0}, + {7.0, 8.0}, {9.0, 10.0}, {11.0, 12.0}); + auto 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;