25#ifndef DUMUX_MULTIDOMAIN_EMBEDDED_POINTSOURCEDATA_HH
26#define DUMUX_MULTIDOMAIN_EMBEDDED_POINTSOURCEDATA_HH
29#include <dune/common/fvector.hh>
41template<
class MDTraits>
44 using Scalar =
typename MDTraits::Scalar;
45 using ShapeValues =
typename std::vector<Dune::FieldVector<Scalar, 1> >;
47 template<std::
size_t id>
using SubDomainTypeTag =
typename MDTraits::template SubDomain<id>::TypeTag;
49 template<std::
size_t id>
using GridView =
typename GridGeometry<id>::GridView;
54 static constexpr auto bulkIdx =
typename MDTraits::template SubDomain<0>::Index();
55 static constexpr auto lowDimIdx =
typename MDTraits::template SubDomain<1>::Index();
57 template<std::
size_t id>
58 static constexpr bool isBox()
63 const std::vector<GridIndex<bulkIdx>>& cornerIndices,
64 GridIndex<bulkIdx> eIdx)
66 static_assert(isBox<bulkIdx>(),
"This interface is only available for the box method.");
67 bulkElementIdx_ = eIdx;
68 bulkCornerIndices_ = cornerIndices;
69 bulkShapeValues_ = shapeValues;
73 const std::vector<GridIndex<lowDimIdx>>& cornerIndices,
74 GridIndex<lowDimIdx> eIdx)
76 static_assert(isBox<lowDimIdx>(),
"This interface is only available for the box method.");
77 lowDimElementIdx_ = eIdx;
78 lowDimCornerIndices_ = cornerIndices;
79 lowDimShapeValues_ = shapeValues;
84 static_assert(!isBox<bulkIdx>(),
"This interface is not available for the box method.");
85 bulkElementIdx_ = eIdx;
90 static_assert(!isBox<lowDimIdx>(),
"This interface is not available for the box method.");
91 lowDimElementIdx_ = eIdx;
94 PrimaryVariables<bulkIdx>
interpolateBulk(
const SolutionVector<bulkIdx>& sol)
const
96 PrimaryVariables<bulkIdx> bulkPriVars(0.0);
99 for (
int i = 0; i < bulkCornerIndices_.size(); ++i)
100 for (
int priVarIdx = 0; priVarIdx < bulkPriVars.size(); ++priVarIdx)
101 bulkPriVars[priVarIdx] += sol[bulkCornerIndices_[i]][priVarIdx]*bulkShapeValues_[i];
112 PrimaryVariables<lowDimIdx> lowDimPriVars(0.0);
113 if (isBox<lowDimIdx>())
115 for (
int i = 0; i < lowDimCornerIndices_.size(); ++i)
116 for (
int priVarIdx = 0; priVarIdx < lowDimPriVars.size(); ++priVarIdx)
117 lowDimPriVars[priVarIdx] += sol[lowDimCornerIndices_[i]][priVarIdx]*lowDimShapeValues_[i];
123 return lowDimPriVars;
127 {
return lowDimElementIdx_; }
130 {
return bulkElementIdx_; }
133 ShapeValues bulkShapeValues_, lowDimShapeValues_;
134 std::vector<GridIndex<bulkIdx>> bulkCornerIndices_;
135 std::vector<GridIndex<lowDimIdx>> lowDimCornerIndices_;
136 GridIndex<bulkIdx> bulkElementIdx_;
137 GridIndex<lowDimIdx> lowDimElementIdx_;
149template<
class MDTraits>
153 using Scalar =
typename MDTraits::Scalar;
154 using ShapeValues =
typename std::vector<Dune::FieldVector<Scalar, 1> >;
156 template<std::
size_t id>
using SubDomainTypeTag =
typename MDTraits::template SubDomain<id>::TypeTag;
158 template<std::
size_t id>
using GridView =
typename GridGeometry<id>::GridView;
163 static constexpr auto bulkIdx =
typename MDTraits::template SubDomain<0>::Index();
164 static constexpr auto lowDimIdx =
typename MDTraits::template SubDomain<1>::Index();
166 template<std::
size_t id>
167 static constexpr bool isBox()
178 PrimaryVariables<bulkIdx> bulkPriVars(sol[0]);
180 if (enableBulkCircleInterpolation_)
184 if (isBox<bulkIdx>())
186 assert(circleCornerIndices_.size() == circleShapeValues_.size());
188 Scalar weightSum = 0.0;
189 for (std::size_t j = 0; j < circleStencil_.size(); ++j)
191 PrimaryVariables<bulkIdx> priVars(0.0);
192 const auto& cornerIndices = *(circleCornerIndices_[j]);
193 const auto& shapeValues = circleShapeValues_[j];
194 for (
int i = 0; i < cornerIndices.size(); ++i)
196 const auto& localSol = sol[cornerIndices[i]];
197 const auto& shapeValue = shapeValues[i];
198 for (
int priVarIdx = 0; priVarIdx < PrimaryVariables<bulkIdx>::size(); ++priVarIdx)
199 priVars[priVarIdx] += localSol[priVarIdx]*shapeValue;
202 priVars *= circleIpWeight_[j];
203 weightSum += circleIpWeight_[j];
204 bulkPriVars += priVars;
206 bulkPriVars /= weightSum;
210 Scalar weightSum = 0.0;
211 for (
int j = 0; j < circleStencil_.size(); ++j)
213 for (
int priVarIdx = 0; priVarIdx < bulkPriVars.size(); ++priVarIdx)
214 bulkPriVars[priVarIdx] += sol[circleStencil_[j]][priVarIdx]*circleIpWeight_[j];
216 weightSum += circleIpWeight_[j];
218 bulkPriVars /= weightSum;
229 const std::vector<ShapeValues>& circleShapeValues,
230 const std::vector<Scalar>& circleIpWeight,
233 circleCornerIndices_ = circleCornerIndices;
234 circleShapeValues_ = circleShapeValues;
235 circleIpWeight_ = circleIpWeight;
237 enableBulkCircleInterpolation_ =
true;
244 circleIpWeight_ = circleIpWeight;
246 enableBulkCircleInterpolation_ =
true;
250 {
return circleStencil_; }
253 std::vector<const std::vector<GridIndex<bulkIdx>>*> circleCornerIndices_;
254 std::vector<ShapeValues> circleShapeValues_;
255 std::vector<Scalar> circleIpWeight_;
256 std::vector<GridIndex<bulkIdx>> circleStencil_;
257 bool enableBulkCircleInterpolation_;
Defines the index types used for grid and local indices.
The available discretization methods in Dumux.
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:150
Struture to define the index types used for grid and local indices.
Definition: indextraits.hh:38
A vector of primary variables.
Definition: common/properties.hh:49
Vector containing all primary variable vector of the grid.
Definition: common/properties.hh:69
Definition: common/properties.hh:98
A point source data class used for integration in multidimension models.
Definition: pointsourcedata.hh:43
GridIndex< bulkIdx > bulkElementIdx() const
Definition: pointsourcedata.hh:129
void addLowDimInterpolation(const ShapeValues &shapeValues, const std::vector< GridIndex< lowDimIdx > > &cornerIndices, GridIndex< lowDimIdx > eIdx)
Definition: pointsourcedata.hh:72
GridIndex< lowDimIdx > lowDimElementIdx() const
Definition: pointsourcedata.hh:126
void addBulkInterpolation(GridIndex< bulkIdx > eIdx)
Definition: pointsourcedata.hh:82
PrimaryVariables< lowDimIdx > interpolateLowDim(const SolutionVector< lowDimIdx > &sol) const
Definition: pointsourcedata.hh:110
void addBulkInterpolation(const ShapeValues &shapeValues, const std::vector< GridIndex< bulkIdx > > &cornerIndices, GridIndex< bulkIdx > eIdx)
Definition: pointsourcedata.hh:62
PrimaryVariables< bulkIdx > interpolateBulk(const SolutionVector< bulkIdx > &sol) const
Definition: pointsourcedata.hh:94
void addLowDimInterpolation(GridIndex< lowDimIdx > eIdx)
Definition: pointsourcedata.hh:88
A point source data class used for integration in multidimension models.
Definition: pointsourcedata.hh:151
const std::vector< GridIndex< bulkIdx > > & circleStencil() const
Definition: pointsourcedata.hh:249
void addCircleInterpolation(const std::vector< Scalar > &circleIpWeight, const std::vector< GridIndex< bulkIdx > > &circleStencil)
Definition: pointsourcedata.hh:241
PointSourceDataCircleAverage()
Definition: pointsourcedata.hh:171
PrimaryVariables< bulkIdx > interpolateBulk(const SolutionVector< bulkIdx > &sol) const
Definition: pointsourcedata.hh:173
void addCircleInterpolation(const std::vector< const std::vector< GridIndex< bulkIdx > > * > &circleCornerIndices, const std::vector< ShapeValues > &circleShapeValues, const std::vector< Scalar > &circleIpWeight, const std::vector< GridIndex< bulkIdx > > &circleStencil)
Definition: pointsourcedata.hh:228
Declares all properties used in Dumux.