version 3.11-dev
Loading...
Searching...
No Matches
couplingmanager1d3dbase.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
13#ifndef DUMUX_MULTIDOMAIN_EMBEDDED_COUPLINGMANAGER_1D3D_BASE_HH
14#define DUMUX_MULTIDOMAIN_EMBEDDED_COUPLINGMANAGER_1D3D_BASE_HH
15
16#include <vector>
17
18#include <dumux/common/tag.hh>
22
24
25namespace Dumux {
26
32
33template<class MDTraits, class Implementation, class PSTraits = DefaultPointSourceTraits<MDTraits>>
35: public EmbeddedCouplingManagerBase<MDTraits, Implementation, PSTraits>
36{
39
40 using Scalar = typename MDTraits::Scalar;
41 using SolutionVector = typename MDTraits::SolutionVector;
42
43 static constexpr auto bulkIdx = typename MDTraits::template SubDomain<0>::Index();
44 static constexpr auto lowDimIdx = typename MDTraits::template SubDomain<1>::Index();
45
46 // the sub domain type aliases
47 template<std::size_t id> using SubDomainTypeTag = typename MDTraits::template SubDomain<id>::TypeTag;
48 template<std::size_t id> using Problem = GetPropType<SubDomainTypeTag<id>, Properties::Problem>;
49 template<std::size_t id> using GridGeometry = GetPropType<SubDomainTypeTag<id>, Properties::GridGeometry>;
50 template<std::size_t id> using GridView = typename GridGeometry<id>::GridView;
51 template<std::size_t id> using Element = typename GridView<id>::template Codim<0>::Entity;
52 template<std::size_t id> using GridIndex = typename IndexTraits<GridView<id>>::GridIndex;
53
54public:
55
56 using ParentType::ParentType;
57
58 void init(std::shared_ptr<Problem<bulkIdx>> bulkProblem,
59 std::shared_ptr<Problem<lowDimIdx>> lowDimProblem,
60 const SolutionVector& curSol)
61 {
62 ParentType::init(bulkProblem, lowDimProblem, curSol);
63 computeLowDimVolumeFractions_();
64 }
65
67 [[deprecated("Will be removed after release 3.11. Only needed for the deprecated lowDimVolume and lowDimVolumeFraction.")]]
69 { computeLowDimVolumeFractions_(); }
70
74 // \{
75
77 Scalar radius(std::size_t id) const
78 {
79 const auto& data = this->pointSourceData()[id];
80 return this->problem(lowDimIdx).spatialParams().radius(data.lowDimElementIdx());
81 }
82
84 // For one-dimensional low dim domain we assume radial tubes
85 [[deprecated("Will be removed after release 3.11. This is not a general implementation: the volume of "
86 "a cylinder around a segment is counted in full in every bulk element containing the segment "
87 "(several for a segment on a face or an edge) and not in the elements the cylinder reaches "
88 "beyond the segment. Use EmbeddedCoupling::lowDimVolumePerBulkElement "
89 "from dumux/multidomain/embedded/lowdimvolume.hh.")]]
90 Scalar lowDimVolume(const Element<bulkIdx>& element) const
91 {
92 const auto eIdx = gridDiscretization(this->problem(bulkIdx)).elementMapper().index(element);
93 return lowDimVolumeInBulkElement_[eIdx];
94 }
95
97 // For one-dimensional low dim domain we assume radial tubes
98 [[deprecated("Will be removed after release 3.11. This is not a general implementation: see lowDimVolume. "
99 "Divide the result of EmbeddedCoupling::lowDimVolumePerBulkElement "
100 "from dumux/multidomain/embedded/lowdimvolume.hh by the element volume.")]]
101 Scalar lowDimVolumeFraction(const Element<bulkIdx>& element) const
102 {
103 const auto eIdx = gridDiscretization(this->problem(bulkIdx)).elementMapper().index(element);
104 return lowDimVolumeInBulkElement_[eIdx] / element.geometry().volume();
105 }
106
107 // \}
108
109private:
110 void computeLowDimVolumeFractions_()
111 {
112 // resize the storage vector
113 lowDimVolumeInBulkElement_.resize(this->gridView(bulkIdx).size(0));
114 // get references to the grid geometries
115 const auto& lowDimGridGeometry = gridDiscretization(this->problem(lowDimIdx));
116 const auto& bulkGridGeometry = gridDiscretization(this->problem(bulkIdx));
117
118 // compute the low dim volume fractions
119 for (const auto& is : intersections(this->glue()))
120 {
121 // all inside elements are identical...
122 const auto& inside = is.targetEntity(0);
123 const auto intersectionGeometry = is.geometry();
124 const auto lowDimElementIdx = lowDimGridGeometry.elementMapper().index(inside);
125
126 // compute the volume the low-dim domain occupies in the bulk domain if it were full-dimensional
127 const auto radius = this->problem(lowDimIdx).spatialParams().radius(lowDimElementIdx);
128 for (int outsideIdx = 0; outsideIdx < is.numDomainNeighbors(); ++outsideIdx)
129 {
130 const auto& outside = is.domainEntity(outsideIdx);
131 const auto bulkElementIdx = bulkGridGeometry.elementMapper().index(outside);
132 lowDimVolumeInBulkElement_[bulkElementIdx] += intersectionGeometry.volume()*M_PI*radius*radius;
133 }
134 }
135 }
136
138 std::vector<Scalar> lowDimVolumeInBulkElement_;
139};
140
141} // end namespace Dumux
142
143#endif
const Problem< i > & problem(Dune::index_constant< i > domainIdx) const
Definition multidomain/couplingmanager.hh:318
Manages the coupling between bulk elements and lower dimensional elements Point sources on each integ...
Definition couplingmanager1d3dbase.hh:36
Scalar lowDimVolumeFraction(const Element< bulkIdx > &element) const
The volume fraction the lower dimensional domain occupies in the bulk domain element.
Definition couplingmanager1d3dbase.hh:101
Scalar radius(std::size_t id) const
Methods to be accessed by the subproblems.
Definition couplingmanager1d3dbase.hh:77
Scalar lowDimVolume(const Element< bulkIdx > &element) const
The volume the lower dimensional domain occupies in the bulk domain element.
Definition couplingmanager1d3dbase.hh:90
void computeLowDimVolumeFractions()
Compute the low dim volume fraction in the bulk domain cells.
Definition couplingmanager1d3dbase.hh:68
void init(std::shared_ptr< Problem< bulkIdx > > bulkProblem, std::shared_ptr< Problem< lowDimIdx > > lowDimProblem, const SolutionVector &curSol)
Definition couplingmanager1d3dbase.hh:58
EmbeddedCouplingManagerBase(std::shared_ptr< const GridGeometry< bulkIdx > > bulkGridGeometry, std::shared_ptr< const GridGeometry< lowDimIdx > > lowDimGridGeometry)
Constructor.
Definition couplingmanagerbase.hh:150
const GridView< id > & gridView(Dune::index_constant< id > domainIdx) const
Return a reference to the bulk problem.
Definition couplingmanagerbase.hh:407
auto & curSol(Dune::index_constant< i > domainIdx)
Definition couplingmanagerbase.hh:500
const GlueType & glue() const
Definition couplingmanagerbase.hh:807
void init(std::shared_ptr< Problem< bulkIdx > > bulkProblem, std::shared_ptr< Problem< lowDimIdx > > lowDimProblem, const SolutionVector &curSol)
Definition couplingmanagerbase.hh:161
const std::vector< PointSourceData > & pointSourceData() const
Return reference to point source data vector member.
Definition couplingmanagerbase.hh:478
Defines all properties used in Dumux.
Coupling manager for low-dimensional domains embedded in the bulk domain. Point sources on each integ...
Type traits for classes providing a grid discretization.
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition propertysystem.hh:296
decltype(auto) gridDiscretization(const T &t, Args &&... args)
The grid discretization.
Definition griddiscretization.hh:98
Defines the index types used for grid and local indices.
Definition adapt.hh:17
Structure to define the index types used for grid and local indices.
Definition indextraits.hh:26
Helper class to create (named and comparable) tagged types.