Merge pull request #2436 from akva2/no_serialization_matman

No need to serialize MaterialLawManager any longer
This commit is contained in:
Atgeirr Flø Rasmussen 2020-03-09 16:05:46 +01:00 committed by GitHub
commit 724adc31cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 18 additions and 130 deletions

View File

@ -2296,9 +2296,7 @@ private:
{
const auto& simulator = this->simulator();
const auto& vanguard = simulator.vanguard();
const auto& deck = vanguard.deck();
const auto& eclState = vanguard.eclState();
const auto& comm = vanguard.gridView().comm();
// the PVT and saturation region numbers
updatePvtnum_();
@ -2318,12 +2316,7 @@ private:
////////////////////////////////
// fluid-matrix interactions (saturation functions; relperm/capillary pressure)
materialLawManager_ = std::make_shared<EclMaterialLawManager>();
if (comm.rank() == 0)
materialLawManager_->initFromDeck(deck, eclState);
EclMpiSerializer ser(comm);
ser.broadcast(*materialLawManager_);
materialLawManager_->initFromState(eclState);
materialLawManager_->initParamsForElements(eclState, this->model().numGridDof());
////////////////////////////////
}

View File

@ -606,8 +606,7 @@ namespace Opm{
void RelpermDiagnostics::unscaledEndPointsCheck_(const Deck& deck,
const EclipseState& eclState)
void RelpermDiagnostics::unscaledEndPointsCheck_(const EclipseState& eclState)
{
// get the number of saturation regions and the number of cells in the deck
const int numSatRegions = eclState.runspec().tabdims().getNumSatTables();
@ -621,7 +620,7 @@ namespace Opm{
// std::cout << "***************\nEnd-Points In all the Tables\n";
for (int satnumIdx = 0; satnumIdx < numSatRegions; ++satnumIdx) {
unscaledEpsInfo_[satnumIdx].extractUnscaled(deck, eclState, satnumIdx);
unscaledEpsInfo_[satnumIdx].extractUnscaled(eclState, satnumIdx);
const std::string regionIdx = std::to_string(satnumIdx + 1);
///Consistency check.
if (unscaledEpsInfo_[satnumIdx].Sgu > (1. - unscaledEpsInfo_[satnumIdx].Swl)) {

View File

@ -92,8 +92,7 @@ namespace Opm {
void tableCheck_(const EclipseState& eclState);
///Check endpoints in the saturation tables.
void unscaledEndPointsCheck_(const Deck& deck,
const EclipseState& eclState);
void unscaledEndPointsCheck_(const EclipseState& eclState);
template <class GridT>
void scaledEndPointsCheck_(const Deck& deck,

View File

@ -40,7 +40,7 @@ namespace Opm {
phaseCheck_(eclState);
satFamilyCheck_(eclState);
tableCheck_(eclState);
unscaledEndPointsCheck_(deck, eclState);
unscaledEndPointsCheck_(eclState);
scaledEndPointsCheck_(deck, eclState, grid);
}

View File

@ -23,11 +23,14 @@
#include "ParallelRestart.hpp"
#include <opm/common/OpmLog/Location.hpp>
#include <opm/material/fluidmatrixinteractions/EclEpsScalingPoints.hpp>
#include <opm/material/fluidmatrixinteractions/EclTwoPhaseMaterialParams.hpp>
#include <opm/material/fluidmatrixinteractions/EclMultiplexerMaterialParams.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/Fault.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/FaultCollection.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/FaultFace.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/MULTREGTScanner.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/TransMult.hpp>
#include <opm/parser/eclipse/EclipseState/InitConfig/Equil.hpp>
#include <opm/parser/eclipse/EclipseState/InitConfig/FoamConfig.hpp>
#include <opm/parser/eclipse/EclipseState/InitConfig/InitConfig.hpp>
@ -946,33 +949,6 @@ template
std::size_t packSize(const std::map<Phase,Group::GroupInjectionProperties>& data,
Dune::MPIHelper::MPICommunicator comm);
template<class Scalar>
std::size_t packSize(const EclEpsScalingPointsInfo<Scalar>& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.Swl, comm) +
packSize(data.Sgl, comm) +
packSize(data.Sowl, comm) +
packSize(data.Sogl, comm) +
packSize(data.krCriticalEps, comm) +
packSize(data.Swcr, comm) +
packSize(data.Sgcr, comm) +
packSize(data.Sowcr, comm) +
packSize(data.Sogcr, comm) +
packSize(data.Swu, comm) +
packSize(data.Sgu, comm) +
packSize(data.Sowu, comm) +
packSize(data.Sogu, comm) +
packSize(data.maxPcow, comm) +
packSize(data.maxPcgo, comm) +
packSize(data.pcowLeverettFactor, comm) +
packSize(data.pcgoLeverettFactor, comm) +
packSize(data.maxKrw, comm) +
packSize(data.maxKrow, comm) +
packSize(data.maxKrog, comm) +
packSize(data.maxKrg, comm);
}
std::size_t packSize(const OilVaporizationProperties& data,
Dune::MPIHelper::MPICommunicator comm)
{
@ -3522,33 +3498,6 @@ void pack(const FaultCollection& data,
pack(data.getFaults(), buffer, position, comm);
}
template<class Scalar>
void pack(const EclEpsScalingPointsInfo<Scalar>& data, std::vector<char>& buffer,
int& position, Dune::MPIHelper::MPICommunicator comm)
{
pack(data.Swl, buffer, position, comm);
pack(data.Sgl, buffer, position, comm);
pack(data.Sowl, buffer, position, comm);
pack(data.Sogl, buffer, position, comm);
pack(data.krCriticalEps, buffer, position, comm);
pack(data.Swcr, buffer, position, comm);
pack(data.Sgcr, buffer, position, comm);
pack(data.Sowcr, buffer, position, comm);
pack(data.Sogcr, buffer, position, comm);
pack(data.Swu, buffer, position, comm);
pack(data.Sgu, buffer, position, comm);
pack(data.Sowu, buffer, position, comm);
pack(data.Sogu, buffer, position, comm);
pack(data.maxPcow, buffer, position, comm);
pack(data.maxPcgo, buffer, position, comm);
pack(data.pcowLeverettFactor, buffer, position, comm);
pack(data.pcgoLeverettFactor, buffer, position, comm);
pack(data.maxKrw, buffer, position, comm);
pack(data.maxKrow, buffer, position, comm);
pack(data.maxKrog, buffer, position, comm);
pack(data.maxKrg, buffer, position, comm);
}
void pack(const SolventDensityTable& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
@ -3808,33 +3757,6 @@ void unpack(DynamicVector<T>& data, std::vector<char>& buffer, int& position,
data = DynamicVector<T>(ddata);
}
template<class Scalar>
void unpack(EclEpsScalingPointsInfo<Scalar>& data, std::vector<char>& buffer,
int& position, Dune::MPIHelper::MPICommunicator comm)
{
unpack(data.Swl, buffer, position, comm);
unpack(data.Sgl, buffer, position, comm);
unpack(data.Sowl, buffer, position, comm);
unpack(data.Sogl, buffer, position, comm);
unpack(data.krCriticalEps, buffer, position, comm);
unpack(data.Swcr, buffer, position, comm);
unpack(data.Sgcr, buffer, position, comm);
unpack(data.Sowcr, buffer, position, comm);
unpack(data.Sogcr, buffer, position, comm);
unpack(data.Swu, buffer, position, comm);
unpack(data.Sgu, buffer, position, comm);
unpack(data.Sowu, buffer, position, comm);
unpack(data.Sogu, buffer, position, comm);
unpack(data.maxPcow, buffer, position, comm);
unpack(data.maxPcgo, buffer, position, comm);
unpack(data.pcowLeverettFactor, buffer, position, comm);
unpack(data.pcgoLeverettFactor, buffer, position, comm);
unpack(data.maxKrw, buffer, position, comm);
unpack(data.maxKrow, buffer, position, comm);
unpack(data.maxKrog, buffer, position, comm);
unpack(data.maxKrg, buffer, position, comm);
}
void unpack(char* str, std::size_t length, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
@ -6103,7 +6025,6 @@ INSTANTIATE_PACK_VECTOR(bool)
INSTANTIATE_PACK_VECTOR(char)
INSTANTIATE_PACK_VECTOR(int)
INSTANTIATE_PACK_VECTOR(std::array<double, 3>)
INSTANTIATE_PACK_VECTOR(EclEpsScalingPointsInfo<double>)
#undef INSTANTIATE_PACK_VECTOR
#define INSTANTIATE_PACK_SHARED_PTR(...) \
@ -6136,9 +6057,6 @@ INSTANTIATE_PACK(int)
INSTANTIATE_PACK(std::array<short,3>)
INSTANTIATE_PACK(std::array<bool,3>)
INSTANTIATE_PACK(unsigned char)
INSTANTIATE_PACK(EclEpsScalingPointsInfo<double>)
INSTANTIATE_PACK(EclTwoPhaseApproach)
INSTANTIATE_PACK(EclMultiplexerApproach)
#undef INSTANTIATE_PACK
} // end namespace Mpi

View File

@ -80,7 +80,6 @@ class Dimension;
class EclHysterConfig;
class EclipseConfig;
class Eqldims;
template<class Scalar> struct EclEpsScalingPointsInfo;
class EDITNNC;
class EndpointScaling;
class Equil;
@ -257,10 +256,6 @@ std::size_t packSize(const DynamicState<T>& data, Dune::MPIHelper::MPICommunicat
template<class T>
std::size_t packSize(const IOrderSet<T>& data, Dune::MPIHelper::MPICommunicator comm);
template<class Scalar>
std::size_t packSize(const EclEpsScalingPointsInfo<Scalar>& data,
Dune::MPIHelper::MPICommunicator comm);
////// pack routines
template<class T>
@ -350,10 +345,6 @@ template<class T>
void pack(const IOrderSet<T>& data, std::vector<char>& buffer,
int& position, Dune::MPIHelper::MPICommunicator comm);
template<class Scalar>
void pack(const EclEpsScalingPointsInfo<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);
@ -446,10 +437,6 @@ template<class T>
void unpack(IOrderSet<T>& data, std::vector<char>& buffer,
int& position, Dune::MPIHelper::MPICommunicator comm);
template<class Scalar>
void unpack(EclEpsScalingPointsInfo<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

@ -25,16 +25,21 @@
#include <boost/test/unit_test.hpp>
#include <opm/common/OpmLog/Location.hpp>
#include <opm/material/fluidmatrixinteractions/EclEpsScalingPoints.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
#include <opm/parser/eclipse/EclipseState/Aquancon.hpp>
#include <opm/parser/eclipse/EclipseState/AquiferCT.hpp>
#include <opm/parser/eclipse/EclipseState/Aquifetp.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
#include <opm/parser/eclipse/EclipseState/Edit/EDITNNC.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/FaceDir.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/Fault.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/FaultCollection.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/FaultFace.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/MULTREGTScanner.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/TransMult.hpp>
#include <opm/parser/eclipse/EclipseState/InitConfig/Equil.hpp>
#include <opm/parser/eclipse/EclipseState/InitConfig/FoamConfig.hpp>
#include <opm/parser/eclipse/EclipseState/InitConfig/InitConfig.hpp>
@ -2318,19 +2323,6 @@ BOOST_AUTO_TEST_CASE(FaultCollection)
}
BOOST_AUTO_TEST_CASE(EclEpsScalingPointsInfo)
{
#ifdef HAVE_MPI
Opm::EclEpsScalingPointsInfo<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, 13.0, 14.0, 15.0,
16.0, 17.0, 18.0, 19.0, 20.0, 21};
auto val2 = PackUnpack(val1);
DO_CHECKS(EclEpsScalingPointsInfo<double>)
#endif
}
BOOST_AUTO_TEST_CASE(SolventDensityTable)
{
#ifdef HAVE_MPI