DUNE-ACFEM (2.5.1)

incompressibletransportmodel.hh
1 #ifndef __DUNE_ACFEM_MODELS_MODULES_INCOMPRESSIBLETRANSPORTMODEL_HH__
2 #define __DUNE_ACFEM_MODELS_MODULES_INCOMPRESSIBLETRANSPORTMODEL_HH__
3 
4 #include "../operatorparts/modeladapter.hh"
5 
6 namespace Dune {
7 
8  namespace ACFem {
9 
40  template<class FunctionSpace, class Velocity>
42  : public OperatorPartsExpression<IncompressibleTransportOperatorParts<FunctionSpace, Velocity> >
43  {
48  typedef typename Velocity::LocalFunctionType LocalVelocityType;
49  public:
50  typedef Velocity VelocityType;
51  typedef FunctionSpace FunctionSpaceType;
52 
53  typedef typename FunctionSpaceType::DomainType DomainType;
54  typedef typename FunctionSpaceType::RangeType RangeType;
55  typedef typename FunctionSpaceType::JacobianRangeType JacobianRangeType;
56  typedef typename FunctionSpaceType::HessianRangeType HessianRangeType;
57 
58  enum {
59  dimDomain = FunctionSpaceType::dimDomain,
60  dimRange = FunctionSpaceType::dimRange,
61  dimWorld = dimDomain,
62  };
63 
64  static_assert((int)VelocityType::FunctionSpaceType::dimRange == (int)dimWorld && dimDomain == dimWorld,
65  "This is meant for dimensionworld vector-fields, "
66  "like fluids, deformations etc.");
67 
68  typedef typename FunctionSpaceType::DomainFieldType DomainFieldType;
69  typedef typename FunctionSpaceType::RangeFieldType RangeFieldType;
70 
71  // Interface methods that need to be reimplemented
72 
73  IncompressibleTransportOperatorParts(const Fem::Function<typename VelocityType::FunctionSpaceType,
74  VelocityType>& velocity,
75  const std::string& name = "")
76  : velocity_(velocity),
77  localVelocity_(velocity_()),
78  name_(name == "" ? "(-U_iU_jD_iPhi_j+Bndry)" : name)
79  {}
80 
81  std::string name() const
82  {
83  return name_;
84  }
85 
86  template<class Entity>
87  void setEntity(const Entity& entity) const
88  {
89  localVelocity_.init(entity);
90  }
91 
93  template<class Entity, class Point>
94  void linearizedSource(const RangeType& uBar,
95  const JacobianRangeType& DuBar,
96  const Entity& entity,
97  const Point &x,
98  const RangeType& value,
99  const JacobianRangeType& jacobian,
100  RangeType& result) const
101  {
102  typename VelocityType::RangeType velocity;
103  localVelocity_.evaluate(x, velocity);
104 
105  jacobian.mv(velocity, result);
106  }
107 
108  protected:
110  mutable LocalVelocityType localVelocity_;
111  const std::string name_;
112  };
113 
114  template<class FunctionSpace, class Velocity>
115  struct OperatorPartsTraits<IncompressibleTransportOperatorParts<FunctionSpace, Velocity> >
116  : public DefaultOperatorPartsTraits<FunctionSpace>
117  {
120  {
121  isLinear = true,
122  isSymmetric = false,
123  isSemiDefinite = false // mmm.
124  };
125 
128  hasFlux = false,
129  hasSources = true,
130  hasRobinFlux = false,
131  };
132  };
133 
135 
148  template<class Object, class Velocity>
149  static inline
150  IncompressibleTransportOperatorParts<typename Object::FunctionSpaceType, Velocity>
152  const Fem::Function<typename Velocity::FunctionSpaceType, Velocity>& velocity,
153  const std::string& name = "")
154  {
156  }
157 
166  template<class Object, class Velocity>
167  static inline
168  OperatorPartsAdapterModel<IncompressibleTransportOperatorParts<typename Object::FunctionSpaceType, Velocity>,
169  typename Object::GridPartType>
170  incompressibleTransportModel(const Object& object,
171  const Fem::Function<typename Velocity::FunctionSpaceType, Velocity>& velocity,
172  const std::string& name = "")
173  {
175  typedef typename Object::GridPartType GridPartType;
176  return OperatorPartsAdapterModel<OperatorPartsType, GridPartType>(OperatorPartsType(velocity, name));
177  }
178 
180 
182 
184 
185  } // namespace ACFem
186 
187 } //Namespace Dune
188 
189 
190 #endif // __DUNE_ACFEM_MODELS_MODULES_INCOMPRESSIBLETRANSPORTMODEL_HH__
Default model implementation.
Definition: operatorparts.hh:387
Define a model for an advection term with a divergence-free velocity field.
Definition: incompressibletransportmodel.hh:43
Interface class for second order elliptic models.
Definition: operatorparts.hh:92
static OperatorPartsAdapterModel< IncompressibleTransportOperatorParts< typename Object::FunctionSpaceType, Velocity >, typename Object::GridPartType > incompressibleTransportModel(const Object &object, const Fem::Function< typename Velocity::FunctionSpaceType, Velocity > &velocity, const std::string &name="")
Generate an advection-model object.
Definition: incompressibletransportmodel.hh:170
StructureFlags
Static flags for the overall structure of the operator.
Definition: incompressibletransportmodel.hh:120
void linearizedSource(const RangeType &uBar, const JacobianRangeType &DuBar, const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, RangeType &result) const
The linearized source term as function of local coordinates.
Definition: incompressibletransportmodel.hh:94
static IncompressibleTransportOperatorParts< typename Object::FunctionSpaceType, Velocity > incompressibleTransportOperatorParts(const Object &object, const Fem::Function< typename Velocity::FunctionSpaceType, Velocity > &velocity, const std::string &name="")
Generate an advection-model object.
Definition: incompressibletransportmodel.hh:151
ConstituentFlags
Provide information about the constituents of the model.
Definition: incompressibletransportmodel.hh:127
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)