1#ifndef DUNE_PDELAB_LOCALOPERATOR_STOKESPARAMETER_HH
2#define DUNE_PDELAB_LOCALOPERATOR_STOKESPARAMETER_HH
5#include <dune/pdelab/common/function.hh>
6#include <dune/pdelab/constraints/common/constraintsparameters.hh>
35 VelocityDirichlet = 1,
44 template<
typename GV,
typename RF>
89 template<
typename GF,
typename Entity,
typename Domain>
90 typename GF::Traits::RangeType
91 evaluateVelocityGridFunction(
const GF& gf,
95 static_assert(int(GF::Traits::dimRange) == int(Domain::dimension),
"dimension of function range does not match grid dimension");
96 typename GF::Traits::RangeType y;
105 template<
typename GF,
typename Entity,
typename Domain>
107 evaluateVelocityGridFunction(
const GF& gf,
113 typename GF::template Child<0>::Type::Traits::RangeType cy;
114 for (
int d = 0; d < Domain::dimension; ++d)
116 gf.child(d).evaluate(e,x,cy);
142 template <
typename GV,
typename RF,
typename F,
typename B,
typename V,
typename J,
bool navier = false,
bool tensor = false>
147 static const bool assemble_navier = navier;
148 static const bool assemble_full_tensor = tensor;
159 : _rho(config.
get<RF>(
"rho"))
160 , _mu(config.
get<RF>(
"mu"))
183 template<
typename EG>
187 typename F::Traits::RangeType fvalue;
188 return evaluateVelocityGridFunction(_f,e,x);
192 template<
typename IG>
193 typename Traits::BoundaryCondition::Type
197 typename B::Traits::BoundaryCondition::Type y;
203 template<
typename EG>
211 template<
typename IG>
219 template<
typename EG>
227 template<
typename IG>
235 template<
typename EG>
239 typename V::Traits::RangeType y;
245 template<
typename EG>
255 template<
typename IG>
264 template<
typename IG>
265 typename std::enable_if<
266 J::Traits::dimRange == 1 &&
267 (GV::dimension > 1) &&
275 typename J::Traits::RangeType r;
276 auto e = ig.inside();
277 _j.evaluate(e,ig.geometryInInside().global(x),r);
283 template<
typename IG>
284 typename std::enable_if<
285 J::Traits::dimRange == GV::dimension &&
293 auto e = ig.inside();
294 typename J::Traits::RangeType y;
295 _j.evaluate(e,ig.geometryInInside().global(x),y);
301 void setTime(RF time)
322 template<
typename PRM>
340 StokesBoundaryCondition::Type bctype = prm_.bctype(intersection,coord);
341 return (bctype == StokesBoundaryCondition::VelocityDirichlet);
349 template<
typename PRM>
376 template<
typename PRM,
int rangeDim>
377 class NavierStokesFunctionAdapterBase
379 Dune::PDELab::GridFunctionTraits<
380 typename PRM::Traits::GridView,
381 typename PRM::Traits::RangeField,
383 Dune::FieldVector<typename PRM::Traits::RangeField,rangeDim>
385 NavierStokesFunctionAdapterBase<PRM,rangeDim>
391 typename PRM::Traits::GridView,
392 typename PRM::Traits::RangeField,
398 NavierStokesFunctionAdapterBase(PRM& prm)
402 void setTime(
const double time)
407 const PRM& parameters()
const
413 const typename Traits::GridViewType& getGridView ()
const
415 return _prm.gridView();
431 template<
typename PRM>
433 :
public NavierStokesFunctionAdapterBase<PRM,PRM::Traits::dimDomain>
437 typedef NavierStokesFunctionAdapterBase<PRM,PRM::Traits::dimDomain> Base;
439 using Base::parameters;
443 typedef typename Base::Traits Traits;
451 void evaluate (
const typename Traits::ElementType& e,
452 const typename Traits::DomainType& x,
453 typename Traits::RangeType& y)
const
455 y = parameters().g(e,x);
464 template <
typename PRM >
465 class NavierStokesDirichletFunctionAdapterFactory
469 NavierStokesDirichletFunctionAdapter<PRM>,
470 NavierStokesPressureDirichletFunctionAdapter<PRM> >
471 BoundaryDirichletFunction;
473 NavierStokesDirichletFunctionAdapterFactory(PRM & prm)
474 : v(prm), p(prm), df(v,p)
477 BoundaryDirichletFunction & dirichletFunction()
483 NavierStokesVelocityDirichletFunctionAdapter<PRM> v;
484 NavierStokesPressureDirichletFunctionAdapter<PRM> p;
485 BoundaryDirichletFunction df;
Wrapper class for entities.
Definition: entity.hh:66
vector space out of a tensor product of fields.
Definition: fvector.hh:91
composite functions
Definition: function.hh:539
leaf of a function tree
Definition: function.hh:302
Definition: stokesparameter.hh:144
Traits::RangeField rho(const IG &ig, const typename Traits::IntersectionDomain &x) const
Density value from local intersection coordinate.
Definition: stokesparameter.hh:229
Traits::VelocityRange g(const EG &e, const typename Traits::Domain &x) const
Dirichlet boundary condition value from local cell coordinate.
Definition: stokesparameter.hh:237
Traits::RangeField rho(const EG &eg, const typename Traits::Domain &x) const
Density value from local cell coordinate.
Definition: stokesparameter.hh:221
NavierStokesDefaultParameters(const Dune::ParameterTree &config, F &f, B &b, V &v, J &j)
Constructor.
Definition: stokesparameter.hh:154
Traits::VelocityRange j(const IG &ig, const typename Traits::IntersectionDomain &x, const typename Traits::Domain &normal) const
Neumann boundary condition (stress)
NavierStokesParameterTraits< GV, RF > Traits
Type traits.
Definition: stokesparameter.hh:151
Traits::VelocityRange f(const EG &e, const typename Traits::Domain &x) const
source term
Definition: stokesparameter.hh:185
Traits::RangeField mu(const EG &e, const typename Traits::Domain &x) const
Dynamic viscosity value from local cell coordinate.
Definition: stokesparameter.hh:205
Traits::RangeField mu(const IG &ig, const typename Traits::IntersectionDomain &x) const
Dynamic viscosity value from local intersection coordinate.
Definition: stokesparameter.hh:213
Traits::RangeField g2(const EG &e, const typename Traits::Domain &x) const
pressure source term
Definition: stokesparameter.hh:247
Traits::BoundaryCondition::Type bctype(const IG &is, const typename Traits::IntersectionDomain &x) const
boundary condition type from local intersection coordinate
Definition: stokesparameter.hh:194
Definition: stokesparameter.hh:434
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate dirichlet function.
Definition: stokesparameter.hh:451
NavierStokesVelocityFunctionAdapter(PRM &prm)
Constructor.
Definition: stokesparameter.hh:446
Definition: stokesparameter.hh:352
StokesPressureDirichletConstraints(const PRM &_prm)
Constructor.
Definition: stokesparameter.hh:359
bool isDirichlet(const I &intersection, const Dune::FieldVector< typename I::ctype, I::mydimension > &coord) const
Definition: stokesparameter.hh:364
Definition: stokesparameter.hh:325
StokesVelocityDirichletConstraints(const PRM &_prm)
Constructor.
Definition: stokesparameter.hh:332
bool isDirichlet(const I &intersection, const Dune::FieldVector< typename I::ctype, I::mydimension > &coord) const
Definition: stokesparameter.hh:337
Hierarchical structure of string parameters.
Definition: parametertree.hh:37
decltype(Node::degree()) StaticDegree
Returns the statically known degree of the given Node type as a std::integral_constant.
Definition: nodeinterface.hh:107
Dune namespace.
Definition: alignedallocator.hh:13
constexpr auto get(std::integer_sequence< T, II... >, std::integral_constant< std::size_t, pos >={})
Return the entry at position pos of the given sequence.
Definition: integersequence.hh:22
A hierarchical structure of string parameters.
template which always yields a true value
Definition: typetraits.hh:134
Static tag representing a codimension.
Definition: dimension.hh:24
Definition: constraintsparameters.hh:26
traits class holding the function signature, same as in local function
Definition: function.hh:183
Definition: stokesparameter.hh:46
GV GridView
the grid view
Definition: stokesparameter.hh:48
GV::Grid::ctype DomainField
Export type for domain field.
Definition: stokesparameter.hh:57
Dune::FieldVector< DomainField, dimDomain > Domain
domain type
Definition: stokesparameter.hh:60
RF RangeField
Export type for range field.
Definition: stokesparameter.hh:66
@ dimDomain
dimension of the domain
Definition: stokesparameter.hh:53
GV::Traits::template Codim< 0 >::Entity Element
grid element type
Definition: stokesparameter.hh:78
Dune::FieldVector< RF, GV::dimensionworld > VelocityRange
deformation range type
Definition: stokesparameter.hh:69
StokesBoundaryCondition BoundaryCondition
boundary type value
Definition: stokesparameter.hh:75
Dune::FieldVector< RF, 1 > PressureRange
pressure range type
Definition: stokesparameter.hh:72
GV::Intersection Intersection
grid intersection type
Definition: stokesparameter.hh:80
Dune::FieldVector< DomainField, dimDomain-1 > IntersectionDomain
domain type
Definition: stokesparameter.hh:63
Definition: stokesparameter.hh:32