3.4
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
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
43inline constexpr Line line{};
44} // end namespace Embedded1d3dCouplingMode
45
46// forward declaration
47template<class MDTraits, class CouplingMode>
48class Embedded1d3dCouplingManager;
49
58template<class MDTraits>
59class Embedded1d3dCouplingManager<MDTraits, Embedded1d3dCouplingMode::Line>
60: public EmbeddedCouplingManagerBase<MDTraits, Embedded1d3dCouplingManager<MDTraits, Embedded1d3dCouplingMode::Line>>
61{
64
65 using Scalar = typename MDTraits::Scalar;
66 using SolutionVector = typename MDTraits::SolutionVector;
67
68 static constexpr auto bulkIdx = typename MDTraits::template SubDomain<0>::Index();
69 static constexpr auto lowDimIdx = typename MDTraits::template SubDomain<1>::Index();
70
71 // the sub domain type aliases
72 template<std::size_t id> using SubDomainTypeTag = typename MDTraits::template SubDomain<id>::TypeTag;
73 template<std::size_t id> using Problem = GetPropType<SubDomainTypeTag<id>, Properties::Problem>;
74 template<std::size_t id> using GridGeometry = GetPropType<SubDomainTypeTag<id>, Properties::GridGeometry>;
75 template<std::size_t id> using GridView = typename GridGeometry<id>::GridView;
76 template<std::size_t id> using Element = typename GridView<id>::template Codim<0>::Entity;
77 template<std::size_t id> using GridIndex = typename IndexTraits<GridView<id>>::GridIndex;
78
79public:
80 static constexpr Embedded1d3dCouplingMode::Line couplingMode{};
81
82 using ParentType::ParentType;
83
84 void init(std::shared_ptr<Problem<bulkIdx>> bulkProblem,
85 std::shared_ptr<Problem<lowDimIdx>> lowDimProblem,
86 const SolutionVector& curSol)
87 {
88 ParentType::init(bulkProblem, lowDimProblem, curSol);
89 computeLowDimVolumeFractions();
90 }
91
94 {
95 // resize the storage vector
96 lowDimVolumeInBulkElement_.resize(this->gridView(bulkIdx).size(0));
97 // get references to the grid geometries
98 const auto& lowDimGridGeometry = this->problem(lowDimIdx).gridGeometry();
99 const auto& bulkGridGeometry = this->problem(bulkIdx).gridGeometry();
100
101 // compute the low dim volume fractions
102 for (const auto& is : intersections(this->glue()))
103 {
104 // all inside elements are identical...
105 const auto& inside = is.targetEntity(0);
106 const auto intersectionGeometry = is.geometry();
107 const auto lowDimElementIdx = lowDimGridGeometry.elementMapper().index(inside);
108
109 // compute the volume the low-dim domain occupies in the bulk domain if it were full-dimensional
110 const auto radius = this->problem(lowDimIdx).spatialParams().radius(lowDimElementIdx);
111 for (int outsideIdx = 0; outsideIdx < is.numDomainNeighbors(); ++outsideIdx)
112 {
113 const auto& outside = is.domainEntity(outsideIdx);
114 const auto bulkElementIdx = bulkGridGeometry.elementMapper().index(outside);
115 lowDimVolumeInBulkElement_[bulkElementIdx] += intersectionGeometry.volume()*M_PI*radius*radius;
116 }
117 }
118 }
119
123 // \{
124
126 Scalar radius(std::size_t id) const
127 {
128 const auto& data = this->pointSourceData()[id];
129 return this->problem(lowDimIdx).spatialParams().radius(data.lowDimElementIdx());
130 }
131
133 // For one-dimensional low dim domain we assume radial tubes
134 Scalar lowDimVolume(const Element<bulkIdx>& element) const
135 {
136 const auto eIdx = this->problem(bulkIdx).gridGeometry().elementMapper().index(element);
137 return lowDimVolumeInBulkElement_[eIdx];
138 }
139
141 // For one-dimensional low dim domain we assume radial tubes
142 Scalar lowDimVolumeFraction(const Element<bulkIdx>& element) const
143 {
144 const auto totalVolume = element.geometry().volume();
145 return lowDimVolume(element) / totalVolume;
146 }
147
148 // \}
149
150private:
152 std::vector<Scalar> lowDimVolumeInBulkElement_;
153};
154
155} // end namespace Dumux
156
157#endif
Defines the index types used for grid and local indices.
Helper class to create (named and comparable) tagged types.
Coupling manager for low-dimensional domains embedded in the bulk domain. Point sources on each integ...
Definition: adapt.hh:29
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:150
constexpr Line line
Definition: couplingmanager1d3d_line.hh:43
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:98
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
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:61
Scalar lowDimVolume(const Element< bulkIdx > &element) const
The volume the lower dimensional domain occupies in the bulk domain element.
Definition: couplingmanager1d3d_line.hh:134
void computeLowDimVolumeFractions()
Compute the low dim volume fraction in the bulk domain cells.
Definition: couplingmanager1d3d_line.hh:93
Scalar radius(std::size_t id) const
Methods to be accessed by the subproblems.
Definition: couplingmanager1d3d_line.hh:126
void init(std::shared_ptr< Problem< bulkIdx > > bulkProblem, std::shared_ptr< Problem< lowDimIdx > > lowDimProblem, const SolutionVector &curSol)
Definition: couplingmanager1d3d_line.hh:84
Scalar lowDimVolumeFraction(const Element< bulkIdx > &element) const
The volume fraction the lower dimensional domain occupies in the bulk domain element.
Definition: couplingmanager1d3d_line.hh:142
Manages the coupling between bulk elements and lower dimensional elements Point sources on each integ...
Definition: couplingmanagerbase.hh:79
Declares all properties used in Dumux.