DUNE-ACFEM (2.5.1)

pmassmodel.hh
1#ifndef __DUNE_ACFEM_MODELS_MODULES_PMASSMODEL_HH__
2#define __DUNE_ACFEM_MODELS_MODULES_PMASSMODEL_HH__
3
4#include "../operatorparts/modeladapter.hh"
5
6namespace Dune {
7
8 namespace ACFem {
9
37 template<class FunctionSpace>
39 : public OperatorPartsExpression<P_MassOperatorParts<FunctionSpace> >
40 {
45 public:
46 typedef FunctionSpace FunctionSpaceType;
47
48 typedef typename FunctionSpaceType::DomainType DomainType;
49 typedef typename FunctionSpaceType::RangeType RangeType;
50 typedef typename FunctionSpaceType::JacobianRangeType JacobianRangeType;
51 typedef typename FunctionSpaceType::HessianRangeType HessianRangeType;
52 typedef typename FunctionSpaceType::RangeFieldType RangeFieldType;
53
54 enum {
55 dimDomain = FunctionSpaceType::dimDomain,
56 dimRange = FunctionSpaceType::dimRange
57 };
58
59 typedef typename FunctionSpaceType::DomainFieldType DomainFieldType;
60
61 P_MassOperatorParts(const RangeFieldType& exponent, const std::string& name = "")
62 : exponent_(exponent - 2.),
63 name_(name == "" ? "(|U|^" + std::to_string(exponent_) + " U)" : name)
64 {}
65
66 std::string name() const
67 {
68 return name_;
69 }
70
72 template<class Entity, class Point>
73 void source(const Entity& entity,
74 const Point &x,
75 const RangeType& value,
76 const JacobianRangeType& jacobian,
77 RangeType& result) const
78 {
79 RangeFieldType factor = std::pow(value.two_norm2(), 0.5*exponent_);
80
81 result = value;
82 result *= factor;
83 }
84
86 template<class Entity, class Point>
87 void linearizedSource(const RangeType& uBar,
88 const JacobianRangeType& DuBar,
89 const Entity& entity,
90 const Point &x,
91 const RangeType& value,
92 const JacobianRangeType& jacobian,
93 RangeType& result) const
94 {
95 RangeFieldType norm = uBar.two_norm2();
96
97 result = value;
98
99 if (exponent_ == 0.0) {
100 return;
101 }
102
103 result *= std::pow(norm, 0.5 * exponent_);
104
105 RangeType tmp(uBar);
106
107 tmp *= exponent_*std::pow(norm, 0.5*exponent_ - 1.) * (uBar * value);
108
109 result += tmp;
110 }
111
112 protected:
113 const RangeFieldType exponent_;
114 const std::string name_;
115 };
116
117 template<class FunctionSpace>
118 struct OperatorPartsTraits<P_MassOperatorParts<FunctionSpace> >
119 : public DefaultOperatorPartsTraits<FunctionSpace>
120 {
123 {
124 isLinear = false,
125 isSymmetric = true,
126 isSemiDefinite = true
127 };
128
131 hasFlux = false,
132 hasSources = true,
133 hasRobinFlux = false,
134 };
135 };
136
138
149 template<class Object>
150 static inline
151 P_MassOperatorParts<typename Object::FunctionSpaceType>
152 p_MassOperatorParts(const typename Object::FunctionSpaceType::RangeFieldType& p,
153 const Object& object, const std::string& name = "")
154 {
156 return OperatorPartsType(p, name);
157 }
158
165 template<class Object>
166 static inline
167 OperatorPartsAdapterModel<P_MassOperatorParts<typename Object::FunctionSpaceType>,
168 typename Object::GridPartType>
169 p_MassModel(const typename Object::FunctionSpaceType::RangeFieldType& p,
170 const Object& object,
171 const std::string& name = "")
172 {
174 typedef typename Object::GridPartType GridPartType;
175 return OperatorPartsAdapterModel<OperatorPartsType, GridPartType>(OperatorPartsType(p, name));
176 }
177
179
181
183
184 } // namespace ACFem
185
186} //Namespace Dune
187
188
189#endif // __DUNE_ACFEM_MODELS_MODULES_PMASSMODEL_HH__
Default model implementation.
Definition: operatorparts.hh:387
Interface class for second order elliptic models.
Definition: operatorparts.hh:92
A simplistic non-linear example.
Definition: pmassmodel.hh:40
static OperatorPartsAdapterModel< P_MassOperatorParts< typename Object::FunctionSpaceType >, typename Object::GridPartType > p_MassModel(const typename Object::FunctionSpaceType::RangeFieldType &p, const Object &object, const std::string &name="")
Generate a P-power mass-model fitting the specified object.
Definition: pmassmodel.hh:169
void linearizedSource(const RangeType &uBar, const JacobianRangeType &DuBar, const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, RangeType &result) const
Definition: pmassmodel.hh:87
static P_MassOperatorParts< typename Object::FunctionSpaceType > p_MassOperatorParts(const typename Object::FunctionSpaceType::RangeFieldType &p, const Object &object, const std::string &name="")
Generate OperatorParts for a (weak, of course) Mass.
Definition: pmassmodel.hh:152
void source(const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, RangeType &result) const
Definition: pmassmodel.hh:73
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 (Nov 12, 23:30, 2024)