dune-pdelab  2.5-dev
dgnavierstokesparameter.hh
Go to the documentation of this file.
1 // -*- tab-width: 2; indent-tabs-mode: nil -*-
2 // vi: set et ts=2 sw=2 sts=2:
3 
4 #ifndef DUNE_PDELAB_LOCALOPERATOR_DGNAVIERSTOKESPARAMETER_HH
5 #define DUNE_PDELAB_LOCALOPERATOR_DGNAVIERSTOKESPARAMETER_HH
6 
7 #include <dune/common/parametertreeparser.hh>
11 
12 namespace Dune {
13  namespace PDELab {
14 
32  template<typename GV, typename RF, typename F, typename B, typename V, typename J,
33  bool navier = false, bool full_tensor = false, typename IP = DefaultInteriorPenalty<typename V::Traits::RangeFieldType> >
35  public NavierStokesDefaultParameters<GV,RF,F,B,V,J,navier,full_tensor>
36  {
37 
40 
41  void initFromString(const std::string & method)
42  {
43  std::string s = method;
44  std::transform(s.begin(), s.end(), s.begin(), tolower);
45 
46  // nipg (epsilon=1) 2d p1 -> Klaus sagt sollte auch sigma 1 klappen
47  if (s.find("nipg") != std::string::npos)
48  {
49  _epsilon = 1;
50  return;
51  }
52  // sipg (epsilon=-1) 2d p1 -> Klaus sagt sigma=3.9irgendwas
53  if (s.find("sipg") != std::string::npos)
54  {
55  _epsilon = -1;
56  return;
57  }
58  // obb sigma = 0, epsilon =
59  if (s == "obb")
60  {
61  _epsilon = 1;
62  return;
63  }
64  // extract parameters
65  {
66  double sigma, beta;
67  if (3 == sscanf(s.c_str(), "%d %lg %lg", &_epsilon, &sigma, &beta))
68  return;
69  }
70  DUNE_THROW(Dune::Exception, "Unknown DG type " << method);
71  }
72 
73  public :
74 
76  typedef typename Base::Traits Traits;
77 
98  DGNavierStokesParameters(const Dune::ParameterTree& configuration,
99  F& f, B& b, V& v, J& j)
100  : Base(configuration,f,b,v,j)
101  , _ip(configuration.sub("dg"))
102  , _epsilon(configuration.sub("dg").get<int>("epsilon"))
103  {}
104 
105 
107  typename Traits::RangeField
109  {
110  typename Traits::RangeField y(1.0 / dt);
111  return y;
112  }
113 
116  template<typename GEO, typename IGEO, typename OGEO>
117  typename Traits::RangeField
118  getFaceIP(const GEO& geo, const IGEO& igeo, const OGEO& ogeo)
119  {
120  return _ip.getFaceIP(geo,igeo,ogeo);
121  }
122 
125  template<typename GEO, typename IGEO>
126  typename Traits::RangeField
127  getFaceIP(const GEO& geo, const IGEO& igeo)
128  {
129  return _ip.getFaceIP(geo,igeo);
130  }
131 
134  int
136  {
137  return _epsilon;
138  }
139 
140  private:
141 
142  IP _ip; // Interior penalty
143  int _epsilon; // IP symmetry factor
144  }; // end class DGNavierStokesParameters
145 
146 
147  namespace NavierStokesDGImp{
164  template< typename PRM, typename Dummy = void>
166 
167  template<typename IntersectionGeometry>
168  static typename PRM::Traits::RangeField
169  boundarySlip
170  (const PRM & ,
171  const IntersectionGeometry& ,
172  const typename PRM::Traits::IntersectionDomain& )
173  {
174  return 1.0;
175  }
176 
177  };
178 
179  template< typename PRM>
181  <PRM,typename std::enable_if<PRM::enable_variable_slip>::type>
182  {
183  template<typename IntersectionGeometry>
184  static typename PRM::Traits::RangeField
185  boundarySlip
186  (const PRM & prm,
187  const IntersectionGeometry& ig,
188  const typename PRM::Traits::IntersectionDomain& x)
189  {
190  return prm.boundarySlip(ig,x);
191  }
192 
193  };
195  }
196 
197  } // end namespace PDELab
198 } // end namespace Dune
199 #endif // DUNE_PDELAB_LOCALOPERATOR_DGNAVIERSTOKESPARAMETER_HH
Wrap intersection.
Definition: geometrywrapper.hh:56
Traits::VelocityRange j(const IG &ig, const typename Traits::IntersectionDomain &x, const typename Traits::Domain &normal) const
Neumann boundary condition (stress)
Definition: stokesparameter.hh:143
int epsilonIPSymmetryFactor()
Definition: dgnavierstokesparameter.hh:135
RF RangeField
Export type for range field.
Definition: stokesparameter.hh:66
Traits::RangeField getFaceIP(const GEO &geo, const IGEO &igeo, const OGEO &ogeo)
Get interior penalty parameter from skeleton face.
Definition: dgnavierstokesparameter.hh:118
DGNavierStokesParameters(const Dune::ParameterTree &configuration, F &f, B &b, V &v, J &j)
Constructor that parses values from parameter tree.
Definition: dgnavierstokesparameter.hh:98
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
Compile-time switch for the boundary slip factor.
Definition: dgnavierstokesparameter.hh:165
Base::Traits Traits
Traits class.
Definition: dgnavierstokesparameter.hh:76
const IG & ig
Definition: constraints.hh:148
Traits::RangeField getFaceIP(const GEO &geo, const IGEO &igeo)
Get interior penalty parameter from boundary face.
Definition: dgnavierstokesparameter.hh:127
Traits::RangeField incompressibilityScaling(typename Traits::RangeField dt) const
Rescaling factor for the incompressibility equation.
Definition: dgnavierstokesparameter.hh:108
Parameter class for local operator DGNavierStokes.
Definition: dgnavierstokesparameter.hh:34
STL namespace.
Definition: stokesparameter.hh:45
Traits::VelocityRange f(const EG &e, const typename Traits::Domain &x) const
source term
Definition: stokesparameter.hh:185
const std::string s
Definition: function.hh:830