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