27#ifndef OPM_OUTPUT_COMPOSITIONAL_MODULE_HPP
28#define OPM_OUTPUT_COMPOSITIONAL_MODULE_HPP
30#include <dune/grid/common/gridenums.hh>
32#include <opm/simulators/utils/moduleVersion.hpp>
34#include <opm/common/Exceptions.hpp>
35#include <opm/common/ErrorMacros.hpp>
36#include <opm/common/TimingMacros.hpp>
37#include <opm/common/OpmLog/OpmLog.hpp>
39#include <opm/input/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
41#include <opm/material/common/Valgrind.hpp>
65template <
class TypeTag>
66class EcfvDiscretization;
74template <
class TypeTag>
86 enum { numPhases = FluidSystem::numPhases };
87 enum { numComponents = FluidSystem::numComponents };
88 enum { oilPhaseIdx = FluidSystem::oilPhaseIdx };
89 enum { gasPhaseIdx = FluidSystem::gasPhaseIdx };
90 enum { waterPhaseIdx = FluidSystem::waterPhaseIdx };
93 template <
class CollectDataToIORankType>
97 :
BaseType(simulator.vanguard().eclState(),
98 simulator.vanguard().schedule(),
100 simulator.vanguard().summaryState(),
102 [
this](
const int idx)
103 {
return simulator_.problem().eclWriter().collectOnIORank().localIdxToGlobalIdx(
idx); },
104 simulator.vanguard().grid().comm(),
115 , simulator_(simulator)
125 this->setupBlockData(isCartIdxOnThisRank);
127 if (! Parameters::Get<Parameters::OwnerCellsFirst>()) {
128 const std::string
msg =
"The output code does not support --owner-cells-first=false.";
136 auto rset = this->eclState_.fieldProps().fip_regions();
137 rset.push_back(
"PVTNUM");
142 this->regionAvgDensity_
143 .emplace(this->simulator_.gridView().comm(),
144 FluidSystem::numPhases,
rset,
145 [
fp = std::cref(
this->eclState_.fieldProps())]
146 (
const std::string&
rsetName) ->
decltype(
auto)
147 { return fp.get().get_int(rsetName); });
157 const unsigned reportStepNum,
160 const bool isRestart)
166 auto rstKeywords = this->schedule_.rst_keywords(reportStepNum);
175 void assignToSolution(data::Solution&
sol)
177 this->compC_.outputRestart(
sol, this->saturation_[oilPhaseIdx]);
191 Entry{PhaseEntry{&this->saturation_,
195 Entry{ScalarEntry{&this->fluidPressure_,
198 if (FluidSystem::phaseIsActive(oilPhaseIdx)) {
202 else if (FluidSystem::phaseIsActive(gasPhaseIdx)) {
212 Entry{ScalarEntry{&this->temperature_,
218 compC.assignMoleFractions(
ectx.globalDofIdx,
222 if (FluidSystem::phaseIsActive(gasPhaseIdx)) {
223 compC.assignGasFractions(
ectx.globalDofIdx,
228 if (FluidSystem::phaseIsActive(oilPhaseIdx)) {
229 compC.assignOilFractions(
ectx.globalDofIdx,
233 }, this->compC_.allocated()
242 { this->extractors_.clear(); }
256 for (
unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(0); ++dofIdx) {
257 const auto& intQuants = elemCtx.intensiveQuantities(dofIdx, 0);
258 const auto& fs = intQuants.fluidState();
261 elemCtx.globalSpaceIndex(dofIdx, 0),
273 void processElementFlows(
const ElementContext& )
280 void processElementBlockData(
const ElementContext& )
315 template <
class ActiveIndex,
class CartesianIndex>
330 this->interRegionFlows_.
clear();
346 return this->interRegionFlows_;
349 void updateFluidInPlace(
const unsigned ,
350 const IntensiveQuantities& ,
357 bool isDefunctParallelWell(std::string
wname)
const override
359 if (simulator_.gridView().comm().size() == 1)
361 const auto& parallelWells = simulator_.vanguard().parallelWells();
362 std::pair<std::string, bool> value {
wname,
true};
363 auto candidate = std::lower_bound(parallelWells.begin(), parallelWells.end(), value);
367 void createLocalRegion_(std::vector<int>& region)
369 std::size_t elemIdx = 0;
370 for (
const auto&
elem :
elements(simulator_.gridView())) {
371 if (
elem.partitionType() != Dune::InteriorEntity) {
379 const Simulator& simulator_;
381 std::vector<typename Extractor::Entry> extractors_;
Output module for the results black oil model writing in ECL binary format.
Helper class for grid instantiation of ECL file-format using problems.
Output module for the results black oil model writing in ECL binary format.
Declares the properties required by the black oil model.
The base class for the element-centered finite-volume discretization scheme.
Definition ecfvdiscretization.hh:147
Definition GenericOutputBlackoilModule.hpp:76
void assignToSolution(data::Solution &sol)
Move all buffers to data::Solution.
Definition GenericOutputBlackoilModule.cpp:308
Inter-region flow accumulation maps for all region definition arrays.
Definition InterRegFlows.hpp:179
void compress()
Form CSR adjacency matrix representation of input graph from connections established in previous call...
Definition InterRegFlows.cpp:165
void clear()
Clear all internal buffers, but preserve allocated capacity.
Definition InterRegFlows.cpp:172
Output module for the results black oil model writing in ECL binary format.
Definition OutputCompositionalModule.hpp:76
void clearExtractors()
Clear list of active element-level data extractors.
Definition OutputCompositionalModule.hpp:241
void initializeFluxData()
Prepare for capturing connection fluxes, particularly to account for inter-region flows.
Definition OutputCompositionalModule.hpp:326
void setupExtractors(const bool, const std::size_t)
Setup list of active element-level data extractors.
Definition OutputCompositionalModule.hpp:182
void finalizeFluxData()
Finalize capturing connection fluxes.
Definition OutputCompositionalModule.hpp:336
void processElement(const ElementContext &elemCtx)
Modify the internal buffers according to the intensive quanties relevant for an element.
Definition OutputCompositionalModule.hpp:248
void allocBuffers(const unsigned bufferSize, const unsigned reportStepNum, const bool substep, const bool log, const bool isRestart)
Allocate memory for the scalar fields we would like to write to ECL output files.
Definition OutputCompositionalModule.hpp:156
void processFluxes(const ElementContext &, ActiveIndex &&, CartesianIndex &&)
Capture connection fluxes, particularly to account for inter-region flows.
Definition OutputCompositionalModule.hpp:316
const InterRegFlowMap & getInterRegFlows() const
Get read-only access to collection of inter-region flows.
Definition OutputCompositionalModule.hpp:344
Defines the common properties required by the porous medium multi-phase models.
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilboundaryratevector.hh:37
std::string moduleVersionName()
Return the version name of the module, for example "2015.10" (for a release branch) or "2016....
Definition moduleVersion.cpp:34
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:242
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition propertysystem.hh:235
This file provides the infrastructure to retrieve run-time parameters.
The Opm property system, traits with inheritance.