version 3.11-dev
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//
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>
21
23
24namespace Dumux {
25
32template<class MDTraits, class Implementation, class PSTraits = DefaultPointSourceTraits<MDTraits>>
34: public EmbeddedCouplingManagerBase<MDTraits, Implementation, PSTraits>
35{
38
39 using Scalar = typename MDTraits::Scalar;
40 using SolutionVector = typename MDTraits::SolutionVector;
41
42 static constexpr auto bulkIdx = typename MDTraits::template SubDomain<0>::Index();
43 static constexpr auto lowDimIdx = typename MDTraits::template SubDomain<1>::Index();
44
45 // the sub domain type aliases
46 template<std::size_t id> using SubDomainTypeTag = typename MDTraits::template SubDomain<id>::TypeTag;
47 template<std::size_t id> using Problem = GetPropType<SubDomainTypeTag<id>, Properties::Problem>;
48 template<std::size_t id> using GridGeometry = GetPropType<SubDomainTypeTag<id>, Properties::GridGeometry>;
49 template<std::size_t id> using GridView = typename GridGeometry<id>::GridView;
50 template<std::size_t id> using Element = typename GridView<id>::template Codim<0>::Entity;
51 template<std::size_t id> using GridIndex = typename IndexTraits<GridView<id>>::GridIndex;
52
53public:
54
56
57 void init(std::shared_ptr<Problem<bulkIdx>> bulkProblem,
58 std::shared_ptr<Problem<lowDimIdx>> lowDimProblem,
59 const SolutionVector& curSol)
60 {
61 ParentType::init(bulkProblem, lowDimProblem, curSol);
63 }
64
67 {
68 // resize the storage vector
69 lowDimVolumeInBulkElement_.resize(this->gridView(bulkIdx).size(0));
70 // get references to the grid geometries
71 const auto& lowDimGridGeometry = this->problem(lowDimIdx).gridGeometry();
72 const auto& bulkGridGeometry = this->problem(bulkIdx).gridGeometry();
73
74 // compute the low dim volume fractions
75 for (const auto& is : intersections(this->glue()))
76 {
77 // all inside elements are identical...
78 const auto& inside = is.targetEntity(0);
79 const auto intersectionGeometry = is.geometry();
80 const auto lowDimElementIdx = lowDimGridGeometry.elementMapper().index(inside);
81
82 // compute the volume the low-dim domain occupies in the bulk domain if it were full-dimensional
83 const auto radius = this->problem(lowDimIdx).spatialParams().radius(lowDimElementIdx);
84 for (int outsideIdx = 0; outsideIdx < is.numDomainNeighbors(); ++outsideIdx)
85 {
86 const auto& outside = is.domainEntity(outsideIdx);
87 const auto bulkElementIdx = bulkGridGeometry.elementMapper().index(outside);
88 lowDimVolumeInBulkElement_[bulkElementIdx] += intersectionGeometry.volume()*M_PI*radius*radius;
89 }
90 }
91 }
92
96 // \{
97
99 Scalar radius(std::size_t id) const
100 {
101 const auto& data = this->pointSourceData()[id];
102 return this->problem(lowDimIdx).spatialParams().radius(data.lowDimElementIdx());
103 }
104
106 // For one-dimensional low dim domain we assume radial tubes
107 Scalar lowDimVolume(const Element<bulkIdx>& element) const
108 {
109 const auto eIdx = this->problem(bulkIdx).gridGeometry().elementMapper().index(element);
110 return lowDimVolumeInBulkElement_[eIdx];
111 }
112
114 // For one-dimensional low dim domain we assume radial tubes
115 Scalar lowDimVolumeFraction(const Element<bulkIdx>& element) const
116 {
117 const auto totalVolume = element.geometry().volume();
118 return lowDimVolume(element) / totalVolume;
119 }
120
121 // \}
122
123private:
125 std::vector<Scalar> lowDimVolumeInBulkElement_;
126};
127
128} // end namespace Dumux
129
130#endif
const Problem< i > & problem(Dune::index_constant< i > domainIdx) const
Return a reference to the sub problem.
Definition: multidomain/couplingmanager.hh:298
Manages the coupling between bulk elements and lower dimensional elements Point sources on each integ...
Definition: couplingmanager1d3dbase.hh:35
Scalar lowDimVolumeFraction(const Element< bulkIdx > &element) const
The volume fraction the lower dimensional domain occupies in the bulk domain element.
Definition: couplingmanager1d3dbase.hh:115
Scalar radius(std::size_t id) const
Methods to be accessed by the subproblems.
Definition: couplingmanager1d3dbase.hh:99
Scalar lowDimVolume(const Element< bulkIdx > &element) const
The volume the lower dimensional domain occupies in the bulk domain element.
Definition: couplingmanager1d3dbase.hh:107
void computeLowDimVolumeFractions()
Compute the low dim volume fraction in the bulk domain cells.
Definition: couplingmanager1d3dbase.hh:66
void init(std::shared_ptr< Problem< bulkIdx > > bulkProblem, std::shared_ptr< Problem< lowDimIdx > > lowDimProblem, const SolutionVector &curSol)
Definition: couplingmanager1d3dbase.hh:57
Manages the coupling between bulk elements and lower dimensional elements Point sources on each integ...
Definition: couplingmanagerbase.hh:71
const GridView< id > & gridView(Dune::index_constant< id > domainIdx) const
Return a reference to the bulk problem.
Definition: couplingmanagerbase.hh:373
auto & curSol(Dune::index_constant< i > domainIdx)
the solution vector of the subproblem
Definition: couplingmanagerbase.hh:421
void init(std::shared_ptr< Problem< bulkIdx > > bulkProblem, std::shared_ptr< Problem< lowDimIdx > > lowDimProblem, const SolutionVector &curSol)
Methods to be accessed by main.
Definition: couplingmanagerbase.hh:134
const std::vector< PointSourceData > & pointSourceData() const
Return reference to point source data vector member.
Definition: couplingmanagerbase.hh:407
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.
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.