DUNE-ACFEM (2.5.1)

fluidselftransportmodel.hh
1#ifndef __DUNE_ACFEM_MODELS_MODULES_FLUIDSELFTRANSPORTMODEL_HH__
2#define __DUNE_ACFEM_MODELS_MODULES_FLUIDSELFTRANSPORTMODEL_HH__
3
4#include "../operatorparts/modeladapter.hh"
5
6namespace Dune {
7
8 namespace ACFem {
9
48 template<class FunctionSpace>
50 : public OperatorPartsExpression<FluidSelfTransportOperatorParts<FunctionSpace> >
51 {
56 public:
57 typedef FunctionSpace FunctionSpaceType;
58
59 typedef typename FunctionSpaceType::DomainType DomainType;
60 typedef typename FunctionSpaceType::RangeType RangeType;
61 typedef typename FunctionSpaceType::JacobianRangeType JacobianRangeType;
62 typedef typename FunctionSpaceType::HessianRangeType HessianRangeType;
63
64 enum {
65 dimDomain = FunctionSpaceType::dimDomain,
66 dimRange = FunctionSpaceType::dimRange,
67 dimWorld = dimDomain
68 };
69
70 static_assert(dimDomain == dimRange && dimDomain == dimWorld,
71 "This is meant for dimensionworld vector-fields, "
72 "like fluids, deformations etc.");
73
74 typedef typename FunctionSpaceType::DomainFieldType DomainFieldType;
75 typedef typename FunctionSpaceType::RangeFieldType RangeFieldType;
76
77 // Interface methods that need to be reimplemented
78
79 FluidSelfTransportOperatorParts(const std::string& name = "")
80 : name_(name == "" ? "(-U_iU_jD_iPhi_j+Bndry)" : name)
81 {}
82
83 std::string name() const
84 {
85 return name_;
86 }
87
89 template<class Intersection>
90 bool setIntersection(const Intersection& intersection) const
91 {
92 // true is correct as higher-level code has to take care of
93 // the Dirichlet-(non-Dirichlet) splitting of the boundary.
94
95 // The following would yield the same result:
96 // return this->robinIndicator().apply(intersection);
97 return true;
98 }
99
101 template<class Entity, class Point>
102 void flux (const Entity& entity,
103 const Point &x,
104 const RangeType& value,
105 const JacobianRangeType& jacobian,
106 JacobianRangeType& flux) const
107 {
108 // We need to provide the tensor-product of value with itself.
109 flux = 0;
110 for (int i = 0; i < dimWorld; ++i) {
111 flux[i][i] = value[i] * value[i];
112 for (int j = i+1; j < dimWorld; ++j) {
113 flux[i][j] = flux[j][i] = - (value[i] * value[j]);
114 }
115 }
116 }
117
119 template<class Entity, class Point>
120 void linearizedFlux (const RangeType& uBar,
121 const JacobianRangeType& DuBar,
122 const Entity& entity,
123 const Point &x,
124 const RangeType& value,
125 const JacobianRangeType& jacobian,
126 JacobianRangeType& flux) const
127 {
128 // actually the sum of tensor products ...
129 flux = 0;
130 for (int i = 0; i < dimWorld; ++i) {
131 flux[i][i] = 2.0 * uBar[i] * value[i];
132 for (int j = i+1; j < dimWorld; ++j) {
133 flux[i][j] = flux[j][i] = - (uBar[i] * value[j] + uBar[j] * value[i]);
134 }
135 }
136
137 }
138
140 template<class Entity, class Point>
141 void fluxDivergence(const Entity& entity,
142 const Point &x,
143 const RangeType& value,
144 const JacobianRangeType& jacobian,
145 const HessianRangeType& hessian,
146 RangeType& result) const
147 {
148 // I think this is correct then ....
149 jacobian.mv(value, result);
150 }
151
152 template<class Intersection, class Point>
153 void robinFlux(const Intersection& intersection,
154 const Point& x,
155 const DomainType& unitOuterNormal,
156 const RangeType& value,
157 RangeType& result) const
158 {
159 result = value;
160 result *= (value * unitOuterNormal); // scalar product
161 }
162
163 template<class Intersection, class Point>
164 void linearizedRobinFlux(const RangeType& uBar,
165 const Intersection& intersection,
166 const Point& x,
167 const DomainType& unitOuterNormal,
168 const RangeType& value,
169 RangeType& result) const
170 {
171 RangeFieldType flowBar(0), flow(0);
172 for (int i = 0; i < dimWorld; ++i) {
173 flowBar += unitOuterNormal[i] * uBar[i];
174 flow += unitOuterNormal[i] * value[i];
175 }
176 for (int i = 0; i < dimWorld; ++i) {
177 result[i] = flow * uBar[i] + flowBar * value[i];
178 }
179 }
180
181 protected:
182 const std::string name_;
183 };
184
185 template<class FunctionSpace>
186 struct OperatorPartsTraits<FluidSelfTransportOperatorParts<FunctionSpace> >
187 : public DefaultOperatorPartsTraits<FunctionSpace>
188 {
191 {
192 isLinear = false,
193 isSymmetric = false,
194 isSemiDefinite = false,
195 };
196
199 hasFlux = true,
200 hasSources = false,
201 hasRobinFlux = true,
202 };
203 };
204
206
216 template<class Object>
217 static inline
218 FluidSelfTransportOperatorParts<typename Object::FunctionSpaceType>
219 fluidSelfTransportOperatorParts(const Object& object, const std::string& name = "")
220 {
222 }
223
229 template<class Object>
230 static inline
231 OperatorPartsAdapterModel<FluidSelfTransportOperatorParts<typename Object::FunctionSpaceType>,
232 typename Object::GridPartType>
233 fluidSelfTransportModel(const Object& object, const std::string& name = "")
234 {
236 typedef typename Object::GridPartType GridPartType;
237 return OperatorPartsAdapterModel<OperatorPartsType, GridPartType>(OperatorPartsType(name));
238 }
239
241
243
245
246 } // namespace ACFem
247
248} //Namespace Dune
249
250
251#endif // __DUNE_ACFEM_MODELS_MODULES_FLUIDSELFTRANSPORTMODEL_HH__
Default model implementation.
Definition: operatorparts.hh:387
Define a model for the "Navier-Stokes" non-lineariry.
Definition: fluidselftransportmodel.hh:51
Interface class for second order elliptic models.
Definition: operatorparts.hh:92
bool setIntersection(const Intersection &intersection) const
Per-intersection initialization for the boundary contributions.
Definition: fluidselftransportmodel.hh:90
void linearizedFlux(const RangeType &uBar, const JacobianRangeType &DuBar, const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, JacobianRangeType &flux) const
Evaluate the linearized flux in local coordinates.
Definition: fluidselftransportmodel.hh:120
static FluidSelfTransportOperatorParts< typename Object::FunctionSpaceType > fluidSelfTransportOperatorParts(const Object &object, const std::string &name="")
Generate a Navier-Stokes non-linearity fitting the given object.
Definition: fluidselftransportmodel.hh:219
ConstituentFlags
Provide information about the constituents of the model.
Definition: fluidselftransportmodel.hh:198
void flux(const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, JacobianRangeType &flux) const
Evaluate in local coordinates.
Definition: fluidselftransportmodel.hh:102
void fluxDivergence(const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, const HessianRangeType &hessian, RangeType &result) const
Compute the point-wise value of the flux-part of the operator, meaning the part of the differential o...
Definition: fluidselftransportmodel.hh:141
StructureFlags
Static flags for the overall structure of the operator.
Definition: fluidselftransportmodel.hh:191
static OperatorPartsAdapterModel< FluidSelfTransportOperatorParts< typename Object::FunctionSpaceType >, typename Object::GridPartType > fluidSelfTransportModel(const Object &object, const std::string &name="")
Generate a Navier-Stokes non-linearity fitting the given object.
Definition: fluidselftransportmodel.hh:233
Traits-template which has to be specialized for each individual model.
Definition: operatorparts.hh:36
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Aug 13, 22:30, 2024)