add mpi serialization for WellEconProductionLimits

This commit is contained in:
Arne Morten Kvarving 2019-12-10 13:20:10 +01:00
parent 9915b046eb
commit c909075f16
3 changed files with 95 additions and 0 deletions

View File

@ -1010,6 +1010,26 @@ std::size_t packSize(const Well::WellInjectionProperties& data,
packSize(data.controlMode, comm);
}
std::size_t packSize(const WellEconProductionLimits& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.minOilRate(), comm) +
packSize(data.minGasRate(), comm) +
packSize(data.maxWaterCut(), comm) +
packSize(data.maxGasOilRatio(), comm) +
packSize(data.maxWaterGasRatio(), comm) +
packSize(data.workover(), comm) +
packSize(data.endRun(), comm) +
packSize(data.followonWell(), comm) +
packSize(data.quantityLimit(), comm) +
packSize(data.maxSecondaryMaxWaterCut(), comm) +
packSize(data.workoverSecondary(), comm) +
packSize(data.maxGasLiquidRatio(), comm) +
packSize(data.minLiquidRate(), comm) +
packSize(data.maxTemperature(), comm) +
packSize(data.minReservoirFluidRate(), comm);
}
////// pack routines
template<class T>
@ -2032,6 +2052,27 @@ void pack(const Well::WellInjectionProperties& data,
pack(data.controlMode, buffer, position, comm);
}
void pack(const WellEconProductionLimits& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.minOilRate(), buffer, position, comm);
pack(data.minGasRate(), buffer, position, comm);
pack(data.maxWaterCut(), buffer, position, comm);
pack(data.maxGasOilRatio(), buffer, position, comm);
pack(data.maxWaterGasRatio(), buffer, position, comm);
pack(data.workover(), buffer, position, comm);
pack(data.endRun(), buffer, position, comm);
pack(data.followonWell(), buffer, position, comm);
pack(data.quantityLimit(), buffer, position, comm);
pack(data.maxSecondaryMaxWaterCut(), buffer, position, comm);
pack(data.workoverSecondary(), buffer, position, comm);
pack(data.maxGasLiquidRatio(), buffer, position, comm);
pack(data.minLiquidRate(), buffer, position, comm);
pack(data.maxTemperature(), buffer, position, comm);
pack(data.minReservoirFluidRate(), buffer, position, comm);
}
/// unpack routines
template<class T>
@ -3426,6 +3467,41 @@ void unpack(Well::WellInjectionProperties& data,
unpack(data.controlMode, buffer, position, comm);
}
void unpack(WellEconProductionLimits& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
double minOilRate, minGasRate, maxWaterCut, maxGasOilRatio, maxWaterGasRatio;
WellEconProductionLimits::EconWorkover workover, workoverSecondary;
bool endRun;
std::string followonWell;
WellEconProductionLimits::QuantityLimit quantityLimit;
double secondaryMaxWaterCut, maxGasLiquidRatio, minLiquidRate,
maxTemperature, minReservoirFluidRate;
unpack(minOilRate, buffer, position, comm);
unpack(minGasRate, buffer, position, comm);
unpack(maxWaterCut, buffer, position, comm);
unpack(maxGasOilRatio, buffer, position, comm);
unpack(maxWaterGasRatio, buffer, position, comm);
unpack(workover, buffer, position, comm);
unpack(endRun, buffer, position, comm);
unpack(followonWell, buffer, position, comm);
unpack(quantityLimit, buffer, position, comm);
unpack(secondaryMaxWaterCut, buffer, position, comm);
unpack(workoverSecondary, buffer, position, comm);
unpack(maxGasLiquidRatio, buffer, position, comm);
unpack(minLiquidRate, buffer, position, comm);
unpack(maxTemperature, buffer, position, comm);
unpack(minReservoirFluidRate, buffer, position, comm);
data = WellEconProductionLimits(minOilRate, minGasRate, maxWaterCut,
maxGasOilRatio, maxWaterGasRatio,
workover, endRun, followonWell,
quantityLimit, secondaryMaxWaterCut,
workoverSecondary, maxGasLiquidRatio,
minLiquidRate, maxTemperature,
minReservoirFluidRate);
}
#define INSTANTIATE_PACK_VECTOR(T) \
template std::size_t packSize(const std::vector<T>& data, \
Dune::MPIHelper::MPICommunicator comm); \

View File

@ -115,6 +115,7 @@ class ViscrefTable;
class WATDENTRecord;
class WatdentTable;
class Welldims;
class WellEconProductionLimits;
class WellFoamProperties;
class WellPolymerProperties;
class WellSegmentDims;
@ -581,6 +582,7 @@ ADD_PACK_PROTOTYPES(WATDENTRecord)
ADD_PACK_PROTOTYPES(WatdentTable)
ADD_PACK_PROTOTYPES(Well::WellInjectionProperties)
ADD_PACK_PROTOTYPES(Welldims)
ADD_PACK_PROTOTYPES(WellEconProductionLimits)
ADD_PACK_PROTOTYPES(WellFoamProperties)
ADD_PACK_PROTOTYPES(WellPolymerProperties)
ADD_PACK_PROTOTYPES(WellSegmentDims)

View File

@ -1400,6 +1400,23 @@ BOOST_AUTO_TEST_CASE(WellInjectionProperties)
}
BOOST_AUTO_TEST_CASE(WellEconProductionLimits)
{
#ifdef HAVE_MPI
Opm::WellEconProductionLimits val1(1.0, 2.0, 3.0, 4.0, 5.0,
Opm::WellEconProductionLimits::EconWorkover::CONP,
true, "test",
Opm::WellEconProductionLimits::QuantityLimit::POTN,
6.0,
Opm::WellEconProductionLimits::EconWorkover::WELL,
7.0, 8.0, 9.0, 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;