Merge pull request #2033 from blattms/avoid_equil_grid-rebased

Avoid using global grid (equilGrid) on non-IO processes.
This commit is contained in:
Markus Blatt
2019-10-21 11:47:17 +02:00
committed by GitHub
6 changed files with 1199 additions and 119 deletions
+28 -11
View File
@@ -43,6 +43,7 @@
#include <opm/output/eclipse/Summary.hpp>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
#include <opm/simulators/utils/ParallelRestart.hpp>
#include <opm/grid/GridHelpers.hpp>
#include <opm/grid/utility/cartesianToCompressed.hpp>
@@ -178,12 +179,14 @@ public:
, collectToIORank_(simulator_.vanguard())
, eclOutputModule_(simulator, collectToIORank_)
{
globalGrid_ = simulator_.vanguard().grid();
globalGrid_.switchToGlobalView();
eclIO_.reset(new Opm::EclipseIO(simulator_.vanguard().eclState(),
Opm::UgGridHelpers::createEclipseGrid(globalGrid_, simulator_.vanguard().eclState().getInputGrid()),
simulator_.vanguard().schedule(),
simulator_.vanguard().summaryConfig()));
if (collectToIORank_.isIORank()) {
globalGrid_ = simulator_.vanguard().grid();
globalGrid_.switchToGlobalView();
eclIO_.reset(new Opm::EclipseIO(simulator_.vanguard().eclState(),
Opm::UgGridHelpers::createEclipseGrid(globalGrid_, simulator_.vanguard().eclState().getInputGrid()),
simulator_.vanguard().schedule(),
simulator_.vanguard().summaryConfig()));
}
// create output thread if enabled and rank is I/O rank
// async output is enabled by default if pthread are enabled
@@ -198,7 +201,10 @@ public:
{ }
const Opm::EclipseIO& eclIO() const
{ return *eclIO_; }
{
assert(eclIO_);
return *eclIO_;
}
void writeInit()
{
@@ -239,7 +245,6 @@ public:
if (reportStepNum == 0)
return;
const auto& summary = eclIO_->summary();
Scalar curTime = simulator_.time() + simulator_.timeStepSize();
Scalar totalCpuTime =
simulator_.executionTimer().realTimeElapsed() +
@@ -272,6 +277,7 @@ public:
std::vector<char> buffer;
if (collectToIORank_.isIORank()) {
const auto& summary = eclIO_->summary();
const auto& eclState = simulator_.vanguard().eclState();
// Add TCPU
@@ -423,7 +429,8 @@ public:
{
Opm::SummaryState& summaryState = simulator_.vanguard().summaryState();
auto restartValues = eclIO_->loadRestart(summaryState, solutionKeys, extraKeys);
auto restartValues = loadParallelRestart(eclIO_.get(), summaryState, solutionKeys, extraKeys,
gridView.grid().comm());
for (unsigned elemIdx = 0; elemIdx < numElements; ++elemIdx) {
unsigned globalIdx = collectToIORank_.localIdxToGlobalIdx(elemIdx);
@@ -484,9 +491,10 @@ private:
#endif
const auto& cartesianCellIdx = globalGrid_.globalCell();
const auto* globalTrans = &(simulator_.vanguard().globalTransmissibility());
const EclTransmissibility<TypeTag>* globalTrans;
if (!collectToIORank_.isParallel())
{
// in the sequential case we must use the transmissibilites defined by
// the problem. (because in the sequential case, the grid manager does
// not compute "global" transmissibilities for performance reasons. in
@@ -494,6 +502,11 @@ private:
// because this object refers to the distributed grid and we need the
// sequential version here.)
globalTrans = &simulator_.problem().eclTransmissibilities();
}
else
{
globalTrans = &(simulator_.vanguard().globalTransmissibility());
}
auto elemIt = globalGridView.template begin</*codim=*/0>();
const auto& elemEndIt = globalGridView.template end</*codim=*/0>();
@@ -583,7 +596,7 @@ private:
ElementMapper globalElemMapper(globalGridView);
#endif
const auto* globalTrans = &(simulator_.vanguard().globalTransmissibility());
const EclTransmissibility<TypeTag>* globalTrans;
if (!collectToIORank_.isParallel()) {
// in the sequential case we must use the transmissibilites defined by
// the problem. (because in the sequential case, the grid manager does
@@ -593,6 +606,10 @@ private:
// sequential version here.)
globalTrans = &simulator_.problem().eclTransmissibilities();
}
else
{
globalTrans = &(simulator_.vanguard().globalTransmissibility());
}
auto cartDims = simulator_.vanguard().cartesianIndexMapper().cartesianDimensions();
auto elemIt = globalGridView.template begin</*codim=*/0>();