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  Copyright (C) 2008-2013 by Andreas Lauser
5 
6  This file is part of the Open Porous Media project (OPM).
7 
8  OPM is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 2 of the License, or
11  (at your option) any later version.
12 
13  OPM is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with OPM. If not, see <http://www.gnu.org/licenses/>.
20 */
26 #ifndef EWOMS_FV_BASE_EXTENSIVE_QUANTITIES_HH
27 #define EWOMS_FV_BASE_EXTENSIVE_QUANTITIES_HH
28 
29 #include "fvbaseproperties.hh"
30 
31 #include <opm/material/common/Valgrind.hpp>
32 
33 namespace Ewoms {
40 template <class TypeTag>
42 {
43  typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
44  typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
45  typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
46 
47 public:
51  static void registerParameters()
52  { }
53 
62  void update(const ElementContext &elemCtx, int scvfIdx, int timeIdx)
63  {
64  const auto &scvf = elemCtx.stencil(timeIdx).interiorFace(scvfIdx);
65  interiorScvIdx_ = scvf.interiorIndex();
66  exteriorScvIdx_ = scvf.exteriorIndex();
67 
68  extrusionFactor_ =
69  (elemCtx.intensiveQuantities(interiorScvIdx_, timeIdx).extrusionFactor()
70  + elemCtx.intensiveQuantities(exteriorScvIdx_, timeIdx).extrusionFactor()) / 2;
71  Valgrind::CheckDefined(extrusionFactor_);
72  assert(extrusionFactor_ > 0);
73  }
74 
75 
86  template <class Context, class FluidState>
87  void updateBoundary(const Context &context,
88  int bfIdx,
89  int timeIdx,
90  const FluidState &fluidState,
91  typename FluidSystem::ParameterCache &paramCache)
92  {
93  int dofIdx = context.interiorScvIndex(bfIdx, timeIdx);
94  interiorScvIdx_ = dofIdx;
95  exteriorScvIdx_ = dofIdx;
96 
97  extrusionFactor_ = context.intensiveQuantities(bfIdx, timeIdx).extrusionFactor();
98  Valgrind::CheckDefined(extrusionFactor_);
99  assert(extrusionFactor_ > 0);
100  }
101 
105  Scalar extrusionFactor() const
106  { return extrusionFactor_; }
107 
112  short interiorIndex() const
113  { return interiorScvIdx_; }
114 
119  short exteriorIndex() const
120  { return exteriorScvIdx_; }
121 
122 private:
123  // local indices of the interior and the exterior sub-control-volumes
124  short interiorScvIdx_;
125  short exteriorScvIdx_;
126 
127  Scalar extrusionFactor_;
128 };
129 
130 } // namespace Ewoms
131 
132 #endif
void update(const ElementContext &elemCtx, int scvfIdx, int timeIdx)
Update the extensive quantities for a given sub-control-volume face.
Definition: fvbaseextensivequantities.hh:62
Declare the properties used by the infrastructure code of the finite volume discretizations.
static void registerParameters()
Register all run-time parameters for the extensive quantities.
Definition: fvbaseextensivequantities.hh:51
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:119
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:112
Provide the properties at a face which make sense indepentently of the conserved quantities.
Definition: fvbaseextensivequantities.hh:41
Definition: baseauxiliarymodule.hh:35
void updateBoundary(const Context &context, int bfIdx, int timeIdx, const FluidState &fluidState, typename FluidSystem::ParameterCache &paramCache)
Update the extensive quantities for a given boundary face.
Definition: fvbaseextensivequantities.hh:87
Scalar extrusionFactor() const
Returns th extrusion factor for the sub-control-volume face.
Definition: fvbaseextensivequantities.hh:105