1#ifndef __DUNE_ACFEM_MODELS_MODULES_PLAPLACIANMODEL_HH__
2#define __DUNE_ACFEM_MODELS_MODULES_PLAPLACIANMODEL_HH__
4#include "../operatorparts/modeladapter.hh"
50 template<
class FunctionSpace>
52 :
public OperatorPartsExpression<P_LaplacianOperatorParts<FunctionSpace> >
59 typedef FunctionSpace FunctionSpaceType;
61 typedef typename FunctionSpaceType::DomainType DomainType;
62 typedef typename FunctionSpaceType::RangeType RangeType;
63 typedef typename FunctionSpaceType::JacobianRangeType JacobianRangeType;
64 typedef typename FunctionSpaceType::HessianRangeType HessianRangeType;
67 dimDomain = FunctionSpaceType::dimDomain,
68 dimRange = FunctionSpaceType::dimRange
71 typedef typename FunctionSpaceType::DomainFieldType DomainFieldType;
72 typedef typename FunctionSpaceType::RangeFieldType RangeFieldType;
77 : exponent_(exponent - 2.),
78 name_(name ==
"" ?
"(|grad(U)|^" + std::to_string(exponent_) +
" grad(U))" : name)
81 std::string name()
const
87 template<
class Entity,
class Po
int>
88 void flux(
const Entity& entity,
90 const RangeType& value,
91 const JacobianRangeType& jacobian,
92 JacobianRangeType&
flux)
const
94 RangeFieldType factor = std::pow(jacobian.frobenius_norm2(), 0.5*exponent_);
101 template<
class Entity,
class Po
int>
103 const JacobianRangeType& DuBar,
104 const Entity& entity,
106 const RangeType& value,
107 const JacobianRangeType& jacobian,
108 JacobianRangeType&
flux)
const
110 RangeFieldType norm = DuBar.frobenius_norm2();
113 flux *= std::pow(norm, 0.5 * exponent_);
115 JacobianRangeType tmp(DuBar);
117 RangeFieldType factor = exponent_*std::pow(norm, 0.5*exponent_ - 1.);
118 RangeFieldType frobscp = 0;
119 for (
int i = 0; i< dimRange; ++i) {
120 frobscp += (DuBar[i] * jacobian[i]);
123 tmp *= factor * frobscp;
128 template<
class Entity,
class Po
int>
131 const RangeType& value,
132 const JacobianRangeType& jacobian,
133 const HessianRangeType& hessian,
134 RangeType& result)
const
136 RangeFieldType norm = jacobian.frobenius_norm2();
137 RangeFieldType factor1 = std::pow(norm, 0.5*exponent_ - 1.);
138 RangeFieldType factor2 = factor1 * norm;
140 JacobianRangeType jac_hess(0);
142 for (
int alpha = 0; alpha < dimRange; ++alpha) {
144 hessian[alpha].mv(jacobian[alpha], tmp);
145 jac_hess[alpha] += tmp;
147 jac_hess *= factor1 * exponent_;
149 for (
int beta = 0; beta < dimRange; ++beta) {
150 RangeFieldType laplacian(0);
151 for (
int i = 0; i < dimDomain; ++i) {
152 laplacian += hessian[beta][i][i];
154 result[beta] = -factor2 * laplacian;
155 result[beta] -= (jac_hess[beta] * jacobian[beta]);
160 const RangeFieldType exponent_;
161 const std::string name_;
164 template<
class FunctionSpace>
165 struct OperatorPartsTraits<P_LaplacianOperatorParts<FunctionSpace> >
166 :
public DefaultOperatorPartsTraits<FunctionSpace>
173 isSemiDefinite =
true
180 hasRobinFlux =
false,
198 template<
class Object>
200 P_LaplacianOperatorParts<typename Object::FunctionSpaceType>
202 const Object&
object,
203 const std::string& name =
"")
206 return OperatorPartsType(p, name);
215 template<
class Object>
217 OperatorPartsAdapterModel<P_LaplacianOperatorParts<typename Object::FunctionSpaceType>,
218 typename Object::GridPartType>
220 const Object&
object,
221 const std::string& name =
"")
224 typedef typename Object::GridPartType GridPartType;
225 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
The p-Laplacian-model.
Definition: plaplacianmodel.hh:53
void flux(const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, JacobianRangeType &flux) const
Evaluate in local coordinates.
Definition: plaplacianmodel.hh:88
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: plaplacianmodel.hh:129
static OperatorPartsAdapterModel< P_LaplacianOperatorParts< typename Object::FunctionSpaceType >, typename Object::GridPartType > p_LaplacianModel(const typename Object::FunctionSpaceType::RangeFieldType &p, const Object &object, const std::string &name="")
Generate a P-laplacian model fitting the specified object.
Definition: plaplacianmodel.hh:219
StructureFlags
Static flags for the overall structure of the operator.
Definition: plaplacianmodel.hh:170
static P_LaplacianOperatorParts< typename Object::FunctionSpaceType > p_LaplacianOperatorParts(const typename Object::FunctionSpaceType::RangeFieldType &p, const Object &object, const std::string &name="")
Generate OperatorParts for a (weak, of course) p-Laplacian.
Definition: plaplacianmodel.hh:201
ConstituentFlags
Provide information about the constituents of the model.
Definition: plaplacianmodel.hh:177
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: plaplacianmodel.hh:102
Traits-template which has to be specialized for each individual model.
Definition: operatorparts.hh:36