mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add mpi serialization for GuideRateConfig
This commit is contained in:
parent
805f68fdee
commit
5de7605863
@ -288,6 +288,8 @@ HANDLE_AS_POD(EclHysterConfig)
|
||||
HANDLE_AS_POD(Eqldims)
|
||||
HANDLE_AS_POD(EquilRecord)
|
||||
HANDLE_AS_POD(FoamData)
|
||||
HANDLE_AS_POD(GuideRateConfig::GroupTarget);
|
||||
HANDLE_AS_POD(GuideRateConfig::WellTarget);
|
||||
HANDLE_AS_POD(JFunc)
|
||||
HANDLE_AS_POD(MLimits)
|
||||
HANDLE_AS_POD(PVTWRecord)
|
||||
@ -1404,6 +1406,14 @@ std::size_t packSize(const GuideRateModel& data,
|
||||
packSize(data.udaCoefs(), comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const GuideRateConfig& data,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.getModel(), comm) +
|
||||
packSize(data.getWells(), comm) +
|
||||
packSize(data.getGroups(), comm);
|
||||
}
|
||||
|
||||
////// pack routines
|
||||
|
||||
template<class T>
|
||||
@ -2831,6 +2841,15 @@ void pack(const GuideRateModel& data,
|
||||
pack(data.udaCoefs(), buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const GuideRateConfig& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.getModel(), buffer, position, comm);
|
||||
pack(data.getWells(), buffer, position, comm);
|
||||
pack(data.getGroups(), buffer, position, comm);
|
||||
}
|
||||
|
||||
/// unpack routines
|
||||
|
||||
template<class T>
|
||||
@ -4838,6 +4857,20 @@ void unpack(GuideRateModel& data,
|
||||
damping_factor, free_gas, defaultModel, udaCoefs);
|
||||
}
|
||||
|
||||
void unpack(GuideRateConfig& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
std::shared_ptr<GuideRateModel> model;
|
||||
std::unordered_map<std::string, GuideRateConfig::WellTarget> wells;
|
||||
std::unordered_map<std::string, GuideRateConfig::GroupTarget> groups;
|
||||
|
||||
unpack(model, buffer, position, comm);
|
||||
unpack(wells, buffer, position, comm);
|
||||
unpack(groups, buffer, position, comm);
|
||||
data = GuideRateConfig(model, wells, groups);
|
||||
}
|
||||
|
||||
#define INSTANTIATE_PACK_VECTOR(T) \
|
||||
template std::size_t packSize(const std::vector<T>& data, \
|
||||
Dune::MPIHelper::MPICommunicator comm); \
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicVector.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQAssign.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQActive.hpp>
|
||||
@ -75,7 +76,6 @@ class EquilRecord;
|
||||
class Events;
|
||||
class FoamConfig;
|
||||
class FoamData;
|
||||
class GuideRateModel;
|
||||
class InitConfig;
|
||||
class IOConfig;
|
||||
template<class T> class IOrderSet;
|
||||
@ -601,6 +601,9 @@ ADD_PACK_PROTOTYPES(EquilRecord)
|
||||
ADD_PACK_PROTOTYPES(Events)
|
||||
ADD_PACK_PROTOTYPES(FoamConfig)
|
||||
ADD_PACK_PROTOTYPES(FoamData)
|
||||
ADD_PACK_PROTOTYPES(GuideRateConfig)
|
||||
ADD_PACK_PROTOTYPES(GuideRateConfig::GroupTarget)
|
||||
ADD_PACK_PROTOTYPES(GuideRateConfig::WellTarget)
|
||||
ADD_PACK_PROTOTYPES(GuideRateModel)
|
||||
ADD_PACK_PROTOTYPES(Group)
|
||||
ADD_PACK_PROTOTYPES(Group::GroupInjectionProperties)
|
||||
|
@ -350,6 +350,18 @@ Opm::GuideRateModel getGuideRateModel()
|
||||
#endif
|
||||
|
||||
|
||||
Opm::GuideRateConfig::GroupTarget getGuideRateConfigGroup()
|
||||
{
|
||||
return Opm::GuideRateConfig::GroupTarget{1.0, Opm::Group::GuideRateTarget::COMB};
|
||||
}
|
||||
|
||||
|
||||
Opm::GuideRateConfig::WellTarget getGuideRateConfigWell()
|
||||
{
|
||||
return Opm::GuideRateConfig::WellTarget{1.0, Opm::Well::GuideRateTarget::COMB, 2.0};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1854,6 +1866,42 @@ BOOST_AUTO_TEST_CASE(GuideRateModel)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(GuideRateConfigGroup)
|
||||
{
|
||||
#ifdef HAVE_MPI
|
||||
Opm::GuideRateConfig::GroupTarget val1 = getGuideRateConfigGroup();
|
||||
auto val2 = PackUnpack(val1);
|
||||
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
|
||||
BOOST_CHECK(val1 == std::get<0>(val2));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(GuideRateConfigWell)
|
||||
{
|
||||
#ifdef HAVE_MPI
|
||||
Opm::GuideRateConfig::WellTarget val1 = getGuideRateConfigWell();
|
||||
auto val2 = PackUnpack(val1);
|
||||
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
|
||||
BOOST_CHECK(val1 == std::get<0>(val2));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(GuideRateConfig)
|
||||
{
|
||||
#ifdef HAVE_MPI
|
||||
auto model = std::make_shared<Opm::GuideRateModel>(getGuideRateModel());
|
||||
Opm::GuideRateConfig val1(model,
|
||||
{{"test1", getGuideRateConfigWell()}},
|
||||
{{"test2", getGuideRateConfigGroup()}});
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user