3.3.0
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
couplingmanager1d3d_line.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 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
25#ifndef DUMUX_MULTIDOMAIN_EMBEDDED_COUPLINGMANAGER_1D3D_LINE_HH
26#define DUMUX_MULTIDOMAIN_EMBEDDED_COUPLINGMANAGER_1D3D_LINE_HH
27
28#include <vector>
29
30#include <dumux/common/tag.hh>
33
35
36namespace Dumux {
37
38namespace Embedded1d3dCouplingMode {
39struct Line : public Utility::Tag<Line> {
40 static std::string name() { return "line"; }
41
42 [[deprecated("Comparison with enum is deprecated. Removed after 3.3. Use tags.")]]
43 friend constexpr bool operator==(Line, EmbeddedCouplingMode m) { return m == EmbeddedCouplingMode::line; }
44 [[deprecated("Comparison with enum is deprecated. Removed after 3.3. Use tags.")]]
45 friend constexpr bool operator==(EmbeddedCouplingMode m, Line) { return m == EmbeddedCouplingMode::line; }
46 [[deprecated("Comparison with enum is deprecated. Removed after 3.3. Use tags.")]]
47 friend constexpr bool operator!=(Line, EmbeddedCouplingMode m) { return m != EmbeddedCouplingMode::line; }
48 [[deprecated("Comparison with enum is deprecated. Removed after 3.3. Use tags.")]]
49 friend constexpr bool operator!=(EmbeddedCouplingMode m, Line) { return m != EmbeddedCouplingMode::line; }
50};
51
52inline constexpr Line line{};
53} // end namespace Embedded1d3dCouplingMode
54
55// forward declaration
56template<class MDTraits, class CouplingMode>
57class Embedded1d3dCouplingManager;
58
67template<class MDTraits>
68class Embedded1d3dCouplingManager<MDTraits, Embedded1d3dCouplingMode::Line>
69: public EmbeddedCouplingManagerBase<MDTraits, Embedded1d3dCouplingManager<MDTraits, Embedded1d3dCouplingMode::Line>>
70{
73
74 using Scalar = typename MDTraits::Scalar;
75 using SolutionVector = typename MDTraits::SolutionVector;
76
77 static constexpr auto bulkIdx = typename MDTraits::template SubDomain<0>::Index();
78 static constexpr auto lowDimIdx = typename MDTraits::template SubDomain<1>::Index();
79
80 // the sub domain type aliases
81 template<std::size_t id> using SubDomainTypeTag = typename MDTraits::template SubDomain<id>::TypeTag;
82 template<std::size_t id> using Problem = GetPropType<SubDomainTypeTag<id>, Properties::Problem>;
83 template<std::size_t id> using GridGeometry = GetPropType<SubDomainTypeTag<id>, Properties::GridGeometry>;
84 template<std::size_t id> using GridView = typename GridGeometry<id>::GridView;
85 template<std::size_t id> using Element = typename GridView<id>::template Codim<0>::Entity;
86 template<std::size_t id> using GridIndex = typename IndexTraits<GridView<id>>::GridIndex;
87
88public:
89 static constexpr Embedded1d3dCouplingMode::Line couplingMode{};
90
91 using ParentType::ParentType;
92
93 void init(std::shared_ptr<Problem<bulkIdx>> bulkProblem,
94 std::shared_ptr<Problem<lowDimIdx>> lowDimProblem,
95 const SolutionVector& curSol)
96 {
97 ParentType::init(bulkProblem, lowDimProblem, curSol);
98 computeLowDimVolumeFractions();
99 }
100
103 {
104 // resize the storage vector
105 lowDimVolumeInBulkElement_.resize(this->gridView(bulkIdx).size(0));
106 // get references to the grid geometries
107 const auto& lowDimGridGeometry = this->problem(lowDimIdx).gridGeometry();
108 const auto& bulkGridGeometry = this->problem(bulkIdx).gridGeometry();
109
110 // compute the low dim volume fractions
111 for (const auto& is : intersections(this->glue()))
112 {
113 // all inside elements are identical...
114 const auto& inside = is.targetEntity(0);
115 const auto intersectionGeometry = is.geometry();
116 const auto lowDimElementIdx = lowDimGridGeometry.elementMapper().index(inside);
117
118 // compute the volume the low-dim domain occupies in the bulk domain if it were full-dimensional
119 const auto radius = this->problem(lowDimIdx).spatialParams().radius(lowDimElementIdx);
120 for (int outsideIdx = 0; outsideIdx < is.numDomainNeighbors(); ++outsideIdx)
121 {
122 const auto& outside = is.domainEntity(outsideIdx);
123 const auto bulkElementIdx = bulkGridGeometry.elementMapper().index(outside);
124 lowDimVolumeInBulkElement_[bulkElementIdx] += intersectionGeometry.volume()*M_PI*radius*radius;
125 }
126 }
127 }
128
132 // \{
133
135 Scalar radius(std::size_t id) const
136 {
137 const auto& data = this->pointSourceData()[id];
138 return this->problem(lowDimIdx).spatialParams().radius(data.lowDimElementIdx());
139 }
140
142 // For one-dimensional low dim domain we assume radial tubes
143 Scalar lowDimVolume(const Element<bulkIdx>& element) const
144 {
145 const auto eIdx = this->problem(bulkIdx).gridGeometry().elementMapper().index(element);
146 return lowDimVolumeInBulkElement_[eIdx];
147 }
148
150 // For one-dimensional low dim domain we assume radial tubes
151 Scalar lowDimVolumeFraction(const Element<bulkIdx>& element) const
152 {
153 const auto totalVolume = element.geometry().volume();
154 return lowDimVolume(element) / totalVolume;
155 }
156
157 // \}
158
159private:
161 std::vector<Scalar> lowDimVolumeInBulkElement_;
162};
163
164} // end namespace Dumux
165
166#endif
Coupling manager for low-dimensional domains embedded in the bulk domain. Point sources on each integ...
Helper class to create (named and comparable) tagged types.
Defines the index types used for grid and local indices.
EmbeddedCouplingMode
The coupling mode.
Definition: couplingmanager1d3d.hh:44
Definition: adapt.hh:29
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:149
constexpr Line line
Definition: couplingmanager1d3d_line.hh:52
Struture to define the index types used for grid and local indices.
Definition: indextraits.hh:38
Property to specify the type of a problem which has to be solved.
Definition: common/properties.hh:57
Definition: common/properties.hh:101
Helper class to create (named and comparable) tagged types Tags any given type. The tagged type is eq...
Definition: tag.hh:42
Manages the coupling between bulk elements and lower dimensional elements Point sources on each integ...
Definition: couplingmanager1d3d.hh:36
Definition: couplingmanager1d3d_line.hh:39
friend constexpr bool operator==(EmbeddedCouplingMode m, Line)
Definition: couplingmanager1d3d_line.hh:45
friend constexpr bool operator!=(Line, EmbeddedCouplingMode m)
Definition: couplingmanager1d3d_line.hh:47
friend constexpr bool operator!=(EmbeddedCouplingMode m, Line)
Definition: couplingmanager1d3d_line.hh:49
friend constexpr bool operator==(Line, EmbeddedCouplingMode m)
Definition: couplingmanager1d3d_line.hh:43
static std::string name()
Definition: couplingmanager1d3d_line.hh:40
Manages the coupling between bulk elements and lower dimensional elements Point sources on each integ...
Definition: couplingmanager1d3d_line.hh:70
Scalar lowDimVolume(const Element< bulkIdx > &element) const
The volume the lower dimensional domain occupies in the bulk domain element.
Definition: couplingmanager1d3d_line.hh:143
void computeLowDimVolumeFractions()
Compute the low dim volume fraction in the bulk domain cells.
Definition: couplingmanager1d3d_line.hh:102
Scalar radius(std::size_t id) const
Methods to be accessed by the subproblems.
Definition: couplingmanager1d3d_line.hh:135
void init(std::shared_ptr< Problem< bulkIdx > > bulkProblem, std::shared_ptr< Problem< lowDimIdx > > lowDimProblem, const SolutionVector &curSol)
Definition: couplingmanager1d3d_line.hh:93
Scalar lowDimVolumeFraction(const Element< bulkIdx > &element) const
The volume fraction the lower dimensional domain occupies in the bulk domain element.
Definition: couplingmanager1d3d_line.hh:151
Manages the coupling between bulk elements and lower dimensional elements Point sources on each integ...
Definition: couplingmanagerbase.hh:78
Declares all properties used in Dumux.