3.3.0
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
linteractionvolume3dadaptive.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 *****************************************************************************/
19
20#ifndef DUMUX_FVMPFAL3DINTERACTIONVOLUME_ADAPTIVE_HH
21#define DUMUX_FVMPFAL3DINTERACTIONVOLUME_ADAPTIVE_HH
22
30
31namespace Dumux
32{
34// Mapper for local interaction volume indices (see doc/docextra/3dmpfa).
35class IndexTranslatorAdaptive: public IndexTranslator
36{
37public:
38 enum
39 {
40 subVolumeTotalNum = 8,
41 fluxFacesTotalNum = 12,
42 fluxFacesNumOnSubVolume = 3,
43 fluxEdgesTotalNum = 6,
44 edgesNumOnFluxFace = 2
45 };
46
47 static int getOldElemIdxFromNewFaceIdxto0(int zeroFaceIdx, int elementIdx)
48 {
49 return oldElemIdxFromNewFaceIdxto0_[zeroFaceIdx][elementIdx];
50 }
51
52 static int getNewElemIdxFromOldFaceIdxto0(int zeroFaceIdx, int elementIdx)
53 {
54 return newElemIdxFromOldFaceIdxto0_[zeroFaceIdx][elementIdx];
55 }
56
57 static int getOldFaceIdxFromNewIdxto0(int zeroFaceIdx, int fIdx)
58 {
59 return oldFaceIdxFromNewIdxto0_[zeroFaceIdx][fIdx];
60 }
61
62 static int getNewFaceIdxFromOldIdxto0(int zeroFaceIdx, int fIdx)
63 {
64 return newFaceIdxFromOldIdxto0_[zeroFaceIdx][fIdx];
65 }
66
67 static int getOldEdgeIdxFromNewFaceIdxto0(int zeroFaceIdx, int edgeIdx)
68 {
69 return oldEdgeIdxFromNewFaceIdxto0_[zeroFaceIdx][edgeIdx];
70 }
71
72 static int getNewEdgeIdxFromOldFaceIdxto0(int zeroFaceIdx, int edgeIdx)
73 {
74 return newEdgeIdxFromOldFaceIdxto0_[zeroFaceIdx][edgeIdx];
75 }
76
77
78private:
79 static const int oldElemIdxFromNewFaceIdxto0_[fluxFacesTotalNum][subVolumeTotalNum];
80 static const int newElemIdxFromOldFaceIdxto0_[fluxFacesTotalNum][subVolumeTotalNum];
81 static const int oldFaceIdxFromNewIdxto0_[fluxFacesTotalNum][fluxFacesTotalNum];
82 static const int newFaceIdxFromOldIdxto0_[fluxFacesTotalNum][fluxFacesTotalNum];
83 static const int oldEdgeIdxFromNewFaceIdxto0_[fluxFacesTotalNum][fluxEdgesTotalNum];
84 static const int newEdgeIdxFromOldFaceIdxto0_[fluxFacesTotalNum][fluxEdgesTotalNum];
85};
86
87const int IndexTranslatorAdaptive::oldElemIdxFromNewFaceIdxto0_[fluxFacesTotalNum][subVolumeTotalNum] =
88{
89 {0, 1, 2, 3, 4, 5, 6, 7},
90 {1, 3, 0, 2, 5, 7, 4, 6},
91 {3, 2, 1, 0, 7, 6, 5, 4},
92 {2, 0, 3, 1, 6, 4, 7, 5},
93 {5, 4, 7, 6, 1, 0, 3, 2},
94 {7, 5, 6, 4, 3, 1, 2, 0},
95 {6, 7, 4, 5, 2, 3, 0, 1},
96 {4, 6, 5, 7, 0, 2, 1, 3},
97 {0, 4, 1, 5, 2, 6, 3, 7},
98 {1, 5, 3, 7, 0, 4, 2, 6},
99 {3, 7, 2, 6, 1, 5, 0, 4},
100 {2, 6, 0, 4, 3, 7, 1, 5}
101};
102
103const int IndexTranslatorAdaptive::newElemIdxFromOldFaceIdxto0_[fluxFacesTotalNum][subVolumeTotalNum] =
104{
105 {0, 1, 2, 3, 4, 5, 6, 7},
106 {2, 0, 3, 1, 6, 4, 7, 5},
107 {3, 2, 1, 0, 7, 6, 5, 4},
108 {1, 3, 0, 2, 5, 7, 4, 6},
109 {5, 4, 7, 6, 1, 0, 3, 2},
110 {7, 5, 6, 4, 3, 1, 2, 0},
111 {6, 7, 4, 5, 2, 3, 0, 1},
112 {4, 6, 5, 7, 0, 2, 1, 3},
113 {0, 2, 4, 6, 1, 3, 5, 7},
114 {4, 0, 6, 2, 5, 1, 7, 3},
115 {6, 4, 2, 0, 7, 5, 3, 1},
116 {2, 6, 0, 4, 3, 7, 1, 5}
117};
118
119const int IndexTranslatorAdaptive::oldFaceIdxFromNewIdxto0_[fluxFacesTotalNum][fluxFacesTotalNum] =
120{
121 {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11},
122 {1, 2, 3, 0, 5, 6, 7, 4, 9, 10, 11, 8},
123 {2, 3, 0, 1, 6, 7, 4, 5, 10, 11, 8, 9},
124 {3, 0, 1, 2, 7, 4, 5, 6, 11, 8, 9, 10},
125 {4, 7, 6, 5, 0, 3, 2, 1, 9, 8, 11, 10},
126 {5, 4, 7, 6, 1, 0, 3, 2, 10, 9, 8, 11},
127 {6, 5, 4, 7, 2, 1, 0, 3, 11, 10, 9, 8},
128 {7, 6, 5, 4, 3, 2, 1, 0, 8, 11, 10, 9},
129 {8, 4, 9, 0, 11, 6, 10, 2, 3, 7, 5, 1},
130 {9, 5, 10, 1, 8, 7, 11, 3, 0, 4, 6, 2},
131 {10, 6, 11, 2, 9, 4, 8, 0, 1, 5, 7, 3},
132 {11, 7, 8, 3, 10, 5, 9, 1, 2, 6, 4, 0}
133};
134
135const int IndexTranslatorAdaptive::newFaceIdxFromOldIdxto0_[fluxFacesTotalNum][fluxFacesTotalNum] =
136{
137 {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11},
138 {3, 0, 1, 2, 7, 4, 5, 6, 11, 8, 9, 10},
139 {2, 3, 0, 1, 6, 7, 4, 5, 10, 11, 8, 9},
140 {1, 2, 3, 0, 5, 6, 7, 4, 9, 10, 11, 8},
141 {4, 7, 6, 5, 0, 3, 2, 1, 9, 8, 11, 10},
142 {5, 4, 7, 6, 1, 0, 3, 2, 10, 9, 8, 11},
143 {6, 5, 4, 7, 2, 1, 0, 3, 11, 10, 9, 8},
144 {7, 6, 5, 4, 3, 2, 1, 0, 8, 11, 10, 9},
145 {3, 11, 7, 8, 1, 10, 5, 9, 0, 2, 6, 4},
146 {8, 3, 11, 7, 9, 1, 10, 5, 4, 0, 2, 6},
147 {7, 8, 3, 11, 5, 9, 1, 10, 6, 4, 0, 2},
148 {11, 7, 8, 3, 10, 5, 9, 1, 2, 6, 4, 0}
149};
150
151const int IndexTranslatorAdaptive::oldEdgeIdxFromNewFaceIdxto0_[fluxFacesTotalNum][fluxEdgesTotalNum] =
152{
153 {0, 1, 2, 3, 4, 5},
154 {0, 1, 3, 4, 5, 2},
155 {0, 1, 4, 5, 2, 3},
156 {0, 1, 5, 2, 3, 4},
157 {1, 0, 2, 5, 4, 3},
158 {1, 0, 3, 2, 5, 4},
159 {1, 0, 4, 3, 2, 5},
160 {1, 0, 5, 4, 3, 2},
161 {2, 4, 5, 1, 3, 0},
162 {3, 5, 2, 1, 4, 0},
163 {4, 2, 3, 1, 5, 0},
164 {5, 3, 4, 1, 2, 0}
165};
166
167const int IndexTranslatorAdaptive::newEdgeIdxFromOldFaceIdxto0_[fluxFacesTotalNum][fluxEdgesTotalNum] =
168{
169 {0, 1, 2, 3, 4, 5},
170 {0, 1, 5, 2, 3, 4},
171 {0, 1, 4, 5, 2, 3},
172 {0, 1, 3, 4, 5, 2},
173 {1, 0, 2, 5, 4, 3},
174 {1, 0, 3, 2, 5, 4},
175 {1, 0, 4, 3, 2, 5},
176 {1, 0, 5, 4, 3, 2},
177 {5, 3, 0, 4, 1, 2},
178 {5, 3, 2, 0, 4, 1},
179 {5, 3, 1, 2, 0, 4},
180 {5, 3, 4, 1, 2, 0}
181};
183
185
190template<class TypeTag>
192{
193private:
199
200 enum
201 {
202 dim = GridView::dimension,
203 dimWorld = GridView::dimensionworld,
204 };
205
206 using Element = typename GridView::template Codim<0>::Entity;
207 using ElementSeed = typename Grid::template Codim<0>::EntitySeed;
208
211 using PrimaryVariables = typename SolutionTypes::PrimaryVariables;
212
213 using DimVector = Dune::FieldVector<Scalar, dim>;
214 using FieldVectorVector = Dune::FieldVector<DimVector, dim>;
215 using FieldVectorVector2 = Dune::FieldVector<DimVector, 2>;
216 using FieldVectorVectorVector = Dune::FieldVector<FieldVectorVector2, dim>;
217 using IndexVector = Dune::FieldVector<int, dim>;
218 using BCTypeVector = std::vector<BoundaryTypes>;
219 using BCVector = std::vector<PrimaryVariables>;
220
221public:
222
224 enum FaceTypes
225 {
226 inside = 1,
227 boundary = 0,
228 outside = -1,
229 };
230
232 enum
233 {
234 subVolumeTotalNum = IndexTranslatorAdaptive::subVolumeTotalNum,
235 fluxFacesTotalNum = IndexTranslatorAdaptive::fluxFacesTotalNum,
236 fluxEdgesTotalNum = IndexTranslatorAdaptive::fluxEdgesTotalNum
237 };
239
242 {
248 sixSmallCells = 4
249 };
250
252
255 : ParentType(grid)
256 , hangingNodeType_(noHangingNode)
257 {}
258
260 void reset()
261 {
262 hangingNodeType_ = noHangingNode;
263 existingLevel_.clear();
264 }
265
267 void setSubVolumeElement(const Element& element, int subVolumeIdx)
268 {
269 ParentType::setSubVolumeElement(element, subVolumeIdx);
270 existingLevel_.insert(element.level());
271 }
272
274
277 void setHangingNodeType(int hNType)
278 {
279 hangingNodeType_ = hNType;
280 }
281
283
287 {
288 if (!isHangingNodeVolume())
289 return existingLevel_.size() < 2;
290 else
291 {
292 return existingLevel_.size() < 3;
293 }
294 }
295
297
302 bool hasLevel(int level)
303 {
304 return existingLevel_.find(level) != existingLevel_.end();
305 }
306
308
312 {
313 return hangingNodeType_ != noHangingNode;
314 }
315
318 {
319 return hangingNodeType_;
320 }
321
324 {
326
328 std::cout<<"hanging node type: "<<hangingNodeType_<<"\n";
329 }
330
331// void printInteractionVolumeInfoToFile(std::ofstream& dataFile)
332// {
333// ParentType::printInteractionVolumeInfoToFile(dataFile);
334//
335// if (isHangingNodeVolume())
336// dataFile<<"hanging node type: "<<hangingNodeType_<<"\n";
337// }
338
339private:
340 int hangingNodeType_;
341 std::set<int> existingLevel_;
342};
343}
344#endif
Class including the information of an interaction volume of a MPFA 3D method that does not change wit...
Definition: adapt.hh:29
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type GetProp
get the type of a property (equivalent to old macro GET_PROP(...))
Definition: propertysystem.hh:140
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:149
Class including the information of a 3d interaction volume of a MPFA L-method that does not change wi...
Definition: linteractionvolume3d.hh:115
void setSubVolumeElement(const Element &element, int subVolumeIdx)
Store a dune element as a sub volume element.
Definition: linteractionvolume3d.hh:208
void printInteractionVolumeInfo()
Print the stored interaction volume data.
Definition: linteractionvolume3d.hh:575
FaceTypes
Definition: linteractionvolume3d.hh:147
@ outside
Flux face is outside the model domain.
Definition: linteractionvolume3d.hh:150
@ inside
Flux face is inside the model domain.
Definition: linteractionvolume3d.hh:148
@ boundary
Flux face is a boundary face.
Definition: linteractionvolume3d.hh:149
@ fluxFacesTotalNum
Number of flux faces in the interaction volume.
Definition: linteractionvolume3d.hh:156
@ subVolumeTotalNum
Number of sub-volumes in the interaction volume.
Definition: linteractionvolume3d.hh:155
@ fluxEdgesTotalNum
Number of edges in the interaction volume.
Definition: linteractionvolume3d.hh:157
Class including the information of a 3d interaction volume of an adaptive MPFA L-method that does not...
Definition: linteractionvolume3dadaptive.hh:192
void setHangingNodeType(int hNType)
Store the type of hanging-node-interaction volume.
Definition: linteractionvolume3dadaptive.hh:277
int getHangingNodeType()
The type of the interaction volume as type of FvMpfaL3dInteractionVolumeAdaptive<TypeTag>::HangingNod...
Definition: linteractionvolume3dadaptive.hh:317
bool hasLevel(int level)
Check if an element of a certain grid level is stored.
Definition: linteractionvolume3dadaptive.hh:302
FvMpfaL3dInteractionVolumeAdaptive(const Grid &grid)
Constructs a FvMpfaL3dInteractionVolumeAdaptive object.
Definition: linteractionvolume3dadaptive.hh:254
void setSubVolumeElement(const Element &element, int subVolumeIdx)
Store a dune element as a sub volume element.
Definition: linteractionvolume3dadaptive.hh:267
bool isHangingNodeVolume()
Check whether the interaction volume is a hanging-node volume.
Definition: linteractionvolume3dadaptive.hh:311
bool sameLevel()
Check if elements in the interaction volume are of the same grid level.
Definition: linteractionvolume3dadaptive.hh:286
HangingNodeTypes
The different hanging node interaction volume types (see dissertation M. Wolff, http://elib....
Definition: linteractionvolume3dadaptive.hh:242
@ fourSmallCellsDiag
hanging-node interaction volume of type 4
Definition: linteractionvolume3dadaptive.hh:247
@ fourSmallCellsFace
hanging-node interaction volume of type 1
Definition: linteractionvolume3dadaptive.hh:245
@ fourSmallCellsEdge
hanging-node interaction volume of type 3
Definition: linteractionvolume3dadaptive.hh:246
@ twoSmallCells
hanging-node interaction volume of type 5 or 7
Definition: linteractionvolume3dadaptive.hh:244
@ sixSmallCells
hanging-node interaction volume of type 2 or 6
Definition: linteractionvolume3dadaptive.hh:248
@ noHangingNode
regular interaction volume
Definition: linteractionvolume3dadaptive.hh:243
void printInteractionVolumeInfo()
Print the stored interaction volume data.
Definition: linteractionvolume3dadaptive.hh:323
void reset()
Reset the interaction volume (deletes stored data)
Definition: linteractionvolume3dadaptive.hh:260