dune-pdelab  2.0.0
maxwellparameter.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil -*-
2 #ifndef DUNE_PDELAB_MAXWELLPARAMETER_HH
3 #define DUNE_PDELAB_MAXWELLPARAMETER_HH
4 
5 #include<vector>
6 
7 #include<dune/common/exceptions.hh>
8 #include<dune/common/fvector.hh>
9 #include<dune/common/static_assert.hh>
10 
11 #include<dune/geometry/quadraturerules.hh>
12 #include<dune/geometry/referenceelements.hh>
13 #include<dune/geometry/type.hh>
14 
18 
19 namespace Dune {
20  namespace PDELab {
21 
28  template<typename GV, typename RF>
30  {
32  typedef GV GridViewType;
33 
35  enum {
37  dimDomain = GV::dimension
38  };
39 
41  typedef typename GV::Grid::ctype DomainFieldType;
42 
44  typedef Dune::FieldVector<DomainFieldType,dimDomain> DomainType;
45 
47  typedef Dune::FieldVector<DomainFieldType,dimDomain-1> IntersectionDomainType;
48 
50  typedef RF RangeFieldType;
51 
53  typedef Dune::FieldVector<RF,GV::dimension> RangeType;
54 
56  typedef Dune::FieldVector<RF,2*GV::dimension> StateType;
57 
59  typedef typename GV::Traits::template Codim<0>::Entity ElementType;
60  typedef typename GV::Intersection IntersectionType;
61  };
62 
63  template<typename T>
65  : public Dune::PDELab::GridFunctionBase<Dune::PDELab::GridFunctionTraits<typename T::Traits::GridViewType,
66  typename T::Traits::RangeFieldType,
67  T::Traits::dimDomain*2,Dune::FieldVector<typename T::Traits::RangeFieldType,T::Traits::dimDomain*2> >
68  ,MaxwellInitialValueAdapter<T> >
69  {
70  public:
71  typedef Dune::PDELab::GridFunctionTraits<typename T::Traits::GridViewType,
72  typename T::Traits::RangeFieldType,
73  T::Traits::dimDomain*2,Dune::FieldVector<typename T::Traits::RangeFieldType,T::Traits::dimDomain*2> > Traits;
74 
76  MaxwellInitialValueAdapter (const typename Traits::GridViewType& g_, const T& t_) : g(g_), t(t_) {}
77 
79  inline void evaluate (const typename Traits::ElementType& e,
80  const typename Traits::DomainType& x,
81  typename Traits::RangeType& y) const
82  {
83  y = t.u0(e,x);
84  }
85 
86  inline const typename Traits::GridViewType& getGridView () const
87  {
88  return g;
89  }
90 
91  private:
92  typename Traits::GridViewType g;
93  const T& t;
94  };
95 
96  template<typename GV, typename RF>
98  {
99  public:
101 
103  : pi(3.141592653589793238462643), time(0.0)
104  {
105  }
106 
108  typename Traits::RangeFieldType
109  eps (const typename Traits::ElementType& e, const typename Traits::DomainType& x) const
110  {
111  return 1.0;
112  }
113 
115  typename Traits::RangeFieldType
116  mu (const typename Traits::ElementType& e, const typename Traits::DomainType& x) const
117  {
118  return 1.0;
119  }
120 
122  typename Traits::RangeFieldType
123  sigma (const typename Traits::ElementType& e, const typename Traits::DomainType& x) const
124  {
125  return 1.0;
126  }
127 
129  typename Traits::StateType
130  g (const typename Traits::IntersectionType& is, const typename Traits::IntersectionDomainType& x, const typename Traits::StateType& s) const
131  {
132  typename Traits::DomainType xglobal = is.geometry().global(x);
133  typename Traits::StateType u(0.0);
134  return u;
135  }
136 
138  typename Traits::StateType
139  j (const typename Traits::ElementType& e, const typename Traits::DomainType& x) const
140  {
141  typename Traits::StateType rhs(0.0);
142  return rhs;
143  }
144 
146  typename Traits::StateType
147  u0 (const typename Traits::ElementType& e, const typename Traits::DomainType& x) const
148  {
149  typename Traits::StateType u(0.0);
150  return u;
151  }
152 
154  void setTime (RF t)
155  {
156  time = t;
157  }
158 
159  private:
160  double pi;
161  RF time;
162  };
163  }
164 }
165 #endif
dimension of the domain
Definition: maxwellparameter.hh:37
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate the GridFunction at given position.
Definition: maxwellparameter.hh:79
Definition: maxwellparameter.hh:64
MaxwellInitialValueAdapter(const typename Traits::GridViewType &g_, const T &t_)
constructor
Definition: maxwellparameter.hh:76
GV::Traits::template Codim< 0 >::Entity ElementType
codim 0 entity
Definition: function.hh:118
Dune::FieldVector< RF, 2 *GV::dimension > StateType
range type
Definition: maxwellparameter.hh:56
Traits::RangeFieldType sigma(const typename Traits::ElementType &e, const typename Traits::DomainType &x) const
permeability
Definition: maxwellparameter.hh:123
Dune::FieldVector< DomainFieldType, dimDomain-1 > IntersectionDomainType
domain type
Definition: maxwellparameter.hh:47
Dune::FieldVector< RF, GV::dimension > RangeType
range type
Definition: maxwellparameter.hh:53
Dune::FieldVector< GV::Grid::ctype, GV::dimension > DomainType
domain type in dim-size coordinates
Definition: function.hh:49
GV GridViewType
the grid view
Definition: maxwellparameter.hh:32
Traits::RangeFieldType eps(const typename Traits::ElementType &e, const typename Traits::DomainType &x) const
permittivity
Definition: maxwellparameter.hh:109
Traits class for convection diffusion parameters.
Definition: maxwellparameter.hh:29
Traits::RangeFieldType mu(const typename Traits::ElementType &e, const typename Traits::DomainType &x) const
permeability
Definition: maxwellparameter.hh:116
Dune::PDELab::GridFunctionTraits< typename T::Traits::GridViewType, typename T::Traits::RangeFieldType, T::Traits::dimDomain *2, Dune::FieldVector< typename T::Traits::RangeFieldType, T::Traits::dimDomain *2 > > Traits
Definition: maxwellparameter.hh:73
leaf of a function tree
Definition: function.hh:577
Dune::FieldVector< DomainFieldType, dimDomain > DomainType
domain type
Definition: maxwellparameter.hh:44
traits class holding the function signature, same as in local function
Definition: function.hh:176
MaxwellModelProblem()
Definition: maxwellparameter.hh:102
GV GridViewType
The type of the grid view the function lives on.
Definition: function.hh:115
Traits::StateType u0(const typename Traits::ElementType &e, const typename Traits::DomainType &x) const
initial value
Definition: maxwellparameter.hh:147
GV::Intersection IntersectionType
Definition: maxwellparameter.hh:60
Definition: maxwellparameter.hh:97
GV::Grid::ctype DomainFieldType
Export type for domain field.
Definition: maxwellparameter.hh:41
MaxwellParameterTraits< GV, RF > Traits
Definition: maxwellparameter.hh:100
GV::Traits::template Codim< 0 >::Entity ElementType
grid types
Definition: maxwellparameter.hh:59
const E & e
Definition: interpolate.hh:172
Traits::StateType j(const typename Traits::ElementType &e, const typename Traits::DomainType &x) const
right hand side
Definition: maxwellparameter.hh:139
void setTime(RF t)
set time for subsequent evaluation
Definition: maxwellparameter.hh:154
const Traits::GridViewType & getGridView() const
Definition: maxwellparameter.hh:86
Traits::StateType g(const typename Traits::IntersectionType &is, const typename Traits::IntersectionDomainType &x, const typename Traits::StateType &s) const
boundary condition value
Definition: maxwellparameter.hh:130
RF RangeFieldType
Export type for range field.
Definition: maxwellparameter.hh:50
const std::string s
Definition: function.hh:1103