version 3.11-dev
Loading...
Searching...
No Matches
discretization/pq1bubble/geometryhelper.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// SPDX-FileCopyrightText: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
13#ifndef DUMUX_DISCRETIZATION_PQ1BUBBLE_GEOMETRY_HELPER_HH
14#define DUMUX_DISCRETIZATION_PQ1BUBBLE_GEOMETRY_HELPER_HH
15
16#include <array>
17#include <ranges>
18
19#include <dune/common/exceptions.hh>
20#include <dune/common/rangeutilities.hh>
21#include <dune/common/reservedvector.hh>
22
23#include <dune/geometry/type.hh>
24#include <dune/geometry/referenceelements.hh>
25#include <dune/geometry/multilineargeometry.hh>
26
28#include <dumux/common/math.hh>
34
35#include "dofhelper.hh"
36
37namespace Dumux {
38
40template <class ct>
41struct PQ1BubbleMLGeometryTraits : public Dune::MultiLinearGeometryTraits<ct>
42{
43 // we use static vectors to store the corners as we know
44 // the maximum number of corners in advance (2^dim for box-type sub-cells,
45 // overlapping sub-cells never exceed this count)
46 template< int mydim, int cdim >
48 {
49 using Type = Dune::ReservedVector< Dune::FieldVector< ct, cdim >, (1<<mydim)>;
50 };
51};
52
53
55
56template<Dune::GeometryType::Id gt>
58
59template<>
60struct OverlappingScvCorners<Dune::GeometryTypes::line>
61{
62 using Key = std::pair<std::uint8_t, std::uint8_t>; // (i, codim)
63 static constexpr std::array<std::array<Key, 2>, 1> keys = {{
64 { Key{0, 1}, Key{1, 1} }
65 }};
66};
67
68template<>
69struct OverlappingScvCorners<Dune::GeometryTypes::triangle>
70{
71 using Key = std::pair<std::uint8_t, std::uint8_t>; // (i, codim)
72 static constexpr std::array<std::array<Key, 3>, 1> keys = {{
73 { Key{0, 1}, Key{1, 1}, Key{2, 1} }
74 }};
75};
76
77template<>
78struct OverlappingScvCorners<Dune::GeometryTypes::quadrilateral>
79{
80 using Key = std::pair<std::uint8_t, std::uint8_t>; // (i, codim)
81 static constexpr std::array<std::array<Key, 4>, 1> keys = {{
82 { Key{2, 1}, Key{1, 1}, Key{0, 1}, Key{3, 1} }
83 }};
84};
85
86template<>
87struct OverlappingScvCorners<Dune::GeometryTypes::tetrahedron>
88{
89 using Key = std::pair<std::uint8_t, std::uint8_t>; // (i, codim)
90 static constexpr std::array<std::array<Key, 4>, 1> keys = {{
91 { Key{0, 1}, Key{1, 1}, Key{2, 1}, Key{3, 1} }
92 }};
93};
94
95template<>
96struct OverlappingScvCorners<Dune::GeometryTypes::hexahedron>
97{
98 using Key = std::pair<std::uint8_t, std::uint8_t>; // (i, codim)
99 static constexpr std::array<std::array<Key, 6>, 1> keys = {{
100 { Key{0, 1}, Key{2, 1}, Key{3, 1}, Key{1, 1}, Key{4, 1}, Key{5, 1} }
101 }};
102};
103
104
105template<Dune::GeometryType::Id gt>
107
108template<>
109struct OverlappingScvfCorners<Dune::GeometryTypes::line>
110{
111 using Key = std::pair<std::uint8_t, std::uint8_t>; // (i, codim)
112 static constexpr std::array<std::array<Key, 1>, 1> keys = {{
113 { Key{0, 0} }
114 }};
115};
116
117template<>
118struct OverlappingScvfCorners<Dune::GeometryTypes::triangle>
119{
120 using Key = std::pair<std::uint8_t, std::uint8_t>; // (i, codim)
121 static constexpr std::array<std::array<Key, 2>, 3> keys = {{
122 { Key{0, 1}, Key{1, 1} },
123 { Key{0, 1}, Key{2, 1} },
124 { Key{1, 1}, Key{2, 1} }
125 }};
126};
127
128template<>
129struct OverlappingScvfCorners<Dune::GeometryTypes::quadrilateral>
130{
131 using Key = std::pair<std::uint8_t, std::uint8_t>; // (i, codim)
132 static constexpr std::array<std::array<Key, 2>, 4> keys = {{
133 { Key{0, 1}, Key{2, 1} },
134 { Key{2, 1}, Key{1, 1} },
135 { Key{0, 1}, Key{3, 1} },
136 { Key{1, 1}, Key{3, 1} }
137 }};
138};
139
140template<>
141struct OverlappingScvfCorners<Dune::GeometryTypes::tetrahedron>
142{
143 using Key = std::pair<std::uint8_t, std::uint8_t>; // (i, codim)
144 static constexpr std::array<std::array<Key, 3>, 4> keys = {{
145 { Key{0, 1}, Key{1, 1}, Key{2, 1} },
146 { Key{0, 1}, Key{1, 1}, Key{3, 1} },
147 { Key{0, 1}, Key{2, 1}, Key{3, 1} },
148 { Key{1, 1}, Key{2, 1}, Key{3, 1} }
149 }};
150};
151
152template<>
153struct OverlappingScvfCorners<Dune::GeometryTypes::hexahedron>
154{
155 using Key = std::pair<std::uint8_t, std::uint8_t>; // (i, codim)
156 static constexpr std::array<std::array<Key, 3>, 8> keys = {{
157 { Key{4, 1}, Key{0, 1}, Key{2, 1} },
158 { Key{4, 1}, Key{2, 1}, Key{1, 1} },
159 { Key{4, 1}, Key{0, 1}, Key{3, 1} },
160 { Key{4, 1}, Key{1, 1}, Key{3, 1} },
161 { Key{5, 1}, Key{0, 1}, Key{2, 1} },
162 { Key{5, 1}, Key{2, 1}, Key{1, 1} },
163 { Key{5, 1}, Key{0, 1}, Key{3, 1} },
164 { Key{5, 1}, Key{1, 1}, Key{3, 1} }
165 }};
166};
167
168} // end namespace Detail::PQ1Bubble
169
174template <class GridView, class ScvType, class ScvfType>
176{
177 using Scalar = typename GridView::ctype;
178 using GlobalPosition = typename Dune::FieldVector<Scalar, GridView::dimensionworld>;
179 using ScvCornerStorage = typename ScvType::Traits::CornerStorage;
180 using ScvfCornerStorage = typename ScvfType::Traits::CornerStorage;
181 using LocalIndexType = typename ScvType::Traits::LocalIndexType;
182
183 using Element = typename GridView::template Codim<0>::Entity;
184 using Intersection = typename GridView::Intersection;
185
186 static constexpr auto dim = GridView::dimension;
187 static constexpr auto dimWorld = GridView::dimensionworld;
188
190public:
192
193 PQ1BubbleGeometryHelper(const typename Element::Geometry& geometry)
194 : geo_(geometry)
195 , boxHelper_(geometry)
196 {}
197
199 ScvCornerStorage getScvCorners(unsigned int localScvIdx) const
200 {
201 return getScvCorners(geo_.type(), [&](const auto& local){ return geo_.global(local); }, localScvIdx);
202 }
203
205 template<class Transformation>
206 static ScvCornerStorage getScvCorners(Dune::GeometryType type, Transformation&& trans, unsigned int localScvIdx)
207 {
208 // proceed according to number of corners of the element
209 const auto& ref = Dune::referenceElement<Scalar, dim>(type);
210 const auto numBoxScv = ref.size(dim);
211 // reuse box geometry helper for the corner scvs
212 if (localScvIdx < numBoxScv)
213 return BoxHelper::getScvCorners(type, trans, localScvIdx);
214
215 const auto localOverlappingScvIdx = localScvIdx-numBoxScv;
216 if (type == Dune::GeometryTypes::triangle)
217 {
219 return Detail::Box::keyToCornerStorage<ScvCornerStorage>(ref, trans, Corners::keys[localOverlappingScvIdx]);
220 }
221 else if (type == Dune::GeometryTypes::quadrilateral)
222 {
224 return Detail::Box::keyToCornerStorage<ScvCornerStorage>(ref, trans, Corners::keys[localOverlappingScvIdx]);
225 }
226 else if (type == Dune::GeometryTypes::tetrahedron)
227 {
229 return Detail::Box::keyToCornerStorage<ScvCornerStorage>(ref, trans, Corners::keys[localOverlappingScvIdx]);
230 }
231 else if (type == Dune::GeometryTypes::hexahedron)
232 {
234 return Detail::Box::keyToCornerStorage<ScvCornerStorage>(ref, trans, Corners::keys[localOverlappingScvIdx]);
235 }
236 else
237 DUNE_THROW(Dune::NotImplemented, "PQ1Bubble scv geometries for dim=" << dim
238 << " dimWorld=" << dimWorld
239 << " type=" << type);
240 }
241
242 Dune::GeometryType getScvGeometryType(unsigned int localScvIdx) const
243 {
244 // proceed according to number of corners of the element
245 const auto type = geo_.type();
246 const auto numBoxScv = boxHelper_.numScv();
247 if (localScvIdx < numBoxScv)
248 return Dune::GeometryTypes::cube(dim);
249 else if (type == Dune::GeometryTypes::simplex(dim))
250 return Dune::GeometryTypes::simplex(dim);
251 else if (type == Dune::GeometryTypes::quadrilateral)
252 return Dune::GeometryTypes::quadrilateral;
253 else if (type == Dune::GeometryTypes::hexahedron)
254 return Dune::GeometryTypes::none(dim); // octahedron
255 else
256 DUNE_THROW(Dune::NotImplemented, "PQ1Bubble scv geometries for dim=" << dim
257 << " dimWorld=" << dimWorld
258 << " type=" << type);
259 }
260
262 ScvfCornerStorage getScvfCorners(unsigned int localScvfIdx) const
263 {
264 return getScvfCorners(geo_.type(), [&](const auto& local){ return geo_.global(local); }, localScvfIdx);
265 }
266
268 template<class Transformation>
269 static ScvfCornerStorage getScvfCorners(Dune::GeometryType type, Transformation&& trans, unsigned int localScvfIdx)
270 {
271 // proceed according to number of corners
272 const auto& ref = Dune::referenceElement<Scalar, dim>(type);
273 const auto numBoxScvf = ref.size(dim-1);
274 // reuse box geometry helper for the corner scvs
275 if (localScvfIdx < numBoxScvf)
276 return BoxHelper::getScvfCorners(type, trans, localScvfIdx);
277
278 const auto localOverlappingScvfIdx = localScvfIdx-numBoxScvf;
279 if (type == Dune::GeometryTypes::triangle)
280 {
282 return Detail::Box::keyToCornerStorage<ScvfCornerStorage>(ref, trans, Corners::keys[localOverlappingScvfIdx]);
283 }
284 else if (type == Dune::GeometryTypes::quadrilateral)
285 {
287 return Detail::Box::keyToCornerStorage<ScvfCornerStorage>(ref, trans, Corners::keys[localOverlappingScvfIdx]);
288 }
289 else if (type == Dune::GeometryTypes::tetrahedron)
290 {
292 return Detail::Box::keyToCornerStorage<ScvfCornerStorage>(ref, trans, Corners::keys[localOverlappingScvfIdx]);
293 }
294 else if (type == Dune::GeometryTypes::hexahedron)
295 {
297 return Detail::Box::keyToCornerStorage<ScvfCornerStorage>(ref, trans, Corners::keys[localOverlappingScvfIdx]);
298 }
299 else
300 DUNE_THROW(Dune::NotImplemented, "PQ1Bubble scvf geometries for dim=" << dim
301 << " dimWorld=" << dimWorld
302 << " type=" << type);
303 }
304
305 Dune::GeometryType getInteriorScvfGeometryType(unsigned int localScvfIdx) const
306 {
307 const auto numBoxScvf = boxHelper_.numInteriorScvf();
308 if (localScvfIdx < numBoxScvf)
309 return Dune::GeometryTypes::cube(dim-1);
310 else
311 return Dune::GeometryTypes::simplex(dim-1);
312 }
313
315 ScvfCornerStorage getBoundaryScvfCorners(unsigned int localFacetIndex,
316 unsigned int indexInFacet) const
317 {
318 return boxHelper_.getBoundaryScvfCorners(localFacetIndex, indexInFacet);
319 }
320
321 Dune::GeometryType getBoundaryScvfGeometryType(unsigned int localScvfIdx) const
322 {
323 return Dune::GeometryTypes::cube(dim-1);
324 }
325
326 GlobalPosition normal(const ScvfCornerStorage& p, const std::array<LocalIndexType, 2>& scvPair)
327 {
328 auto normal = Detail::scvfUnitNormal(geo_, p);
329
330 GlobalPosition v = dofPosition(scvPair[1]) - dofPosition(scvPair[0]);
331
332 const auto s = v*normal;
333 if (std::signbit(s))
334 normal *= -1;
335
336 return normal;
337 }
338
340 const typename Element::Geometry& elementGeometry() const
341 { return geo_; }
342
344 static auto numInteriorScvf(Dune::GeometryType type)
345 {
346 return BoxHelper::numInteriorScvf(type) + Dune::referenceElement<Scalar, dim>(type).size(dim);
347 }
348
350 static auto numBoundaryScvf(Dune::GeometryType type, unsigned int localFacetIndex)
351 {
352 return Dune::referenceElement<Scalar, dim>(type).size(localFacetIndex, 1, dim);
353 }
354
356 std::size_t numScv() const
357 {
358 return boxHelper_.numScv() + 1;
359 }
360
362 Scalar scvVolume(unsigned int localScvIdx, const ScvCornerStorage& p) const
363 {
364 const auto scvType = getScvGeometryType(localScvIdx);
365 if constexpr (dim == 3)
366 if (scvType == Dune::GeometryTypes::none(dim))
367 return octahedronVolume_(p);
368
370 scvType,
371 [&](unsigned int i){ return p[i]; }
372 );
373 }
374
376 static std::size_t numNonCVLocalDofs(Dune::GeometryType type)
377 {
378 return 0;
379 }
380
381 GlobalPosition dofPosition(unsigned int localDofIdx) const
382 {
383 const auto numVertexDofs = Dune::referenceElement<Scalar, dim>(geo_.type()).size(dim);
384 if (localDofIdx < numVertexDofs)
385 return geo_.corner(localDofIdx);
386 else
387 return geo_.center();
388 }
389
390 std::array<LocalIndexType, 2> getScvPairForScvf(unsigned int localScvfIndex) const
391 {
392 const auto numEdges = referenceElement(geo_).size(dim-1);
393 if (localScvfIndex < numEdges)
394 return {
395 static_cast<LocalIndexType>(referenceElement(geo_).subEntity(localScvfIndex, dim-1, 0, dim)),
396 static_cast<LocalIndexType>(referenceElement(geo_).subEntity(localScvfIndex, dim-1, 1, dim))
397 };
398 else
399 return {
400 static_cast<LocalIndexType>(DofHelper::numElementDofs(geo_.type())-1),
401 static_cast<LocalIndexType>(localScvfIndex-numEdges)
402 };
403 }
404
405 std::array<LocalIndexType, 2> getScvPairForBoundaryScvf(unsigned int localFacetIndex, unsigned int localIsScvfIndex) const
406 {
407 const LocalIndexType insideScvIdx
408 = static_cast<LocalIndexType>(referenceElement(geo_).subEntity(localFacetIndex, 1, localIsScvfIndex, dim));
409 return { insideScvIdx, insideScvIdx };
410 }
411
412 bool isOverlappingScvf(unsigned int localScvfIndex) const
413 {
414 if (localScvfIndex < boxHelper_.numInteriorScvf())
415 return false;
416 else
417 return true;
418 }
419
420 bool isOverlappingBoundaryScvf(unsigned int localFacetIndex) const
421 {
422 return false;
423 }
424
425 bool isOverlappingScv(unsigned int localScvIndex) const
426 {
427 if (localScvIndex < boxHelper_.numScv())
428 return false;
429 else
430 return true;
431 }
432
434 static Element::Geometry::LocalCoordinate localScvfCenter(Dune::GeometryType type, unsigned int localScvfIdx)
435 {
436 return Dumux::center(getScvfCorners(type, [&](const auto& local){ return local; }, localScvfIdx));
437 }
438
440 static Element::Geometry::LocalCoordinate localBoundaryScvfCenter(Dune::GeometryType type, unsigned int localFacetIndex, unsigned int indexInFace)
441 {
442 return Dumux::center(BoxHelper::getBoundaryScvfCorners(type, [&](const auto& local){ return local; }, localFacetIndex, indexInFace));
443 }
444
445private:
446 Scalar octahedronVolume_(const ScvCornerStorage& p) const
447 {
448 using std::abs;
449 return 1.0/6.0 * (
450 abs(Dumux::tripleProduct(p[4]-p[0], p[1]-p[0], p[2]-p[0]))
451 + abs(Dumux::tripleProduct(p[5]-p[0], p[1]-p[0], p[2]-p[0]))
452 );
453 }
454
455 typename Element::Geometry geo_;
456 BoxHelper boxHelper_;
457};
458
459template <class GridView, class ScvType, class ScvfType, std::size_t numCubeBubbleDofs>
461{
462 using Scalar = typename GridView::ctype;
463 using GlobalPosition = typename Dune::FieldVector<Scalar, GridView::dimensionworld>;
464 using ScvCornerStorage = typename ScvType::Traits::CornerStorage;
465 using ScvfCornerStorage = typename ScvfType::Traits::CornerStorage;
466 using LocalIndexType = typename ScvType::Traits::LocalIndexType;
467
468 using Element = typename GridView::template Codim<0>::Entity;
469 using Intersection = typename GridView::Intersection;
470
471 static constexpr auto dim = GridView::dimension;
472 static constexpr auto dimWorld = GridView::dimensionworld;
473
475public:
477
478 HybridPQ1BubbleGeometryHelper(const typename Element::Geometry& geometry)
479 : geo_(geometry)
480 , boxHelper_(geometry)
481 {}
482
484 ScvCornerStorage getScvCorners(unsigned int localScvIdx) const
485 {
486 return getScvCorners(geo_.type(), [&](const auto& local){ return geo_.global(local); }, localScvIdx);
487 }
488
490 template<class Transformation>
491 static ScvCornerStorage getScvCorners(Dune::GeometryType type, Transformation&& trans, unsigned int localScvIdx)
492 {
493 // proceed according to number of corners of the element
494 const auto& ref = Dune::referenceElement<Scalar, dim>(type);
495 const auto numBoxScv = ref.size(dim);
496 // reuse box geometry helper for the corner scvs
497 if (localScvIdx < numBoxScv)
498 return BoxHelper::getScvCorners(type, trans, localScvIdx);
499
500 DUNE_THROW(Dune::NotImplemented, "PQ1Bubble scv corners call for hybrid dofs");
501 }
502
503 Dune::GeometryType getScvGeometryType(unsigned int localScvIdx) const
504 {
505 // proceed according to number of corners of the element
506 const auto numBoxScv = boxHelper_.numScv();
507
508 if (localScvIdx < numBoxScv)
509 return Dune::GeometryTypes::cube(dim);
510
511 DUNE_THROW(Dune::NotImplemented, "PQ1Bubble scv geometry call for hybrid dofs");
512 }
513
515 ScvfCornerStorage getScvfCorners(unsigned int localScvfIdx) const
516 {
517 return getScvfCorners(geo_.type(), [&](const auto& local){ return geo_.global(local); }, localScvfIdx);
518 }
519
521 template<class Transformation>
522 static ScvfCornerStorage getScvfCorners(Dune::GeometryType type, Transformation&& trans, unsigned int localScvfIdx)
523 {
524 // proceed according to number of corners
525 const auto& ref = Dune::referenceElement<Scalar, dim>(type);
526 const auto numBoxScvf = ref.size(dim-1);
527 // reuse box geometry helper for scvfs
528 if (localScvfIdx < numBoxScvf)
529 return BoxHelper::getScvfCorners(type, trans, localScvfIdx);
530
531 DUNE_THROW(Dune::NotImplemented, "PQ1Bubble scvf corners call for hybrid dofs");
532 }
533
534 Dune::GeometryType getInteriorScvfGeometryType(unsigned int localScvfIdx) const
535 {
536 const auto numBoxScvf = boxHelper_.numInteriorScvf();
537 if (localScvfIdx < numBoxScvf)
538 return Dune::GeometryTypes::cube(dim-1);
539
540 DUNE_THROW(Dune::NotImplemented, "PQ1Bubble interior scvf geometry type call for hybrid dofs");
541 }
542
544 ScvfCornerStorage getBoundaryScvfCorners(unsigned int localFacetIndex,
545 unsigned int indexInFacet) const
546 {
547 return boxHelper_.getBoundaryScvfCorners(localFacetIndex, indexInFacet);
548 }
549
550 Dune::GeometryType getBoundaryScvfGeometryType(unsigned int localScvfIdx) const
551 {
552 return Dune::GeometryTypes::cube(dim-1);
553 }
554
555 GlobalPosition normal(const ScvfCornerStorage& p, const std::array<LocalIndexType, 2>& scvPair)
556 {
557 auto normal = Detail::scvfUnitNormal(geo_, p);
558
559 GlobalPosition v = dofPosition(scvPair[1]) - dofPosition(scvPair[0]);
560
561 const auto s = v*normal;
562 if (std::signbit(s))
563 normal *= -1;
564
565 return normal;
566 }
567
569 const typename Element::Geometry& elementGeometry() const
570 { return geo_; }
571
573 static auto numInteriorScvf(Dune::GeometryType type)
574 {
575 return BoxHelper::numInteriorScvf(type);
576 }
577
579 static auto numBoundaryScvf(Dune::GeometryType type, unsigned int localFacetIndex)
580 {
581 return Dune::referenceElement<Scalar, dim>(type).size(localFacetIndex, 1, dim);
582 }
583
585 std::size_t numScv() const
586 {
587 return boxHelper_.numScv();
588 }
589
591 Scalar scvVolume(unsigned int localScvIdx, const ScvCornerStorage& p) const
592 {
593 const auto scvType = getScvGeometryType(localScvIdx);
594
596 scvType,
597 [&](unsigned int i){ return p[i]; }
598 );
599 }
600
602 static std::size_t numNonCVLocalDofs(Dune::GeometryType type)
603 {
604 return type.isCube() ? numCubeBubbleDofs : 1;
605 }
606
607 GlobalPosition dofPosition(unsigned int localDofIdx) const
608 {
609 const auto numVertexDofs = Dune::referenceElement<Scalar, dim>(geo_.type()).size(dim);
610 if (localDofIdx < numVertexDofs)
611 return geo_.corner(localDofIdx);
612 else
613 return geo_.center();
614 }
615
616 std::array<LocalIndexType, 2> getScvPairForScvf(unsigned int localScvfIndex) const
617 {
618 const auto numEdges = referenceElement(geo_).size(dim-1);
619 if (localScvfIndex < numEdges)
620 return {
621 static_cast<LocalIndexType>(referenceElement(geo_).subEntity(localScvfIndex, dim-1, 0, dim)),
622 static_cast<LocalIndexType>(referenceElement(geo_).subEntity(localScvfIndex, dim-1, 1, dim))
623 };
624
625 DUNE_THROW(Dune::NotImplemented, "PQ1Bubble scv pair call for hybrid dofs");
626 }
627
628 std::array<LocalIndexType, 2> getScvPairForBoundaryScvf(unsigned int localFacetIndex, unsigned int localIsScvfIndex) const
629 {
630 const LocalIndexType insideScvIdx
631 = static_cast<LocalIndexType>(referenceElement(geo_).subEntity(localFacetIndex, 1, localIsScvfIndex, dim));
632 return { insideScvIdx, insideScvIdx };
633 }
634
635 bool isOverlappingScvf(unsigned int localScvfIndex) const
636 { return false; }
637
638 bool isOverlappingBoundaryScvf(unsigned int localFacetIndex) const
639 { return false; }
640
641 bool isOverlappingScv(unsigned int localScvIndex) const
642 { return false; }
643
645 static Element::Geometry::LocalCoordinate localScvfCenter(Dune::GeometryType type, unsigned int localScvfIdx)
646 {
647 return Dumux::center(getScvfCorners(type, [&](const auto& local){ return local; }, localScvfIdx));
648 }
649
651 static Element::Geometry::LocalCoordinate localBoundaryScvfCenter(Dune::GeometryType type, unsigned int localFacetIndex, unsigned int indexInFace)
652 {
653 return Dumux::center(BoxHelper::getBoundaryScvfCorners(type, [&](const auto& local){ return local; }, localFacetIndex, indexInFace));
654 }
655
656private:
657 typename Element::Geometry geo_;
658
660};
661
662} // end namespace Dumux
663
664#endif
Helper class constructing the dual grid finite volume geometries for the box discretizazion method.
Compute the center point of a convex polytope geometry or a random-access container of corner points.
Create sub control volumes and sub control volume face geometries.
Definition boxgeometryhelper.hh:262
PQ1BubbleDofHelper< GridView, numCubeBubbleDofs > DofHelper
Definition discretization/pq1bubble/geometryhelper.hh:476
static auto numInteriorScvf(Dune::GeometryType type)
number of interior sub control volume faces
Definition discretization/pq1bubble/geometryhelper.hh:573
std::array< LocalIndexType, 2 > getScvPairForScvf(unsigned int localScvfIndex) const
Definition discretization/pq1bubble/geometryhelper.hh:616
static Element::Geometry::LocalCoordinate localScvfCenter(Dune::GeometryType type, unsigned int localScvfIdx)
local scvf center
Definition discretization/pq1bubble/geometryhelper.hh:645
bool isOverlappingScv(unsigned int localScvIndex) const
Definition discretization/pq1bubble/geometryhelper.hh:641
HybridPQ1BubbleGeometryHelper(const typename Element::Geometry &geometry)
Definition discretization/pq1bubble/geometryhelper.hh:478
const Element::Geometry & elementGeometry() const
the wrapped element geometry
Definition discretization/pq1bubble/geometryhelper.hh:569
static Element::Geometry::LocalCoordinate localBoundaryScvfCenter(Dune::GeometryType type, unsigned int localFacetIndex, unsigned int indexInFace)
local boundary scvf center
Definition discretization/pq1bubble/geometryhelper.hh:651
static ScvfCornerStorage getScvfCorners(Dune::GeometryType type, Transformation &&trans, unsigned int localScvfIdx)
Create a vector with the corners of sub control volume faces.
Definition discretization/pq1bubble/geometryhelper.hh:522
ScvfCornerStorage getBoundaryScvfCorners(unsigned int localFacetIndex, unsigned int indexInFacet) const
Create the sub control volume face geometries on the boundary.
Definition discretization/pq1bubble/geometryhelper.hh:544
Dune::GeometryType getScvGeometryType(unsigned int localScvIdx) const
Definition discretization/pq1bubble/geometryhelper.hh:503
Dune::GeometryType getInteriorScvfGeometryType(unsigned int localScvfIdx) const
Definition discretization/pq1bubble/geometryhelper.hh:534
static ScvCornerStorage getScvCorners(Dune::GeometryType type, Transformation &&trans, unsigned int localScvIdx)
Create a vector with the scv corners.
Definition discretization/pq1bubble/geometryhelper.hh:491
bool isOverlappingBoundaryScvf(unsigned int localFacetIndex) const
Definition discretization/pq1bubble/geometryhelper.hh:638
static std::size_t numNonCVLocalDofs(Dune::GeometryType type)
number of hybrid dofs (overrides base: for cube elements there are numCubeBubbleDofs extra dofs)
Definition discretization/pq1bubble/geometryhelper.hh:602
static auto numBoundaryScvf(Dune::GeometryType type, unsigned int localFacetIndex)
number of boundary sub control volume faces for face localFacetIndex
Definition discretization/pq1bubble/geometryhelper.hh:579
Scalar scvVolume(unsigned int localScvIdx, const ScvCornerStorage &p) const
get scv volume
Definition discretization/pq1bubble/geometryhelper.hh:591
std::array< LocalIndexType, 2 > getScvPairForBoundaryScvf(unsigned int localFacetIndex, unsigned int localIsScvfIndex) const
Definition discretization/pq1bubble/geometryhelper.hh:628
GlobalPosition dofPosition(unsigned int localDofIdx) const
Definition discretization/pq1bubble/geometryhelper.hh:607
bool isOverlappingScvf(unsigned int localScvfIndex) const
Definition discretization/pq1bubble/geometryhelper.hh:635
ScvfCornerStorage getScvfCorners(unsigned int localScvfIdx) const
Create a vector with the corners of sub control volume faces.
Definition discretization/pq1bubble/geometryhelper.hh:515
ScvCornerStorage getScvCorners(unsigned int localScvIdx) const
Create a vector with the scv corners.
Definition discretization/pq1bubble/geometryhelper.hh:484
std::size_t numScv() const
number of sub control volumes (number of codim-1 entities)
Definition discretization/pq1bubble/geometryhelper.hh:585
GlobalPosition normal(const ScvfCornerStorage &p, const std::array< LocalIndexType, 2 > &scvPair)
Definition discretization/pq1bubble/geometryhelper.hh:555
Dune::GeometryType getBoundaryScvfGeometryType(unsigned int localScvfIdx) const
Definition discretization/pq1bubble/geometryhelper.hh:550
Dof helper for the PQ1Bubble method, providing the number of dofs and their positions.
Definition pq1bubble/dofhelper.hh:36
static std::size_t numElementDofs(Dune::GeometryType type)
Definition pq1bubble/dofhelper.hh:48
PQ1BubbleGeometryHelper(const typename Element::Geometry &geometry)
Definition discretization/pq1bubble/geometryhelper.hh:193
static auto numBoundaryScvf(Dune::GeometryType type, unsigned int localFacetIndex)
number of boundary sub control volume faces for face localFacetIndex
Definition discretization/pq1bubble/geometryhelper.hh:350
bool isOverlappingBoundaryScvf(unsigned int localFacetIndex) const
Definition discretization/pq1bubble/geometryhelper.hh:420
bool isOverlappingScvf(unsigned int localScvfIndex) const
Definition discretization/pq1bubble/geometryhelper.hh:412
static std::size_t numNonCVLocalDofs(Dune::GeometryType type)
number of hybrid dofs (overrides base: PQ1Bubble uses no non-CV dofs in the FV context)
Definition discretization/pq1bubble/geometryhelper.hh:376
GlobalPosition normal(const ScvfCornerStorage &p, const std::array< LocalIndexType, 2 > &scvPair)
Definition discretization/pq1bubble/geometryhelper.hh:326
std::size_t numScv() const
number of sub control volumes (number of codim-1 entities)
Definition discretization/pq1bubble/geometryhelper.hh:356
static auto numInteriorScvf(Dune::GeometryType type)
number of interior sub control volume faces
Definition discretization/pq1bubble/geometryhelper.hh:344
static ScvfCornerStorage getScvfCorners(Dune::GeometryType type, Transformation &&trans, unsigned int localScvfIdx)
Create a vector with the corners of sub control volume faces.
Definition discretization/pq1bubble/geometryhelper.hh:269
static ScvCornerStorage getScvCorners(Dune::GeometryType type, Transformation &&trans, unsigned int localScvIdx)
Create a vector with the scv corners.
Definition discretization/pq1bubble/geometryhelper.hh:206
Dune::GeometryType getBoundaryScvfGeometryType(unsigned int localScvfIdx) const
Definition discretization/pq1bubble/geometryhelper.hh:321
static Element::Geometry::LocalCoordinate localBoundaryScvfCenter(Dune::GeometryType type, unsigned int localFacetIndex, unsigned int indexInFace)
local boundary scvf center
Definition discretization/pq1bubble/geometryhelper.hh:440
PQ1BubbleDofHelper< GridView, 1 > DofHelper
Definition discretization/pq1bubble/geometryhelper.hh:191
ScvfCornerStorage getBoundaryScvfCorners(unsigned int localFacetIndex, unsigned int indexInFacet) const
Create the sub control volume face geometries on the boundary.
Definition discretization/pq1bubble/geometryhelper.hh:315
std::array< LocalIndexType, 2 > getScvPairForScvf(unsigned int localScvfIndex) const
Definition discretization/pq1bubble/geometryhelper.hh:390
GlobalPosition dofPosition(unsigned int localDofIdx) const
Definition discretization/pq1bubble/geometryhelper.hh:381
Dune::GeometryType getInteriorScvfGeometryType(unsigned int localScvfIdx) const
Definition discretization/pq1bubble/geometryhelper.hh:305
bool isOverlappingScv(unsigned int localScvIndex) const
Definition discretization/pq1bubble/geometryhelper.hh:425
Scalar scvVolume(unsigned int localScvIdx, const ScvCornerStorage &p) const
get scv volume
Definition discretization/pq1bubble/geometryhelper.hh:362
const Element::Geometry & elementGeometry() const
the wrapped element geometry
Definition discretization/pq1bubble/geometryhelper.hh:340
ScvfCornerStorage getScvfCorners(unsigned int localScvfIdx) const
Create a vector with the corners of sub control volume faces.
Definition discretization/pq1bubble/geometryhelper.hh:262
std::array< LocalIndexType, 2 > getScvPairForBoundaryScvf(unsigned int localFacetIndex, unsigned int localIsScvfIndex) const
Definition discretization/pq1bubble/geometryhelper.hh:405
static Element::Geometry::LocalCoordinate localScvfCenter(Dune::GeometryType type, unsigned int localScvfIdx)
local scvf center
Definition discretization/pq1bubble/geometryhelper.hh:434
ScvCornerStorage getScvCorners(unsigned int localScvIdx) const
Create a vector with the scv corners.
Definition discretization/pq1bubble/geometryhelper.hh:199
Dune::GeometryType getScvGeometryType(unsigned int localScvIdx) const
Definition discretization/pq1bubble/geometryhelper.hh:242
Scalar tripleProduct(const Dune::FieldVector< Scalar, 3 > &vec1, const Dune::FieldVector< Scalar, 3 > &vec2, const Dune::FieldVector< Scalar, 3 > &vec3)
Triple product of three vectors in three-dimensional Euclidean space retuning scalar.
Definition math.hh:700
auto scvfUnitNormal(const ElementGeometry &geo, const CornerStorage &corners)
Unit normal of an interior sub-control volume face, up to sign.
Definition scvfnormal.hh:33
auto convexPolytopeVolume(Dune::GeometryType type, const CornerF &c)
Compute the volume of several common geometry types.
Definition volume.hh:41
Corners::value_type center(const Corners &corners)
The center of a given list of corners.
Definition center.hh:24
Defines the index types used for grid and local indices.
Class representing dofs on elements for control-volume finite element schemes.
Define some often used mathematical functions.
S keyToCornerStorage(const ReferenceElement &ref, Transformation &&trans, const std::array< T, N > &key)
Definition boxgeometryhelper.hh:233
Definition discretization/pq1bubble/geometryhelper.hh:54
Definition adapt.hh:17
Definition common/pdesolver.hh:24
Dof helper for the PQ1Bubble method, providing the number of dofs and their positions.
Normal vector of a sub-control volume face of an element-local dual grid.
static constexpr std::array< std::array< Key, 6 >, 1 > keys
Definition discretization/pq1bubble/geometryhelper.hh:99
std::pair< std::uint8_t, std::uint8_t > Key
Definition discretization/pq1bubble/geometryhelper.hh:98
std::pair< std::uint8_t, std::uint8_t > Key
Definition discretization/pq1bubble/geometryhelper.hh:62
static constexpr std::array< std::array< Key, 2 >, 1 > keys
Definition discretization/pq1bubble/geometryhelper.hh:63
static constexpr std::array< std::array< Key, 4 >, 1 > keys
Definition discretization/pq1bubble/geometryhelper.hh:81
std::pair< std::uint8_t, std::uint8_t > Key
Definition discretization/pq1bubble/geometryhelper.hh:80
static constexpr std::array< std::array< Key, 4 >, 1 > keys
Definition discretization/pq1bubble/geometryhelper.hh:90
std::pair< std::uint8_t, std::uint8_t > Key
Definition discretization/pq1bubble/geometryhelper.hh:89
static constexpr std::array< std::array< Key, 3 >, 1 > keys
Definition discretization/pq1bubble/geometryhelper.hh:72
std::pair< std::uint8_t, std::uint8_t > Key
Definition discretization/pq1bubble/geometryhelper.hh:71
Definition discretization/pq1bubble/geometryhelper.hh:57
std::pair< std::uint8_t, std::uint8_t > Key
Definition discretization/pq1bubble/geometryhelper.hh:155
static constexpr std::array< std::array< Key, 3 >, 8 > keys
Definition discretization/pq1bubble/geometryhelper.hh:156
static constexpr std::array< std::array< Key, 1 >, 1 > keys
Definition discretization/pq1bubble/geometryhelper.hh:112
std::pair< std::uint8_t, std::uint8_t > Key
Definition discretization/pq1bubble/geometryhelper.hh:111
std::pair< std::uint8_t, std::uint8_t > Key
Definition discretization/pq1bubble/geometryhelper.hh:131
static constexpr std::array< std::array< Key, 2 >, 4 > keys
Definition discretization/pq1bubble/geometryhelper.hh:132
static constexpr std::array< std::array< Key, 3 >, 4 > keys
Definition discretization/pq1bubble/geometryhelper.hh:144
std::pair< std::uint8_t, std::uint8_t > Key
Definition discretization/pq1bubble/geometryhelper.hh:143
static constexpr std::array< std::array< Key, 2 >, 3 > keys
Definition discretization/pq1bubble/geometryhelper.hh:121
std::pair< std::uint8_t, std::uint8_t > Key
Definition discretization/pq1bubble/geometryhelper.hh:120
Definition discretization/pq1bubble/geometryhelper.hh:106
Definition discretization/pq1bubble/geometryhelper.hh:48
Dune::ReservedVector< Dune::FieldVector< ct, cdim >,(1<< mydim)> Type
Definition discretization/pq1bubble/geometryhelper.hh:49
Traits for an efficient corner storage for the PQ1Bubble method.
Definition discretization/pq1bubble/geometryhelper.hh:42
Compute the volume of several common geometry types.