mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
avoid deck usage on non-root processes setting up MaterialLawManager
This commit is contained in:
parent
1354656f8b
commit
60f3fea67a
@ -71,6 +71,31 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void broadcast(T& data)
|
||||||
|
{
|
||||||
|
if (m_comm.size() == 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
#if HAVE_MPI
|
||||||
|
if (m_comm.rank() == 0) {
|
||||||
|
size_t size = data.packSize(*this);
|
||||||
|
std::vector<char> buffer(size);
|
||||||
|
int position = 0;
|
||||||
|
data.pack(buffer, position, *this);
|
||||||
|
m_comm.broadcast(&position, 1, 0);
|
||||||
|
m_comm.broadcast(buffer.data(), position, 0);
|
||||||
|
} else {
|
||||||
|
int size;
|
||||||
|
m_comm.broadcast(&size, 1, 0);
|
||||||
|
std::vector<char> buffer(size);
|
||||||
|
m_comm.broadcast(buffer.data(), size, 0);
|
||||||
|
int position = 0;
|
||||||
|
data.unpack(buffer, position, *this);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator> m_comm;
|
Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator> m_comm;
|
||||||
};
|
};
|
||||||
|
@ -2346,6 +2346,7 @@ private:
|
|||||||
const auto& vanguard = simulator.vanguard();
|
const auto& vanguard = simulator.vanguard();
|
||||||
const auto& deck = vanguard.deck();
|
const auto& deck = vanguard.deck();
|
||||||
const auto& eclState = vanguard.eclState();
|
const auto& eclState = vanguard.eclState();
|
||||||
|
const auto& comm = vanguard.gridView().comm();
|
||||||
|
|
||||||
// the PVT and saturation region numbers
|
// the PVT and saturation region numbers
|
||||||
updatePvtnum_();
|
updatePvtnum_();
|
||||||
@ -2370,7 +2371,12 @@ private:
|
|||||||
compressedToCartesianElemIdx[elemIdx] = vanguard.cartesianIndex(elemIdx);
|
compressedToCartesianElemIdx[elemIdx] = vanguard.cartesianIndex(elemIdx);
|
||||||
|
|
||||||
materialLawManager_ = std::make_shared<EclMaterialLawManager>();
|
materialLawManager_ = std::make_shared<EclMaterialLawManager>();
|
||||||
|
if (comm.rank() == 0)
|
||||||
materialLawManager_->initFromDeck(deck, eclState);
|
materialLawManager_->initFromDeck(deck, eclState);
|
||||||
|
|
||||||
|
EclMpiSerializer ser(comm);
|
||||||
|
ser.broadcast(*materialLawManager_);
|
||||||
|
|
||||||
materialLawManager_->initParamsForElements(eclState, compressedToCartesianElemIdx);
|
materialLawManager_->initParamsForElements(eclState, compressedToCartesianElemIdx);
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
#include "ParallelRestart.hpp"
|
#include "ParallelRestart.hpp"
|
||||||
#include <opm/common/OpmLog/Location.hpp>
|
#include <opm/common/OpmLog/Location.hpp>
|
||||||
#include <opm/material/fluidmatrixinteractions/EclEpsScalingPoints.hpp>
|
#include <opm/material/fluidmatrixinteractions/EclEpsScalingPoints.hpp>
|
||||||
|
#include <opm/material/fluidmatrixinteractions/EclTwoPhaseMaterialParams.hpp>
|
||||||
|
#include <opm/material/fluidmatrixinteractions/EclMultiplexerMaterialParams.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
|
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
|
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/InitConfig/Equil.hpp>
|
#include <opm/parser/eclipse/EclipseState/InitConfig/Equil.hpp>
|
||||||
@ -6778,6 +6780,7 @@ INSTANTIATE_PACK_VECTOR(double)
|
|||||||
INSTANTIATE_PACK_VECTOR(std::vector<double>)
|
INSTANTIATE_PACK_VECTOR(std::vector<double>)
|
||||||
INSTANTIATE_PACK_VECTOR(bool)
|
INSTANTIATE_PACK_VECTOR(bool)
|
||||||
INSTANTIATE_PACK_VECTOR(char)
|
INSTANTIATE_PACK_VECTOR(char)
|
||||||
|
INSTANTIATE_PACK_VECTOR(int)
|
||||||
INSTANTIATE_PACK_VECTOR(Opm::Tabulated1DFunction<double>)
|
INSTANTIATE_PACK_VECTOR(Opm::Tabulated1DFunction<double>)
|
||||||
INSTANTIATE_PACK_VECTOR(std::array<double, 3>)
|
INSTANTIATE_PACK_VECTOR(std::array<double, 3>)
|
||||||
INSTANTIATE_PACK_VECTOR(EclEpsScalingPointsInfo<double>)
|
INSTANTIATE_PACK_VECTOR(EclEpsScalingPointsInfo<double>)
|
||||||
@ -6817,6 +6820,8 @@ INSTANTIATE_PACK(std::array<short,3>)
|
|||||||
INSTANTIATE_PACK(std::array<bool,3>)
|
INSTANTIATE_PACK(std::array<bool,3>)
|
||||||
INSTANTIATE_PACK(unsigned char)
|
INSTANTIATE_PACK(unsigned char)
|
||||||
INSTANTIATE_PACK(EclEpsScalingPointsInfo<double>)
|
INSTANTIATE_PACK(EclEpsScalingPointsInfo<double>)
|
||||||
|
INSTANTIATE_PACK(EclTwoPhaseApproach)
|
||||||
|
INSTANTIATE_PACK(EclMultiplexerApproach)
|
||||||
#undef INSTANTIATE_PACK
|
#undef INSTANTIATE_PACK
|
||||||
|
|
||||||
} // end namespace Mpi
|
} // end namespace Mpi
|
||||||
|
Loading…
Reference in New Issue
Block a user