diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index 6453f626f..b6c313b28 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -1062,6 +1063,22 @@ std::size_t packSize(const Well::WellProductionProperties& data, packSize(data.getNumProductionControls(), comm); } +std::size_t packSize(const SpiralICD& data, + Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(data.strength(), comm) + + packSize(data.length(), comm) + + packSize(data.densityCalibration(), comm) + + packSize(data.viscosityCalibration(), comm) + + packSize(data.criticalValue(), comm) + + packSize(data.widthTransitionRegion(), comm) + + packSize(data.maxViscosityRatio(), comm) + + packSize(data.methodFlowScaling(), comm) + + packSize(data.maxAbsoluteRate(), comm) + + packSize(data.status(), comm) + + packSize(data.scalingFactor(), comm); +} + ////// pack routines template @@ -2137,6 +2154,23 @@ void pack(const Well::WellProductionProperties& data, pack(data.getNumProductionControls(), buffer, position, comm); } +void pack(const SpiralICD& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(data.strength(), buffer, position, comm); + pack(data.length(), buffer, position, comm); + pack(data.densityCalibration(), buffer, position, comm); + pack(data.viscosityCalibration(), buffer, position, comm); + pack(data.criticalValue(), buffer, position, comm); + pack(data.widthTransitionRegion(), buffer, position, comm); + pack(data.maxViscosityRatio(), buffer, position, comm); + pack(data.methodFlowScaling(), buffer, position, comm); + pack(data.maxAbsoluteRate(), buffer, position, comm); + pack(data.status(), buffer, position, comm); + pack(data.scalingFactor(), buffer, position, comm); +} + /// unpack routines template @@ -3619,6 +3653,37 @@ void unpack(Well::WellProductionProperties& data, whistctl_cmode, prodCtrls); } +void unpack(SpiralICD& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + double strength, length, densityCalibration, + viscosityCalibration, criticalValue, + widthTransitionRegion, maxViscosityRatio; + int methodFlowScaling; + double maxAbsoluteRate; + SpiralICD::Status status; + double scalingFactor; + + unpack(strength, buffer, position, comm); + unpack(length, buffer, position, comm); + unpack(densityCalibration, buffer, position, comm); + unpack(viscosityCalibration, buffer, position, comm); + unpack(criticalValue, buffer, position, comm); + unpack(widthTransitionRegion, buffer, position, comm); + unpack(maxViscosityRatio, buffer, position, comm); + unpack(methodFlowScaling, buffer, position, comm); + unpack(maxAbsoluteRate, buffer, position, comm); + unpack(status, buffer, position, comm); + unpack(scalingFactor, buffer, position, comm); + + data = SpiralICD(strength, length, densityCalibration, + viscosityCalibration, criticalValue, + widthTransitionRegion, maxViscosityRatio, + methodFlowScaling, maxAbsoluteRate, + status, scalingFactor); +} + #define INSTANTIATE_PACK_VECTOR(T) \ template std::size_t packSize(const std::vector& data, \ Dune::MPIHelper::MPICommunicator comm); \ diff --git a/opm/simulators/utils/ParallelRestart.hpp b/opm/simulators/utils/ParallelRestart.hpp index 4d0dc7a6f..c5a806349 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -100,6 +100,7 @@ class SimulationConfig; class SimpleTable; class SkprpolyTable; class SkprwatTable; +class SpiralICD; class Tabdims; class TableColumn; class TableContainer; @@ -565,6 +566,7 @@ ADD_PACK_PROTOTYPES(SimulationConfig) ADD_PACK_PROTOTYPES(SimpleTable) ADD_PACK_PROTOTYPES(SkprpolyTable) ADD_PACK_PROTOTYPES(SkprwatTable) +ADD_PACK_PROTOTYPES(SpiralICD) ADD_PACK_PROTOTYPES(Tabdims) ADD_PACK_PROTOTYPES(TableColumn) ADD_PACK_PROTOTYPES(TableContainer) diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index 442681e86..3244f855e 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -1468,6 +1469,18 @@ BOOST_AUTO_TEST_CASE(WellProductionProperties) } +BOOST_AUTO_TEST_CASE(SpiralICD) +{ +#ifdef HAVE_MPI + Opm::SpiralICD val1(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8, 9.0, + Opm::SpiralICD::Status::OPEN, 10.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;