DUNE-ACFEM (unstable)

laplacianmodel.hh
1 #ifndef __DUNE_ACFEM_MODELS_MODULES_LAPLACIANMODEL_HH__
2 #define __DUNE_ACFEM_MODELS_MODULES_LAPLACIANMODEL_HH__
3 
4 #include "../../expressions/terminal.hh"
5 
6 #include "../modelbase.hh"
7 #include "../expressiontraits.hh"
8 
9 namespace Dune {
10 
11  namespace ACFem::PDEModel {
12 
32  template<class FunctionSpace>
34  : public ModelBase<FunctionSpace>
35  , public Expressions::SelfExpression<LaplacianModel<FunctionSpace> >
36  , public MPL::UniqueTags<TypedValueExpression, SemiPositiveExpression, SymmetricModel>
37  {
38  typedef LaplacianModel ThisType;
40  public:
41  using typename BaseType::RangeType;
42  using typename BaseType::JacobianRangeType;
43  using typename BaseType::HessianRangeType;
44 
45  using BaseType::dimRange;
46  using BaseType::dimDomain;
47 
48  // Interface methods that need to be reimplemented
49  LaplacianModel(const std::string& name = "")
50  : name_(name == "" ? "Laplace" : name)
51  {}
52 
53  std::string name() const
54  {
55  return name_;
56  }
57 
59  auto linearizedFlux(const JacobianRangeType& jacobian) const
60  {
61  return jacobian;
62  }
63 
65  auto fluxDivergence(const HessianRangeType& hessian) const
66  {
67  RangeType result;
68  for (int i = 0; i < dimRange; ++i) {
69  result[i] = -hessian[i][0][0];
70  for (int j = 1; j < dimDomain; ++j) {
71  result[i] -= hessian[i][j][j];
72  }
73  }
74  return result;
75  }
76 
77  protected:
78  std::string name_;
79  };
80 
82 
93  template<class Object>
94  static inline auto
95  laplacianModel(const Object& object, const std::string& name = "")
96  {
98  return expressionClosure(ModelType(name));
99  }
100 
102 
104 
106 
107  } // namespace ACFem::PDEModel::
108 
109  namespace ACFem {
111  }
112 
113 } //Namespace Dune
114 
115 
116 #endif // __DUNE_ACFEM_MODELS_MODULES_LAPLACIANMODEL_HH__
Define a simple Laplacian-model, given function-space and grid-part.
Definition: laplacianmodel.hh:37
constexpr decltype(auto) expressionClosure(T &&t)
Do-nothing default implementation for pathologic cases.
Definition: interface.hh:93
auto 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: laplacianmodel.hh:65
static auto laplacianModel(const Object &object, const std::string &name="")
Generate Model for a (weak, of course) Laplacian.
Definition: laplacianmodel.hh:95
auto linearizedFlux(const JacobianRangeType &jacobian) const
Evaluate the linearized flux in local coordinates.
Definition: laplacianmodel.hh:59
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)