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 "fvbaseproperties.hh"
32 
33 #include <opm/common/Valgrind.hpp>
34 #include <opm/common/Unused.hpp>
35 
36 namespace Ewoms {
43 template <class TypeTag>
45 {
46  typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
47  typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
48  typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
49 
50 public:
54  static void registerParameters()
55  { }
56 
65  void update(const ElementContext& elemCtx, unsigned scvfIdx, unsigned timeIdx)
66  {
67  const auto& scvf = elemCtx.stencil(timeIdx).interiorFace(scvfIdx);
68  interiorScvIdx_ = scvf.interiorIndex();
69  exteriorScvIdx_ = scvf.exteriorIndex();
70 
71  extrusionFactor_ =
72  (elemCtx.intensiveQuantities(interiorScvIdx_, timeIdx).extrusionFactor()
73  + elemCtx.intensiveQuantities(exteriorScvIdx_, timeIdx).extrusionFactor()) / 2;
74  Opm::Valgrind::CheckDefined(extrusionFactor_);
75  assert(extrusionFactor_ > 0);
76  }
77 
78 
89  template <class Context, class FluidState>
90  void updateBoundary(const Context& context,
91  unsigned bfIdx,
92  unsigned timeIdx,
93  const FluidState& fluidState OPM_UNUSED,
94  typename FluidSystem::template ParameterCache<typename FluidState::Scalar>& paramCache OPM_UNUSED)
95  {
96  unsigned dofIdx = context.interiorScvIndex(bfIdx, timeIdx);
97  interiorScvIdx_ = static_cast<unsigned short>(dofIdx);
98  exteriorScvIdx_ = static_cast<unsigned short>(dofIdx);
99 
100  extrusionFactor_ = context.intensiveQuantities(bfIdx, timeIdx).extrusionFactor();
101  Opm::Valgrind::CheckDefined(extrusionFactor_);
102  assert(extrusionFactor_ > 0);
103  }
104 
108  Scalar extrusionFactor() const
109  { return extrusionFactor_; }
110 
115  unsigned short interiorIndex() const
116  { return interiorScvIdx_; }
117 
122  unsigned short exteriorIndex() const
123  { return exteriorScvIdx_; }
124 
125 private:
126  // local indices of the interior and the exterior sub-control-volumes
127  unsigned short interiorScvIdx_;
128  unsigned short exteriorScvIdx_;
129 
130  Scalar extrusionFactor_;
131 };
132 
133 } // namespace Ewoms
134 
135 #endif
static void registerParameters()
Register all run-time parameters for the extensive quantities.
Definition: fvbaseextensivequantities.hh:54
Definition: baseauxiliarymodule.hh:37
Provide the properties at a face which make sense indepentently of the conserved quantities.
Definition: fvbaseextensivequantities.hh:44
Declare the properties used by the infrastructure code of the finite volume discretizations.
void updateBoundary(const Context &context, unsigned bfIdx, unsigned timeIdx, const FluidState &fluidState OPM_UNUSED, typename FluidSystem::template ParameterCache< typename FluidState::Scalar > &paramCache OPM_UNUSED)
Update the extensive quantities for a given boundary face.
Definition: fvbaseextensivequantities.hh:90
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:115
void update(const ElementContext &elemCtx, unsigned scvfIdx, unsigned timeIdx)
Update the extensive quantities for a given sub-control-volume face.
Definition: fvbaseextensivequantities.hh:65
Scalar extrusionFactor() const
Returns th extrusion factor for the sub-control-volume face.
Definition: fvbaseextensivequantities.hh:108
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:122