3.6-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
gridfacevariables.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 * See the file COPYING for full copying permissions. *
5 * *
6 * This program 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 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
24#ifndef DUMUX_DISCRETIZATION_STAGGERED_GRID_FACEVARIABLES_HH
25#define DUMUX_DISCRETIZATION_STAGGERED_GRID_FACEVARIABLES_HH
26
27// make the local view function available whenever we use this class
31
32namespace Dumux {
33
41template<class P, class FV>
43{
44 template<class GridFaceVariables, bool enableCache>
46
47 using FaceVariables = FV;
48 using Problem = P;
49};
50
55template<class Problem,
56 class FaceVariables,
57 bool cachingEnabled = false,
60
66template<class P, class FV, class Traits>
67class StaggeredGridFaceVariables<P, FV, /*cachingEnabled*/true, Traits>
68{
69 using ThisType = StaggeredGridFaceVariables<P, FV, /*cachingEnabled*/true, Traits>;
70 using Problem = typename Traits::Problem;
71
72public:
74 static constexpr bool cachingEnabled = true;
75
77 using LocalView = typename Traits::template LocalView<ThisType, cachingEnabled>;
78
80 using FaceVariables = typename Traits::FaceVariables;
81
82 StaggeredGridFaceVariables(const Problem& problem) : problemPtr_(&problem) {}
83
85 template<class GridGeometry, class SolutionVector>
86 void update(const GridGeometry& gridGeometry, const SolutionVector& sol)
87 {
88 faceVariables_.resize(gridGeometry.numScvf());
89 auto fvGeometry = localView(gridGeometry);
90 for (auto&& element : elements(gridGeometry.gridView()))
91 {
92 fvGeometry.bindElement(element);
93
94 for (auto&& scvf : scvfs(fvGeometry))
95 {
96 const auto faceSol = StaggeredFaceSolution(scvf, sol, gridGeometry);
97 faceVariables_[scvf.index()].update(faceSol, problem(), element, fvGeometry, scvf);
98 }
99 }
100 }
101
102 const FaceVariables& faceVars(const std::size_t facetIdx) const
103 { return faceVariables_[facetIdx]; }
104
105 FaceVariables& faceVars(const std::size_t facetIdx)
106 { return faceVariables_[facetIdx]; }
107
108 const Problem& problem() const
109 { return *problemPtr_; }
110
111private:
112 const Problem* problemPtr_;
113 std::vector<FaceVariables> faceVariables_;
114};
115
121template<class P, class FV, class Traits>
122class StaggeredGridFaceVariables<P, FV, /*cachingEnabled*/false, Traits>
123{
124 using ThisType = StaggeredGridFaceVariables<P, FV, /*cachingEnabled*/false, Traits>;
125 using Problem = typename Traits::Problem;
126
127public:
129 static constexpr bool cachingEnabled = false;
130
132 using LocalView = typename Traits::template LocalView<ThisType, cachingEnabled>;
133
135 using FaceVariables = typename Traits::FaceVariables;
136
137 StaggeredGridFaceVariables(const Problem& problem) : problemPtr_(&problem) {}
138
140 template<class GridGeometry, class SolutionVector>
141 void update(const GridGeometry& gridGeometry, const SolutionVector& sol) {}
142
143 const Problem& problem() const
144 { return *problemPtr_; }
145
146private:
147 const Problem* problemPtr_;
148};
149
150} // end namespace Dumux
151
152#endif
Free function to get the local view of a grid cache object.
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition: localview.hh:38
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
Base class for the face variables vector.
Definition: elementfacevariables.hh:40
The global face variables class for staggered models.
Definition: facesolution.hh:40
Traits class to be used for the StaggeredGridFaceVariables.
Definition: gridfacevariables.hh:43
P Problem
Definition: gridfacevariables.hh:48
FV FaceVariables
Definition: gridfacevariables.hh:47
Face variables cache class for staggered models.
Definition: gridfacevariables.hh:59
Face variables cache class for staggered models. Specialization in case of storing the face variables...
Definition: gridfacevariables.hh:68
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition: gridfacevariables.hh:77
void update(const GridGeometry &gridGeometry, const SolutionVector &sol)
Update all face variables.
Definition: gridfacevariables.hh:86
typename Traits::FaceVariables FaceVariables
export the type of the face variables
Definition: gridfacevariables.hh:80
StaggeredGridFaceVariables(const Problem &problem)
Definition: gridfacevariables.hh:82
const Problem & problem() const
Definition: gridfacevariables.hh:108
FaceVariables & faceVars(const std::size_t facetIdx)
Definition: gridfacevariables.hh:105
const FaceVariables & faceVars(const std::size_t facetIdx) const
Definition: gridfacevariables.hh:102
Face variables cache class for staggered models. Specialization in case of not storing the face varia...
Definition: gridfacevariables.hh:123
StaggeredGridFaceVariables(const Problem &problem)
Definition: gridfacevariables.hh:137
const Problem & problem() const
Definition: gridfacevariables.hh:143
typename Traits::FaceVariables FaceVariables
export the type of the face variables
Definition: gridfacevariables.hh:135
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition: gridfacevariables.hh:132
void update(const GridGeometry &gridGeometry, const SolutionVector &sol)
Do nothing here.
Definition: gridfacevariables.hh:141