fvbaseextensivequantities.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_FV_BASE_EXTENSIVE_QUANTITIES_HH
29#define EWOMS_FV_BASE_EXTENSIVE_QUANTITIES_HH
30
31#include <opm/material/common/Valgrind.hpp>
32
35
36#include <cassert>
37
38namespace Opm {
39
46template <class TypeTag>
48{
52
53public:
57 static void registerParameters()
58 {}
59
68 void update(const ElementContext& elemCtx, unsigned scvfIdx, unsigned timeIdx)
69 {
70 const auto& scvf = elemCtx.stencil(timeIdx).interiorFace(scvfIdx);
71 interiorScvIdx_ = scvf.interiorIndex();
72 exteriorScvIdx_ = scvf.exteriorIndex();
73
74 extrusionFactor_ =
75 (elemCtx.intensiveQuantities(interiorScvIdx_, timeIdx).extrusionFactor() +
76 elemCtx.intensiveQuantities(exteriorScvIdx_, timeIdx).extrusionFactor()) / 2;
77 Valgrind::CheckDefined(extrusionFactor_);
78 assert(extrusionFactor_ > 0);
79 }
80
91 template <class Context, class FluidState>
92 void updateBoundary(const Context& context,
93 unsigned bfIdx,
94 unsigned timeIdx,
95 const FluidState&)
96 {
97 const unsigned dofIdx = context.interiorScvIndex(bfIdx, timeIdx);
98 interiorScvIdx_ = static_cast<unsigned short>(dofIdx);
99 exteriorScvIdx_ = static_cast<unsigned short>(dofIdx);
100
101 extrusionFactor_ = context.intensiveQuantities(bfIdx, timeIdx).extrusionFactor();
102 Valgrind::CheckDefined(extrusionFactor_);
103 assert(extrusionFactor_ > 0);
104 }
105
109 Scalar extrusionFactor() const
110 { return extrusionFactor_; }
111
116 unsigned short interiorIndex() const
117 { return interiorScvIdx_; }
118
123 unsigned short exteriorIndex() const
124 { return exteriorScvIdx_; }
125
126private:
127 // local indices of the interior and the exterior sub-control-volumes
128 unsigned short interiorScvIdx_{};
129 unsigned short exteriorScvIdx_{};
130
131 Scalar extrusionFactor_{};
132};
133
134} // namespace Opm
135
136#endif
Provide the properties at a face which make sense independently of the conserved quantities.
Definition: fvbaseextensivequantities.hh:48
static void registerParameters()
Register all run-time parameters for the extensive quantities.
Definition: fvbaseextensivequantities.hh:57
Scalar extrusionFactor() const
Returns th extrusion factor for the sub-control-volume face.
Definition: fvbaseextensivequantities.hh:109
unsigned short exteriorIndex() const
Return the local index of the control volume which is on the "exterior" of the sub-control volume fac...
Definition: fvbaseextensivequantities.hh:123
void updateBoundary(const Context &context, unsigned bfIdx, unsigned timeIdx, const FluidState &)
Update the extensive quantities for a given boundary face.
Definition: fvbaseextensivequantities.hh:92
unsigned short interiorIndex() const
Return the local index of the control volume which is on the "interior" of the sub-control volume fac...
Definition: fvbaseextensivequantities.hh:116
void update(const ElementContext &elemCtx, unsigned scvfIdx, unsigned timeIdx)
Update the extensive quantities for a given sub-control-volume face.
Definition: fvbaseextensivequantities.hh:68
Declare the properties used by the infrastructure code of the finite volume discretizations.
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