version 3.8
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// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
13#ifndef DUMUX_MULTIDOMAIN_EMBEDDED_COUPLINGMANAGER_1D3D_LINE_HH
14#define DUMUX_MULTIDOMAIN_EMBEDDED_COUPLINGMANAGER_1D3D_LINE_HH
15
16#include <vector>
17
18#include <dumux/common/tag.hh>
21
23
24namespace Dumux {
25
26namespace Embedded1d3dCouplingMode {
27struct Line : public Utility::Tag<Line> {
28 static std::string name() { return "line"; }
29};
30
31inline constexpr Line line{};
32} // end namespace Embedded1d3dCouplingMode
33
34// forward declaration
35template<class MDTraits, class CouplingMode>
36class Embedded1d3dCouplingManager;
37
46template<class MDTraits>
47class Embedded1d3dCouplingManager<MDTraits, Embedded1d3dCouplingMode::Line>
48: public EmbeddedCouplingManagerBase<MDTraits, Embedded1d3dCouplingManager<MDTraits, Embedded1d3dCouplingMode::Line>>
49{
52
53 using Scalar = typename MDTraits::Scalar;
54 using SolutionVector = typename MDTraits::SolutionVector;
55
56 static constexpr auto bulkIdx = typename MDTraits::template SubDomain<0>::Index();
57 static constexpr auto lowDimIdx = typename MDTraits::template SubDomain<1>::Index();
58
59 // the sub domain type aliases
60 template<std::size_t id> using SubDomainTypeTag = typename MDTraits::template SubDomain<id>::TypeTag;
61 template<std::size_t id> using Problem = GetPropType<SubDomainTypeTag<id>, Properties::Problem>;
62 template<std::size_t id> using GridGeometry = GetPropType<SubDomainTypeTag<id>, Properties::GridGeometry>;
63 template<std::size_t id> using GridView = typename GridGeometry<id>::GridView;
64 template<std::size_t id> using Element = typename GridView<id>::template Codim<0>::Entity;
65 template<std::size_t id> using GridIndex = typename IndexTraits<GridView<id>>::GridIndex;
66
67public:
68 static constexpr Embedded1d3dCouplingMode::Line couplingMode{};
69
70 using ParentType::ParentType;
71
72 void init(std::shared_ptr<Problem<bulkIdx>> bulkProblem,
73 std::shared_ptr<Problem<lowDimIdx>> lowDimProblem,
74 const SolutionVector& curSol)
75 {
76 ParentType::init(bulkProblem, lowDimProblem, curSol);
77 computeLowDimVolumeFractions();
78 }
79
82 {
83 // resize the storage vector
84 lowDimVolumeInBulkElement_.resize(this->gridView(bulkIdx).size(0));
85 // get references to the grid geometries
86 const auto& lowDimGridGeometry = this->problem(lowDimIdx).gridGeometry();
87 const auto& bulkGridGeometry = this->problem(bulkIdx).gridGeometry();
88
89 // compute the low dim volume fractions
90 for (const auto& is : intersections(this->glue()))
91 {
92 // all inside elements are identical...
93 const auto& inside = is.targetEntity(0);
94 const auto intersectionGeometry = is.geometry();
95 const auto lowDimElementIdx = lowDimGridGeometry.elementMapper().index(inside);
96
97 // compute the volume the low-dim domain occupies in the bulk domain if it were full-dimensional
98 const auto radius = this->problem(lowDimIdx).spatialParams().radius(lowDimElementIdx);
99 for (int outsideIdx = 0; outsideIdx < is.numDomainNeighbors(); ++outsideIdx)
100 {
101 const auto& outside = is.domainEntity(outsideIdx);
102 const auto bulkElementIdx = bulkGridGeometry.elementMapper().index(outside);
103 lowDimVolumeInBulkElement_[bulkElementIdx] += intersectionGeometry.volume()*M_PI*radius*radius;
104 }
105 }
106 }
107
111 // \{
112
114 Scalar radius(std::size_t id) const
115 {
116 const auto& data = this->pointSourceData()[id];
117 return this->problem(lowDimIdx).spatialParams().radius(data.lowDimElementIdx());
118 }
119
121 // For one-dimensional low dim domain we assume radial tubes
122 Scalar lowDimVolume(const Element<bulkIdx>& element) const
123 {
124 const auto eIdx = this->problem(bulkIdx).gridGeometry().elementMapper().index(element);
125 return lowDimVolumeInBulkElement_[eIdx];
126 }
127
129 // For one-dimensional low dim domain we assume radial tubes
130 Scalar lowDimVolumeFraction(const Element<bulkIdx>& element) const
131 {
132 const auto totalVolume = element.geometry().volume();
133 return lowDimVolume(element) / totalVolume;
134 }
135
136 // \}
137
138private:
140 std::vector<Scalar> lowDimVolumeInBulkElement_;
141};
142
144template<class MDTraits>
145struct CouplingManagerSupportsMultithreadedAssembly<Embedded1d3dCouplingManager<MDTraits, Embedded1d3dCouplingMode::Line>>
146: public std::true_type {};
147
148} // end namespace Dumux
149
150#endif
Manages the coupling between bulk elements and lower dimensional elements Point sources on each integ...
Definition: couplingmanager1d3d_line.hh:49
Scalar lowDimVolume(const Element< bulkIdx > &element) const
The volume the lower dimensional domain occupies in the bulk domain element.
Definition: couplingmanager1d3d_line.hh:122
void computeLowDimVolumeFractions()
Compute the low dim volume fraction in the bulk domain cells.
Definition: couplingmanager1d3d_line.hh:81
Scalar radius(std::size_t id) const
Methods to be accessed by the subproblems.
Definition: couplingmanager1d3d_line.hh:114
void init(std::shared_ptr< Problem< bulkIdx > > bulkProblem, std::shared_ptr< Problem< lowDimIdx > > lowDimProblem, const SolutionVector &curSol)
Definition: couplingmanager1d3d_line.hh:72
Scalar lowDimVolumeFraction(const Element< bulkIdx > &element) const
The volume fraction the lower dimensional domain occupies in the bulk domain element.
Definition: couplingmanager1d3d_line.hh:130
Manages the coupling between bulk elements and lower dimensional elements Point sources on each integ...
Definition: couplingmanager1d3d.hh:24
Manages the coupling between bulk elements and lower dimensional elements Point sources on each integ...
Definition: couplingmanagerbase.hh:71
Defines all properties used in Dumux.
Coupling manager for low-dimensional domains embedded in the bulk domain. Point sources on each integ...
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:296
Defines the index types used for grid and local indices.
constexpr Line line
Definition: couplingmanager1d3d_line.hh:31
Definition: adapt.hh:17
Type trait that is specialized for coupling manager supporting multithreaded assembly.
Definition: multistagemultidomainfvassembler.hh:78
Definition: couplingmanager1d3d_line.hh:27
static std::string name()
Definition: couplingmanager1d3d_line.hh:28
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 Tags any given type. The tagged type is eq...
Definition: tag.hh:30
Helper class to create (named and comparable) tagged types.