mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #5043 from totto82/fixParallelOutput
Only output interior cells
This commit is contained in:
commit
98421e31e7
@ -31,6 +31,8 @@
|
||||
#include <dune/common/version.hh>
|
||||
#include <dune/grid/common/gridenums.hh>
|
||||
#include <dune/grid/common/mcmgmapper.hh>
|
||||
#include <dune/grid/common/partitionset.hh>
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
@ -865,7 +867,7 @@ CollectDataToIORank(const Grid& grid, const EquilGrid* equilGrid,
|
||||
ElementMapper elemMapper(localGridView, Dune::mcmgElementLayout());
|
||||
sortedCartesianIdx_.reserve(localGridView.size(0));
|
||||
|
||||
for (const auto& elem : elements(localGridView))
|
||||
for (const auto& elem : elements(localGridView, Dune::Partitions::interior))
|
||||
{
|
||||
auto idx = elemMapper.index(elem);
|
||||
sortedCartesianIdx_.push_back(cartMapper.cartesianIndex(idx));
|
||||
@ -934,12 +936,12 @@ CollectDataToIORank(const Grid& grid, const EquilGrid* equilGrid,
|
||||
distributedCartesianIndex.resize(gridSize, -1);
|
||||
|
||||
// A mapping for the whole grid (including the ghosts) is needed for restarts
|
||||
for (const auto& elem : elements(localGridView)) {
|
||||
for (const auto& elem : elements(localGridView, Dune::Partitions::interior)) {
|
||||
int elemIdx = elemMapper.index(elem);
|
||||
distributedCartesianIndex[elemIdx] = cartMapper.cartesianIndex(elemIdx);
|
||||
|
||||
// only store interior element for collection
|
||||
//assert(element.partitionType() == Dune::InteriorEntity);
|
||||
assert(elem.partitionType() == Dune::InteriorEntity);
|
||||
|
||||
localIndexMap_.push_back(elemIdx);
|
||||
}
|
||||
|
@ -44,6 +44,7 @@
|
||||
|
||||
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
|
||||
#include <opm/simulators/utils/ParallelRestart.hpp>
|
||||
#include <opm/simulators/flow/countGlobalCells.hpp>
|
||||
|
||||
#include <opm/common/OpmLog/OpmLog.hpp>
|
||||
|
||||
@ -516,17 +517,18 @@ private:
|
||||
}
|
||||
|
||||
const auto& gridView = simulator_.vanguard().gridView();
|
||||
const int numElements = gridView.size(/*codim=*/0);
|
||||
const int num_interior = detail::
|
||||
countLocalInteriorCellsGridView(gridView);
|
||||
const bool log = this->collectToIORank_.isIORank();
|
||||
|
||||
damarisOutputModule_->allocBuffers(numElements, reportStepNum,
|
||||
damarisOutputModule_->allocBuffers(num_interior, reportStepNum,
|
||||
isSubStep, log, /*isRestart*/ false);
|
||||
|
||||
ElementContext elemCtx(simulator_);
|
||||
OPM_BEGIN_PARALLEL_TRY_CATCH();
|
||||
{
|
||||
OPM_TIMEBLOCK(prepareCellBasedData);
|
||||
for (const auto& elem : elements(gridView)) {
|
||||
for (const auto& elem : elements(gridView, Dune::Partitions::interior)) {
|
||||
elemCtx.updatePrimaryStencil(elem);
|
||||
elemCtx.updatePrimaryIntensiveQuantities(/*timeIdx=*/0);
|
||||
|
||||
@ -535,7 +537,7 @@ private:
|
||||
}
|
||||
if(!simulator_.model().linearizer().getFlowsInfo().empty()){
|
||||
OPM_TIMEBLOCK(prepareFlowsData);
|
||||
for (const auto& elem : elements(gridView)) {
|
||||
for (const auto& elem : elements(gridView, Dune::Partitions::interior)) {
|
||||
elemCtx.updatePrimaryStencil(elem);
|
||||
elemCtx.updatePrimaryIntensiveQuantities(/*timeIdx=*/0);
|
||||
damarisOutputModule_->processElementFlows(elemCtx);
|
||||
@ -543,7 +545,7 @@ private:
|
||||
}
|
||||
{
|
||||
OPM_TIMEBLOCK(prepareBlockData);
|
||||
for (const auto& elem : elements(gridView)) {
|
||||
for (const auto& elem : elements(gridView, Dune::Partitions::interior)) {
|
||||
elemCtx.updatePrimaryStencil(elem);
|
||||
elemCtx.updatePrimaryIntensiveQuantities(/*timeIdx=*/0);
|
||||
damarisOutputModule_->processElementBlockData(elemCtx);
|
||||
@ -554,7 +556,7 @@ private:
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for
|
||||
#endif
|
||||
for (int dofIdx=0; dofIdx < numElements; ++dofIdx){
|
||||
for (int dofIdx=0; dofIdx < num_interior; ++dofIdx){
|
||||
const auto& intQuants = *(simulator_.model().cachedIntensiveQuantities(dofIdx, /*timeIdx=*/0));
|
||||
const auto totVolume = simulator_.model().dofTotalVolume(dofIdx);
|
||||
damarisOutputModule_->updateFluidInPlace(dofIdx, intQuants, totVolume);
|
||||
|
@ -707,8 +707,13 @@ regionSum(const ScalarBuffer& property,
|
||||
if (property.empty())
|
||||
return totals;
|
||||
|
||||
assert(regionId.size() == property.size());
|
||||
for (std::size_t j = 0; j < regionId.size(); ++j) {
|
||||
// the regionId contains the ghost cells
|
||||
// the property does not contain the ghostcells
|
||||
// This code assumes that that the ghostcells are
|
||||
// added after the interior cells
|
||||
// OwnerCellsFirst = True
|
||||
assert(regionId.size() >= property.size());
|
||||
for (std::size_t j = 0; j < property.size(); ++j) {
|
||||
const int regionIdx = regionId[j] - 1;
|
||||
// the cell is not attributed to any region. ignore it!
|
||||
if (regionIdx < 0)
|
||||
|
@ -173,6 +173,14 @@ public:
|
||||
|
||||
this->forceDisableFipresvOutput_ =
|
||||
EWOMS_GET_PARAM(TypeTag, bool, ForceDisableResvFluidInPlaceOutput);
|
||||
|
||||
if (! EWOMS_GET_PARAM(TypeTag, bool, OwnerCellsFirst)) {
|
||||
const std::string msg = "The output code does not support --owner-cells-first=false.";
|
||||
if (collectToIORank.isIORank()) {
|
||||
OpmLog::error(msg);
|
||||
}
|
||||
OPM_THROW_NOLOG(std::runtime_error, msg);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -41,6 +41,8 @@
|
||||
|
||||
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
|
||||
#include <opm/simulators/utils/ParallelRestart.hpp>
|
||||
#include <opm/simulators/flow/countGlobalCells.hpp>
|
||||
|
||||
|
||||
#include <opm/common/OpmLog/OpmLog.hpp>
|
||||
|
||||
@ -329,15 +331,16 @@ public:
|
||||
}
|
||||
|
||||
const auto& gridView = simulator_.vanguard().gridView();
|
||||
const int numElements = gridView.size(/*codim=*/0);
|
||||
const int num_interior = detail::
|
||||
countLocalInteriorCellsGridView(gridView);
|
||||
|
||||
this->eclOutputModule_->
|
||||
allocBuffers(numElements, 0, false, false, /*isRestart*/ false);
|
||||
allocBuffers(num_interior, 0, false, false, /*isRestart*/ false);
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for
|
||||
#endif
|
||||
for (int dofIdx = 0; dofIdx < numElements; ++dofIdx) {
|
||||
for (int dofIdx = 0; dofIdx < num_interior; ++dofIdx) {
|
||||
const auto& intQuants = *simulator_.model().cachedIntensiveQuantities(dofIdx, /*timeIdx=*/0);
|
||||
const auto totVolume = simulator_.model().dofTotalVolume(dofIdx);
|
||||
|
||||
@ -557,11 +560,12 @@ private:
|
||||
}
|
||||
|
||||
const auto& gridView = simulator_.vanguard().gridView();
|
||||
const int numElements = gridView.size(/*codim=*/0);
|
||||
const bool log = this->collectToIORank_.isIORank();
|
||||
|
||||
const int num_interior = detail::
|
||||
countLocalInteriorCellsGridView(gridView);
|
||||
this->eclOutputModule_->
|
||||
allocBuffers(numElements, reportStepNum,
|
||||
allocBuffers(num_interior, reportStepNum,
|
||||
isSubStep, log, /*isRestart*/ false);
|
||||
|
||||
ElementContext elemCtx(simulator_);
|
||||
@ -570,7 +574,7 @@ private:
|
||||
|
||||
{
|
||||
OPM_TIMEBLOCK(prepareCellBasedData);
|
||||
for (const auto& elem : elements(gridView)) {
|
||||
for (const auto& elem : elements(gridView, Dune::Partitions::interior)) {
|
||||
elemCtx.updatePrimaryStencil(elem);
|
||||
elemCtx.updatePrimaryIntensiveQuantities(/*timeIdx=*/0);
|
||||
|
||||
@ -581,7 +585,7 @@ private:
|
||||
if constexpr (enableMech) {
|
||||
if (simulator_.vanguard().eclState().runspec().mech()) {
|
||||
OPM_TIMEBLOCK(prepareMechData);
|
||||
for (const auto& elem : elements(gridView)) {
|
||||
for (const auto& elem : elements(gridView, Dune::Partitions::interior)) {
|
||||
elemCtx.updatePrimaryStencil(elem);
|
||||
elemCtx.updatePrimaryIntensiveQuantities(/*timeIdx=*/0);
|
||||
eclOutputModule_->processElementMech(elemCtx);
|
||||
@ -591,7 +595,7 @@ private:
|
||||
|
||||
if (! this->simulator_.model().linearizer().getFlowsInfo().empty()) {
|
||||
OPM_TIMEBLOCK(prepareFlowsData);
|
||||
for (const auto& elem : elements(gridView)) {
|
||||
for (const auto& elem : elements(gridView, Dune::Partitions::interior)) {
|
||||
elemCtx.updatePrimaryStencil(elem);
|
||||
elemCtx.updatePrimaryIntensiveQuantities(/*timeIdx=*/0);
|
||||
|
||||
@ -601,7 +605,7 @@ private:
|
||||
|
||||
{
|
||||
OPM_TIMEBLOCK(prepareBlockData);
|
||||
for (const auto& elem : elements(gridView)) {
|
||||
for (const auto& elem : elements(gridView, Dune::Partitions::interior)) {
|
||||
elemCtx.updatePrimaryStencil(elem);
|
||||
elemCtx.updatePrimaryIntensiveQuantities(/*timeIdx=*/0);
|
||||
|
||||
@ -615,7 +619,7 @@ private:
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for
|
||||
#endif
|
||||
for (int dofIdx = 0; dofIdx < numElements; ++dofIdx) {
|
||||
for (int dofIdx = 0; dofIdx < num_interior; ++dofIdx) {
|
||||
const auto& intQuants = *simulator_.model().cachedIntensiveQuantities(dofIdx, /*timeIdx=*/0);
|
||||
const auto totVolume = simulator_.model().dofTotalVolume(dofIdx);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user