3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
fvmpfal3dinteractionvolumecontaineradaptive.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_FVMPFAL3D_2P2CINTERACTIONVOLUMECONTAINER_ADAPTIVE_HH
25#define DUMUX_FVMPFAL3D_2P2CINTERACTIONVOLUMECONTAINER_ADAPTIVE_HH
26
27// dumux environment
30
31namespace Dumux {
32
45template<class TypeTag>
47{
49 using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
50
51 enum
52 {
53 dim = GridView::dimension, dimWorld = GridView::dimensionworld
54 };
55
56 using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
57
58 using Indices = typename GET_PROP_TYPE(TypeTag, ModelTraits)::Indices;
59
60 using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes);
61 using PrimaryVariables = typename GET_PROP(TypeTag, SolutionTypes)::PrimaryVariables;
62
63 using GridTypeIndices = typename GET_PROP_TYPE(TypeTag, GridTypeIndices);
64
65 using Element = typename GridView::Traits::template Codim<0>::Entity;
66 using ElementGeometry = typename Element::Geometry;
67 using Vertex = typename GridView::Traits::template Codim<dim>::Entity;
68
69 using IntersectionIterator = typename GridView::IntersectionIterator;
70 using Intersection = typename GridView::Intersection;
71 using IntersectionGeometry = typename Intersection::Geometry;
72
73 using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>;
74 using DimMatrix = Dune::FieldMatrix<Scalar, dim, dim>;
75
76 using DimVector = Dune::FieldVector<Scalar, dim>;
77
78 enum
79 {
80 pressureEqIdx = Indices::pressureEqIdx,
81 };
82 enum
83 {
84 innerEdgeFace = 2, innerSideFace = 1
85 };
86 enum
87 {
88 realFaceArea = 0, fluxFaceArea = 1
89 };
90
91public:
94
95 using GlobalInteractionVolumeVector = std::vector<InteractionVolume>;
96 using FaceAreaVector = std::vector<Dune::FieldVector<Dune::FieldVector<Scalar, 2>, 2*dim> >;
97
99
100 inline int getMpfaCase8cells(const IntersectionIterator& isIt,
101 const int localidxLarge,
103 bool& properFluxDirection);
104 inline int getMpfaCase6cells(const IntersectionIterator& isIt,
106 bool& properFluxDirection);
107 inline int getMpfaCase2or4cells(const IntersectionIterator& isIt,
109 bool& properFluxDirection);
110
112 : ParentType(problem), problem_(problem)
113 {
114 if (dim != 3)
115 {
116 DUNE_THROW(Dune::NotImplemented, "Dimension not supported!");
117 }
118 }
119private:
120 Problem& problem_;
121};
122
128template<class TypeTag>
130{
131 return;
132}
133
150template<class TypeTag>
152 const int localIdxLarge,
153 InteractionVolume& interactionVolume,
154 bool& properFluxDirection)
155{
156 int subVolumeFaceIdx = -1;
157
158 /************** determine subVolumeFace of interest */
159 int localFaceIdxInside = isIt->indexInInside();
160 switch(localIdxLarge)
161 {
162 case 0:{ //cell I = 7
163 if(localFaceIdxInside == 0) //left
164 {
165 subVolumeFaceIdx = 6;
166 properFluxDirection = false;
167 }
168 else if(localFaceIdxInside == 2) //front
169 subVolumeFaceIdx = 5;
170 else if(localFaceIdxInside == 4) //bottom
171 subVolumeFaceIdx = 10;
172 break;
173 }
174 case 1:{ //cell I = 6
175 if(localFaceIdxInside == 1) //right
176 subVolumeFaceIdx = 6;
177 else if(localFaceIdxInside == 2) //front
178 {
179 subVolumeFaceIdx = 7;
180 properFluxDirection = false;
181 }
182 else if(localFaceIdxInside == 4) //bottom
183 {
184 subVolumeFaceIdx = 11;
185 properFluxDirection = false;
186 }
187 break;
188 }
189 case 2:{ // cellI = 5
190 if(localFaceIdxInside == 0) // left
191 subVolumeFaceIdx = 4;
192 else if(localFaceIdxInside == 3) //rear
193 {
194 subVolumeFaceIdx = 5;
195 properFluxDirection = false;
196 }
197 else if(localFaceIdxInside == 4) //bottom
198 {
199 subVolumeFaceIdx = 9;
200 properFluxDirection = false;
201 }
202 break;
203 }
204 case 3:{ //cellI = 4
205 if(localFaceIdxInside == 1) //right
206 {
207 subVolumeFaceIdx = 4;
208 properFluxDirection = false;
209 }
210 else if(localFaceIdxInside == 3) //rear
211 subVolumeFaceIdx = 7;
212 else if(localFaceIdxInside == 4) //botm
213 subVolumeFaceIdx = 8;
214 break;
215 }
216 case 4:{ //cellI = 3
217 if(localFaceIdxInside == 0) //left
218 subVolumeFaceIdx = 2;
219 else if(localFaceIdxInside == 2) //front
220 {
221 subVolumeFaceIdx = 1;
222 properFluxDirection = false;
223 }
224 else if(localFaceIdxInside == 5) //top
225 {
226 subVolumeFaceIdx = 10;
227 properFluxDirection = false;
228 }
229 break;
230 }
231 case 5:{ //cellI = 2
232 if(localFaceIdxInside == 1) //right
233 {
234 subVolumeFaceIdx = 2;
235 properFluxDirection = false;
236 }
237 else if(localFaceIdxInside == 2) //front
238 subVolumeFaceIdx = 3;
239 else if(localFaceIdxInside == 5) //top
240 subVolumeFaceIdx = 11;
241 break;
242 }
243 case 6:{ //cellI = 1
244 if(localFaceIdxInside == 0) // left
245 {
246 subVolumeFaceIdx = 0;
247 properFluxDirection = false;
248 }
249 else if(localFaceIdxInside == 3) //rear
250 subVolumeFaceIdx = 1;
251 else if(localFaceIdxInside == 5) //top
252 subVolumeFaceIdx = 9;
253 break;
254 }
255 case 7:{ //cellI= 0
256 if(localFaceIdxInside == 1) //right
257 subVolumeFaceIdx = 0;
258 else if(localFaceIdxInside == 3)//rear
259 {
260 subVolumeFaceIdx = 3;
261 properFluxDirection = false;
262 }
263 else if(localFaceIdxInside == 5)//top
264 {
265 subVolumeFaceIdx = 8;
266 properFluxDirection = false;
267 }
268 break;
269 }
270 }
271 return subVolumeFaceIdx;
272}
273
286template<class TypeTag>
288 InteractionVolume& interactionVolume,
289 bool& properFluxDirection)
290{
291 int mapI(-5), mapJ(-5);
292 int mapI2(-5), mapJ2(-5);
293 // search for cell I
294 for (int i= 0; i<interactionVolume.getElementNumber(); i++)
295 {
296 if(isIt->inside() == interactionVolume.getSubVolumeElement(i))
297 {
298 if(mapI == -5)
299 mapI = i;
300 else
301 mapI2 = i;
302 }
303
304 if(isIt->outside() == interactionVolume.getSubVolumeElement(i))
305 {
306 if(mapJ == -5)
307 mapJ = i;
308 else
309 mapJ2 =i;
310 }
311 }
312
313 for(int passionfruit = 0; passionfruit <=1; passionfruit++) // loop at most twice
314 {
315 if(mapI== 0 || mapJ == 0)
316 {
317 if(mapI== 2)
318 return 3;
319 else if (mapJ== 2){
320 properFluxDirection = false;
321 return 3;
322 }
323 else if(mapJ== 1)
324 return 0;
325 else if (mapI==1){
326 properFluxDirection = false;
327 return 0;
328 }
329 }
330 // no "else if" because there is also 4 - 0 treated under I or J == 4
331 if(mapI== 1 || mapJ == 1)
332 {
333 if (mapI== 3){
334 properFluxDirection = false;
335 return 1;
336 }
337 else if(mapJ== 3)
338 return 1;
339 else if(mapI == 5){
340 properFluxDirection = false;
341 return 9;
342 }
343 else if(mapJ == 5)
344 return 9;
345 }
346 else if(mapI== 2 || mapJ == 2)
347 {
348 if(mapI == 6){
349 properFluxDirection = false;
350 return 11;
351 }
352 else if(mapJ ==6)
353 return 11;
354 }
355 else if(mapI== 3 || mapJ == 3)
356 {
357 if (mapJ== 7){
358 properFluxDirection = false;
359 return 10;
360 }
361 else if(mapI== 7)
362 return 10;
363 }
364 else if(mapI== 4 || mapJ == 4)
365 {
366 // this has to be subVolFaceIdx 8 because 7 would mean
367 // a case that should be modelled by tpfa
368 if (mapI== 0){
369 properFluxDirection = false;
370 return 8;
371 }
372 else if(mapJ== 0)
373 return 8;
374 else if(mapI == 6){
375 properFluxDirection = false;
376 return 7;
377 }
378 else if(mapJ == 6)
379 return 7;
380 }
381 else if(mapI== 5 || mapJ == 5)
382 {
383 if (mapJ== 7){
384 properFluxDirection = false;
385 return 5;
386 }
387 else if(mapI== 7)
388 return 5;
389 }
390 else if(mapI== 6 || mapJ == 6)
391 {
392 if (mapI== 7){
393 properFluxDirection = false;
394 return 6;
395 }
396 else if(mapJ== 7)
397 return 6;
398 }
399 // configuration not found: I or J are twice in the interaction volume: investigate other localIdx
400 if(mapI2 != -5)
401 mapI = mapI2;
402 else if(mapJ2 != -5)
403 mapJ = mapJ2;
404 }
405
406 Dune::dgrave << " Could not find "<< interactionVolume.getHangingNodeType() <<" case configuration for I = "
407 << problem_.variables().index(isIt->inside()) << " localIdx " << mapI << " , "
408 << problem_.variables().index(isIt->outside()) << " localIdx " << mapJ << std::endl;
409
410 return -1;
411}
412
425template<class TypeTag>
427 InteractionVolume& interactionVolume,
428 bool& properFluxDirection)
429{
430 int mapI(-5), mapJ(-5);
431 int mapI2(-5), mapJ2(-5);
432 // search for cell I
433 for (int i= 0; i<interactionVolume.getElementNumber(); i++)
434 {
435 if(isIt->inside() == interactionVolume.getSubVolumeElement(i))
436 {
437 if(mapI == -5)
438 mapI = i;
439 else
440 mapI2 = i;
441 }
442
443 if(isIt->outside() == interactionVolume.getSubVolumeElement(i))
444 {
445 if(mapJ == -5)
446 mapJ = i;
447 else
448 mapJ2 =i;
449 }
450 }
451
452 for(int passionfruit = 0; passionfruit <=1; passionfruit++) // loop at most twice
453 {
454
455 if(mapI== 0 || mapJ == 0)
456 {
457 if (mapJ== 2){
458 properFluxDirection = false;
459 return 3;
460 }
461 else if(mapI== 2)
462 return 3;
463 else if (mapJ== 4){
464 properFluxDirection = false;
465 return 8;
466 }
467 else if(mapI== 4)
468 return 8;
469 //it has to be case 0
470 else if (mapJ == 0)
471 properFluxDirection = false;
472
473 return 0;
474 }
475 else if(mapI== 1 || mapJ == 1)
476 {
477 if (mapI== 3){
478 properFluxDirection = false;
479 return 1;
480 }
481 else if(mapJ== 3)
482 return 1;
483 else if(mapI == 5){
484 properFluxDirection = false;
485 return 9;
486 }
487 else if(mapJ == 5)
488 return 9;
489 }
490 else if(mapI== 2 || mapJ == 2)
491 {
492 if (mapJ== 3){
493 properFluxDirection = false;
494 return 2;
495 }
496 else if(mapI== 3)
497 return 2;
498 else if(mapI == 6){
499 properFluxDirection = false;
500 return 11;
501 }
502 else if(mapJ ==6)
503 return 11;
504 }
505 else if(mapI== 3 || mapJ == 3)
506 {
507 if (mapJ== 7){
508 properFluxDirection = false;
509 return 10;
510 }
511 else if(mapI== 7)
512 return 10;
513 }
514 else if(mapI== 4 || mapJ == 4)
515 {
516 if (mapJ== 5){
517 properFluxDirection = false;
518 return 4;
519 }
520 else if(mapI== 5)
521 return 4;
522 else if(mapI == 6){
523 properFluxDirection = false;
524 return 7;
525 }
526 else if(mapJ == 6)
527 return 7;
528 }
529 else if(mapI== 5 || mapJ == 5)
530 {
531 if (mapJ== 7){
532 properFluxDirection = false;
533 return 5;
534 }
535 else if(mapI== 7)
536 return 5;
537 }
538 else if(mapI== 6 || mapJ == 6)
539 {
540 if (mapI== 7){
541 properFluxDirection = false;
542 return 6;
543 }
544 else if(mapJ== 7)
545 return 6;
546 }
547 // configuration not found: I or J are twice in the interaction volume: investigate other localIdx
548 if(mapI2 != -5)
549 mapI = mapI2;
550 else if(mapJ2 != -5)
551 mapJ = mapJ2;
552 }
553
554 Dune::dgrave << " Could not find "<< interactionVolume.getHangingNodeType() <<" case configuration for I = "
555 << problem_.variables().index(isIt->inside()) << " localIdx " << mapI << " and "
556 << problem_.variables().index(isIt->outside()) << " localIdx " << mapJ << std::endl;
557 return -1;
558}
559
560
561} // end namespace Dumux
562#endif
#define GET_PROP(TypeTag, PropTagName)
Definition: propertysystemmacros.hh:281
#define GET_PROP_TYPE(TypeTag, PropTagName)
Definition: propertysystemmacros.hh:283
Contains a class to exchange entries of a vector.
Interactionvolume container for 3-d MPFA L-method on an h-adaptive grid.
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
Property tag MPFAInteractionVolume
Type of the data container for one interaction volume.
Definition: porousmediumflow/sequential/cellcentered/mpfa/properties.hh:96
Interactionvolume container for 3-d MPFA L-method.
Definition: 3dinteractionvolumecontainer.hh:46
typename GET_PROP_TYPE(TypeTag, MPFAInteractionVolume) InteractionVolume
Type for storing an MPFA-interaction-volume. (Usually of type FvMpfaL3dInteractionVolume or FvMpfaL3d...
Definition: 3dinteractionvolumecontainer.hh:93
InteractionVolume & interactionVolume(int vertexIdx)
Returns an interaction volume.
Definition: 3dinteractionvolumecontainer.hh:142
Interactionvolume container for 3-d MPFA L-method on an h-adaptive grid.
Definition: 3dinteractionvolumecontaineradaptive.hh:47
Interaction volume container for compositional adaptive 3-d (using MPFA L-method) Model.
Definition: fvmpfal3dinteractionvolumecontaineradaptive.hh:47
FvMpfaL3d2P2CInteractionVolumeContainerAdaptive(Problem &problem)
Definition: fvmpfal3dinteractionvolumecontaineradaptive.hh:111
int getMpfaCase6cells(const IntersectionIterator &isIt, InteractionVolume &interactionVolume, bool &properFluxDirection)
Determine the subVolumeFaceIdx for a given intersection and interactionVolume with 6 cells.
Definition: fvmpfal3dinteractionvolumecontaineradaptive.hh:287
void storeBoundaryInteractionVolume(InteractionVolume &interactionVolume, const Vertex &vertex)
Overwrites the method from the base class FvMpfaL3dInteractionVolumeContainerAdaptive On each boundar...
Definition: fvmpfal3dinteractionvolumecontaineradaptive.hh:129
int getMpfaCase2or4cells(const IntersectionIterator &isIt, InteractionVolume &interactionVolume, bool &properFluxDirection)
Determine the subVolumeFaceIdx for a given intersection and interactionVolume with 2/4 cells.
Definition: fvmpfal3dinteractionvolumecontaineradaptive.hh:426
int getMpfaCase8cells(const IntersectionIterator &isIt, const int localidxLarge, InteractionVolume &interactionVolume, bool &properFluxDirection)
Determine the subVolumeFaceIdx for a given intersection and interactionVolume with 8 cells.
Definition: fvmpfal3dinteractionvolumecontaineradaptive.hh:151