version 3.10.0
Loading...
Searching...
No Matches
discretization/facecentered/staggered/fvgridgeometry.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//
12#ifndef DUMUX_DISCRETIZATION_FACECENTERED_STAGGERED_FV_GRID_GEOMETRY
13#define DUMUX_DISCRETIZATION_FACECENTERED_STAGGERED_FV_GRID_GEOMETRY
14
15#include <memory>
16
17#include <dune/common/rangeutilities.hh>
18#include <dune/grid/common/scsgmapper.hh>
19
23#include <dumux/common/math.hh>
24
29
37
39
40namespace Dumux {
41
48template<class GridView>
76
83template<class GridView,
84 bool cachingEnabled = false,
87
94template<class GV, class Traits>
95class FaceCenteredStaggeredFVGridGeometry<GV, true, Traits>
96: public BaseGridGeometry<GV, Traits>
97{
99 using ParentType = BaseGridGeometry<GV, Traits>;
100 using GridIndexType = typename IndexTraits<GV>::GridIndex;
101 using LocalIndexType = typename IndexTraits<GV>::LocalIndex;
102 using SmallLocalIndexType = typename IndexTraits<GV>::SmallLocalIndex;
103 using Element = typename GV::template Codim<0>::Entity;
104
105 using IntersectionMapper = typename Traits::IntersectionMapper;
106 using ConnectivityMap = typename Traits::template ConnectivityMap<ThisType>;
107
108 using Scalar = typename GV::ctype;
109
110 static constexpr auto dim = Traits::StaticInfo::dim;
111 static constexpr auto numScvsPerElement = Traits::StaticInfo::numScvsPerElement;
112 static constexpr auto numLateralScvfsPerScv = Traits::StaticInfo::numLateralScvfsPerScv;
113 static constexpr auto numLateralScvfsPerElement = Traits::StaticInfo::numLateralScvfsPerElement;
114 static constexpr auto minNumScvfsPerElement = Traits::StaticInfo::minNumScvfsPerElement;
115 static constexpr auto maxNumScvfsPerElement = Traits::StaticInfo::maxNumScvfsPerElement;
116
117 using ScvfCornerStorage = typename Traits::SubControlVolumeFace::Traits::CornerStorage;
118 using ScvCornerStorage = typename Traits::SubControlVolume::Traits::CornerStorage;
119
120public:
122 using DiscretizationMethod = DiscretizationMethods::FCStaggered;
123 static constexpr DiscretizationMethod discMethod{};
124
125 static constexpr bool cachingEnabled = true;
126
130 using LocalView = typename Traits::template LocalView<ThisType, true>;
132 using SubControlVolume = typename Traits::SubControlVolume;
134 using SubControlVolumeFace = typename Traits::SubControlVolumeFace;
136 using GridView = GV;
138 using GeometryHelper = typename Traits::GeometryHelper;
140 using LocalIntersectionMapper = typename Traits::LocalIntersectionMapper;
142 using StaticInformation = typename Traits::StaticInfo;
147
149 FaceCenteredStaggeredFVGridGeometry(std::shared_ptr<BasicGridGeometry> gg, const std::string& paramGroup = "")
150 : ParentType(std::move(gg))
151 , intersectionMapper_(this->gridView())
152 , periodicGridTraits_(this->gridView().grid())
153 {
154 // Check if the overlap size is what we expect
156 DUNE_THROW(Dune::InvalidStateException, "The staggered discretization method needs overlap of exactly 1 for parallel computations. "
157 << " Set the parameter \"Grid.Overlap\" in the input file.");
158
159 update_();
160 }
161
163 FaceCenteredStaggeredFVGridGeometry(const GridView& gridView, const std::string& paramGroup = "")
164 : FaceCenteredStaggeredFVGridGeometry(std::make_shared<BasicGridGeometry>(gridView), paramGroup)
165 {}
166
168 std::size_t numScv() const
169 { return scvs_.size(); }
170
172 std::size_t numScvf() const
173 { return scvfs_.size(); }
174
176 std::size_t numBoundaryScv() const
177 { return numBoundaryScv_; }
178
180 std::size_t numBoundaryScvf() const
181 { return numBoundaryScvf_; }
182
184 std::size_t numIntersections() const
185 { return intersectionMapper_.numIntersections(); }
186
188 std::size_t numDofs() const
189 { return this->gridView().size(1); }
190
192 void update(const GridView& gridView)
193 {
194 ParentType::update(gridView);
195 update_();
196 }
197
199 void update(GridView&& gridView)
200 {
201 ParentType::update(std::move(gridView));
202 update_();
203 }
204
206 const SubControlVolume& scv(GridIndexType scvIdx) const
207 { return scvs_[scvIdx]; }
208
211 auto scvs(const LocalView& fvGeometry) const
212 {
213 auto begin = scvs_.cbegin() + numScvsPerElement*fvGeometry.elementIndex();
214 const auto end = begin + numScvsPerElement;
215 return Dune::IteratorRange<std::decay_t<decltype(begin)>>(begin, end);
216 }
217
219 const SubControlVolumeFace& scvf(GridIndexType scvfIdx) const
220 { return scvfs_[scvfIdx]; }
221
223 const std::vector<GridIndexType>& scvfIndicesOfElement(GridIndexType eIdx) const
224 { return scvfIndicesOfElement_[eIdx]; }
225
230 const ConnectivityMap& connectivityMap() const
231 { return connectivityMap_; }
232
234 bool hasBoundaryScvf(GridIndexType eIdx) const
235 { return hasBoundaryScvf_[eIdx]; }
236
238 const IntersectionMapper& intersectionMapper() const
239 { return intersectionMapper_; }
240
242 bool dofOnPeriodicBoundary(GridIndexType dofIdx) const
243 { return periodicFaceMap_.count(dofIdx); }
244
246 GridIndexType periodicallyMappedDof(GridIndexType dofIdx) const
247 { return periodicFaceMap_.at(dofIdx); }
248
250 const std::unordered_map<GridIndexType, GridIndexType>& periodicDofMap() const
251 { return periodicFaceMap_; }
252
253
254private:
255
256 void update_()
257 {
258 // clear containers (necessary after grid refinement)
259 scvs_.clear();
260 scvfs_.clear();
261 scvfIndicesOfElement_.clear();
262 intersectionMapper_.update(this->gridView());
263
264 // determine size of containers
265 const auto numElements = this->gridView().size(0);
266 scvfIndicesOfElement_.resize(numElements);
267 hasBoundaryScvf_.resize(numElements, false);
268
269 outSideBoundaryVolVarIdx_ = 0;
270 numBoundaryScv_ = 0;
271 numBoundaryScvf_ = 0;
272
273 GeometryHelper geometryHelper(this->gridView());
274
275 // get the global scvf indices first
276 GridIndexType numScvfs = 0;
277 for (const auto& element : elements(this->gridView()))
278 {
279 assert(numScvsPerElement == element.subEntities(1));
280
281 for (const auto& intersection : intersections(this->gridView(), element))
282 {
283 // frontal scvf in element center
284 ++numScvfs;
285
286 // lateral scvfs
287 numScvfs += numLateralScvfsPerScv;
288
289 // handle physical domain boundary
290 if (onDomainBoundary_(intersection))
291 {
292 ++numBoundaryScv_; // frontal face
293 numBoundaryScv_ += numLateralScvfsPerScv; // boundary scvs for lateral faces
294
295 // frontal scvf at boundary
296 ++numScvfs;
297 }
298 }
299 }
300
301 // allocate memory
302 const auto numScvs = numElements*numScvsPerElement;
303 scvs_.resize(numScvs);
304 scvfs_.reserve(numScvfs);
305
306 // Build the scvs and scv faces
307 std::size_t globalScvfIdx = 0;
308 for (const auto& element : elements(this->gridView()))
309 {
310 const auto eIdx = this->elementMapper().index(element);
311 auto& globalScvfIndices = scvfIndicesOfElement_[eIdx];
312 globalScvfIndices.resize(minNumScvfsPerElement);
313 globalScvfIndices.reserve(maxNumScvfsPerElement);
314
315 auto getGlobalScvIdx = [&](const auto elementIdx, const auto localScvIdx)
316 { return numScvsPerElement*elementIdx + localScvIdx; };
317
318 LocalIntersectionMapper localIsMapper;
319 localIsMapper.update(this->gridView(), element);
320
321 for (const auto& intersection : intersections(this->gridView(), element))
322 {
323 const auto& intersectionUnitOuterNormal = intersection.centerUnitOuterNormal();
324 const auto localScvIdx = localIsMapper.realToRefIdx(intersection.indexInInside());
325 auto localScvfIdx = localScvIdx*(1 + numLateralScvfsPerScv);
326
327 const auto globalScvIdx = getGlobalScvIdx(eIdx, localScvIdx);
328 const auto dofIndex = intersectionMapper().globalIntersectionIndex(element, intersection.indexInInside());
329 const auto localOppositeScvIdx = geometryHelper.localOppositeIdx(localScvIdx);
330 const auto& intersectionGeometry = intersection.geometry();
331 const auto& elementGeometry = element.geometry();
332
333 assert(localIsMapper.refToRealIdx(localScvIdx) == intersection.indexInInside());
334
335 // handle periodic boundaries
336 if (onPeriodicBoundary_(intersection))
337 {
338 this->setPeriodic();
339
340 const auto& otherElement = intersection.outside();
341
342 SmallLocalIndexType otherIntersectionLocalIdx = 0;
343 bool periodicFaceFound = false;
344
345 for (const auto& otherIntersection : intersections(this->gridView(), otherElement))
346 {
347 if (periodicFaceFound)
348 continue;
349
350 if (Dune::FloatCmp::eq(intersectionUnitOuterNormal*otherIntersection.centerUnitOuterNormal(), -1.0, 1e-7))
351 {
352 const auto periodicDofIdx = intersectionMapper().globalIntersectionIndex(otherElement, otherIntersectionLocalIdx);
353 periodicFaceMap_[dofIndex] = periodicDofIdx;
354 periodicFaceFound = true;
355 }
356
357 ++otherIntersectionLocalIdx;
358 }
359 }
360
361 // the sub control volume
362 scvs_[globalScvIdx] = SubControlVolume(
363 elementGeometry,
364 intersectionGeometry,
365 globalScvIdx,
366 localScvIdx,
367 dofIndex,
368 Dumux::normalAxis(intersectionUnitOuterNormal),
369 this->elementMapper().index(element),
370 onDomainBoundary_(intersection)
371 );
372
373 // the frontal sub control volume face at the element center
374 scvfs_.emplace_back(elementGeometry,
375 intersectionGeometry,
376 std::array{globalScvIdx, getGlobalScvIdx(eIdx, localOppositeScvIdx)},
377 localScvfIdx,
378 globalScvfIdx,
379 intersectionUnitOuterNormal,
380 SubControlVolumeFace::FaceType::frontal,
381 SubControlVolumeFace::BoundaryType::interior
382 );
383
384 globalScvfIndices[localScvfIdx] = globalScvfIdx++;
385 ++localScvfIdx;
386
387 // the lateral sub control volume faces
388 for (const auto lateralFacetIndex : Dune::transformedRangeView(geometryHelper.localLaterFaceIndices(localScvIdx),
389 [&](auto&& idx) { return localIsMapper.refToRealIdx(idx) ;})
390 )
391 {
392 const auto& lateralIntersection = geometryHelper.intersection(lateralFacetIndex, element);
393
394 // helper lambda to get the lateral scvf's global inside and outside scv indices
395 const auto globalScvIndicesForLateralFace = [&]
396 {
397 const auto globalOutsideScvIdx = [&]
398 {
399 if (lateralIntersection.neighbor())
400 {
401 const auto parallelElemIdx = this->elementMapper().index(lateralIntersection.outside());
402 return getGlobalScvIdx(parallelElemIdx, localScvIdx);
403 }
404 else if (onDomainBoundary_(lateralIntersection))
405 return numScvs + outSideBoundaryVolVarIdx_++;
406 else
407 return globalScvIdx; // fallback for parallel, won't be used anyway
408 }();
409
410 return std::array{globalScvIdx, globalOutsideScvIdx};
411 }();
412
413 const auto boundaryType = [&]
414 {
415 if (onProcessorBoundary_(lateralIntersection))
416 return SubControlVolumeFace::BoundaryType::processorBoundary;
417 else if (onDomainBoundary_(lateralIntersection))
418 return SubControlVolumeFace::BoundaryType::physicalBoundary;
419 else
420 return SubControlVolumeFace::BoundaryType::interior;
421 }();
422
423 scvfs_.emplace_back(
424 elementGeometry,
425 intersectionGeometry,
426 geometryHelper.facet(lateralFacetIndex, element).geometry(),
427 globalScvIndicesForLateralFace, // TODO higher order
428 localScvfIdx,
429 globalScvfIdx,
430 lateralIntersection.centerUnitOuterNormal(),
431 SubControlVolumeFace::FaceType::lateral,
432 boundaryType
433 );
434
435 globalScvfIndices[localScvfIdx] = globalScvfIdx++;
436 ++localScvfIdx;
437
438 if (onDomainBoundary_(lateralIntersection))
439 {
440 ++numBoundaryScvf_;
441 hasBoundaryScvf_[eIdx] = true;
442 }
443 } // end loop over lateral facets
444
445 } // end first loop over intersections
446
447 // do a second loop over all intersections to add frontal boundary faces
448 int localScvfIdx = minNumScvfsPerElement;
449 for (const auto& intersection : intersections(this->gridView(), element))
450 {
451 // the frontal sub control volume face at a domain boundary (coincides with element face)
452 if (onDomainBoundary_(intersection))
453 {
454 const auto localScvIdx = localIsMapper.realToRefIdx(intersection.indexInInside());
455 const auto globalScvIdx = getGlobalScvIdx(eIdx, localScvIdx);
456 ++numBoundaryScvf_;
457
458 // the frontal sub control volume face at the boundary
459 scvfs_.emplace_back(
460 element.geometry(),
461 intersection.geometry(),
462 std::array{globalScvIdx, globalScvIdx}, // TODO outside boundary, periodic, parallel?
463 localScvfIdx,
464 globalScvfIdx,
465 intersection.centerUnitOuterNormal(),
466 SubControlVolumeFace::FaceType::frontal,
467 SubControlVolumeFace::BoundaryType::physicalBoundary
468 );
469
470 globalScvfIndices.push_back(globalScvfIdx);
471 ++globalScvfIdx;
472 ++localScvfIdx;
473 hasBoundaryScvf_[eIdx] = true;
474 }
475 }
476 }
477
478 connectivityMap_.update(*this);
479 }
480
481 bool onDomainBoundary_(const typename GridView::Intersection& intersection) const
482 {
483 return !intersection.neighbor() && intersection.boundary();
484 }
485
486 bool onProcessorBoundary_(const typename GridView::Intersection& intersection) const
487 {
488 return !intersection.neighbor() && !intersection.boundary();
489 }
490
491 bool onPeriodicBoundary_(const typename GridView::Intersection& intersection) const
492 {
493 return periodicGridTraits_.isPeriodic(intersection);
494 }
495
496 // mappers
497 ConnectivityMap connectivityMap_;
498 IntersectionMapper intersectionMapper_;
499
500 std::vector<SubControlVolume> scvs_;
501 std::vector<SubControlVolumeFace> scvfs_;
502 GridIndexType numBoundaryScv_;
503 GridIndexType numBoundaryScvf_;
504 GridIndexType outSideBoundaryVolVarIdx_;
505 std::vector<bool> hasBoundaryScvf_;
506
507 std::vector<std::vector<GridIndexType>> scvfIndicesOfElement_;
508
509 // a map for periodic boundary vertices
510 std::unordered_map<GridIndexType, GridIndexType> periodicFaceMap_;
511
512 PeriodicGridTraits<typename GridView::Grid> periodicGridTraits_;
513};
514
521template<class GV, class Traits>
522class FaceCenteredStaggeredFVGridGeometry<GV, false, Traits>
523: public BaseGridGeometry<GV, Traits>
524{
525 using ThisType = FaceCenteredStaggeredFVGridGeometry<GV, false, Traits>;
526 using ParentType = BaseGridGeometry<GV, Traits>;
527 using GridIndexType = typename IndexTraits<GV>::GridIndex;
528 using LocalIndexType = typename IndexTraits<GV>::LocalIndex;
529 using SmallLocalIndexType = typename IndexTraits<GV>::SmallLocalIndex;
530 using Element = typename GV::template Codim<0>::Entity;
531
532 using IntersectionMapper = typename Traits::IntersectionMapper;
533 using ConnectivityMap = typename Traits::template ConnectivityMap<ThisType>;
534
535 static constexpr auto dim = Traits::StaticInfo::dim;
536 static constexpr auto numScvsPerElement = Traits::StaticInfo::numScvsPerElement;
537 static constexpr auto numLateralScvfsPerScv = Traits::StaticInfo::numLateralScvfsPerScv;
538 static constexpr auto numLateralScvfsPerElement = Traits::StaticInfo::numLateralScvfsPerElement;
539 static constexpr auto minNumScvfsPerElement = Traits::StaticInfo::minNumScvfsPerElement;
540 static constexpr auto maxNumScvfsPerElement = Traits::StaticInfo::maxNumScvfsPerElement;
541
542public:
544 using DiscretizationMethod = DiscretizationMethods::FCStaggered;
545 static constexpr DiscretizationMethod discMethod{};
546
547 static constexpr bool cachingEnabled = false;
548
550 using BasicGridGeometry = BasicGridGeometry_t<GV, Traits>;
552 using LocalView = typename Traits::template LocalView<ThisType, false>;
554 using SubControlVolume = typename Traits::SubControlVolume;
556 using SubControlVolumeFace = typename Traits::SubControlVolumeFace;
558 using GridView = GV;
560 using GeometryHelper = typename Traits::GeometryHelper;
562 using LocalIntersectionMapper = typename Traits::LocalIntersectionMapper;
564 using StaticInformation = typename Traits::StaticInfo;
566 using Extrusion = Extrusion_t<Traits>;
568 using SupportsPeriodicity = typename PeriodicGridTraits<typename GV::Grid>::SupportsPeriodicity;
569
571 FaceCenteredStaggeredFVGridGeometry(std::shared_ptr<BasicGridGeometry> gg, const std::string& paramGroup = "")
572 : ParentType(std::move(gg))
573 , intersectionMapper_(this->gridView())
574 , periodicGridTraits_(this->gridView().grid())
575 {
576 // Check if the overlap size is what we expect
578 DUNE_THROW(Dune::InvalidStateException, "The staggered discretization method needs at least an overlap of 1 for parallel computations. "
579 << " Set the parameter \"Grid.Overlap\" in the input file.");
580
581 update_();
582 }
583
585 FaceCenteredStaggeredFVGridGeometry(const GridView& gridView, const std::string& paramGroup = "")
586 : FaceCenteredStaggeredFVGridGeometry(std::make_shared<BasicGridGeometry>(gridView), paramGroup)
587 {}
588
590 std::size_t numScv() const
591 { return numScvs_; }
592
594 std::size_t numScvf() const
595 { return numScvf_; }
596
598 std::size_t numBoundaryScv() const
599 { return numBoundaryScv_; }
600
602 std::size_t numBoundaryScvf() const
603 { return numBoundaryScvf_; }
604
606 std::size_t numIntersections() const
607 { return intersectionMapper_.numIntersections(); }
608
610 std::size_t numDofs() const
611 { return this->gridView().size(1); }
612
617 const ConnectivityMap& connectivityMap() const
618 { return connectivityMap_; }
619
621 bool hasBoundaryScvf(GridIndexType eIdx) const
622 { return hasBoundaryScvf_[eIdx]; }
623
625 const IntersectionMapper& intersectionMapper() const
626 { return intersectionMapper_; }
627
629 const std::vector<GridIndexType>& scvfIndicesOfElement(GridIndexType eIdx) const
630 { return scvfIndicesOfElement_[eIdx]; }
631
633 GridIndexType outsideVolVarIndex(GridIndexType scvfIdx) const
634 { return outsideVolVarIndices_.at(scvfIdx); }
635
637 void update(const GridView& gridView)
638 {
639 ParentType::update(gridView);
640 update_();
641 }
642
644 void update(GridView&& gridView)
645 {
646 ParentType::update(std::move(gridView));
647 update_();
648 }
649
651 bool dofOnPeriodicBoundary(GridIndexType dofIdx) const
652 { return periodicFaceMap_.count(dofIdx); }
653
655 GridIndexType periodicallyMappedDof(GridIndexType dofIdx) const
656 { return periodicFaceMap_.at(dofIdx); }
657
659 const std::unordered_map<GridIndexType, GridIndexType>& periodicDofMap() const
660 { return periodicFaceMap_; }
661
662private:
663
664 void update_()
665 {
666 intersectionMapper_.update(this->gridView());
667
668 // clear local data
669 numScvf_ = 0;
670 numBoundaryScv_ = 0;
671 numBoundaryScvf_ = 0;
672 hasBoundaryScvf_.clear();
673 scvfIndicesOfElement_.clear();
674 outsideVolVarIndices_.clear();
675
676 // determine size of containers
677 const auto numElements = this->gridView().size(0);
678 scvfIndicesOfElement_.resize(numElements);
679 hasBoundaryScvf_.resize(numElements, false);
680 numScvs_ = numElements*numScvsPerElement;
681
682 GeometryHelper geometryHelper(this->gridView());
683
684 // get the global scv indices first
685 GridIndexType scvfIdx = 0;
686
687 GridIndexType neighborVolVarIdx = numScvs_;
688
689 for (const auto& element : elements(this->gridView()))
690 {
691 const auto eIdx = this->elementMapper().index(element);
692 assert(numScvsPerElement == element.subEntities(1));
693
694 // the element-wise index sets for finite volume geometry
695 auto& globalScvfIndices = scvfIndicesOfElement_[eIdx];
696 globalScvfIndices.reserve(maxNumScvfsPerElement);
697 globalScvfIndices.resize(minNumScvfsPerElement);
698
699 // keep track of frontal boundary scvfs
700 std::size_t numFrontalBoundaryScvfs = 0;
701
702 using LocalIntersectionIndexMapper = FaceCenteredStaggeredLocalIntersectionIndexMapper<GridView>;
703 LocalIntersectionIndexMapper localIsMapper;
704 localIsMapper.update(this->gridView(), element);
705
706 for (const auto& intersection : intersections(this->gridView(), element))
707 {
708 const auto localScvIdx = localIsMapper.realToRefIdx(intersection.indexInInside());
709 auto localScvfIdx = localScvIdx*(1 + numLateralScvfsPerScv);
710
711 assert(localIsMapper.refToRealIdx(localScvIdx) == intersection.indexInInside());
712 // the frontal sub control volume face at the element center
713 globalScvfIndices[localScvfIdx] = scvfIdx++;
714 ++localScvfIdx;
715
716 if constexpr(dim > 1)
717 {
718 // the lateral sub control volume faces
719 for (const auto lateralFacetIndex : Dune::transformedRangeView(geometryHelper.localLaterFaceIndices(localScvIdx),
720 [&](auto idx) { return localIsMapper.refToRealIdx(idx) ;})
721 )
722 {
723 if (onDomainBoundary_(geometryHelper.intersection(lateralFacetIndex, element)))
724 {
725 outsideVolVarIndices_[scvfIdx] = neighborVolVarIdx++;
726 ++numBoundaryScvf_;
727 hasBoundaryScvf_[eIdx] = true;
728 }
729
730 globalScvfIndices[localScvfIdx] = scvfIdx++;
731 ++localScvfIdx;
732 }
733 }
734
735 // handle physical domain boundary
736 if (onDomainBoundary_(intersection))
737 {
738 ++numBoundaryScv_; // frontal face
739 numBoundaryScv_ += numLateralScvfsPerScv; // boundary scvs for lateral faces
740 ++numFrontalBoundaryScvfs;
741 ++numBoundaryScvf_;
742 hasBoundaryScvf_[eIdx] = true;
743 }
744
745 // handle periodic boundaries
746 if (onPeriodicBoundary_(intersection))
747 {
748 this->setPeriodic();
749
750 const auto& otherElement = intersection.outside();
751
752 SmallLocalIndexType otherIntersectionLocalIdx = 0;
753 bool periodicFaceFound = false;
754
755 for (const auto& otherIntersection : intersections(this->gridView(), otherElement))
756 {
757 if (periodicFaceFound)
758 continue;
759
760 if (Dune::FloatCmp::eq(intersection.centerUnitOuterNormal()*otherIntersection.centerUnitOuterNormal(), -1.0, 1e-7))
761 {
762 const auto periodicDofIdx = intersectionMapper().globalIntersectionIndex(otherElement, otherIntersectionLocalIdx);
763 const auto dofIndex = intersectionMapper().globalIntersectionIndex(element, localScvIdx);
764 periodicFaceMap_[dofIndex] = periodicDofIdx;
765 periodicFaceFound = true;
766 }
767
768 ++otherIntersectionLocalIdx;
769 }
770 }
771 }
772
773 // add global indices of frontal boundary scvfs last
774 for (std::size_t i = 0; i < numFrontalBoundaryScvfs; ++i)
775 globalScvfIndices.push_back(scvfIdx++);
776 }
777
778 // set number of subcontrolvolume faces
779 numScvf_ = scvfIdx;
780
781 connectivityMap_.update(*this);
782 }
783
784 bool onDomainBoundary_(const typename GridView::Intersection& intersection) const
785 {
786 return !intersection.neighbor() && intersection.boundary();
787 }
788
789 bool onProcessorBoundary_(const typename GridView::Intersection& intersection) const
790 {
791 return !intersection.neighbor() && !intersection.boundary();
792 }
793
794 bool onPeriodicBoundary_(const typename GridView::Intersection& intersection) const
795 {
796 return periodicGridTraits_.isPeriodic(intersection);
797 }
798
799 // mappers
800 ConnectivityMap connectivityMap_;
801 IntersectionMapper intersectionMapper_;
802
804 std::size_t numScvs_;
805 std::size_t numScvf_;
806 std::size_t numBoundaryScv_;
807 std::size_t numBoundaryScvf_;
808 std::vector<bool> hasBoundaryScvf_;
809
810 std::vector<std::vector<GridIndexType>> scvfIndicesOfElement_;
811
812 // a map for periodic boundary vertices
813 std::unordered_map<GridIndexType, GridIndexType> periodicFaceMap_;
814 std::unordered_map<GridIndexType, GridIndexType> outsideVolVarIndices_;
815
816 PeriodicGridTraits<typename GridView::Grid> periodicGridTraits_;
817};
818
819} // end namespace Dumux
820
821#endif
Base class for grid geometries.
Check the overlap size for different discretization methods.
Base class for all grid geometries.
Definition basegridgeometry.hh:52
An implementation of a grid geometry with some basic features.
Definition basicgridgeometry.hh:37
defines a standard intersection mapper for mapping of global DOFs assigned to faces....
Definition intersectionmapper.hh:29
Traits extracting the public Extrusion type from T Defaults to NoExtrusion if no such type is found.
Definition extrusion.hh:155
Stores the dof indices corresponding to the neighboring scvs that contribute to the derivative calcul...
Definition facecentered/staggered/connectivitymap.hh:30
Definition discretization/facecentered/staggered/fvelementgeometry.hh:124
Base class for the finite volume geometry vector for face-centered staggered models This builds up th...
Definition discretization/facecentered/staggered/fvgridgeometry.hh:86
Face centered staggered geometry helper.
Definition discretization/facecentered/staggered/geometryhelper.hh:28
Face centered staggered sub control volume face.
Definition discretization/facecentered/staggered/subcontrolvolumeface.hh:54
Face centered staggered sub control volume.
Definition discretization/facecentered/staggered/subcontrolvolume.hh:52
defines an intersection mapper for mapping of global DOFs assigned to faces which also works for adap...
Definition intersectionmapper.hh:200
Definition periodicgridtraits.hh:121
Defines the default element and vertex mapper types.
Geometry helper for face-centered staggered scheme.
Face centered staggered sub control volume.
Face centered staggered sub control volume face.
Helper classes to compute the integration elements.
Stores the dof indices corresponding to the neighboring scvs that contribute to the derivative calcul...
Dune::Std::detected_or_t< Dumux::BasicGridGeometry< GV, typename T::ElementMapper, typename T::VertexMapper >, Detail::SpecifiesBaseGridGeometry, T > BasicGridGeometry_t
Type of the basic grid geometry implementation used as backend.
Definition basegridgeometry.hh:38
Detail::FaceCenteredStaggeredLocalIntersectionIndexMapper< GridView, ConsistentlyOrientedGrid< typename GridView::Grid >{}> FaceCenteredStaggeredLocalIntersectionIndexMapper
Provides a mapping of local intersection indices (indexInInside) such that the local indices always f...
Definition localintersectionindexmapper.hh:116
static std::size_t normalAxis(const Vector &v)
Returns the normal axis index of a unit vector (0 = x, 1 = y, 2 = z)
Definition normalaxis.hh:26
@ element
Definition fieldtype.hh:23
Defines the index types used for grid and local indices.
defines intersection mappers.
Provides a mapping of local intersection indices (indexInInside) such that the local indices always f...
Define some often used mathematical functions.
The available discretization methods in Dumux.
Definition adapt.hh:17
typename Extrusion< T >::type Extrusion_t
Convenience alias for obtaining the extrusion type.
Definition extrusion.hh:166
Base class for the finite volume geometry vector for face-centered staggered models This builds up th...
Grid properties related to periodicity.
static bool isValid(const GridView &gridView) noexcept
Definition checkoverlapsize.hh:30
Definition defaultmappertraits.hh:23
Definition discretization/facecentered/staggered/fvgridgeometry.hh:64
static constexpr auto numLateralScvfsPerElement
Definition discretization/facecentered/staggered/fvgridgeometry.hh:69
static constexpr auto maxNumScvfsPerElement
Definition discretization/facecentered/staggered/fvgridgeometry.hh:72
static constexpr auto numScvsPerElement
Definition discretization/facecentered/staggered/fvgridgeometry.hh:67
static constexpr auto numFacesPerElement
Definition discretization/facecentered/staggered/fvgridgeometry.hh:66
static constexpr auto dim
Definition discretization/facecentered/staggered/fvgridgeometry.hh:65
static constexpr auto numLateralScvfsPerScv
Definition discretization/facecentered/staggered/fvgridgeometry.hh:68
static constexpr auto minNumScvfsPerElement
Definition discretization/facecentered/staggered/fvgridgeometry.hh:70
The default traits for the face-center staggered finite volume grid geometry Defines the scv and scvf...
Definition discretization/facecentered/staggered/fvgridgeometry.hh:50
ConformingGridIntersectionMapper< GridView > IntersectionMapper
Definition discretization/facecentered/staggered/fvgridgeometry.hh:53
FaceCenteredStaggeredGeometryHelper< GridView > GeometryHelper
Definition discretization/facecentered/staggered/fvgridgeometry.hh:55
FaceCenteredStaggeredFVElementGeometry< GridGeometry, enableCache > LocalView
Definition discretization/facecentered/staggered/fvgridgeometry.hh:61
FaceCenteredStaggeredSubControlVolumeFace< GridView > SubControlVolumeFace
Definition discretization/facecentered/staggered/fvgridgeometry.hh:52
FaceCenteredStaggeredConnectivityMap< GridGeometry > ConnectivityMap
Definition discretization/facecentered/staggered/fvgridgeometry.hh:58
FaceCenteredStaggeredSubControlVolume< GridView > SubControlVolume
Definition discretization/facecentered/staggered/fvgridgeometry.hh:51
FaceCenteredStaggeredLocalIntersectionIndexMapper< GridView > LocalIntersectionMapper
Definition discretization/facecentered/staggered/fvgridgeometry.hh:54
typename GridView::IndexSet::IndexType GridIndex
Definition indextraits.hh:27
std::uint_least8_t SmallLocalIndex
Definition indextraits.hh:29
unsigned int LocalIndex
Definition indextraits.hh:28
Definition periodicgridtraits.hh:34