mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add mpi serialization for WetGasPvt
This commit is contained in:
@@ -630,6 +630,25 @@ std::size_t packSize(const DryGasPvt<Scalar>& data,
|
||||
template std::size_t packSize(const DryGasPvt<double>& data,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Scalar>
|
||||
std::size_t packSize(const WetGasPvt<Scalar>& data,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.gasReferenceDensity(), comm) +
|
||||
packSize(data.oilReferenceDensity(), comm) +
|
||||
packSize(data.inverseGasB(), comm) +
|
||||
packSize(data.inverseSaturatedGasB(), comm) +
|
||||
packSize(data.gasMu(), comm) +
|
||||
packSize(data.inverseGasBMu(), comm) +
|
||||
packSize(data.inverseSaturatedGasBMu(), comm) +
|
||||
packSize(data.saturatedOilVaporizationFactorTable(), comm) +
|
||||
packSize(data.saturationPressure(), comm) +
|
||||
packSize(data.vapPar1(), comm);
|
||||
}
|
||||
|
||||
template std::size_t packSize(const WetGasPvt<double>& data,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
////// pack routines
|
||||
|
||||
template<class T>
|
||||
@@ -1258,6 +1277,26 @@ template void pack(const DryGasPvt<double>& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Scalar>
|
||||
void pack(const WetGasPvt<Scalar>& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.gasReferenceDensity(), buffer, position, comm);
|
||||
pack(data.oilReferenceDensity(), buffer, position, comm);
|
||||
pack(data.inverseGasB(), buffer, position, comm);
|
||||
pack(data.inverseSaturatedGasB(), buffer, position, comm);
|
||||
pack(data.gasMu(), buffer, position, comm);
|
||||
pack(data.inverseGasBMu(), buffer, position, comm);
|
||||
pack(data.inverseSaturatedGasBMu(), buffer, position, comm);
|
||||
pack(data.saturatedOilVaporizationFactorTable(), buffer, position, comm);
|
||||
pack(data.saturationPressure(), buffer, position, comm);
|
||||
pack(data.vapPar1(), buffer, position, comm);
|
||||
}
|
||||
|
||||
template void pack(const WetGasPvt<double>& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
/// unpack routines
|
||||
|
||||
template<class T>
|
||||
@@ -2060,6 +2099,39 @@ template void unpack(DryGasPvt<double>& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Scalar>
|
||||
void unpack(WetGasPvt<Scalar>& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
std::vector<Scalar> gasReferenceDensity, oilReferenceDensity;
|
||||
std::vector<typename WetGasPvt<Scalar>::TabulatedTwoDFunction> inverseGasB;
|
||||
std::vector<typename WetGasPvt<Scalar>::TabulatedOneDFunction> inverseSaturatedGasB;
|
||||
std::vector<typename WetGasPvt<Scalar>::TabulatedTwoDFunction> gasMu;
|
||||
std::vector<typename WetGasPvt<Scalar>::TabulatedTwoDFunction> inverseGasBMu;
|
||||
std::vector<typename WetGasPvt<Scalar>::TabulatedOneDFunction> inverseSaturatedGasBMu;
|
||||
std::vector<typename WetGasPvt<Scalar>::TabulatedOneDFunction> satOilVapFacTable;
|
||||
std::vector<typename WetGasPvt<Scalar>::TabulatedOneDFunction> saturationPressure;
|
||||
Scalar vapPar1;
|
||||
unpack(gasReferenceDensity, buffer, position, comm);
|
||||
unpack(oilReferenceDensity, buffer, position, comm);
|
||||
unpack(inverseGasB, buffer, position, comm);
|
||||
unpack(inverseSaturatedGasB, buffer, position, comm);
|
||||
unpack(gasMu, buffer, position, comm);
|
||||
unpack(inverseGasBMu, buffer, position, comm);
|
||||
unpack(inverseSaturatedGasBMu, buffer, position, comm);
|
||||
unpack(satOilVapFacTable, buffer, position, comm);
|
||||
unpack(saturationPressure, buffer, position, comm);
|
||||
unpack(vapPar1, buffer, position, comm);
|
||||
data = WetGasPvt<Scalar>(gasReferenceDensity, oilReferenceDensity, inverseGasB,
|
||||
inverseSaturatedGasB, gasMu, inverseGasBMu,
|
||||
inverseSaturatedGasBMu, satOilVapFacTable,
|
||||
saturationPressure, vapPar1);
|
||||
}
|
||||
|
||||
template void unpack(WetGasPvt<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,
|
||||
|
||||
@@ -23,10 +23,12 @@
|
||||
#include <mpi.h>
|
||||
#endif
|
||||
|
||||
#include <opm/material/fluidsystems/blackoilpvt/SolventPvt.hpp>
|
||||
#include <opm/material/common/Tabulated1DFunction.hpp>
|
||||
#include <opm/material/common/IntervalTabulated2DFunction.hpp>
|
||||
#include <opm/material/common/UniformXTabulated2DFunction.hpp>
|
||||
#include <opm/material/fluidsystems/blackoilpvt/DryGasPvt.hpp>
|
||||
#include <opm/material/fluidsystems/blackoilpvt/SolventPvt.hpp>
|
||||
#include <opm/material/fluidsystems/blackoilpvt/WetGasPvt.hpp>
|
||||
#include <opm/output/eclipse/RestartValue.hpp>
|
||||
#include <opm/output/eclipse/EclipseIO.hpp>
|
||||
#include <opm/output/eclipse/Summary.hpp>
|
||||
@@ -164,6 +166,9 @@ std::size_t packSize(const SolventPvt<Scalar>& data, Dune::MPIHelper::MPICommuni
|
||||
template<class Scalar>
|
||||
std::size_t packSize(const DryGasPvt<Scalar>& data, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Scalar>
|
||||
std::size_t packSize(const WetGasPvt<Scalar>& data, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
////// pack routines
|
||||
|
||||
template<class T>
|
||||
@@ -243,6 +248,10 @@ template<class Scalar>
|
||||
void pack(const DryGasPvt<Scalar>& data, std::vector<char>& buffer,
|
||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Scalar>
|
||||
void pack(const WetGasPvt<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);
|
||||
|
||||
@@ -325,6 +334,10 @@ template<class Scalar>
|
||||
void unpack(DryGasPvt<Scalar>& data, std::vector<char>& buffer,
|
||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Scalar>
|
||||
void unpack(WetGasPvt<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);
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <opm/simulators/utils/ParallelRestart.hpp>
|
||||
#include <opm/material/fluidsystems/blackoilpvt/DryGasPvt.hpp>
|
||||
#include <opm/material/fluidsystems/blackoilpvt/SolventPvt.hpp>
|
||||
#include <opm/material/fluidsystems/blackoilpvt/WetGasPvt.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Edit/EDITNNC.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
|
||||
@@ -1037,6 +1038,27 @@ BOOST_AUTO_TEST_CASE(DryGasPvt)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(WetGasPvt)
|
||||
{
|
||||
#ifdef HAVE_MPI
|
||||
Opm::Tabulated1DFunction<double> func(2, std::vector<double>{1.0, 2.0},
|
||||
std::vector<double>{3.0, 4.0});
|
||||
std::vector<double> xPos{1.0, 2.0};
|
||||
std::vector<double> yPos{3.0, 4.0};
|
||||
using FFuncType = Opm::UniformXTabulated2DFunction<double>;
|
||||
using Samples = std::vector<std::vector<FFuncType::SamplePoint>>;
|
||||
Samples samples({{{1.0, 2.0, 3.0}, {3.0, 4.0, 5.0}}});
|
||||
FFuncType func2(xPos, yPos, samples, FFuncType::Vertical);
|
||||
Opm::WetGasPvt<double> val1({1.0, 2.0}, {3.0, 4.0},
|
||||
{func2}, {func}, {func2},
|
||||
{func2}, {func}, {func}, {func}, 5.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;
|
||||
|
||||
Reference in New Issue
Block a user