add mpi serialization for SpiralICD

This commit is contained in:
Arne Morten Kvarving 2019-12-10 13:44:33 +01:00
parent 8ba5caadd4
commit 9baba1bae9
3 changed files with 80 additions and 0 deletions

View File

@ -32,6 +32,7 @@
#include <opm/parser/eclipse/EclipseState/Edit/EDITNNC.hpp> #include <opm/parser/eclipse/EclipseState/Edit/EDITNNC.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Events.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/Events.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MessageLimits.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/MessageLimits.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.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/Schedule/VFPInjTable.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.hpp>
@ -1062,6 +1063,22 @@ std::size_t packSize(const Well::WellProductionProperties& data,
packSize(data.getNumProductionControls(), comm); 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 ////// pack routines
template<class T> template<class T>
@ -2137,6 +2154,23 @@ void pack(const Well::WellProductionProperties& data,
pack(data.getNumProductionControls(), buffer, position, comm); pack(data.getNumProductionControls(), buffer, position, comm);
} }
void pack(const SpiralICD& data,
std::vector<char>& 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 /// unpack routines
template<class T> template<class T>
@ -3619,6 +3653,37 @@ void unpack(Well::WellProductionProperties& data,
whistctl_cmode, prodCtrls); whistctl_cmode, prodCtrls);
} }
void unpack(SpiralICD& data,
std::vector<char>& 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) \ #define INSTANTIATE_PACK_VECTOR(T) \
template std::size_t packSize(const std::vector<T>& data, \ template std::size_t packSize(const std::vector<T>& data, \
Dune::MPIHelper::MPICommunicator comm); \ Dune::MPIHelper::MPICommunicator comm); \

View File

@ -100,6 +100,7 @@ class SimulationConfig;
class SimpleTable; class SimpleTable;
class SkprpolyTable; class SkprpolyTable;
class SkprwatTable; class SkprwatTable;
class SpiralICD;
class Tabdims; class Tabdims;
class TableColumn; class TableColumn;
class TableContainer; class TableContainer;
@ -565,6 +566,7 @@ ADD_PACK_PROTOTYPES(SimulationConfig)
ADD_PACK_PROTOTYPES(SimpleTable) ADD_PACK_PROTOTYPES(SimpleTable)
ADD_PACK_PROTOTYPES(SkprpolyTable) ADD_PACK_PROTOTYPES(SkprpolyTable)
ADD_PACK_PROTOTYPES(SkprwatTable) ADD_PACK_PROTOTYPES(SkprwatTable)
ADD_PACK_PROTOTYPES(SpiralICD)
ADD_PACK_PROTOTYPES(Tabdims) ADD_PACK_PROTOTYPES(Tabdims)
ADD_PACK_PROTOTYPES(TableColumn) ADD_PACK_PROTOTYPES(TableColumn)
ADD_PACK_PROTOTYPES(TableContainer) ADD_PACK_PROTOTYPES(TableContainer)

View File

@ -38,6 +38,7 @@
#include <opm/parser/eclipse/EclipseState/IOConfig/RestartConfig.hpp> #include <opm/parser/eclipse/EclipseState/IOConfig/RestartConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Events.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/Events.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MessageLimits.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/MessageLimits.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.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/Schedule/VFPInjTable.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.hpp>
@ -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() bool init_unit_test_func()
{ {
return true; return true;