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 <utility>
18#include <unordered_map>
19#include <array>
20#include <vector>
21#include <span>
22
23#include <dune/localfunctions/lagrange/lagrangelfecache.hh>
24
35
37
38namespace Dumux {
39
40namespace Detail {
41template<class GV, class T>
42using BoxGeometryHelper_t = Dune::Std::detected_or_t<
45 T
46>;
47} // end namespace Detail
48
53template<class GridView, class ScvRule = Dumux::QuadratureRules::MidpointQuadrature, class ScvfRule = Dumux::QuadratureRules::MidpointQuadrature>
55
62template<class GridView, class MapperTraits = DefaultMapperTraits<GridView>, class QuadratureTraits = BoxQuadratureTraits<GridView>>
64: public MapperTraits, public QuadratureTraits
65{
68
69 template<class GridGeometry, bool enableCache>
71};
72
79template<class Scalar,
80 class GridView,
81 bool enableGridGeometryCache = false,
84
91template<class Scalar, class GV, class Traits>
92class BoxFVGridGeometry<Scalar, GV, true, Traits>
93: public BaseGridGeometry<GV, Traits>
94{
96 using ParentType = BaseGridGeometry<GV, Traits>;
97 using GridIndexType = typename IndexTraits<GV>::GridIndex;
98 using LocalIndexType = typename IndexTraits<GV>::LocalIndex;
99
100 using Element = typename GV::template Codim<0>::Entity;
101 using CoordScalar = typename GV::ctype;
102 static const int dim = GV::dimension;
103 static const int dimWorld = GV::dimensionworld;
104
105public:
109
113 using LocalView = typename Traits::template LocalView<ThisType, true>;
115 using SubControlVolume = typename Traits::SubControlVolume;
117 using SubControlVolumeFace = typename Traits::SubControlVolumeFace;
123 using DofMapper = typename Traits::VertexMapper;
125 using FeCache = Dune::LagrangeLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
127 using GridView = GV;
131 using ScvQuadratureRule = typename Traits::ScvQuadratureRule;
133 using ScvfQuadratureRule = typename Traits::ScvfQuadratureRule;
134
136 BoxFVGridGeometry(std::shared_ptr<BasicGridGeometry> gg)
137 : ParentType(std::move(gg))
138 , cache_(*this)
139 , periodicGridTraits_(this->gridView().grid())
140 {
141 update_();
142 }
143
148
151 const DofMapper& dofMapper() const
152 { return this->vertexMapper(); }
153
155 std::size_t numScv() const
156 { return numScv_; }
157
159 std::size_t numScvf() const
160 { return numScvf_; }
161
164 std::size_t numBoundaryScvf() const
165 { return numBoundaryScvf_; }
166
168 std::size_t numDofs() const
169 { return this->vertexMapper().size(); }
170
171
174 {
176 update_();
177 }
178
181 {
182 ParentType::update(std::move(gridView));
183 update_();
184 }
185
187 const FeCache& feCache() const
188 { return feCache_; }
189
191 bool dofOnBoundary(GridIndexType dofIdx) const
192 { return boundaryDofIndices_[dofIdx]; }
193
195 bool dofOnPeriodicBoundary(GridIndexType dofIdx) const
196 { return periodicDofMap_.count(dofIdx); }
197
199 GridIndexType periodicallyMappedDof(GridIndexType dofIdx) const
200 { return periodicDofMap_.at(dofIdx); }
201
203 const std::unordered_map<GridIndexType, GridIndexType>& periodicDofMap() const
204 { return periodicDofMap_; }
205
207 friend inline LocalView localView(const BoxFVGridGeometry& gg)
208 { return { gg.cache_ }; }
209
210private:
211
212 class BoxGridGeometryCache
213 {
214 friend class BoxFVGridGeometry;
215 public:
217 using GeometryHelper = Detail::BoxGeometryHelper_t<GV, Traits>;
218 using DofHelper = typename GeometryHelper::DofHelper;
219
220 explicit BoxGridGeometryCache(const BoxFVGridGeometry& gg)
221 : gridGeometry_(&gg)
222 {}
223
224 const BoxFVGridGeometry& gridGeometry() const
225 { return *gridGeometry_; }
226
228 const std::vector<SubControlVolume>& scvs(GridIndexType eIdx) const
229 { return scvs_[eIdx]; }
230
232 const std::vector<SubControlVolumeFace>& scvfs(GridIndexType eIdx) const
233 { return scvfs_[eIdx]; }
234
236 bool hasBoundaryScvf(GridIndexType eIdx) const
237 { return hasBoundaryScvf_[eIdx]; }
238
240 const std::vector<std::array<LocalIndexType, 2>>& scvfBoundaryGeometryKeys(GridIndexType eIdx) const
241 { return scvfBoundaryGeometryKeys_.at(eIdx); }
242
244 auto boundaryFaces(GridIndexType eIdx) const -> std::span<const BoundaryFace>
245 {
246 if (auto it = boundaryFaces_.find(eIdx); it != boundaryFaces_.end())
247 return {it->second};
248 return {};
249 }
250
252 const auto& boundaryFaceScvfRanges(GridIndexType eIdx) const
253 { return boundaryFaceScvfRanges_.at(eIdx); }
254
255 private:
256 void clear_()
257 {
258 scvs_.clear();
259 scvfs_.clear();
260 hasBoundaryScvf_.clear();
261 scvfBoundaryGeometryKeys_.clear();
262 boundaryFaces_.clear();
263 boundaryFaceScvfRanges_.clear();
264 }
265
266 std::vector<std::vector<SubControlVolume>> scvs_;
267 std::vector<std::vector<SubControlVolumeFace>> scvfs_;
268 std::vector<bool> hasBoundaryScvf_;
269 std::unordered_map<GridIndexType, std::vector<std::array<LocalIndexType, 2>>> scvfBoundaryGeometryKeys_;
270 std::unordered_map<GridIndexType, Dune::ReservedVector<typename BoxFVGridGeometry::BoundaryFace, 2*dim>> boundaryFaces_;
271 std::unordered_map<GridIndexType, Dune::ReservedVector<std::array<LocalIndexType, 2>, 2*dim>> boundaryFaceScvfRanges_;
272
273 const BoxFVGridGeometry* gridGeometry_;
274 };
275
276public:
279 using Cache = BoxGridGeometryCache;
280
281private:
282 using GeometryHelper = typename Cache::GeometryHelper;
283
284 void update_()
285 {
286 cache_.clear_();
287
288 const auto numElements = this->gridView().size(0);
289 cache_.scvs_.resize(numElements);
290 cache_.scvfs_.resize(numElements);
291 cache_.hasBoundaryScvf_.resize(numElements, false);
292
293 boundaryDofIndices_.assign(numDofs(), false);
294
295 numScv_ = 0;
296 numScvf_ = 0;
297 numBoundaryScvf_ = 0;
298 // Build the SCV and SCV faces
299 for (const auto& element : elements(this->gridView()))
300 {
301 // fill the element map with seeds
302 const auto eIdx = this->elementMapper().index(element);
303
304 // count
305 numScv_ += element.subEntities(dim);
306 numScvf_ += element.subEntities(dim-1);
307
308 // get the element geometry
309 auto elementGeometry = element.geometry();
310 const auto refElement = referenceElement(elementGeometry);
311
312 // instantiate the geometry helper
313 GeometryHelper geometryHelper(elementGeometry);
314
315 // construct the sub control volumes
316 cache_.scvs_[eIdx].resize(elementGeometry.corners());
317 for (LocalIndexType scvLocalIdx = 0; scvLocalIdx < elementGeometry.corners(); ++scvLocalIdx)
318 {
319 const auto dofIdxGlobal = this->vertexMapper().subIndex(element, scvLocalIdx, dim);
320
321 cache_.scvs_[eIdx][scvLocalIdx] = SubControlVolume(
322 geometryHelper.getScvCorners(scvLocalIdx),
323 scvLocalIdx,
324 eIdx,
325 dofIdxGlobal
326 );
327 }
328
329 // construct the sub control volume faces
330 LocalIndexType scvfLocalIdx = 0;
331 cache_.scvfs_[eIdx].resize(element.subEntities(dim-1));
332 for (; scvfLocalIdx < element.subEntities(dim-1); ++scvfLocalIdx)
333 {
334 // find the global and local scv indices this scvf is belonging to
335 std::array<LocalIndexType, 2> localScvIndices{{
336 static_cast<LocalIndexType>(refElement.subEntity(scvfLocalIdx, dim-1, 0, dim)),
337 static_cast<LocalIndexType>(refElement.subEntity(scvfLocalIdx, dim-1, 1, dim))
338 }};
339
340 const auto& corners = geometryHelper.getScvfCorners(scvfLocalIdx);
341 cache_.scvfs_[eIdx][scvfLocalIdx] = SubControlVolumeFace(
342 corners,
343 geometryHelper.normal(corners, localScvIndices),
344 element,
345 scvfLocalIdx,
346 std::move(localScvIndices)
347 );
348 }
349
350 // construct the sub control volume faces on the domain boundary
351 LocalIndexType numBoundaryFaces = 0;
352 for (const auto& intersection : intersections(this->gridView(), element))
353 {
354 if (intersection.boundary() && !intersection.neighbor())
355 {
356 const auto isGeometry = intersection.geometry();
357 cache_.hasBoundaryScvf_[eIdx] = true;
358
359 // add one boundary face per boundary intersection
360 cache_.boundaryFaces_[eIdx].push_back(BoundaryFace{
361 isGeometry.center(),
362 isGeometry.volume(),
363 intersection.centerUnitOuterNormal(),
364 numBoundaryFaces++,
365 static_cast<LocalIndexType>(intersection.indexInInside()),
366 typename BoundaryFace::Traits::BoundaryFlag{intersection}
367 });
368
369 // count
370 numScvf_ += isGeometry.corners();
371 numBoundaryScvf_ += isGeometry.corners();
372
373 // record the scvf subrange for this boundary face: {offset, count}
374 cache_.boundaryFaceScvfRanges_[eIdx].push_back(std::array<LocalIndexType, 2>{{
375 scvfLocalIdx,
376 static_cast<LocalIndexType>(isGeometry.corners())
377 }});
378
379 for (unsigned int isScvfLocalIdx = 0; isScvfLocalIdx < isGeometry.corners(); ++isScvfLocalIdx)
380 {
381 // find the scvs this scvf is belonging to
382 const LocalIndexType insideScvIdx = static_cast<LocalIndexType>(refElement.subEntity(intersection.indexInInside(), 1, isScvfLocalIdx, dim));
383 std::array<LocalIndexType, 2> localScvIndices{{insideScvIdx, insideScvIdx}};
384
385 cache_.scvfs_[eIdx].emplace_back(
386 geometryHelper.getBoundaryScvfCorners(intersection.indexInInside(), isScvfLocalIdx),
387 intersection.centerUnitOuterNormal(),
388 intersection,
389 isScvfLocalIdx,
390 scvfLocalIdx,
391 std::move(localScvIndices)
392 );
393
394 cache_.scvfBoundaryGeometryKeys_[eIdx].emplace_back(std::array<LocalIndexType, 2>{{
395 static_cast<LocalIndexType>(intersection.indexInInside()),
396 static_cast<LocalIndexType>(isScvfLocalIdx)
397 }});
398
399 // increment local counter
400 scvfLocalIdx++;
401 }
402
403 // add all vertices on the intersection to the set of
404 // boundary vertices
405 const auto fIdx = intersection.indexInInside();
406 const auto numFaceVerts = refElement.size(fIdx, 1, dim);
407 for (int localVIdx = 0; localVIdx < numFaceVerts; ++localVIdx)
408 {
409 const auto vIdx = refElement.subEntity(fIdx, 1, localVIdx, dim);
410 const auto vIdxGlobal = this->vertexMapper().subIndex(element, vIdx, dim);
411 boundaryDofIndices_[vIdxGlobal] = true;
412 }
413 }
414
415 // inform the grid geometry if we have periodic boundaries
416 else if (periodicGridTraits_.isPeriodic(intersection))
417 {
418 this->setPeriodic();
419
420 // find the mapped periodic vertex of all vertices on periodic boundaries
421 const auto fIdx = intersection.indexInInside();
422 const auto numFaceVerts = refElement.size(fIdx, 1, dim);
423 const auto eps = 1e-7*(elementGeometry.corner(1) - elementGeometry.corner(0)).two_norm();
424 for (int localVIdx = 0; localVIdx < numFaceVerts; ++localVIdx)
425 {
426 const auto vIdx = refElement.subEntity(fIdx, 1, localVIdx, dim);
427 const auto vIdxGlobal = this->vertexMapper().subIndex(element, vIdx, dim);
428 const auto vPos = elementGeometry.corner(vIdx);
429
430 const auto& outside = intersection.outside();
431 const auto outsideGeometry = outside.geometry();
432 for (const auto& isOutside : intersections(this->gridView(), outside))
433 {
434 // only check periodic vertices of the periodic neighbor
435 if (periodicGridTraits_.isPeriodic(isOutside))
436 {
437 const auto fIdxOutside = isOutside.indexInInside();
438 const auto numFaceVertsOutside = refElement.size(fIdxOutside, 1, dim);
439 for (int localVIdxOutside = 0; localVIdxOutside < numFaceVertsOutside; ++localVIdxOutside)
440 {
441 const auto vIdxOutside = refElement.subEntity(fIdxOutside, 1, localVIdxOutside, dim);
442 const auto vPosOutside = outsideGeometry.corner(vIdxOutside);
443 const auto shift = std::abs((this->bBoxMax()-this->bBoxMin())*intersection.centerUnitOuterNormal());
444 if (std::abs((vPosOutside-vPos).two_norm() - shift) < eps)
445 periodicDofMap_[vIdxGlobal] = this->vertexMapper().subIndex(outside, vIdxOutside, dim);
446 }
447 }
448 }
449 }
450 }
451 }
452 }
453
454 // error check: periodic boundaries currently don't work for box in parallel
455 if (this->isPeriodic() && this->gridView().comm().size() > 1)
456 DUNE_THROW(Dune::NotImplemented, "Periodic boundaries for box method for parallel simulations!");
457 }
458
459 const FeCache feCache_;
460
461 std::size_t numScv_;
462 std::size_t numScvf_;
463 std::size_t numBoundaryScvf_;
464
465 // vertices on the boundary
466 std::vector<bool> boundaryDofIndices_;
467
468 // a map for periodic boundary vertices
469 std::unordered_map<GridIndexType, GridIndexType> periodicDofMap_;
470
471 Cache cache_;
472
474};
475
483template<class Scalar, class GV, class Traits>
484class BoxFVGridGeometry<Scalar, GV, false, Traits>
485: public BaseGridGeometry<GV, Traits>
486{
488 using ParentType = BaseGridGeometry<GV, Traits>;
489 using GridIndexType = typename IndexTraits<GV>::GridIndex;
490
491 static const int dim = GV::dimension;
492 static const int dimWorld = GV::dimensionworld;
493
494 using Element = typename GV::template Codim<0>::Entity;
495 using CoordScalar = typename GV::ctype;
496
497public:
501
505 using LocalView = typename Traits::template LocalView<ThisType, false>;
507 using SubControlVolume = typename Traits::SubControlVolume;
509 using SubControlVolumeFace = typename Traits::SubControlVolumeFace;
515 using DofMapper = typename Traits::VertexMapper;
517 using FeCache = Dune::LagrangeLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
519 using GridView = GV;
523 using ScvQuadratureRule = typename Traits::ScvQuadratureRule;
525 using ScvfQuadratureRule = typename Traits::ScvfQuadratureRule;
526
528 BoxFVGridGeometry(std::shared_ptr<BasicGridGeometry> gg)
529 : ParentType(std::move(gg))
530 , cache_(*this)
531 , periodicGridTraits_(this->gridView().grid())
532 {
533 update_();
534 }
535
540
543 const DofMapper& dofMapper() const
544 { return this->vertexMapper(); }
545
547 std::size_t numScv() const
548 { return numScv_; }
549
551 std::size_t numScvf() const
552 { return numScvf_; }
553
556 std::size_t numBoundaryScvf() const
557 { return numBoundaryScvf_; }
558
560 std::size_t numDofs() const
561 { return this->vertexMapper().size(); }
562
563
566 {
568 update_();
569 }
570
573 {
574 ParentType::update(std::move(gridView));
575 update_();
576 }
577
579 const FeCache& feCache() const
580 { return feCache_; }
581
583 bool dofOnBoundary(GridIndexType dofIdx) const
584 { return boundaryDofIndices_[dofIdx]; }
585
587 bool dofOnPeriodicBoundary(GridIndexType dofIdx) const
588 { return periodicDofMap_.count(dofIdx); }
589
591 GridIndexType periodicallyMappedDof(GridIndexType dofIdx) const
592 { return periodicDofMap_.at(dofIdx); }
593
595 const std::unordered_map<GridIndexType, GridIndexType>& periodicDofMap() const
596 { return periodicDofMap_; }
597
599 friend inline LocalView localView(const BoxFVGridGeometry& gg)
600 { return { gg.cache_ }; }
601
602private:
603
604 class BoxGridGeometryCache
605 {
606 friend class BoxFVGridGeometry;
607 public:
609 using GeometryHelper = Detail::BoxGeometryHelper_t<GV, Traits>;
610 using DofHelper = typename GeometryHelper::DofHelper;
611
612 explicit BoxGridGeometryCache(const BoxFVGridGeometry& gg)
613 : gridGeometry_(&gg)
614 {}
615
616 const BoxFVGridGeometry& gridGeometry() const
617 { return *gridGeometry_; }
618
619 private:
620 const BoxFVGridGeometry* gridGeometry_;
621 };
622
623public:
626 using Cache = BoxGridGeometryCache;
627
628private:
629
630 void update_()
631 {
632 boundaryDofIndices_.assign(numDofs(), false);
633
634 // save global data on the grid's scvs and scvfs
635 // TODO do we need those information?
636 numScv_ = 0;
637 numScvf_ = 0;
638 numBoundaryScvf_ = 0;
639 for (const auto& element : elements(this->gridView()))
640 {
641 numScv_ += element.subEntities(dim);
642 numScvf_ += element.subEntities(dim-1);
643
644 const auto elementGeometry = element.geometry();
645 const auto refElement = referenceElement(elementGeometry);
646
647 // store the sub control volume face indices on the domain boundary
648 for (const auto& intersection : intersections(this->gridView(), element))
649 {
650 if (intersection.boundary() && !intersection.neighbor())
651 {
652 const auto isGeometry = intersection.geometry();
653 numScvf_ += isGeometry.corners();
654 numBoundaryScvf_ += isGeometry.corners();
655
656 // add all vertices on the intersection to the set of
657 // boundary vertices
658 const auto fIdx = intersection.indexInInside();
659 const auto numFaceVerts = refElement.size(fIdx, 1, dim);
660 for (int localVIdx = 0; localVIdx < numFaceVerts; ++localVIdx)
661 {
662 const auto vIdx = refElement.subEntity(fIdx, 1, localVIdx, dim);
663 const auto vIdxGlobal = this->vertexMapper().subIndex(element, vIdx, dim);
664 boundaryDofIndices_[vIdxGlobal] = true;
665 }
666 }
667
668 // inform the grid geometry if we have periodic boundaries
669 else if (periodicGridTraits_.isPeriodic(intersection))
670 {
671 this->setPeriodic();
672
673 // find the mapped periodic vertex of all vertices on periodic boundaries
674 const auto fIdx = intersection.indexInInside();
675 const auto numFaceVerts = refElement.size(fIdx, 1, dim);
676 const auto eps = 1e-7*(elementGeometry.corner(1) - elementGeometry.corner(0)).two_norm();
677 for (int localVIdx = 0; localVIdx < numFaceVerts; ++localVIdx)
678 {
679 const auto vIdx = refElement.subEntity(fIdx, 1, localVIdx, dim);
680 const auto vIdxGlobal = this->vertexMapper().subIndex(element, vIdx, dim);
681 const auto vPos = elementGeometry.corner(vIdx);
682
683 const auto& outside = intersection.outside();
684 const auto outsideGeometry = outside.geometry();
685 for (const auto& isOutside : intersections(this->gridView(), outside))
686 {
687 // only check periodic vertices of the periodic neighbor
688 if (periodicGridTraits_.isPeriodic(isOutside))
689 {
690 const auto fIdxOutside = isOutside.indexInInside();
691 const auto numFaceVertsOutside = refElement.size(fIdxOutside, 1, dim);
692 for (int localVIdxOutside = 0; localVIdxOutside < numFaceVertsOutside; ++localVIdxOutside)
693 {
694 const auto vIdxOutside = refElement.subEntity(fIdxOutside, 1, localVIdxOutside, dim);
695 const auto vPosOutside = outsideGeometry.corner(vIdxOutside);
696 const auto shift = std::abs((this->bBoxMax()-this->bBoxMin())*intersection.centerUnitOuterNormal());
697 if (std::abs((vPosOutside-vPos).two_norm() - shift) < eps)
698 periodicDofMap_[vIdxGlobal] = this->vertexMapper().subIndex(outside, vIdxOutside, dim);
699 }
700 }
701 }
702 }
703 }
704 }
705 }
706
707 // error check: periodic boundaries currently don't work for box in parallel
708 if (this->isPeriodic() && this->gridView().comm().size() > 1)
709 DUNE_THROW(Dune::NotImplemented, "Periodic boundaries for box method for parallel simulations!");
710 }
711
712 const FeCache feCache_;
713
714 // Information on the global number of geometries
715 // TODO do we need those information?
716 std::size_t numScv_;
717 std::size_t numScvf_;
718 std::size_t numBoundaryScvf_;
719
720 // vertices on the boundary
721 std::vector<bool> boundaryDofIndices_;
722
723 // a map for periodic boundary vertices
724 std::unordered_map<GridIndexType, GridIndexType> periodicDofMap_;
725
726 Cache cache_;
727
729};
730
731} // end namespace Dumux
732
733#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:556
friend LocalView localView(const BoxFVGridGeometry &gg)
local view of this object (constructed with the internal cache)
Definition discretization/box/fvgridgeometry.hh:599
bool dofOnPeriodicBoundary(GridIndexType dofIdx) const
If a vertex / d.o.f. is on a periodic boundary.
Definition discretization/box/fvgridgeometry.hh:587
GV GridView
export the grid view type
Definition discretization/box/fvgridgeometry.hh:519
typename Traits::template LocalView< ThisType, false > LocalView
export the type of the fv element geometry (the local view type)
Definition discretization/box/fvgridgeometry.hh:505
typename Traits::SubControlVolumeFace SubControlVolumeFace
export the type of sub control volume
Definition discretization/box/fvgridgeometry.hh:509
BoxFVGridGeometry(const GridView &gridView)
Constructor.
Definition discretization/box/fvgridgeometry.hh:537
static constexpr DiscretizationMethod discMethod
Definition discretization/box/fvgridgeometry.hh:500
typename Traits::SubControlVolume SubControlVolume
export the type of sub control volume
Definition discretization/box/fvgridgeometry.hh:507
Experimental::BoundaryFace< GV > BoundaryFace
export the boundary face type
Definition discretization/box/fvgridgeometry.hh:511
typename Traits::ScvQuadratureRule ScvQuadratureRule
export the scv interpolation point data type
Definition discretization/box/fvgridgeometry.hh:523
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:591
const FeCache & feCache() const
The finite element cache for creating local FE bases.
Definition discretization/box/fvgridgeometry.hh:579
BoxGridGeometryCache Cache
Definition discretization/box/fvgridgeometry.hh:626
std::size_t numScvf() const
The total number of sun control volume faces.
Definition discretization/box/fvgridgeometry.hh:551
typename Traits::VertexMapper DofMapper
export dof mapper type
Definition discretization/box/fvgridgeometry.hh:515
BasicGridGeometry_t< GV, Traits > BasicGridGeometry
export basic grid geometry type for the alternative constructor
Definition discretization/box/fvgridgeometry.hh:503
bool dofOnBoundary(GridIndexType dofIdx) const
If a vertex / d.o.f. is on the boundary.
Definition discretization/box/fvgridgeometry.hh:583
typename Traits::ScvfQuadratureRule ScvfQuadratureRule
the quadrature rule type for scvfs
Definition discretization/box/fvgridgeometry.hh:525
const DofMapper & dofMapper() const
Definition discretization/box/fvgridgeometry.hh:543
DiscretizationMethods::Box DiscretizationMethod
export the discretization method this geometry belongs to
Definition discretization/box/fvgridgeometry.hh:499
typename PeriodicGridTraits< typename GV::Grid >::SupportsPeriodicity SupportsPeriodicity
export whether the grid(geometry) supports periodicity
Definition discretization/box/fvgridgeometry.hh:521
void update(GridView &&gridView)
update all fvElementGeometries (call this after grid adaption)
Definition discretization/box/fvgridgeometry.hh:572
Extrusion_t< Traits > Extrusion
export the type of extrusion
Definition discretization/box/fvgridgeometry.hh:513
std::size_t numDofs() const
The total number of degrees of freedom.
Definition discretization/box/fvgridgeometry.hh:560
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:528
std::size_t numScv() const
The total number of sub control volumes.
Definition discretization/box/fvgridgeometry.hh:547
void update(const GridView &gridView)
update all fvElementGeometries (call this after grid adaption)
Definition discretization/box/fvgridgeometry.hh:565
Dune::LagrangeLocalFiniteElementCache< CoordScalar, Scalar, dim, 1 > FeCache
export the finite element cache type
Definition discretization/box/fvgridgeometry.hh:517
const std::unordered_map< GridIndexType, GridIndexType > & periodicDofMap() const
Returns the map between dofs across periodic boundaries.
Definition discretization/box/fvgridgeometry.hh:595
GV GridView
export the grid view type
Definition discretization/box/fvgridgeometry.hh:127
Experimental::BoundaryFace< GV > BoundaryFace
export the boundary face type
Definition discretization/box/fvgridgeometry.hh:119
friend LocalView localView(const BoxFVGridGeometry &gg)
local view of this object (constructed with the internal cache)
Definition discretization/box/fvgridgeometry.hh:207
BoxGridGeometryCache Cache
Definition discretization/box/fvgridgeometry.hh:279
void update(const GridView &gridView)
update all fvElementGeometries (call this after grid adaption)
Definition discretization/box/fvgridgeometry.hh:173
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:199
std::size_t numDofs() const
The total number of degrees of freedom.
Definition discretization/box/fvgridgeometry.hh:168
std::size_t numScv() const
The total number of sub control volumes.
Definition discretization/box/fvgridgeometry.hh:155
BasicGridGeometry_t< GV, Traits > BasicGridGeometry
export basic grid geometry type for the alternative constructor
Definition discretization/box/fvgridgeometry.hh:111
typename Traits::ScvQuadratureRule ScvQuadratureRule
export the scv interpolation point data type
Definition discretization/box/fvgridgeometry.hh:131
const FeCache & feCache() const
The finite element cache for creating local FE bases.
Definition discretization/box/fvgridgeometry.hh:187
std::size_t numBoundaryScvf() const
Definition discretization/box/fvgridgeometry.hh:164
DiscretizationMethods::Box DiscretizationMethod
export the discretization method this geometry belongs to
Definition discretization/box/fvgridgeometry.hh:107
typename Traits::ScvfQuadratureRule ScvfQuadratureRule
the quadrature rule type for scvfs
Definition discretization/box/fvgridgeometry.hh:133
static constexpr DiscretizationMethod discMethod
Definition discretization/box/fvgridgeometry.hh:108
Dune::LagrangeLocalFiniteElementCache< CoordScalar, Scalar, dim, 1 > FeCache
export the finite element cache type
Definition discretization/box/fvgridgeometry.hh:125
typename Traits::SubControlVolumeFace SubControlVolumeFace
export the type of sub control volume
Definition discretization/box/fvgridgeometry.hh:117
const DofMapper & dofMapper() const
Definition discretization/box/fvgridgeometry.hh:151
const std::unordered_map< GridIndexType, GridIndexType > & periodicDofMap() const
Returns the map between dofs across periodic boundaries.
Definition discretization/box/fvgridgeometry.hh:203
BoxFVGridGeometry(const GridView &gridView)
Constructor.
Definition discretization/box/fvgridgeometry.hh:145
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:136
Extrusion_t< Traits > Extrusion
export the type of extrusion
Definition discretization/box/fvgridgeometry.hh:121
typename PeriodicGridTraits< typename GV::Grid >::SupportsPeriodicity SupportsPeriodicity
export whether the grid(geometry) supports periodicity
Definition discretization/box/fvgridgeometry.hh:129
typename Traits::template LocalView< ThisType, true > LocalView
export the type of the fv element geometry (the local view type)
Definition discretization/box/fvgridgeometry.hh:113
bool dofOnBoundary(GridIndexType dofIdx) const
If a vertex / d.o.f. is on the boundary.
Definition discretization/box/fvgridgeometry.hh:191
std::size_t numScvf() const
The total number of sun control volume faces.
Definition discretization/box/fvgridgeometry.hh:159
bool dofOnPeriodicBoundary(GridIndexType dofIdx) const
If a vertex / d.o.f. is on a periodic boundary.
Definition discretization/box/fvgridgeometry.hh:195
void update(GridView &&gridView)
update all fvElementGeometries (call this after grid adaption)
Definition discretization/box/fvgridgeometry.hh:180
typename Traits::SubControlVolume SubControlVolume
export the type of sub control volume
Definition discretization/box/fvgridgeometry.hh:115
typename Traits::VertexMapper DofMapper
export dof mapper type
Definition discretization/box/fvgridgeometry.hh:123
Base class for the finite volume geometry vector for box schemes This builds up the sub control volum...
Definition discretization/box/fvgridgeometry.hh:83
Create sub control volumes and sub control volume face geometries.
Definition boxgeometryhelper.hh:261
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:54
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
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:42
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
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:65
BoxFVElementGeometry< GridGeometry, enableCache > LocalView
Definition discretization/box/fvgridgeometry.hh:70
BoxSubControlVolume< GridView > SubControlVolume
Definition discretization/box/fvgridgeometry.hh:66
BoxSubControlVolumeFace< GridView > SubControlVolumeFace
Definition discretization/box/fvgridgeometry.hh:67
Quadrature rule traits for discretization schemes.
Definition quadraturerules.hh:85
typename GridView::IndexSet::IndexType GridIndex
Definition indextraits.hh:27
unsigned int LocalIndex
Definition indextraits.hh:28
Definition periodicgridtraits.hh:24
Definition periodicgridtraits.hh:23