version 3.11-dev
Loading...
Searching...
No Matches
discretization/box/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//
14#ifndef DUMUX_DISCRETIZATION_BOX_GRID_FVGEOMETRY_HH
15#define DUMUX_DISCRETIZATION_BOX_GRID_FVGEOMETRY_HH
16
17#include <ranges>
18#include <utility>
19#include <unordered_map>
20#include <array>
21#include <vector>
22#include <span>
23
24#include <dune/localfunctions/lagrange/lagrangelfecache.hh>
25
36
39
40namespace Dumux {
41
42namespace Detail {
43template<class GV, class T>
44using BoxGeometryHelper_t = Dune::Std::detected_or_t<
47 T
48>;
49} // end namespace Detail
50
55template<class GridView, class ScvRule = Dumux::QuadratureRules::MidpointQuadrature, class ScvfRule = Dumux::QuadratureRules::MidpointQuadrature>
57
64template<class GridView, class MapperTraits = DefaultMapperTraits<GridView>, class QuadratureTraits = BoxQuadratureTraits<GridView>>
66: public MapperTraits, public QuadratureTraits
67{
70
71 template<class GridGeometry, bool enableCache>
73};
74
81template<class Scalar,
82 class GridView,
83 bool enableGridGeometryCache = false,
86
93template<class Scalar, class GV, class Traits>
94class BoxFVGridGeometry<Scalar, GV, true, Traits>
95: public BaseGridGeometry<GV, Traits>
96{
98 using ParentType = BaseGridGeometry<GV, Traits>;
99 using GridIndexType = typename IndexTraits<GV>::GridIndex;
100 using LocalIndexType = typename IndexTraits<GV>::LocalIndex;
101
102 using Element = typename GV::template Codim<0>::Entity;
103 using CoordScalar = typename GV::ctype;
104 static const int dim = GV::dimension;
105 static const int dimWorld = GV::dimensionworld;
106
107public:
111
115 using LocalView = typename Traits::template LocalView<ThisType, true>;
117 using SubControlVolume = typename Traits::SubControlVolume;
119 using SubControlVolumeFace = typename Traits::SubControlVolumeFace;
125 using DofMapper = typename Traits::VertexMapper;
127 using FeCache = Dune::LagrangeLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
129 using GridView = GV;
133 using ScvQuadratureRule = typename Traits::ScvQuadratureRule;
135 using ScvfQuadratureRule = typename Traits::ScvfQuadratureRule;
136
138 BoxFVGridGeometry(std::shared_ptr<BasicGridGeometry> gg)
139 : ParentType(std::move(gg))
140 , cache_(*this)
141 , periodicGridTraits_(this->gridView().grid())
142 {
143 update_();
144 }
145
150
153 const DofMapper& dofMapper() const
154 { return this->vertexMapper(); }
155
157 std::size_t numScv() const
158 { return numScv_; }
159
161 std::size_t numScvf() const
162 { return numScvf_; }
163
166 std::size_t numBoundaryScvf() const
167 { return numBoundaryScvf_; }
168
170 std::size_t numDofs() const
171 { return this->vertexMapper().size(); }
172
173
176 {
178 update_();
179 }
180
183 {
184 ParentType::update(std::move(gridView));
185 update_();
186 }
187
189 const FeCache& feCache() const
190 { return feCache_; }
191
193 bool dofOnBoundary(GridIndexType dofIdx) const
194 { return boundaryDofIndices_[dofIdx]; }
195
197 bool dofOnPeriodicBoundary(GridIndexType dofIdx) const
198 { return periodicDofMap_.count(dofIdx); }
199
201 [[deprecated("Will be removed after release 3.11. Use periodicallyMappedDofs, returning a range of dofs")]]
202 GridIndexType periodicallyMappedDof(GridIndexType dofIdx) const
203 { return periodicDofMap_.at(dofIdx)[0]; }
204
206 const std::ranges::range auto periodicallyMappedDofs(GridIndexType dofIdx) const
207 { return std::views::all(periodicDofMap_.at(dofIdx)); }
208
210 const std::unordered_map<GridIndexType, std::vector<GridIndexType>>& periodicDofMap() const
211 { return periodicDofMap_; }
212
214 friend inline LocalView localView(const BoxFVGridGeometry& gg)
215 { return { gg.cache_ }; }
216
217private:
218
219 class BoxGridGeometryCache
220 {
221 friend class BoxFVGridGeometry;
222 public:
224 using GeometryHelper = Detail::BoxGeometryHelper_t<GV, Traits>;
225 using DofHelper = typename GeometryHelper::DofHelper;
226
227 explicit BoxGridGeometryCache(const BoxFVGridGeometry& gg)
228 : gridGeometry_(&gg)
229 {}
230
231 const BoxFVGridGeometry& gridGeometry() const
232 { return *gridGeometry_; }
233
235 const std::vector<SubControlVolume>& scvs(GridIndexType eIdx) const
236 { return scvs_[eIdx]; }
237
239 const std::vector<SubControlVolumeFace>& scvfs(GridIndexType eIdx) const
240 { return scvfs_[eIdx]; }
241
243 bool hasBoundaryScvf(GridIndexType eIdx) const
244 { return hasBoundaryScvf_[eIdx]; }
245
247 const std::vector<std::array<LocalIndexType, 2>>& scvfBoundaryGeometryKeys(GridIndexType eIdx) const
248 { return scvfBoundaryGeometryKeys_.at(eIdx); }
249
251 auto boundaryFaces(GridIndexType eIdx) const -> std::span<const BoundaryFace>
252 {
253 if (auto it = boundaryFaces_.find(eIdx); it != boundaryFaces_.end())
254 return {it->second};
255 return {};
256 }
257
259 const auto& boundaryFaceScvfRanges(GridIndexType eIdx) const
260 { return boundaryFaceScvfRanges_.at(eIdx); }
261
262 private:
263 void clear_()
264 {
265 scvs_.clear();
266 scvfs_.clear();
267 hasBoundaryScvf_.clear();
268 scvfBoundaryGeometryKeys_.clear();
269 boundaryFaces_.clear();
270 boundaryFaceScvfRanges_.clear();
271 }
272
273 std::vector<std::vector<SubControlVolume>> scvs_;
274 std::vector<std::vector<SubControlVolumeFace>> scvfs_;
275 std::vector<bool> hasBoundaryScvf_;
276 std::unordered_map<GridIndexType, std::vector<std::array<LocalIndexType, 2>>> scvfBoundaryGeometryKeys_;
277 std::unordered_map<GridIndexType, Dune::ReservedVector<typename BoxFVGridGeometry::BoundaryFace, 2*dim>> boundaryFaces_;
278 std::unordered_map<GridIndexType, Dune::ReservedVector<std::array<LocalIndexType, 2>, 2*dim>> boundaryFaceScvfRanges_;
279
280 const BoxFVGridGeometry* gridGeometry_;
281 };
282
283public:
286 using Cache = BoxGridGeometryCache;
287
288private:
289 using GeometryHelper = typename Cache::GeometryHelper;
290
291 void update_()
292 {
293 cache_.clear_();
294
295 const auto numElements = this->gridView().size(0);
296 cache_.scvs_.resize(numElements);
297 cache_.scvfs_.resize(numElements);
298 cache_.hasBoundaryScvf_.resize(numElements, false);
299
300 boundaryDofIndices_.assign(numDofs(), false);
301 periodicDofMap_.clear();
302
303 numScv_ = 0;
304 numScvf_ = 0;
305 numBoundaryScvf_ = 0;
306 // Build the SCV and SCV faces
307 for (const auto& element : elements(this->gridView()))
308 {
309 // fill the element map with seeds
310 const auto eIdx = this->elementMapper().index(element);
311
312 // count
313 numScv_ += element.subEntities(dim);
314 numScvf_ += element.subEntities(dim-1);
315
316 // get the element geometry
317 auto elementGeometry = element.geometry();
318 const auto refElement = referenceElement(elementGeometry);
319
320 // instantiate the geometry helper
321 GeometryHelper geometryHelper(elementGeometry);
322
323 // construct the sub control volumes
324 cache_.scvs_[eIdx].resize(elementGeometry.corners());
325 for (LocalIndexType scvLocalIdx = 0; scvLocalIdx < elementGeometry.corners(); ++scvLocalIdx)
326 {
327 const auto dofIdxGlobal = this->vertexMapper().subIndex(element, scvLocalIdx, dim);
328
329 cache_.scvs_[eIdx][scvLocalIdx] = SubControlVolume(
330 geometryHelper.getScvCorners(scvLocalIdx),
331 scvLocalIdx,
332 eIdx,
333 dofIdxGlobal
334 );
335 }
336
337 // construct the sub control volume faces
338 LocalIndexType scvfLocalIdx = 0;
339 cache_.scvfs_[eIdx].resize(element.subEntities(dim-1));
340 for (; scvfLocalIdx < element.subEntities(dim-1); ++scvfLocalIdx)
341 {
342 // find the global and local scv indices this scvf is belonging to
343 std::array<LocalIndexType, 2> localScvIndices{{
344 static_cast<LocalIndexType>(refElement.subEntity(scvfLocalIdx, dim-1, 0, dim)),
345 static_cast<LocalIndexType>(refElement.subEntity(scvfLocalIdx, dim-1, 1, dim))
346 }};
347
348 const auto& corners = geometryHelper.getScvfCorners(scvfLocalIdx);
349 cache_.scvfs_[eIdx][scvfLocalIdx] = SubControlVolumeFace(
350 corners,
351 geometryHelper.normal(corners, localScvIndices),
352 element,
353 scvfLocalIdx,
354 std::move(localScvIndices)
355 );
356 }
357
358 // construct the sub control volume faces on the domain boundary
359 LocalIndexType numBoundaryFaces = 0;
360 for (const auto& intersection : intersections(this->gridView(), element))
361 {
362 if (intersection.boundary() && !intersection.neighbor())
363 {
364 const auto isGeometry = intersection.geometry();
365 cache_.hasBoundaryScvf_[eIdx] = true;
366
367 // add one boundary face per boundary intersection
368 cache_.boundaryFaces_[eIdx].push_back(BoundaryFace{
369 isGeometry.center(),
370 isGeometry.volume(),
371 intersection.centerUnitOuterNormal(),
372 numBoundaryFaces++,
373 static_cast<LocalIndexType>(intersection.indexInInside()),
374 typename BoundaryFace::Traits::BoundaryFlag{intersection}
375 });
376
377 // count
378 numScvf_ += isGeometry.corners();
379 numBoundaryScvf_ += isGeometry.corners();
380
381 // record the scvf subrange for this boundary face: {offset, count}
382 cache_.boundaryFaceScvfRanges_[eIdx].push_back(std::array<LocalIndexType, 2>{{
383 scvfLocalIdx,
384 static_cast<LocalIndexType>(isGeometry.corners())
385 }});
386
387 for (unsigned int isScvfLocalIdx = 0; isScvfLocalIdx < isGeometry.corners(); ++isScvfLocalIdx)
388 {
389 // find the scvs this scvf is belonging to
390 const LocalIndexType insideScvIdx = static_cast<LocalIndexType>(refElement.subEntity(intersection.indexInInside(), 1, isScvfLocalIdx, dim));
391 std::array<LocalIndexType, 2> localScvIndices{{insideScvIdx, insideScvIdx}};
392
393 cache_.scvfs_[eIdx].emplace_back(
394 geometryHelper.getBoundaryScvfCorners(intersection.indexInInside(), isScvfLocalIdx),
395 intersection.centerUnitOuterNormal(),
396 intersection,
397 isScvfLocalIdx,
398 scvfLocalIdx,
399 std::move(localScvIndices)
400 );
401
402 cache_.scvfBoundaryGeometryKeys_[eIdx].emplace_back(std::array<LocalIndexType, 2>{{
403 static_cast<LocalIndexType>(intersection.indexInInside()),
404 static_cast<LocalIndexType>(isScvfLocalIdx)
405 }});
406
407 // increment local counter
408 scvfLocalIdx++;
409 }
410
411 // add all vertices on the intersection to the set of
412 // boundary vertices
413 const auto fIdx = intersection.indexInInside();
414 const auto numFaceVerts = refElement.size(fIdx, 1, dim);
415 for (int localVIdx = 0; localVIdx < numFaceVerts; ++localVIdx)
416 {
417 const auto vIdx = refElement.subEntity(fIdx, 1, localVIdx, dim);
418 const auto vIdxGlobal = this->vertexMapper().subIndex(element, vIdx, dim);
419 boundaryDofIndices_[vIdxGlobal] = true;
420 }
421 }
422
423 // inform the grid geometry if we have periodic boundaries
424 else if (periodicGridTraits_.isPeriodic(intersection))
425 {
426 this->setPeriodic();
427
428 // find the mapped periodic vertex of all vertices on periodic boundaries
429 const auto fIdx = intersection.indexInInside();
430 const auto numFaceVerts = refElement.size(fIdx, 1, dim);
431 const auto eps = 1e-7*(elementGeometry.corner(1) - elementGeometry.corner(0)).two_norm();
432 for (int localVIdx = 0; localVIdx < numFaceVerts; ++localVIdx)
433 {
434 const auto vIdx = refElement.subEntity(fIdx, 1, localVIdx, dim);
435 const auto vIdxGlobal = this->vertexMapper().subIndex(element, vIdx, dim);
436 const auto vPos = elementGeometry.corner(vIdx);
437
438 const auto& outside = intersection.outside();
439 const auto outsideGeometry = outside.geometry();
440 for (const auto& isOutside : intersections(this->gridView(), outside))
441 {
442 // only check periodic vertices of the periodic neighbor
443 if (periodicGridTraits_.isPeriodic(isOutside))
444 {
445 const auto fIdxOutside = isOutside.indexInInside();
446 const auto numFaceVertsOutside = refElement.size(fIdxOutside, 1, dim);
447 for (int localVIdxOutside = 0; localVIdxOutside < numFaceVertsOutside; ++localVIdxOutside)
448 {
449 const auto vIdxOutside = refElement.subEntity(fIdxOutside, 1, localVIdxOutside, dim);
450 const auto vPosOutside = outsideGeometry.corner(vIdxOutside);
451 const auto shift = std::abs((this->bBoxMax()-this->bBoxMin())*intersection.centerUnitOuterNormal());
452 if ((vPosOutside - vPos + shift*intersection.centerUnitOuterNormal()).two_norm() < eps)
453 Dumux::Detail::addPeriodicallyMappedDof(periodicDofMap_, vIdxGlobal, this->vertexMapper().subIndex(outside, vIdxOutside, dim));
454 }
455 }
456 }
457 }
458 }
459 }
460 }
461
462 Dumux::Detail::closePeriodicDofMap(periodicDofMap_);
463
464 // error check: periodic boundaries currently don't work for box in parallel
465 if (this->isPeriodic() && this->gridView().comm().size() > 1)
466 DUNE_THROW(Dune::NotImplemented, "Periodic boundaries for box method for parallel simulations!");
467 }
468
469 const FeCache feCache_;
470
471 std::size_t numScv_;
472 std::size_t numScvf_;
473 std::size_t numBoundaryScvf_;
474
475 // vertices on the boundary
476 std::vector<bool> boundaryDofIndices_;
477
478 // a map for periodic boundary vertices
479 std::unordered_map<GridIndexType, std::vector<GridIndexType>> periodicDofMap_;
480
481 Cache cache_;
482
484};
485
493template<class Scalar, class GV, class Traits>
494class BoxFVGridGeometry<Scalar, GV, false, Traits>
495: public BaseGridGeometry<GV, Traits>
496{
498 using ParentType = BaseGridGeometry<GV, Traits>;
499 using GridIndexType = typename IndexTraits<GV>::GridIndex;
500
501 static const int dim = GV::dimension;
502 static const int dimWorld = GV::dimensionworld;
503
504 using Element = typename GV::template Codim<0>::Entity;
505 using CoordScalar = typename GV::ctype;
506
507public:
511
515 using LocalView = typename Traits::template LocalView<ThisType, false>;
517 using SubControlVolume = typename Traits::SubControlVolume;
519 using SubControlVolumeFace = typename Traits::SubControlVolumeFace;
525 using DofMapper = typename Traits::VertexMapper;
527 using FeCache = Dune::LagrangeLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
529 using GridView = GV;
533 using ScvQuadratureRule = typename Traits::ScvQuadratureRule;
535 using ScvfQuadratureRule = typename Traits::ScvfQuadratureRule;
536
538 BoxFVGridGeometry(std::shared_ptr<BasicGridGeometry> gg)
539 : ParentType(std::move(gg))
540 , cache_(*this)
541 , periodicGridTraits_(this->gridView().grid())
542 {
543 update_();
544 }
545
550
553 const DofMapper& dofMapper() const
554 { return this->vertexMapper(); }
555
557 std::size_t numScv() const
558 { return numScv_; }
559
561 std::size_t numScvf() const
562 { return numScvf_; }
563
566 std::size_t numBoundaryScvf() const
567 { return numBoundaryScvf_; }
568
570 std::size_t numDofs() const
571 { return this->vertexMapper().size(); }
572
573
576 {
578 update_();
579 }
580
583 {
584 ParentType::update(std::move(gridView));
585 update_();
586 }
587
589 const FeCache& feCache() const
590 { return feCache_; }
591
593 bool dofOnBoundary(GridIndexType dofIdx) const
594 { return boundaryDofIndices_[dofIdx]; }
595
597 bool dofOnPeriodicBoundary(GridIndexType dofIdx) const
598 { return periodicDofMap_.count(dofIdx); }
599
601 [[deprecated("Will be removed after release 3.11. Use periodicallyMappedDofs, returning a range of dofs")]]
602 GridIndexType periodicallyMappedDof(GridIndexType dofIdx) const
603 { return periodicDofMap_.at(dofIdx)[0]; }
604
606 const std::ranges::range auto periodicallyMappedDofs(GridIndexType dofIdx) const
607 { return std::views::all(periodicDofMap_.at(dofIdx)); }
608
610 const std::unordered_map<GridIndexType, std::vector<GridIndexType>>& periodicDofMap() const
611 { return periodicDofMap_; }
612
614 friend inline LocalView localView(const BoxFVGridGeometry& gg)
615 { return { gg.cache_ }; }
616
617private:
618
619 class BoxGridGeometryCache
620 {
621 friend class BoxFVGridGeometry;
622 public:
624 using GeometryHelper = Detail::BoxGeometryHelper_t<GV, Traits>;
625 using DofHelper = typename GeometryHelper::DofHelper;
626
627 explicit BoxGridGeometryCache(const BoxFVGridGeometry& gg)
628 : gridGeometry_(&gg)
629 {}
630
631 const BoxFVGridGeometry& gridGeometry() const
632 { return *gridGeometry_; }
633
634 private:
635 const BoxFVGridGeometry* gridGeometry_;
636 };
637
638public:
641 using Cache = BoxGridGeometryCache;
642
643private:
644
645 void update_()
646 {
647 boundaryDofIndices_.assign(numDofs(), false);
648 periodicDofMap_.clear();
649
650 // save global data on the grid's scvs and scvfs
651 // TODO do we need those information?
652 numScv_ = 0;
653 numScvf_ = 0;
654 numBoundaryScvf_ = 0;
655 for (const auto& element : elements(this->gridView()))
656 {
657 numScv_ += element.subEntities(dim);
658 numScvf_ += element.subEntities(dim-1);
659
660 const auto elementGeometry = element.geometry();
661 const auto refElement = referenceElement(elementGeometry);
662
663 // store the sub control volume face indices on the domain boundary
664 for (const auto& intersection : intersections(this->gridView(), element))
665 {
666 if (intersection.boundary() && !intersection.neighbor())
667 {
668 const auto isGeometry = intersection.geometry();
669 numScvf_ += isGeometry.corners();
670 numBoundaryScvf_ += isGeometry.corners();
671
672 // add all vertices on the intersection to the set of
673 // boundary vertices
674 const auto fIdx = intersection.indexInInside();
675 const auto numFaceVerts = refElement.size(fIdx, 1, dim);
676 for (int localVIdx = 0; localVIdx < numFaceVerts; ++localVIdx)
677 {
678 const auto vIdx = refElement.subEntity(fIdx, 1, localVIdx, dim);
679 const auto vIdxGlobal = this->vertexMapper().subIndex(element, vIdx, dim);
680 boundaryDofIndices_[vIdxGlobal] = true;
681 }
682 }
683
684 // inform the grid geometry if we have periodic boundaries
685 else if (periodicGridTraits_.isPeriodic(intersection))
686 {
687 this->setPeriodic();
688
689 // find the mapped periodic vertex of all vertices on periodic boundaries
690 const auto fIdx = intersection.indexInInside();
691 const auto numFaceVerts = refElement.size(fIdx, 1, dim);
692 const auto eps = 1e-7*(elementGeometry.corner(1) - elementGeometry.corner(0)).two_norm();
693 for (int localVIdx = 0; localVIdx < numFaceVerts; ++localVIdx)
694 {
695 const auto vIdx = refElement.subEntity(fIdx, 1, localVIdx, dim);
696 const auto vIdxGlobal = this->vertexMapper().subIndex(element, vIdx, dim);
697 const auto vPos = elementGeometry.corner(vIdx);
698
699 const auto& outside = intersection.outside();
700 const auto outsideGeometry = outside.geometry();
701 for (const auto& isOutside : intersections(this->gridView(), outside))
702 {
703 // only check periodic vertices of the periodic neighbor
704 if (periodicGridTraits_.isPeriodic(isOutside))
705 {
706 const auto fIdxOutside = isOutside.indexInInside();
707 const auto numFaceVertsOutside = refElement.size(fIdxOutside, 1, dim);
708 for (int localVIdxOutside = 0; localVIdxOutside < numFaceVertsOutside; ++localVIdxOutside)
709 {
710 const auto vIdxOutside = refElement.subEntity(fIdxOutside, 1, localVIdxOutside, dim);
711 const auto vPosOutside = outsideGeometry.corner(vIdxOutside);
712 const auto shift = std::abs((this->bBoxMax()-this->bBoxMin())*intersection.centerUnitOuterNormal());
713 if ((vPosOutside - vPos + shift*intersection.centerUnitOuterNormal()).two_norm() < eps)
714 Dumux::Detail::addPeriodicallyMappedDof(periodicDofMap_, vIdxGlobal, this->vertexMapper().subIndex(outside, vIdxOutside, dim));
715 }
716 }
717 }
718 }
719 }
720 }
721 }
722
723 Dumux::Detail::closePeriodicDofMap(periodicDofMap_);
724
725 // error check: periodic boundaries currently don't work for box in parallel
726 if (this->isPeriodic() && this->gridView().comm().size() > 1)
727 DUNE_THROW(Dune::NotImplemented, "Periodic boundaries for box method for parallel simulations!");
728 }
729
730 const FeCache feCache_;
731
732 // Information on the global number of geometries
733 // TODO do we need those information?
734 std::size_t numScv_;
735 std::size_t numScvf_;
736 std::size_t numBoundaryScvf_;
737
738 // vertices on the boundary
739 std::vector<bool> boundaryDofIndices_;
740
741 // a map for periodic boundary vertices
742 std::unordered_map<GridIndexType, std::vector<GridIndexType>> periodicDofMap_;
743
744 Cache cache_;
745
747};
748
749} // end namespace Dumux
750
751#endif
Base class for grid geometries.
Implementation of a boundary face related to primary grid elements (dune intersections).
Helper class constructing the dual grid finite volume geometries for the box discretizazion method.
const ElementMapper & elementMapper() const
Returns the mapper for elements to indices for constant grids.
Definition basegridgeometry.hh:112
void setPeriodic(bool value=true)
Set the periodicity of the grid geometry.
Definition basegridgeometry.hh:169
const GlobalCoordinate & bBoxMax() const
The coordinate of the corner of the GridView's bounding box with the largest values.
Definition basegridgeometry.hh:156
Element element(GridIndexType eIdx) const
Get an element from a global element index.
Definition basegridgeometry.hh:142
const VertexMapper & vertexMapper() const
Returns the mapper for vertices to indices for constant grids.
Definition basegridgeometry.hh:106
const GridView & gridView() const
Return the gridView this grid geometry object lives on.
Definition basegridgeometry.hh:100
void update(const GridView &gridView)
Update all fvElementGeometries (call this after grid adaption).
Definition basegridgeometry.hh:88
const GlobalCoordinate & bBoxMin() const
The coordinate of the corner of the GridView's bounding box with the smallest values.
Definition basegridgeometry.hh:149
bool isPeriodic() const
Returns if the grid geometry is periodic (at all).
Definition basegridgeometry.hh:162
Base class for the finite volume geometry vector for box models This builds up the sub control volume...
Definition discretization/box/fvelementgeometry.hh:46
std::size_t numBoundaryScvf() const
Definition discretization/box/fvgridgeometry.hh:566
const std::ranges::range auto periodicallyMappedDofs(GridIndexType dofIdx) const
The indices of the vertices / d.o.f. on the other side of the periodic boundary.
Definition discretization/box/fvgridgeometry.hh:606
friend LocalView localView(const BoxFVGridGeometry &gg)
local view of this object (constructed with the internal cache)
Definition discretization/box/fvgridgeometry.hh:614
bool dofOnPeriodicBoundary(GridIndexType dofIdx) const
If a vertex / d.o.f. is on a periodic boundary.
Definition discretization/box/fvgridgeometry.hh:597
GV GridView
export the grid view type
Definition discretization/box/fvgridgeometry.hh:529
typename Traits::template LocalView< ThisType, false > LocalView
export the type of the fv element geometry (the local view type)
Definition discretization/box/fvgridgeometry.hh:515
typename Traits::SubControlVolumeFace SubControlVolumeFace
export the type of sub control volume
Definition discretization/box/fvgridgeometry.hh:519
BoxFVGridGeometry(const GridView &gridView)
Constructor.
Definition discretization/box/fvgridgeometry.hh:547
static constexpr DiscretizationMethod discMethod
Definition discretization/box/fvgridgeometry.hh:510
typename Traits::SubControlVolume SubControlVolume
export the type of sub control volume
Definition discretization/box/fvgridgeometry.hh:517
Experimental::BoundaryFace< GV > BoundaryFace
export the boundary face type
Definition discretization/box/fvgridgeometry.hh:521
typename Traits::ScvQuadratureRule ScvQuadratureRule
export the scv interpolation point data type
Definition discretization/box/fvgridgeometry.hh:533
GridIndexType periodicallyMappedDof(GridIndexType dofIdx) const
The index of the vertex / d.o.f. on the other side of the periodic boundary.
Definition discretization/box/fvgridgeometry.hh:602
const FeCache & feCache() const
The finite element cache for creating local FE bases.
Definition discretization/box/fvgridgeometry.hh:589
BoxGridGeometryCache Cache
Definition discretization/box/fvgridgeometry.hh:641
std::size_t numScvf() const
The total number of sun control volume faces.
Definition discretization/box/fvgridgeometry.hh:561
typename Traits::VertexMapper DofMapper
export dof mapper type
Definition discretization/box/fvgridgeometry.hh:525
BasicGridGeometry_t< GV, Traits > BasicGridGeometry
export basic grid geometry type for the alternative constructor
Definition discretization/box/fvgridgeometry.hh:513
bool dofOnBoundary(GridIndexType dofIdx) const
If a vertex / d.o.f. is on the boundary.
Definition discretization/box/fvgridgeometry.hh:593
typename Traits::ScvfQuadratureRule ScvfQuadratureRule
the quadrature rule type for scvfs
Definition discretization/box/fvgridgeometry.hh:535
const std::unordered_map< GridIndexType, std::vector< GridIndexType > > & periodicDofMap() const
Returns the map between dofs across periodic boundaries.
Definition discretization/box/fvgridgeometry.hh:610
const DofMapper & dofMapper() const
Definition discretization/box/fvgridgeometry.hh:553
DiscretizationMethods::Box DiscretizationMethod
export the discretization method this geometry belongs to
Definition discretization/box/fvgridgeometry.hh:509
typename PeriodicGridTraits< typename GV::Grid >::SupportsPeriodicity SupportsPeriodicity
export whether the grid(geometry) supports periodicity
Definition discretization/box/fvgridgeometry.hh:531
void update(GridView &&gridView)
update all fvElementGeometries (call this after grid adaption)
Definition discretization/box/fvgridgeometry.hh:582
Extrusion_t< Traits > Extrusion
export the type of extrusion
Definition discretization/box/fvgridgeometry.hh:523
std::size_t numDofs() const
The total number of degrees of freedom.
Definition discretization/box/fvgridgeometry.hh:570
BoxFVGridGeometry(std::shared_ptr< BasicGridGeometry > gg)
Constructor with basic grid geometry used to share state with another grid geometry on the same grid ...
Definition discretization/box/fvgridgeometry.hh:538
std::size_t numScv() const
The total number of sub control volumes.
Definition discretization/box/fvgridgeometry.hh:557
void update(const GridView &gridView)
update all fvElementGeometries (call this after grid adaption)
Definition discretization/box/fvgridgeometry.hh:575
Dune::LagrangeLocalFiniteElementCache< CoordScalar, Scalar, dim, 1 > FeCache
export the finite element cache type
Definition discretization/box/fvgridgeometry.hh:527
GV GridView
export the grid view type
Definition discretization/box/fvgridgeometry.hh:129
Experimental::BoundaryFace< GV > BoundaryFace
export the boundary face type
Definition discretization/box/fvgridgeometry.hh:121
friend LocalView localView(const BoxFVGridGeometry &gg)
local view of this object (constructed with the internal cache)
Definition discretization/box/fvgridgeometry.hh:214
BoxGridGeometryCache Cache
Definition discretization/box/fvgridgeometry.hh:286
void update(const GridView &gridView)
update all fvElementGeometries (call this after grid adaption)
Definition discretization/box/fvgridgeometry.hh:175
const std::unordered_map< GridIndexType, std::vector< GridIndexType > > & periodicDofMap() const
Returns the map between dofs across periodic boundaries.
Definition discretization/box/fvgridgeometry.hh:210
GridIndexType periodicallyMappedDof(GridIndexType dofIdx) const
The index of the vertex / d.o.f. on the other side of the periodic boundary.
Definition discretization/box/fvgridgeometry.hh:202
std::size_t numDofs() const
The total number of degrees of freedom.
Definition discretization/box/fvgridgeometry.hh:170
std::size_t numScv() const
The total number of sub control volumes.
Definition discretization/box/fvgridgeometry.hh:157
const std::ranges::range auto periodicallyMappedDofs(GridIndexType dofIdx) const
The indices of the vertices / d.o.f. on the other side of the periodic boundary.
Definition discretization/box/fvgridgeometry.hh:206
BasicGridGeometry_t< GV, Traits > BasicGridGeometry
export basic grid geometry type for the alternative constructor
Definition discretization/box/fvgridgeometry.hh:113
typename Traits::ScvQuadratureRule ScvQuadratureRule
export the scv interpolation point data type
Definition discretization/box/fvgridgeometry.hh:133
const FeCache & feCache() const
The finite element cache for creating local FE bases.
Definition discretization/box/fvgridgeometry.hh:189
std::size_t numBoundaryScvf() const
Definition discretization/box/fvgridgeometry.hh:166
DiscretizationMethods::Box DiscretizationMethod
export the discretization method this geometry belongs to
Definition discretization/box/fvgridgeometry.hh:109
typename Traits::ScvfQuadratureRule ScvfQuadratureRule
the quadrature rule type for scvfs
Definition discretization/box/fvgridgeometry.hh:135
static constexpr DiscretizationMethod discMethod
Definition discretization/box/fvgridgeometry.hh:110
Dune::LagrangeLocalFiniteElementCache< CoordScalar, Scalar, dim, 1 > FeCache
export the finite element cache type
Definition discretization/box/fvgridgeometry.hh:127
typename Traits::SubControlVolumeFace SubControlVolumeFace
export the type of sub control volume
Definition discretization/box/fvgridgeometry.hh:119
const DofMapper & dofMapper() const
Definition discretization/box/fvgridgeometry.hh:153
BoxFVGridGeometry(const GridView &gridView)
Constructor.
Definition discretization/box/fvgridgeometry.hh:147
BoxFVGridGeometry(std::shared_ptr< BasicGridGeometry > gg)
Constructor with basic grid geometry used to share state with another grid geometry on the same grid ...
Definition discretization/box/fvgridgeometry.hh:138
Extrusion_t< Traits > Extrusion
export the type of extrusion
Definition discretization/box/fvgridgeometry.hh:123
typename PeriodicGridTraits< typename GV::Grid >::SupportsPeriodicity SupportsPeriodicity
export whether the grid(geometry) supports periodicity
Definition discretization/box/fvgridgeometry.hh:131
typename Traits::template LocalView< ThisType, true > LocalView
export the type of the fv element geometry (the local view type)
Definition discretization/box/fvgridgeometry.hh:115
bool dofOnBoundary(GridIndexType dofIdx) const
If a vertex / d.o.f. is on the boundary.
Definition discretization/box/fvgridgeometry.hh:193
std::size_t numScvf() const
The total number of sun control volume faces.
Definition discretization/box/fvgridgeometry.hh:161
bool dofOnPeriodicBoundary(GridIndexType dofIdx) const
If a vertex / d.o.f. is on a periodic boundary.
Definition discretization/box/fvgridgeometry.hh:197
void update(GridView &&gridView)
update all fvElementGeometries (call this after grid adaption)
Definition discretization/box/fvgridgeometry.hh:182
typename Traits::SubControlVolume SubControlVolume
export the type of sub control volume
Definition discretization/box/fvgridgeometry.hh:117
typename Traits::VertexMapper DofMapper
export dof mapper type
Definition discretization/box/fvgridgeometry.hh:125
Base class for the finite volume geometry vector for box schemes This builds up the sub control volum...
Definition discretization/box/fvgridgeometry.hh:85
Create sub control volumes and sub control volume face geometries.
Definition boxgeometryhelper.hh:262
Class for a sub control volume face in the box method, i.e a part of the boundary of a sub control vo...
Definition discretization/box/subcontrolvolumeface.hh:60
the sub control volume for the box scheme
Definition discretization/box/subcontrolvolume.hh:58
Class for a boundary face related to primary grid elements (dune intersections).
Definition boundaryface.hh:69
Defines the default element and vertex mapper types.
Base class for the local finite volume geometry for box models This builds up the sub control volumes...
the sub control volume for the box scheme
Base class for a sub control volume face.
Helper classes to compute the integration elements.
CVFE::DefaultQuadratureTraits< GridView, ScvRule, ScvfRule > BoxQuadratureTraits
Quadrature rule traits for Box discretization.
Definition discretization/box/fvgridgeometry.hh:56
void closePeriodicDofMap(std::unordered_map< Index, std::vector< Index > > &periodicDofMap)
Map every degree of freedom to all others it is identified with.
Definition periodicdofmap.hh:48
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
void addPeriodicallyMappedDof(std::unordered_map< Index, std::vector< Index > > &periodicDofMap, std::type_identity_t< Index > dofIdx, std::type_identity_t< Index > periodicDofIdx)
Register a degree of freedom as periodically mapped to another one.
Definition periodicdofmap.hh:29
BaseGridGeometry(std::shared_ptr< BaseImplementation > impl)
Constructor from a BaseImplementation.
Definition basegridgeometry.hh:72
Defines the index types used for grid and local indices.
The available discretization methods in Dumux.
Definition cvfelocalresidual.hh:25
Dune::Std::detected_or_t< Dumux::BoxGeometryHelper< GV, GV::dimension, typename T::SubControlVolume, typename T::SubControlVolumeFace >, SpecifiesGeometryHelper, T > BoxGeometryHelper_t
Definition discretization/box/fvgridgeometry.hh:44
typename T::GeometryHelper SpecifiesGeometryHelper
Definition basegridgeometry.hh:30
CVFE< CVFEMethods::PQ1 > Box
Definition method.hh:102
Definition adapt.hh:17
std::ranges::range auto scvs(const FVElementGeometry &fvGeometry, const LocalDof &localDof)
Definition localdof.hh:82
typename Extrusion< T >::type Extrusion_t
Convenience alias for obtaining the extrusion type.
Definition extrusion.hh:257
Helpers for maps between degrees of freedom identified across periodic boundaries.
Grid properties related to periodicity.
The default traits for the box finite volume grid geometry Defines the scv and scvf types and the map...
Definition discretization/box/fvgridgeometry.hh:67
BoxFVElementGeometry< GridGeometry, enableCache > LocalView
Definition discretization/box/fvgridgeometry.hh:72
BoxSubControlVolume< GridView > SubControlVolume
Definition discretization/box/fvgridgeometry.hh:68
BoxSubControlVolumeFace< GridView > SubControlVolumeFace
Definition discretization/box/fvgridgeometry.hh:69
Quadrature rule traits for discretization schemes.
Definition quadraturerules.hh:86
typename GridView::IndexSet::IndexType GridIndex
Definition indextraits.hh:27
unsigned int LocalIndex
Definition indextraits.hh:28
Definition periodicgridtraits.hh:24
Definition periodicgridtraits.hh:23