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 
79  DUNE_DEPRECATED_MSG("This constructor is deprecated. Use the parameter tree version instead!")
80  DGNavierStokesParameters(const std::string& method, const RF mu, const RF rho,
81  F& f, B& b, V& v, J& j, IP& ip) :
82  Base(mu,rho,f,b,v,j) ,
83  _ip(ip)
84  {
85  initFromString(method);
86  }
87 
108  DGNavierStokesParameters(const Dune::ParameterTree& configuration,
109  F& f, B& b, V& v, J& j)
110  : Base(configuration,f,b,v,j)
111  , _ip(configuration.sub("dg"))
112  , _epsilon(configuration.sub("dg").get<int>("epsilon"))
113  {}
114 
115 
117  typename Traits::RangeField
119  {
120  typename Traits::RangeField y(1.0 / dt);
121  return y;
122  }
123 
126  template<typename GEO, typename IGEO, typename OGEO>
127  typename Traits::RangeField
128  getFaceIP(const GEO& geo, const IGEO& igeo, const OGEO& ogeo)
129  {
130  return _ip.getFaceIP(geo,igeo,ogeo);
131  }
132 
135  template<typename GEO, typename IGEO>
136  typename Traits::RangeField
137  getFaceIP(const GEO& geo, const IGEO& igeo)
138  {
139  return _ip.getFaceIP(geo,igeo);
140  }
141 
144  int
146  {
147  return _epsilon;
148  }
149 
150  private:
151 
152  IP _ip; // Interior penalty
153  int _epsilon; // IP symmetry factor
154  }; // end class DGNavierStokesParameters
155 
156 
157  namespace NavierStokesDGImp{
174  template< typename PRM, typename Dummy = void>
176 
177  template<typename IntersectionGeometry>
178  static typename PRM::Traits::RangeField
179  boundarySlip
180  (const PRM & ,
181  const IntersectionGeometry& ,
182  const typename PRM::Traits::IntersectionDomain& )
183  {
184  return 1.0;
185  }
186 
187  };
188 
189  template< typename PRM>
191  <PRM,typename Dune::enable_if<PRM::enable_variable_slip>::type>
192  {
193  template<typename IntersectionGeometry>
194  static typename PRM::Traits::RangeField
195  boundarySlip
196  (const PRM & prm,
197  const IntersectionGeometry& ig,
198  const typename PRM::Traits::IntersectionDomain& x)
199  {
200  return prm.boundarySlip(ig,x);
201  }
202 
203  };
205  }
206 
207  } // end namespace PDELab
208 } // end namespace Dune
209 #endif // DUNE_PDELAB_LOCALOPERATOR_DGNAVIERSTOKESPARAMETER_HH
RF RangeField
Export type for range field.
Definition: stokesparameter.hh:66
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:137
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 rho(const EG &eg, const typename Traits::Domain &x) const
Density value from local cell coordinate.
Definition: stokesparameter.hh:221
DGNavierStokesParameters(const Dune::ParameterTree &configuration, F &f, B &b, V &v, J &j)
Constructor that parses values from parameter tree.
Definition: dgnavierstokesparameter.hh:108
const std::string s
Definition: function.hh:1101
Traits::RangeField getFaceIP(const GEO &geo, const IGEO &igeo, const OGEO &ogeo)
Get interior penalty parameter from skeleton face.
Definition: dgnavierstokesparameter.hh:128
For backward compatibility – Do not use this!
Definition: adaptivity.hh:27
Wrap intersection.
Definition: geometrywrapper.hh:56
Parameter class for local operator DGNavierStokes.
Definition: dgnavierstokesparameter.hh:34
Definition: stokesparameter.hh:143
Base::Traits Traits
Traits class.
Definition: dgnavierstokesparameter.hh:76
STL namespace.
Definition: stokesparameter.hh:45
Traits::RangeField incompressibilityScaling(typename Traits::RangeField dt) const
Rescaling factor for the incompressibility equation.
Definition: dgnavierstokesparameter.hh:118
int epsilonIPSymmetryFactor()
Definition: dgnavierstokesparameter.hh:145
Traits::VelocityRange f(const EG &e, const typename Traits::Domain &x) const
source term
Definition: stokesparameter.hh:185
Traits::VelocityRange j(const IG &ig, const typename Traits::IntersectionDomain &x, const typename Traits::Domain &normal) const
Neumann boundary condition (stress)
Compile-time switch for the boundary slip factor.
Definition: dgnavierstokesparameter.hh:175