DUNE-ACFEM (unstable)

deformationtensormodel.hh
1 #ifndef __DUNE_ACFEM_MODELS_MODULES_DEFORMATIONTENSORMODEL_HH__
2 #define __DUNE_ACFEM_MODELS_MODULES_DEFORMATIONTENSORMODEL_HH__
3 
4 #include "../../expressions/expressionoperations.hh"
5 #include "../../expressions/terminal.hh"
6 
7 #include "../modelbase.hh"
8 #include "../expressiontraits.hh"
9 
10 namespace Dune {
11 
12  namespace ACFem::PDEModel {
13 
55  template<class FunctionSpace>
57  : public ModelBase<FunctionSpace>
58  , public Expressions::SelfExpression<DeformationTensorModel<FunctionSpace> >
59  , public MPL::UniqueTags<TypedValueExpression, SemiPositiveExpression, SymmetricModel>
60  {
63  public:
64  using typename BaseType::RangeType;
65  using typename BaseType::JacobianRangeType;
66  using typename BaseType::HessianRangeType;
67 
68  using BaseType::dimDomain;
69  using BaseType::dimRange;
70  enum {
71  dimWorld = dimDomain
72  };
73 
74  static_assert(dimDomain == dimRange && dimDomain == dimWorld,
75  "This is meant for dimensionworld vector-fields, "
76  "like fluids, deformations etc.");
77 
78  // Interface methods that need to be reimplemented
79 
80  DeformationTensorModel(const std::string& name = "")
81  : name_(name == "" ? "(D_iU_j+ D_jU_i)" : name)
82  {}
83 
84  std::string name() const
85  {
86  return name_;
87  }
88 
90  JacobianRangeType linearizedFlux(const JacobianRangeType& jacobian) const
91  {
92  JacobianRangeType flux;
93  // Why is there no transposeMatrix stuff, or an adaper??? anyhow ...
94  for (int i = 0; i < dimWorld; ++i) {
95  flux[i][i] = 2.*jacobian[i][i];
96  for (int j = i+1; j < dimWorld; ++j) {
97  flux[i][j] = flux[j][i] = jacobian[i][j] + jacobian[j][i];
98  }
99  }
100  return flux;
101  }
102 
104  template<class Point>
105  RangeType fluxDivergence(const HessianRangeType& hessian) const
106  {
107  RangeType result;
108  // just do it in a straight-forward fashion ...
109  for (int alpha = 0; alpha < dimWorld; ++alpha) {
110  result[alpha] = 0;
111  for (int i = 0; i < dimWorld; ++i) {
112  // For divergence free vector fields the second term is zero.
113  result[alpha] -= hessian[alpha][i][i] + hessian[i][alpha][i];
114  }
115  }
116  return result;
117  }
118 
119  protected:
120  std::string name_;
121  };
122 
124 
130  template<class Object>
131  inline auto deformationTensorModel(const Object& object, const std::string& name = "")
132  {
134  return expressionClosure(ModelType(name));
135  }
136 
138 
140 
142 
143  } // namespace ACFem
144 
145  namespace ACFem {
146 
148 
149  }
150 
151 } //Namespace Dune
152 
153 
154 #endif // __DUNE_ACFEM_MODELS_MODULES_DEFORMATIONTENSORMODEL_HH__
Define the a model where the flux-part is formed from the symmetric gradient.
Definition: deformationtensormodel.hh:60
constexpr decltype(auto) expressionClosure(T &&t)
Do-nothing default implementation for pathologic cases.
Definition: interface.hh:93
RangeType fluxDivergence(const HessianRangeType &hessian) const
Compute the point-wise value of the flux-part of the operator, meaning the part of the differential o...
Definition: deformationtensormodel.hh:105
JacobianRangeType linearizedFlux(const JacobianRangeType &jacobian) const
Evaluate the linearized flux in local coordinates.
Definition: deformationtensormodel.hh:90
auto deformationTensorModel(const Object &object, const std::string &name="")
Generate a deformation tensor model fitting the specified object.
Definition: deformationtensormodel.hh:131
Terminals may derive from this class to express that they are expressions.
Definition: terminal.hh:25
A structure defining some basic default types and methods.
Definition: modelbase.hh:41
typename FunctionSpaceType::JacobianRangeType JacobianRangeType
The type returned by classifyBoundary().
Definition: modelbase.hh:63
typename FunctionSpaceType::RangeType RangeType
The type returned by classifyBoundary().
Definition: modelbase.hh:62
HessianRangeSelector< FunctionSpaceType > HessianRangeType
The type returned by classifyBoundary().
Definition: modelbase.hh:65
static constexpr int dimRange
The type returned by classifyBoundary().
Definition: modelbase.hh:86
static constexpr int dimDomain
The type returned by classifyBoundary().
Definition: modelbase.hh:85
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (May 16, 22:29, 2024)