mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Capture Bulk Connection Fluxes to Accumlate Inter-Region Flows
This commit adds a new grid traversal that computes fluxes-presently surface level component fluxes-for all bulk connections on the current MPI rank. We aggregate those fluxes, if applicable, into a container for inter-region flows, but this support could be extended to capturing the full 3D vector flow rates for restart output if needed.
This commit is contained in:
@@ -38,8 +38,11 @@
|
||||
|
||||
#include <ebos/eclgenericwriter.hh>
|
||||
|
||||
#include <string>
|
||||
#include <dune/grid/common/partitionset.hh>
|
||||
|
||||
#include <functional>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
|
||||
namespace Opm::Properties {
|
||||
|
||||
@@ -181,11 +184,12 @@ public:
|
||||
const auto localGroupAndNetworkData = simulator_.problem().wellModel()
|
||||
.groupAndNetworkData(reportStepNum);
|
||||
|
||||
|
||||
const auto localAquiferData = simulator_.problem().aquiferModel().aquiferData();
|
||||
const auto localWellTestState = simulator_.problem().wellModel().wellTestState();
|
||||
this->prepareLocalCellData(isSubStep, reportStepNum);
|
||||
|
||||
this->captureLocalFluxData();
|
||||
|
||||
if (this->collectToIORank_.isParallel())
|
||||
this->collectToIORank_.collect({},
|
||||
eclOutputModule_->getBlockData(),
|
||||
@@ -435,6 +439,42 @@ private:
|
||||
OPM_END_PARALLEL_TRY_CATCH("EclWriter::prepareLocalCellData() failed: ", simulator_.vanguard().grid().comm())
|
||||
}
|
||||
|
||||
void captureLocalFluxData()
|
||||
{
|
||||
const auto& gridView = this->simulator_.vanguard().gridView();
|
||||
const auto timeIdx = 0u;
|
||||
|
||||
auto elemCtx = ElementContext { this->simulator_ };
|
||||
|
||||
const auto elemMapper = ElementMapper { gridView, Dune::mcmgElementLayout() };
|
||||
const auto activeIndex = [&elemMapper](const Element& e)
|
||||
{
|
||||
return elemMapper.index(e);
|
||||
};
|
||||
|
||||
const auto cartesianIndex = [this](const int elemIndex)
|
||||
{
|
||||
return this->cartMapper_.cartesianIndex(elemIndex);
|
||||
};
|
||||
|
||||
this->eclOutputModule_->initializeFluxData();
|
||||
|
||||
OPM_BEGIN_PARALLEL_TRY_CATCH();
|
||||
|
||||
for (const auto& elem : elements(gridView, Dune::Partitions::interiorBorder)) {
|
||||
elemCtx.updateStencil(elem);
|
||||
elemCtx.updateIntensiveQuantities(timeIdx);
|
||||
elemCtx.updateExtensiveQuantities(timeIdx);
|
||||
|
||||
this->eclOutputModule_->processFluxes(elemCtx, activeIndex, cartesianIndex);
|
||||
}
|
||||
|
||||
OPM_END_PARALLEL_TRY_CATCH("EclWriter::captureLocalFluxData() failed: ",
|
||||
this->simulator_.vanguard().grid().comm())
|
||||
|
||||
this->eclOutputModule_->finalizeFluxData();
|
||||
}
|
||||
|
||||
Simulator& simulator_;
|
||||
std::unique_ptr<EclOutputBlackOilModule<TypeTag>> eclOutputModule_;
|
||||
Scalar restartTimeStepSize_;
|
||||
|
||||
Reference in New Issue
Block a user