1#ifndef __DUNE_ACFEM_MODELS_MODULES_PMASSMODEL_HH__
2#define __DUNE_ACFEM_MODELS_MODULES_PMASSMODEL_HH__
4#include "../operatorparts/modeladapter.hh"
37 template<
class FunctionSpace>
39 :
public OperatorPartsExpression<P_MassOperatorParts<FunctionSpace> >
46 typedef FunctionSpace FunctionSpaceType;
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;
55 dimDomain = FunctionSpaceType::dimDomain,
56 dimRange = FunctionSpaceType::dimRange
59 typedef typename FunctionSpaceType::DomainFieldType DomainFieldType;
62 : exponent_(exponent - 2.),
63 name_(name ==
"" ?
"(|U|^" + std::to_string(exponent_) +
" U)" : name)
66 std::string name()
const
72 template<
class Entity,
class Po
int>
75 const RangeType& value,
76 const JacobianRangeType& jacobian,
77 RangeType& result)
const
79 RangeFieldType factor = std::pow(value.two_norm2(), 0.5*exponent_);
86 template<
class Entity,
class Po
int>
88 const JacobianRangeType& DuBar,
91 const RangeType& value,
92 const JacobianRangeType& jacobian,
93 RangeType& result)
const
95 RangeFieldType norm = uBar.two_norm2();
99 if (exponent_ == 0.0) {
103 result *= std::pow(norm, 0.5 * exponent_);
107 tmp *= exponent_*std::pow(norm, 0.5*exponent_ - 1.) * (uBar * value);
113 const RangeFieldType exponent_;
114 const std::string name_;
117 template<
class FunctionSpace>
118 struct OperatorPartsTraits<P_MassOperatorParts<FunctionSpace> >
119 :
public DefaultOperatorPartsTraits<FunctionSpace>
126 isSemiDefinite =
true
133 hasRobinFlux =
false,
149 template<
class Object>
151 P_MassOperatorParts<typename Object::FunctionSpaceType>
153 const Object&
object,
const std::string& name =
"")
156 return OperatorPartsType(p, name);
165 template<
class Object>
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 =
"")
174 typedef typename Object::GridPartType GridPartType;
175 return OperatorPartsAdapterModel<OperatorPartsType, GridPartType>(OperatorPartsType(p, name));
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
StructureFlags
Definition: pmassmodel.hh:123
ConstituentFlags
Definition: pmassmodel.hh:130
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