add mpi serialization for ConstantCompressibilityWaterPvt

This commit is contained in:
Arne Morten Kvarving 2019-12-05 20:04:01 +01:00
parent fe4ed0466a
commit e56bbba99c
3 changed files with 85 additions and 0 deletions

View File

@ -799,6 +799,21 @@ std::size_t packSize(const OilPvtThermal<Scalar>& data,
template std::size_t packSize(const OilPvtThermal<double>& data,
Dune::MPIHelper::MPICommunicator comm);
template<class Scalar>
std::size_t packSize(const ConstantCompressibilityWaterPvt<Scalar>& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.waterReferenceDensity(), comm) +
packSize(data.waterReferencePressure(), comm) +
packSize(data.waterReferenceFormationVolumeFactor(), comm) +
packSize(data.waterCompressibility(), comm) +
packSize(data.waterViscosity(), comm) +
packSize(data.waterViscosibility(), comm);
}
template std::size_t packSize(const ConstantCompressibilityWaterPvt<double>& data,
Dune::MPIHelper::MPICommunicator comm);
////// pack routines
template<class T>
@ -1605,6 +1620,23 @@ template void pack(const OilPvtThermal<double>& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm);
template<class Scalar>
void pack(const ConstantCompressibilityWaterPvt<Scalar>& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.waterReferenceDensity(), buffer, position, comm);
pack(data.waterReferencePressure(), buffer, position, comm);
pack(data.waterReferenceFormationVolumeFactor(), buffer, position, comm);
pack(data.waterCompressibility(), buffer, position, comm);
pack(data.waterViscosity(), buffer, position, comm);
pack(data.waterViscosibility(), buffer, position, comm);
}
template void pack(const ConstantCompressibilityWaterPvt<double>& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm);
/// unpack routines
template<class T>
@ -2675,6 +2707,33 @@ template void unpack(OilPvtThermal<double>& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm);
template<class Scalar>
void unpack(ConstantCompressibilityWaterPvt<Scalar>& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::vector<Scalar> waterReferenceDensity, waterReferencePressure,
waterReferenceFormationVolumeFactor,
waterCompressibility, waterViscosity, waterViscosibility;
unpack(waterReferenceDensity, buffer, position, comm);
unpack(waterReferencePressure, buffer, position, comm);
unpack(waterReferenceFormationVolumeFactor, buffer, position, comm);
unpack(waterCompressibility, buffer, position, comm);
unpack(waterViscosity, buffer, position, comm);
unpack(waterViscosibility, buffer, position, comm);
data = ConstantCompressibilityWaterPvt<Scalar>(waterReferenceDensity,
waterReferencePressure,
waterReferenceFormationVolumeFactor,
waterCompressibility,
waterViscosity,
waterViscosibility);
}
template void unpack(ConstantCompressibilityWaterPvt<double>& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm);
} // end namespace Mpi
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,
const std::vector<Opm::RestartKey>& solutionKeys,

View File

@ -27,6 +27,7 @@
#include <opm/material/common/IntervalTabulated2DFunction.hpp>
#include <opm/material/common/UniformXTabulated2DFunction.hpp>
#include <opm/material/fluidsystems/blackoilpvt/ConstantCompressibilityOilPvt.hpp>
#include <opm/material/fluidsystems/blackoilpvt/ConstantCompressibilityWaterPvt.hpp>
#include <opm/material/fluidsystems/blackoilpvt/DeadOilPvt.hpp>
#include <opm/material/fluidsystems/blackoilpvt/DryGasPvt.hpp>
#include <opm/material/fluidsystems/blackoilpvt/GasPvtMultiplexer.hpp>
@ -200,6 +201,10 @@ std::size_t packSize(const LiveOilPvt<Scalar>& data,
template<class Scalar>
std::size_t packSize(const OilPvtThermal<Scalar>& data, Dune::MPIHelper::MPICommunicator comm);
template<class Scalar>
std::size_t packSize(const ConstantCompressibilityWaterPvt<Scalar>& data,
Dune::MPIHelper::MPICommunicator comm);
////// pack routines
template<class T>
@ -316,6 +321,11 @@ template<class Scalar>
void pack(const OilPvtThermal<Scalar>& data, std::vector<char>& buffer,
int& position, Dune::MPIHelper::MPICommunicator comm);
template<class Scalar>
void pack(const ConstantCompressibilityWaterPvt<Scalar>& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm);
void pack(const char* str, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm);
@ -432,6 +442,10 @@ template<class Scalar>
void unpack(OilPvtThermal<Scalar>& data, std::vector<char>& buffer,
int& position, Dune::MPIHelper::MPICommunicator comm);
template<class Scalar>
void unpack(ConstantCompressibilityWaterPvt<Scalar>& data, std::vector<char>& buffer,
int& position, Dune::MPIHelper::MPICommunicator comm);
void unpack(char* str, std::size_t length, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm);

View File

@ -1136,6 +1136,18 @@ BOOST_AUTO_TEST_CASE(OilPvtThermal)
}
BOOST_AUTO_TEST_CASE(ConstantCompressibilityWaterPvt)
{
#ifdef HAVE_MPI
Opm::ConstantCompressibilityWaterPvt<double> val1({1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0},
{7.0, 8.0}, {9.0, 10.0}, {11.0, 12.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;