83 const auto& gridView = simulator.
gridView();
84 const auto& comm = gridView.comm();
86 std::accumulate(rmap_.activeRegions().begin(),
87 rmap_.activeRegions().end(), 0,
88 [](
const auto acc,
const auto&
reg)
89 { return std::max(acc, reg); });
94 attr_.insert(
reg, Attributes());
108 ElementContext elemCtx( simulator );
109 OPM_BEGIN_PARALLEL_TRY_CATCH();
110 for (
const auto&
elem :
elements(gridView, Dune::Partitions::interior)) {
111 elemCtx.updatePrimaryStencil(
elem);
112 elemCtx.updatePrimaryIntensiveQuantities(0);
113 const unsigned cellIdx = elemCtx.globalSpaceIndex(0, 0);
114 const auto& intQuants = elemCtx.intensiveQuantities(0, 0);
115 const auto& fs = intQuants.fluidState();
119 * intQuants.porosity().value();
123 if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
124 hydrocarbon -= fs.saturation(FluidSystem::waterPhaseIdx).value();
135 if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)) {
138 assert(FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx));
146 if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)) {
147 attr.pressure += fs.pressure(FluidSystem::oilPhaseIdx).value() *
pv_cell;
148 }
else if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) {
149 attr.pressure += fs.pressure(FluidSystem::gasPhaseIdx).value() *
pv_cell;
151 assert(FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx));
152 attr.pressure += fs.pressure(FluidSystem::waterPhaseIdx).value() *
pv_cell;
156 OPM_END_PARALLEL_TRY_CATCH(
"AverageRegionalPressure::defineState(): ", simulator.
vanguard().grid().comm());
163 auto&
ra = attr_.attributes(
reg);
188 auto&
ra_field = attr_.attributes(0);