DUNE-ACFEM (2.5.1)

deformationtensormodel.hh
1 #ifndef __DUNE_ACFEM_MODELS_MODULES_DEFORMATIONTENSORMODEL_HH__
2 #define __DUNE_ACFEM_MODELS_MODULES_DEFORMATIONTENSORMODEL_HH__
3 
4 #include "../operatorparts/modeladapter.hh"
5 
6 namespace Dune {
7 
8  namespace ACFem {
9 
51  template<class FunctionSpace>
53  : public OperatorPartsExpression<DeformationTensorOperatorParts<FunctionSpace> >
54  {
59  public:
60  typedef FunctionSpace FunctionSpaceType;
61 
62  typedef typename FunctionSpaceType::DomainType DomainType;
63  typedef typename FunctionSpaceType::RangeType RangeType;
64  typedef typename FunctionSpaceType::JacobianRangeType JacobianRangeType;
65  typedef typename FunctionSpaceType::HessianRangeType HessianRangeType;
66 
67  enum {
68  dimDomain = FunctionSpaceType::dimDomain,
69  dimRange = FunctionSpaceType::dimRange,
70  dimWorld = FunctionSpaceType::dimDomain
71  };
72 
73  static_assert(dimDomain == dimRange && dimDomain == dimWorld,
74  "This is meant for dimensionworld vector-fields, "
75  "like fluids, deformations etc.");
76 
77  typedef typename FunctionSpaceType::DomainFieldType DomainFieldType;
78  typedef typename FunctionSpaceType::RangeFieldType RangeFieldType;
79 
80  // Interface methods that need to be reimplemented
81 
82  DeformationTensorOperatorParts(const std::string& name = "")
83  : name_(name == "" ? "(D_iU_j+ D_jU_i)" : name)
84  {}
85 
86  std::string name() const
87  {
88  return name_;
89  }
90 
92  template<class Entity, class Point>
93  void linearizedFlux (const RangeType& uBar,
94  const JacobianRangeType& DuBar,
95  const Entity& entity,
96  const Point &x,
97  const RangeType& value,
98  const JacobianRangeType& jacobian,
99  JacobianRangeType& flux) const
100  {
101  // Why is there no transposeMatrix stuff, or an adaper??? anyhow ...
102  for (int i = 0; i < dimWorld; ++i) {
103  flux[i][i] = 2.*jacobian[i][i];
104  for (int j = i+1; j < dimWorld; ++j) {
105  flux[i][j] = flux[j][i] = jacobian[i][j] + jacobian[j][i];
106  }
107  }
108  }
109 
111  template<class Entity, class Point>
112  void fluxDivergence(const Entity& entity,
113  const Point &x,
114  const RangeType& value,
115  const JacobianRangeType& jacobian,
116  const HessianRangeType& hessian,
117  RangeType& result) const
118  {
119  // just do it in a straight-forward fashion ...
120  for (int alpha = 0; alpha < dimWorld; ++alpha) {
121  result[alpha] = 0;
122  for (int i = 0; i < dimWorld; ++i) {
123  // For divergence free vector fields the second term is zero.
124  result[alpha] -= hessian[alpha][i][i] + hessian[i][alpha][i];
125  }
126  }
127  }
128 
129  protected:
130  const std::string name_;
131  };
132 
133  template<class FunctionSpace>
134  struct OperatorPartsTraits<DeformationTensorOperatorParts<FunctionSpace> >
135  : public DefaultOperatorPartsTraits<FunctionSpace>
136  {
139  {
140  isLinear = true,
141  isSymmetric = true,
142  isSemiDefinite = true
143  };
144 
147  hasFlux = true,
148  hasSources = false,
149  hasRobinFlux = false,
150  };
151  };
152 
154 
163  template<class Object>
164  static inline
165  DeformationTensorOperatorParts<typename Object::FunctionSpaceType>
166  deformationTensorOperatorParts(const Object& object, const std::string& name = "")
167  {
169  return OperatorPartsType(name);
170  }
171 
176  template<class Object>
177  static inline
178  OperatorPartsAdapterModel<DeformationTensorOperatorParts<typename Object::FunctionSpaceType>,
179  typename Object::GridPartType>
180  deformationTensorModel(const Object& object, const std::string& name = "")
181  {
183  typedef typename Object::GridPartType GridPartType;
184  return OperatorPartsAdapterModel<OperatorPartsType, GridPartType>(OperatorPartsType(name));
185  }
186 
188 
190 
192 
193  } // namespace ACFem
194 
195 } //Namespace Dune
196 
197 
198 #endif // __DUNE_ACFEM_MODELS_MODULES_DEFORMATIONTENSORMODEL_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 the a model where the flux-part is formed from the symmetric gradient.
Definition: deformationtensormodel.hh:54
Interface class for second order elliptic models.
Definition: operatorparts.hh:92
ConstituentFlags
Provide information about the constituents of the model.
Definition: deformationtensormodel.hh:146
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: deformationtensormodel.hh:112
StructureFlags
Static flags for the overall structure of the operator.
Definition: deformationtensormodel.hh:139
static OperatorPartsAdapterModel< DeformationTensorOperatorParts< typename Object::FunctionSpaceType >, typename Object::GridPartType > deformationTensorModel(const Object &object, const std::string &name="")
Generate a deformation tensor model fitting the specified object.
Definition: deformationtensormodel.hh:180
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: deformationtensormodel.hh:93
static DeformationTensorOperatorParts< typename Object::FunctionSpaceType > deformationTensorOperatorParts(const Object &object, const std::string &name="")
Generate a deformation tensor model fitting the specified object.
Definition: deformationtensormodel.hh:166
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.80.0 (May 16, 22:29, 2024)