13#ifndef DUMUX_MULTIDOMAIN_EMBEDDED_POINTSOURCEDATA_HH
14#define DUMUX_MULTIDOMAIN_EMBEDDED_POINTSOURCEDATA_HH
17#include <dune/common/fvector.hh>
29template<
class MDTraits>
32 using Scalar =
typename MDTraits::Scalar;
33 using ShapeValues =
typename std::vector<Dune::FieldVector<Scalar, 1> >;
35 template<std::
size_t id>
using SubDomainTypeTag =
typename MDTraits::template SubDomain<id>::TypeTag;
37 template<std::
size_t id>
using GridView =
typename GridGeometry<id>::GridView;
42 static constexpr auto bulkIdx =
typename MDTraits::template SubDomain<0>::Index();
43 static constexpr auto lowDimIdx =
typename MDTraits::template SubDomain<1>::Index();
45 template<std::
size_t id>
46 static constexpr bool isBox()
51 const std::vector<GridIndex<bulkIdx>>& cornerIndices,
52 GridIndex<bulkIdx> eIdx)
54 static_assert(isBox<bulkIdx>(),
"This interface is only available for the box method.");
55 bulkElementIdx_ = eIdx;
56 bulkCornerIndices_ = cornerIndices;
57 bulkShapeValues_ = shapeValues;
61 const std::vector<GridIndex<lowDimIdx>>& cornerIndices,
62 GridIndex<lowDimIdx> eIdx)
64 static_assert(isBox<lowDimIdx>(),
"This interface is only available for the box method.");
65 lowDimElementIdx_ = eIdx;
66 lowDimCornerIndices_ = cornerIndices;
67 lowDimShapeValues_ = shapeValues;
72 static_assert(!isBox<bulkIdx>(),
"This interface is not available for the box method.");
73 bulkElementIdx_ = eIdx;
78 static_assert(!isBox<lowDimIdx>(),
"This interface is not available for the box method.");
79 lowDimElementIdx_ = eIdx;
82 PrimaryVariables<bulkIdx>
interpolateBulk(
const SolutionVector<bulkIdx>& sol)
const
84 PrimaryVariables<bulkIdx> bulkPriVars(0.0);
87 for (
int i = 0; i < bulkCornerIndices_.size(); ++i)
88 for (
int priVarIdx = 0; priVarIdx < bulkPriVars.size(); ++priVarIdx)
89 bulkPriVars[priVarIdx] += sol[bulkCornerIndices_[i]][priVarIdx]*bulkShapeValues_[i];
100 PrimaryVariables<lowDimIdx> lowDimPriVars(0.0);
101 if (isBox<lowDimIdx>())
103 for (
int i = 0; i < lowDimCornerIndices_.size(); ++i)
104 for (
int priVarIdx = 0; priVarIdx < lowDimPriVars.size(); ++priVarIdx)
105 lowDimPriVars[priVarIdx] += sol[lowDimCornerIndices_[i]][priVarIdx]*lowDimShapeValues_[i];
111 return lowDimPriVars;
115 {
return lowDimElementIdx_; }
118 {
return bulkElementIdx_; }
121 ShapeValues bulkShapeValues_, lowDimShapeValues_;
122 std::vector<GridIndex<bulkIdx>> bulkCornerIndices_;
123 std::vector<GridIndex<lowDimIdx>> lowDimCornerIndices_;
124 GridIndex<bulkIdx> bulkElementIdx_;
125 GridIndex<lowDimIdx> lowDimElementIdx_;
137template<
class MDTraits>
141 using Scalar =
typename MDTraits::Scalar;
142 using ShapeValues =
typename std::vector<Dune::FieldVector<Scalar, 1> >;
144 template<std::
size_t id>
using SubDomainTypeTag =
typename MDTraits::template SubDomain<id>::TypeTag;
146 template<std::
size_t id>
using GridView =
typename GridGeometry<id>::GridView;
151 static constexpr auto bulkIdx =
typename MDTraits::template SubDomain<0>::Index();
152 static constexpr auto lowDimIdx =
typename MDTraits::template SubDomain<1>::Index();
154 template<std::
size_t id>
155 static constexpr bool isBox()
166 PrimaryVariables<bulkIdx> bulkPriVars(sol[0]);
168 if (enableBulkCircleInterpolation_)
172 if (isBox<bulkIdx>())
174 assert(circleCornerIndices_.size() == circleShapeValues_.size());
176 Scalar weightSum = 0.0;
177 for (std::size_t j = 0; j < circleStencil_.size(); ++j)
179 PrimaryVariables<bulkIdx> priVars(0.0);
180 const auto& cornerIndices = *(circleCornerIndices_[j]);
181 const auto& shapeValues = circleShapeValues_[j];
182 for (
int i = 0; i < cornerIndices.size(); ++i)
184 const auto& localSol = sol[cornerIndices[i]];
185 const auto& shapeValue = shapeValues[i];
186 for (
int priVarIdx = 0; priVarIdx < PrimaryVariables<bulkIdx>::size(); ++priVarIdx)
187 priVars[priVarIdx] += localSol[priVarIdx]*shapeValue;
190 priVars *= circleIpWeight_[j];
191 weightSum += circleIpWeight_[j];
192 bulkPriVars += priVars;
194 bulkPriVars /= weightSum;
198 Scalar weightSum = 0.0;
199 for (
int j = 0; j < circleStencil_.size(); ++j)
201 for (
int priVarIdx = 0; priVarIdx < bulkPriVars.size(); ++priVarIdx)
202 bulkPriVars[priVarIdx] += sol[circleStencil_[j]][priVarIdx]*circleIpWeight_[j];
204 weightSum += circleIpWeight_[j];
206 bulkPriVars /= weightSum;
217 const std::vector<ShapeValues>& circleShapeValues,
218 const std::vector<Scalar>& circleIpWeight,
221 circleCornerIndices_ = circleCornerIndices;
222 circleShapeValues_ = circleShapeValues;
223 circleIpWeight_ = circleIpWeight;
225 enableBulkCircleInterpolation_ =
true;
232 circleIpWeight_ = circleIpWeight;
234 enableBulkCircleInterpolation_ =
true;
238 {
return circleStencil_; }
241 std::vector<const std::vector<GridIndex<bulkIdx>>*> circleCornerIndices_;
242 std::vector<ShapeValues> circleShapeValues_;
243 std::vector<Scalar> circleIpWeight_;
244 std::vector<GridIndex<bulkIdx>> circleStencil_;
245 bool enableBulkCircleInterpolation_;
A point source data class used for integration in multidimensional models.
Definition: pointsourcedata.hh:139
const std::vector< GridIndex< bulkIdx > > & circleStencil() const
Definition: pointsourcedata.hh:237
void addCircleInterpolation(const std::vector< Scalar > &circleIpWeight, const std::vector< GridIndex< bulkIdx > > &circleStencil)
Definition: pointsourcedata.hh:229
PointSourceDataCircleAverage()
Definition: pointsourcedata.hh:159
PrimaryVariables< bulkIdx > interpolateBulk(const SolutionVector< bulkIdx > &sol) const
Definition: pointsourcedata.hh:161
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:216
A point source data class used for integration in multidimensional models.
Definition: pointsourcedata.hh:31
GridIndex< bulkIdx > bulkElementIdx() const
Definition: pointsourcedata.hh:117
void addLowDimInterpolation(const ShapeValues &shapeValues, const std::vector< GridIndex< lowDimIdx > > &cornerIndices, GridIndex< lowDimIdx > eIdx)
Definition: pointsourcedata.hh:60
GridIndex< lowDimIdx > lowDimElementIdx() const
Definition: pointsourcedata.hh:114
void addBulkInterpolation(GridIndex< bulkIdx > eIdx)
Definition: pointsourcedata.hh:70
PrimaryVariables< lowDimIdx > interpolateLowDim(const SolutionVector< lowDimIdx > &sol) const
Definition: pointsourcedata.hh:98
void addBulkInterpolation(const ShapeValues &shapeValues, const std::vector< GridIndex< bulkIdx > > &cornerIndices, GridIndex< bulkIdx > eIdx)
Definition: pointsourcedata.hh:50
PrimaryVariables< bulkIdx > interpolateBulk(const SolutionVector< bulkIdx > &sol) const
Definition: pointsourcedata.hh:82
void addLowDimInterpolation(GridIndex< lowDimIdx > eIdx)
Definition: pointsourcedata.hh:76
Defines all properties used in Dumux.
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:296
The available discretization methods in Dumux.
constexpr Box box
Definition: method.hh:147
Structure to define the index types used for grid and local indices.
Definition: indextraits.hh:26