dune-pdelab  2.0.0
stokesdgparameter.hh
Go to the documentation of this file.
1 #ifndef DUNE_PDELAB_LOCALOPERATOR_STOKESDGPARAMETER_HH
2 #define DUNE_PDELAB_LOCALOPERATOR_STOKESDGPARAMETER_HH
3 
4 #include <dune/common/parametertreeparser.hh>
5 
7 
8 #include "dgparameter.hh"
9 #include "stokesparameter.hh"
10 
11 namespace Dune {
12  namespace PDELab {
13 
25  template<typename GV, typename RF, typename F, typename B, typename V, typename J,
26  typename IP = DefaultInteriorPenalty<typename V::Traits::RangeFieldType> >
28  : public NavierStokesDefaultParameters<GV,RF,F,B,V,J>
29  {
30  private:
31 
33 
34  void initFromString(const std::string & method)
35  {
36  std::string s = method;
37  std::transform(s.begin(), s.end(), s.begin(), tolower);
38 
39  // nipg (epsilon=1) 2d p1 -> Klaus sagt sollte auch sigma 1 klappen
40  if (s.find("nipg") != std::string::npos)
41  {
42  _epsilon = 1;
43  return;
44  }
45  // sipg (epsilon=-1) 2d p1 -> Klaus sagt sigma=3.9irgendwas
46  if (s.find("sipg") != std::string::npos)
47  {
48  _epsilon = -1;
49  return;
50  }
51  // obb sigma = 0, epsilon =
52  if (s == "obb")
53  {
54  _epsilon = 1;
55  return;
56  }
57  // extract parameters
58  {
59  double sigma, beta;
60  if (3 == sscanf(s.c_str(), "%d %lg %lg", &_epsilon, &sigma, &beta))
61  return;
62  }
63  DUNE_THROW(Dune::Exception, "Unknown DG type " << method);
64  }
65 
66  protected:
67  StokesDGParameters(const std::string & method, const RF mu, const RF rho,
68  F & f, B & b, V & v, J & j, IP & ip)
69  : Base(mu,rho,f,b,v,j),
70  _ip(ip)
71  {
72  initFromString(method);
73  }
74 
75 
76  public:
77 
79  typedef typename Base::Traits Traits;
80 
81  StokesDGParameters(const std::string & method, const RF mu,
82  F & f, B & b, V & v, J & j, IP & ip)
83  : Base(mu,1.0,f,b,v,j),
84  _ip(ip)
85  {
86  initFromString(method);
87  }
88 
89  StokesDGParameters(const Dune::ParameterTree & configuration,
90  F & f, B & b, V & v, J & j, IP & ip)
91  : Base(configuration,f,b,v,j),
92  _ip(ip),
93  _epsilon(configuration.get<int>("epsilon"))
94  {}
95 
96 
98  typename Traits::RangeField
100  {
101  typename Traits::RangeField y(1.0 / dt);
102  return y;
103  }
104 
109  template<typename I>
110  typename Traits::RangeField
111  getFaceIP(const I & ig) const
112  {
113  return _ip.getFaceIP(ig);
114  }
115 
120  template<typename I>
121  typename Traits::RangeField
122  getFaceIP(const I & ig, const typename Traits::IntersectionDomain& ) const
123  {
124  return _ip.getFaceIP(ig);
125  }
126 
129  int
131  {
132  return _epsilon;
133  }
134 
135  private:
136 
137  IP & _ip; // Interior penalty
138  int _epsilon; // IP symmetry factor
139  };
140 
141 
153  template<typename GV, typename RF, typename F, typename B, typename V, typename J,
154  typename IP = DefaultInteriorPenalty<typename V::Traits::RangeField> >
156  : public StokesDGParameters<GV,RF,F,B,V,J,IP>
157  {
158 
161 
162  public:
163 
164  NavierStokesDGParameters(const std::string & method, const RF mu, const RF rho,
165  F & f, B & b, V & v, J & j, IP & ip)
166  : Base(method,mu,rho,f,b,v,j,ip)
167  {}
168 
169  NavierStokesDGParameters(const Dune::ParameterTree & configuration,
170  F & f, B & b, V & v, J & j, IP & ip)
171  : Base(configuration,f,b,v,j,ip)
172  {}
173 
174  };
175 
176 
177  namespace NavierStokesDGImp{
194  template< typename PRM, typename Dummy = void>
196 
197  template<typename IntersectionGeometry>
198  static typename PRM::Traits::RangeField
200  (const PRM & ,
201  const IntersectionGeometry& ,
202  const typename PRM::Traits::IntersectionDomain& )
203  {
204  return 1.0;
205  }
206 
207  };
208 
209  template< typename PRM>
211  <PRM,typename Dune::enable_if<PRM::enable_variable_slip>::type>
212  {
213  template<typename IntersectionGeometry>
214  static typename PRM::Traits::RangeField
216  (const PRM & prm,
217  const IntersectionGeometry& ig,
218  const typename PRM::Traits::IntersectionDomain& x)
219  {
220  return prm.boundarySlip(ig,x);
221  }
222 
223  };
225  }
226 
227 
228  }
229 }
230 
231 #endif
Traits::VelocityRange f(const EG &e, const typename Traits::Domain &x) const
source term
Definition: stokesparameter.hh:185
Dune::FieldVector< DomainField, dimDomain-1 > IntersectionDomain
domain type
Definition: stokesparameter.hh:63
Compile-time switch for the boundary slip factor.
Definition: stokesdgparameter.hh:195
Traits::VelocityRange j(const IG &ig, const typename Traits::IntersectionDomain &x, const typename Traits::Domain &normal) const
Neumann boundary condition (stress)
RF RangeField
Export type for range field.
Definition: stokesparameter.hh:66
Definition: stokesparameter.hh:45
static PRM::Traits::RangeField boundarySlip(const PRM &, const IntersectionGeometry &, const typename PRM::Traits::IntersectionDomain &)
Definition: stokesdgparameter.hh:200
NavierStokesDGParameters(const std::string &method, const RF mu, const RF rho, F &f, B &b, V &v, J &j, IP &ip)
Definition: stokesdgparameter.hh:164
Traits::RangeField rho(const EG &eg, const typename Traits::Domain &x) const
Density value from local cell coordinate.
Definition: stokesparameter.hh:221
StokesDGParameters(const std::string &method, const RF mu, F &f, B &b, V &v, J &j, IP &ip)
Definition: stokesdgparameter.hh:81
Traits::RangeField getFaceIP(const I &ig) const
Interior penalty parameter.
Definition: stokesdgparameter.hh:111
const IG & ig
Definition: common/constraints.hh:146
Definition: stokesparameter.hh:143
Traits::RangeField incompressibilityScaling(typename Traits::RangeField dt) const
Rescaling factor for the incompressibility equation.
Definition: stokesdgparameter.hh:99
Traits::RangeField mu(const EG &e, const typename Traits::Domain &x) const
Dynamic viscosity value from local cell coordinate.
Definition: stokesparameter.hh:205
int epsilonIPSymmetryFactor()
Definition: stokesdgparameter.hh:130
StokesDGParameters(const std::string &method, const RF mu, const RF rho, F &f, B &b, V &v, J &j, IP &ip)
Definition: stokesdgparameter.hh:67
NavierStokesDGParameters(const Dune::ParameterTree &configuration, F &f, B &b, V &v, J &j, IP &ip)
Definition: stokesdgparameter.hh:169
Parameter class for local operator StokesDG.
Definition: stokesdgparameter.hh:27
Traits::RangeField getFaceIP(const I &ig, const typename Traits::IntersectionDomain &) const
Interior penalty parameter.
Definition: stokesdgparameter.hh:122
Wrap intersection.
Definition: geometrywrapper.hh:56
const std::string s
Definition: function.hh:1103
Parameter class for local operator NavierStokesDG.
Definition: stokesdgparameter.hh:155
StokesDGParameters(const Dune::ParameterTree &configuration, F &f, B &b, V &v, J &j, IP &ip)
Definition: stokesdgparameter.hh:89
Base::Traits Traits
Traits class.
Definition: stokesdgparameter.hh:79