multiphasebaseextensivequantities.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 2 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18
19 Consult the COPYING file in the top-level source directory of this
20 module for the precise wording of the license and the list of
21 copyright holders.
22*/
28#ifndef EWOMS_MULTI_PHASE_BASE_EXTENSIVE_QUANTITIES_HH
29#define EWOMS_MULTI_PHASE_BASE_EXTENSIVE_QUANTITIES_HH
30
31#include <dune/common/fvector.hh>
32
33#include <opm/material/common/Valgrind.hpp>
34
39
40#include <array>
41
42namespace Opm {
49template <class TypeTag>
51 : public GetPropType<TypeTag, Properties::DiscExtensiveQuantities>
52 , public GetPropType<TypeTag, Properties::FluxModule>::FluxExtensiveQuantities
53{
58
59 enum { numPhases = getPropValue<TypeTag, Properties::NumPhases>() };
60
62 using FluxExtensiveQuantities = typename FluxModule::FluxExtensiveQuantities;
63
64public:
68 static void registerParameters()
69 {
70 FluxModule::registerParameters();
71 }
72
81 void update(const ElementContext& elemCtx, unsigned scvfIdx, unsigned timeIdx)
82 {
83 ParentType::update(elemCtx, scvfIdx, timeIdx);
84
85 // compute the pressure potential gradients
86 FluxExtensiveQuantities::calculateGradients_(elemCtx, scvfIdx, timeIdx);
87
88 // Check whether the pressure potential is in the same direction as the face
89 // normal or in the opposite one
90 for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
91 if (!elemCtx.model().phaseIsConsidered(phaseIdx)) {
92 Valgrind::SetUndefined(upstreamScvIdx_[phaseIdx]);
93 Valgrind::SetUndefined(downstreamScvIdx_[phaseIdx]);
94 continue;
95 }
96
97 upstreamScvIdx_[phaseIdx] = FluxExtensiveQuantities::upstreamIndex_(phaseIdx);
98 downstreamScvIdx_[phaseIdx] = FluxExtensiveQuantities::downstreamIndex_(phaseIdx);
99 }
100
101 FluxExtensiveQuantities::calculateFluxes_(elemCtx, scvfIdx, timeIdx);
102 }
103
104
115 template <class Context, class FluidState>
116 void updateBoundary(const Context& context,
117 unsigned bfIdx,
118 unsigned timeIdx,
119 const FluidState& fluidState)
120 {
121 ParentType::updateBoundary(context, bfIdx, timeIdx, fluidState);
122
123 FluxExtensiveQuantities::calculateBoundaryGradients_(context.elementContext(),
124 bfIdx,
125 timeIdx,
126 fluidState);
127 FluxExtensiveQuantities::calculateBoundaryFluxes_(context.elementContext(),
128 bfIdx,
129 timeIdx);
130 }
131
139 short upstreamIndex(unsigned phaseIdx) const
140 { return upstreamScvIdx_[phaseIdx]; }
141
149 short downstreamIndex(unsigned phaseIdx) const
150 { return downstreamScvIdx_[phaseIdx]; }
151
158 Scalar upstreamWeight(unsigned) const
159 { return 1.0; }
160
167 Scalar downstreamWeight(unsigned phaseIdx) const
168 { return 1.0 - upstreamWeight(phaseIdx); }
169
170private:
171 std::array<short, numPhases> upstreamScvIdx_{};
172 std::array<short, numPhases> downstreamScvIdx_{};
173};
174
175} // namespace Opm
176
177#endif
This class calculates the pressure potential gradients and the filter velocities for multi-phase flow...
Definition: multiphasebaseextensivequantities.hh:53
void updateBoundary(const Context &context, unsigned bfIdx, unsigned timeIdx, const FluidState &fluidState)
Update the extensive quantities for a given boundary face.
Definition: multiphasebaseextensivequantities.hh:116
Scalar downstreamWeight(unsigned phaseIdx) const
Return the weight of the downstream control volume for a given phase as a function of the normal flux...
Definition: multiphasebaseextensivequantities.hh:167
Scalar upstreamWeight(unsigned) const
Return the weight of the upstream control volume for a given phase as a function of the normal flux.
Definition: multiphasebaseextensivequantities.hh:158
short upstreamIndex(unsigned phaseIdx) const
Return the local index of the upstream control volume for a given phase as a function of the normal f...
Definition: multiphasebaseextensivequantities.hh:139
void update(const ElementContext &elemCtx, unsigned scvfIdx, unsigned timeIdx)
Update the extensive quantities for a given sub-control-volume-face.
Definition: multiphasebaseextensivequantities.hh:81
short downstreamIndex(unsigned phaseIdx) const
Return the local index of the downstream control volume for a given phase as a function of the normal...
Definition: multiphasebaseextensivequantities.hh:149
static void registerParameters()
Register all run-time parameters for the extensive quantities.
Definition: multiphasebaseextensivequantities.hh:68
Defines the common properties required by the porous medium multi-phase models.
Definition: blackoilboundaryratevector.hh:39
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:233
This file provides the infrastructure to retrieve run-time parameters.
This method contains all callback classes for quantities that are required by some extensive quantiti...