dune-pdelab  2.4.1
dgparameter.hh
Go to the documentation of this file.
1 #ifndef DUNE_PDELAB_LOCALOPERATOR_DGPARAMETER_HH
2 #define DUNE_PDELAB_LOCALOPERATOR_DGPARAMETER_HH
3 
4 #include <dune/common/parametertreeparser.hh>
5 
6 namespace Dune {
7  namespace PDELab {
8 
19  template <typename RF>
21  {
22  private:
23  RF beta;
24  RF sigma;
25  RF mu;
26  public:
27 
28  DefaultInteriorPenalty(const std::string method, const RF mu_)
29  : mu(mu_)
30  {
31  std::string s = method;
32  std::transform(s.begin(), s.end(), s.begin(), tolower);
33 
34  // nipg (epsilon=1) 2d p1 -> Klaus sagt sollte auch sigma 1 klappen
35  if (s.find("nipg") != std::string::npos)
36  {
37  beta = 1;
38  if (sscanf(s.c_str(), "nipg %lg", &sigma) != 1)
39  sigma = 3.9;
40  return;
41  }
42  // sipg (epsilon=-1) 2d p1 -> Klaus sagt sigma=3.9irgendwas
43  if (s.find("sipg") != std::string::npos)
44  {
45  beta = 1;
46  if (sscanf(s.c_str(), "sipg %lg", &sigma) != 1)
47  sigma = 3.9;
48  return;
49  }
50  // obb sigma = 0, epsilon =
51  if (s == "obb")
52  {
53  beta = 1;
54  sigma = 0;
55  return;
56  }
57  // extract parameters
58  {
59  int epsilon;
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  DefaultInteriorPenalty(const Dune::ParameterTree & config, const RF mu_)
67  : mu(mu_)
68  {
69  beta = config.get<double>("beta");
70  sigma = config.get<double>("ip_sigma");
71  }
72 
73  template<typename I>
74  RF getFaceIP(const I & ig) const
75  {
76  return mu * sigma / std::pow(ig.geometry().volume(),beta);
77  }
78  };
79 
80  } // end namespace PDELab
81 } // end namespace Dune
82 
83 #endif
const IG & ig
Definition: constraints.hh:148
Definition: adaptivity.hh:27
DefaultInteriorPenalty(const std::string method, const RF mu_)
Definition: dgparameter.hh:28
RF getFaceIP(const I &ig) const
Definition: dgparameter.hh:74
This is the default implementation for the interior penalty factor.
Definition: dgparameter.hh:20
const std::string s
Definition: function.hh:1102
DefaultInteriorPenalty(const Dune::ParameterTree &config, const RF mu_)
Definition: dgparameter.hh:66