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
32
36
37#include <opm/material/common/Valgrind.hpp>
38
39#include <dune/common/fvector.hh>
40
41namespace Opm {
48template <class TypeTag>
50 : public GetPropType<TypeTag, Properties::DiscExtensiveQuantities>
51 , public GetPropType<TypeTag, Properties::FluxModule>::FluxExtensiveQuantities
52{
57
58 enum { numPhases = getPropValue<TypeTag, Properties::NumPhases>() };
59
61 using FluxExtensiveQuantities = typename FluxModule::FluxExtensiveQuantities;
62
63public:
67 static void registerParameters()
68 {
69 FluxModule::registerParameters();
70 }
71
80 void update(const ElementContext& elemCtx, unsigned scvfIdx, unsigned timeIdx)
81 {
82 ParentType::update(elemCtx, scvfIdx, timeIdx);
83
84 // compute the pressure potential gradients
85 FluxExtensiveQuantities::calculateGradients_(elemCtx, scvfIdx, timeIdx);
86
87 // Check whether the pressure potential is in the same direction as the face
88 // normal or in the opposite one
89 for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
90 if (!elemCtx.model().phaseIsConsidered(phaseIdx)) {
91 Valgrind::SetUndefined(upstreamScvIdx_[phaseIdx]);
92 Valgrind::SetUndefined(downstreamScvIdx_[phaseIdx]);
93 continue;
94 }
95
96 upstreamScvIdx_[phaseIdx] = FluxExtensiveQuantities::upstreamIndex_(phaseIdx);
97 downstreamScvIdx_[phaseIdx] = FluxExtensiveQuantities::downstreamIndex_(phaseIdx);
98 }
99
100 FluxExtensiveQuantities::calculateFluxes_(elemCtx, scvfIdx, timeIdx);
101 }
102
103
114 template <class Context, class FluidState>
115 void updateBoundary(const Context& context,
116 unsigned bfIdx,
117 unsigned timeIdx,
118 const FluidState& fluidState)
119 {
120 ParentType::updateBoundary(context, bfIdx, timeIdx, fluidState);
121
122 FluxExtensiveQuantities::calculateBoundaryGradients_(context.elementContext(),
123 bfIdx,
124 timeIdx,
125 fluidState);
126 FluxExtensiveQuantities::calculateBoundaryFluxes_(context.elementContext(),
127 bfIdx,
128 timeIdx);
129 }
130
138 short upstreamIndex(unsigned phaseIdx) const
139 { return upstreamScvIdx_[phaseIdx]; }
140
148 short downstreamIndex(unsigned phaseIdx) const
149 { return downstreamScvIdx_[phaseIdx]; }
150
157 Scalar upstreamWeight(unsigned) const
158 { return 1.0; }
159
166 Scalar downstreamWeight(unsigned phaseIdx) const
167 { return 1.0 - upstreamWeight(phaseIdx); }
168
169private:
170 short upstreamScvIdx_[numPhases];
171 short downstreamScvIdx_[numPhases];
172};
173
174} // namespace Opm
175
176#endif
This class calculates the pressure potential gradients and the filter velocities for multi-phase flow...
Definition: multiphasebaseextensivequantities.hh:52
void updateBoundary(const Context &context, unsigned bfIdx, unsigned timeIdx, const FluidState &fluidState)
Update the extensive quantities for a given boundary face.
Definition: multiphasebaseextensivequantities.hh:115
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:166
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:157
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:138
void update(const ElementContext &elemCtx, unsigned scvfIdx, unsigned timeIdx)
Update the extensive quantities for a given sub-control-volume-face.
Definition: multiphasebaseextensivequantities.hh:80
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:148
static void registerParameters()
Register all run-time parameters for the extensive quantities.
Definition: multiphasebaseextensivequantities.hh:67
Defines the common properties required by the porous medium multi-phase models.
Definition: blackoilboundaryratevector.hh:37
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:242
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...