mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add mpi serialization for WellSegments
This commit is contained in:
parent
5bc506cd3b
commit
c31d209295
@ -1143,6 +1143,21 @@ std::size_t packSize(const UnitSystem& data,
|
||||
packSize(data.use_count(), comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const WellSegments& data,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.wellName(), comm) +
|
||||
packSize(data.depthTopSegment(), comm) +
|
||||
packSize(data.lengthTopSegment(), comm) +
|
||||
packSize(data.volumeTopSegment(), comm) +
|
||||
packSize(data.lengthDepthType(), comm) +
|
||||
packSize(data.compPressureDrop(), comm) +
|
||||
packSize(data.multiPhaseModel(), comm) +
|
||||
packSize(data.segments(), comm) +
|
||||
packSize(data.segmentNumberIndex(), comm);
|
||||
|
||||
}
|
||||
|
||||
////// pack routines
|
||||
|
||||
template<class T>
|
||||
@ -2300,6 +2315,21 @@ void pack(const UnitSystem& data,
|
||||
pack(data.use_count(), buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const WellSegments& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.wellName(), buffer, position, comm);
|
||||
pack(data.depthTopSegment(), buffer, position, comm);
|
||||
pack(data.lengthTopSegment(), buffer, position, comm);
|
||||
pack(data.volumeTopSegment(), buffer, position, comm);
|
||||
pack(data.lengthDepthType(), buffer, position, comm);
|
||||
pack(data.compPressureDrop(), buffer, position, comm);
|
||||
pack(data.multiPhaseModel(), buffer, position, comm);
|
||||
pack(data.segments(), buffer, position, comm);
|
||||
pack(data.segmentNumberIndex(), buffer, position, comm);
|
||||
}
|
||||
|
||||
/// unpack routines
|
||||
|
||||
template<class T>
|
||||
@ -3916,6 +3946,32 @@ void unpack(UnitSystem& data,
|
||||
data = UnitSystem(name, type, dimensions, use_count);
|
||||
}
|
||||
|
||||
void unpack(WellSegments& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
std::string wellName;
|
||||
double depthTopSegment, lengthTopSegment, volumeTopSegment;
|
||||
WellSegments::CompPressureDrop compPressureDrop;
|
||||
WellSegments::LengthDepth lengthDepthType;
|
||||
WellSegments::MultiPhaseModel multiPhaseModel;
|
||||
std::vector<Segment> segments;
|
||||
std::map<int,int> segmentNumberIndex;
|
||||
|
||||
unpack(wellName, buffer, position, comm);
|
||||
unpack(depthTopSegment, buffer, position, comm);
|
||||
unpack(lengthTopSegment, buffer, position, comm);
|
||||
unpack(volumeTopSegment, buffer, position, comm);
|
||||
unpack(lengthDepthType, buffer, position, comm);
|
||||
unpack(compPressureDrop, buffer, position, comm);
|
||||
unpack(multiPhaseModel, buffer, position, comm);
|
||||
unpack(segments, buffer, position, comm);
|
||||
unpack(segmentNumberIndex, buffer, position, comm);
|
||||
data = WellSegments(wellName, depthTopSegment, lengthTopSegment,
|
||||
volumeTopSegment, lengthDepthType, compPressureDrop,
|
||||
multiPhaseModel, segments, segmentNumberIndex);
|
||||
}
|
||||
|
||||
#define INSTANTIATE_PACK_VECTOR(T) \
|
||||
template std::size_t packSize(const std::vector<T>& data, \
|
||||
Dune::MPIHelper::MPICommunicator comm); \
|
||||
|
@ -125,6 +125,7 @@ class WellEconProductionLimits;
|
||||
class WellFoamProperties;
|
||||
class WellPolymerProperties;
|
||||
class WellSegmentDims;
|
||||
class WellSegments;
|
||||
class WellTracerProperties;
|
||||
|
||||
namespace Mpi
|
||||
@ -612,6 +613,7 @@ ADD_PACK_PROTOTYPES(WellEconProductionLimits)
|
||||
ADD_PACK_PROTOTYPES(WellFoamProperties)
|
||||
ADD_PACK_PROTOTYPES(WellPolymerProperties)
|
||||
ADD_PACK_PROTOTYPES(WellSegmentDims)
|
||||
ADD_PACK_PROTOTYPES(WellSegments)
|
||||
ADD_PACK_PROTOTYPES(WellTestConfig)
|
||||
ADD_PACK_PROTOTYPES(WellTestConfig::WTESTWell)
|
||||
ADD_PACK_PROTOTYPES(WellTracerProperties)
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellFoamProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellPolymerProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTracerProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/Aqudims.hpp>
|
||||
@ -1529,6 +1530,26 @@ BOOST_AUTO_TEST_CASE(UnitSystem)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(WellSegments)
|
||||
{
|
||||
#ifdef HAVE_MPI
|
||||
Opm::Segment seg(1, 2, 3, {1, 2}, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, false,
|
||||
Opm::Segment::SegmentType::SICD,
|
||||
std::make_shared<Opm::SpiralICD>(),
|
||||
std::make_shared<Opm::Valve>());
|
||||
Opm::WellSegments val1("test", 1.0, 2.0, 3.0,
|
||||
Opm::WellSegments::LengthDepth::ABS,
|
||||
Opm::WellSegments::CompPressureDrop::HF_,
|
||||
Opm::WellSegments::MultiPhaseModel::DF,
|
||||
{seg, seg}, {{1,2},{3,4}});
|
||||
|
||||
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