DUNE-ACFEM (2.5.1)

laplacianmodel.hh
1#ifndef __DUNE_ACFEM_MODELS_MODULES_LAPLACIANMODEL_HH__
2#define __DUNE_ACFEM_MODELS_MODULES_LAPLACIANMODEL_HH__
3
4#include "../operatorparts/modeladapter.hh"
5
6namespace Dune {
7
8 namespace ACFem {
9
29 template<class FunctionSpace>
31 : public OperatorPartsExpression<LaplacianOperatorParts<FunctionSpace> >
32 {
37 public:
38 typedef FunctionSpace FunctionSpaceType;
39
40 typedef typename FunctionSpaceType::DomainType DomainType;
41 typedef typename FunctionSpaceType::RangeType RangeType;
42 typedef typename FunctionSpaceType::JacobianRangeType JacobianRangeType;
43 typedef typename FunctionSpaceType::HessianRangeType HessianRangeType;
44
45 enum {
46 dimDomain = FunctionSpaceType::dimDomain,
47 dimRange = FunctionSpaceType::dimRange
48 };
49
50 typedef typename FunctionSpaceType::DomainFieldType DomainFieldType;
51 typedef typename FunctionSpaceType::RangeFieldType RangeFieldType;
52
53 // Interface methods that need to be reimplemented
54 LaplacianOperatorParts(const std::string& name = "")
55 : name_(name == "" ? "Laplace" : name)
56 {}
57
58 std::string name() const
59 {
60 return name_;
61 }
62
64 template<class Entity, class Point>
65 void linearizedFlux (const RangeType& uBar,
66 const JacobianRangeType& DuBar,
67 const Entity& entity,
68 const Point &x,
69 const RangeType& value,
70 const JacobianRangeType& jacobian,
71 JacobianRangeType& flux) const
72 {
73 flux = jacobian;
74 }
75
77 template<class Entity, class Point>
78 void fluxDivergence(const Entity& entity,
79 const Point &x,
80 const RangeType& value,
81 const JacobianRangeType& jacobian,
82 const HessianRangeType& hessian,
83 RangeType& result) const
84 {
85 // This is then the trace of the Hessian
86 for (int i = 0; i < dimRange; ++i) {
87 result[i] = 0;
88 for (int j = 0; j < dimDomain; ++j) {
89 result[i] -= hessian[i][j][j];
90 }
91 }
92 }
93
94 protected:
95 const std::string name_;
96 };
97
98 template<class FunctionSpace>
99 struct OperatorPartsTraits<LaplacianOperatorParts<FunctionSpace> >
100 : public DefaultOperatorPartsTraits<FunctionSpace>
101 {
104 {
105 isLinear = true,
106 isSymmetric = true,
107 isSemiDefinite = true
108 };
109
112 hasFlux = true,
113 hasSources = false,
114 hasRobinFlux = false,
115 };
116 };
117
119
130 template<class Object>
131 static inline
132 LaplacianOperatorParts<typename Object::FunctionSpaceType>
133 laplacianOperatorParts(const Object& object, const std::string& name = "")
134 {
136 return OperatorPartsType(name);
137 }
138
143 template<class Object>
144 static inline
145 OperatorPartsAdapterModel<LaplacianOperatorParts<typename Object::FunctionSpaceType>,
146 typename Object::GridPartType>
147 laplacianModel(const Object& object, const std::string& name = "")
148 {
150 typedef typename Object::GridPartType GridPartType;
151 return OperatorPartsAdapterModel<OperatorPartsType, GridPartType>(OperatorPartsType(name));
152 }
153
155
157
159
160 } // namespace ACFem
161
162} //Namespace Dune
163
164
165#endif // __DUNE_ACFEM_MODELS_MODULES_LAPLACIANMODEL_HH__
Default model implementation.
Definition: operatorparts.hh:387
void flux(const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, JacobianRangeType &flux) const
Definition: operatorparts.hh:450
Define a simple Laplacian-model, given function-space and grid-part.
Definition: laplacianmodel.hh:32
Interface class for second order elliptic models.
Definition: operatorparts.hh:92
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: laplacianmodel.hh:78
static OperatorPartsAdapterModel< LaplacianOperatorParts< typename Object::FunctionSpaceType >, typename Object::GridPartType > laplacianModel(const Object &object, const std::string &name="")
Generate a Laplacian-model fitting the specified object.
Definition: laplacianmodel.hh:147
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: laplacianmodel.hh:65
static LaplacianOperatorParts< typename Object::FunctionSpaceType > laplacianOperatorParts(const Object &object, const std::string &name="")
Generate OperatorParts for a (weak, of course) Laplacian.
Definition: laplacianmodel.hh:133
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)