2 #ifndef DUNE_PDELAB_CONVECTIONDIFFUSION_HH 3 #define DUNE_PDELAB_CONVECTIONDIFFUSION_HH 4 #warning This file is deprecated and will be removed after the Dune-PDELab 2.4 release! Include the header dune/pdelab/localoperator/nonlinearconvectiondiffusionfem.hh instead! 8 #include<dune/common/exceptions.hh> 9 #include<dune/common/fvector.hh> 10 #include<dune/geometry/type.hh> 12 #include<dune/geometry/referenceelements.hh> 13 #include<dune/geometry/quadraturerules.hh> 39 template<
typename GV,
typename RF>
56 typedef Dune::FieldVector<DomainFieldType,dimDomain>
DomainType;
65 typedef Dune::FieldVector<RF,GV::dimensionworld>
RangeType;
68 typedef Dune::FieldMatrix<RangeFieldType,dimDomain,dimDomain>
PermTensorType;
71 typedef typename GV::Traits::template Codim<0>::Entity
ElementType;
76 template<
class T,
class Imp>
83 typename Traits::RangeFieldType
84 f (
const typename Traits::ElementType&
e,
const typename Traits::DomainType& x,
85 typename Traits::RangeFieldType u)
const 87 return asImp().f(e,x,u);
91 typename Traits::RangeFieldType
92 w (
const typename Traits::ElementType&
e,
const typename Traits::DomainType& x,
93 typename Traits::RangeFieldType u)
const 95 return asImp().w(e,x,u);
99 typename Traits::RangeFieldType
100 v (
const typename Traits::ElementType&
e,
const typename Traits::DomainType& x,
101 typename Traits::RangeFieldType u)
const 103 return asImp().v(e,x,u);
107 typename Traits::PermTensorType
108 D (
const typename Traits::ElementType&
e,
const typename Traits::DomainType& x)
const 110 return asImp().D(e,x);
114 typename Traits::RangeType
115 q (
const typename Traits::ElementType&
e,
const typename Traits::DomainType& x,
116 typename Traits::RangeFieldType u)
const 118 return asImp().q(e,x,u);
123 const I & intersection,
124 const Dune::FieldVector<typename I::ctype, I::dimension-1> & coord
127 return asImp().isDirichlet( intersection, coord );
131 typename Traits::RangeFieldType
132 g (
const typename Traits::ElementType&
e,
const typename Traits::DomainType& x)
const 134 return asImp().g(e,x);
140 typename Traits::RangeFieldType
141 j (
const typename Traits::ElementType&
e,
const typename Traits::DomainType& x,
142 typename Traits::RangeFieldType u)
const 144 return asImp().j(e,x);
148 Imp& asImp () {
return static_cast<Imp &
> (*this);}
149 const Imp& asImp ()
const {
return static_cast<const Imp &
>(*this);}
161 const typename T::Traits::GridViewType gv;
172 const I & intersection,
173 const Dune::FieldVector<typename I::ctype, I::dimension-1> & coord
176 return t.isDirichlet( intersection, coord );
187 :
public GridFunctionBase<Dune::PDELab::GridFunctionTraits<typename T::Traits::GridViewType,
188 typename T::Traits::RangeFieldType,
189 1,Dune::FieldVector<typename T::Traits::RangeFieldType,1> >
190 ,DirichletBoundaryCondition_CD<T> >
194 typename T::Traits::RangeFieldType,
195 1,Dune::FieldVector<typename T::Traits::RangeFieldType,1> >
Traits;
236 enum { doPatternVolume =
true };
239 enum { doAlphaVolume =
true };
240 enum { doAlphaBoundary =
true };
242 DUNE_DEPRECATED_MSG(
"Deprecated in Dune-PDELab 2.4, use the local operator NonLinearConvectionDiffusionFEM instead!")
244 : param(param_), intorder(intorder_)
248 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
typename R>
249 void alpha_volume (
const EG& eg,
const LFSU& lfsu,
const X& x,
const LFSV& lfsv, R& r)
const 252 typedef typename LFSU::Traits::FiniteElementType::
253 Traits::LocalBasisType::Traits::DomainFieldType DF;
254 typedef typename LFSU::Traits::FiniteElementType::
255 Traits::LocalBasisType::Traits::RangeFieldType RF;
256 typedef typename LFSU::Traits::FiniteElementType::
257 Traits::LocalBasisType::Traits::JacobianType JacobianType;
258 typedef typename LFSU::Traits::FiniteElementType::
259 Traits::LocalBasisType::Traits::RangeType
RangeType;
261 typedef typename LFSU::Traits::SizeType size_type;
264 const int dim = EG::Geometry::mydimension;
267 Dune::GeometryType gt = eg.geometry().type();
268 const Dune::QuadratureRule<DF,dim>& rule = Dune::QuadratureRules<DF,dim>::rule(gt,intorder);
271 typename T::Traits::PermTensorType tensor;
272 Dune::FieldVector<DF,dim> localcenter = Dune::ReferenceElements<DF,dim>::general(gt).position(0,0);
273 tensor = param.D(eg.entity(),localcenter);
276 std::vector<typename T::Traits::RangeFieldType>
w(lfsu.size());
277 for (size_type i=0; i<lfsu.size(); i++)
278 w[i] = param.w(eg.entity(),localcenter,x(lfsu,i));
281 for (
typename Dune::QuadratureRule<DF,dim>::const_iterator it=rule.begin(); it!=rule.end(); ++it)
284 std::vector<RangeType> phi(lfsu.size());
285 lfsu.finiteElement().localBasis().evaluateFunction(it->position(),phi);
289 for (size_type i=0; i<lfsu.size(); i++)
293 typename T::Traits::RangeFieldType f = param.f(eg.entity(),it->position(),u);
296 typename T::Traits::RangeType q = param.q(eg.entity(),it->position(),u);
299 std::vector<JacobianType> js(lfsu.size());
300 lfsu.finiteElement().localBasis().evaluateJacobian(it->position(),js);
303 const typename EG::Geometry::JacobianInverseTransposed jac
304 = eg.geometry().jacobianInverseTransposed(it->position());
305 std::vector<Dune::FieldVector<RF,dim> > gradphi(lfsu.size());
306 for (size_type i=0; i<lfsu.size(); i++)
309 jac.umv(js[i][0],gradphi[i]);
313 Dune::FieldVector<RF,dim> vgradu(0.0);
314 for (size_type i=0; i<lfsu.size(); i++)
315 vgradu.axpy(
w[i],gradphi[i]);
316 vgradu *= param.v(eg.entity(),it->position(),u);
319 Dune::FieldVector<RF,dim> Dvgradu(0.0);
320 tensor.umv(vgradu,Dvgradu);
323 RF factor = it->weight() * eg.geometry().integrationElement(it->position());
324 for (size_type i=0; i<lfsu.size(); i++)
325 r.accumulate(lfsu,i,( Dvgradu*gradphi[i] - q*gradphi[i] - f*phi[i] )*factor);
330 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
typename R>
332 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
336 typedef typename LFSV::Traits::FiniteElementType::
337 Traits::LocalBasisType::Traits::DomainFieldType DF;
338 typedef typename LFSV::Traits::FiniteElementType::
339 Traits::LocalBasisType::Traits::RangeFieldType RF;
340 typedef typename LFSV::Traits::FiniteElementType::
341 Traits::LocalBasisType::Traits::RangeType
RangeType;
343 typedef typename LFSV::Traits::SizeType size_type;
346 const int dim = IG::dimension;
349 Dune::GeometryType gtface = ig.geometryInInside().type();
350 const Dune::QuadratureRule<DF,dim-1>& rule = Dune::QuadratureRules<DF,dim-1>::rule(gtface,intorder);
353 Dune::FieldVector<DF,dim-1> facecenterlocal = Dune::ReferenceElements<DF,dim-1>::general(gtface).position(0,0);
354 Dune::FieldVector<DF,dim> facecenterinelement = ig.geometryInInside().global( facecenterlocal );
355 std::vector<typename T::Traits::RangeFieldType>
w(lfsu_s.size());
356 auto cell_inside = ig.inside();
357 for (size_type i=0; i<lfsu_s.size(); i++)
358 w[i] = param.w(cell_inside,facecenterinelement,x_s(lfsu_s,i));
361 for (
typename Dune::QuadratureRule<DF,dim-1>::const_iterator it=rule.begin(); it!=rule.end(); ++it)
365 if( param.isDirichlet( ig.intersection(), it->position() ) )
369 Dune::FieldVector<DF,dim> local = ig.geometryInInside().global(it->position());
372 std::vector<RangeType> phi(lfsv_s.size());
373 lfsv_s.finiteElement().localBasis().evaluateFunction(local,phi);
377 for (size_type i=0; i<lfsu_s.size(); i++)
381 typename T::Traits::RangeFieldType j;
382 j = param.j(cell_inside,local,u);
385 RF factor = it->weight()*ig.geometry().integrationElement(it->position());
386 for (size_type i=0; i<lfsv_s.size(); i++)
387 r_s.accumulate(lfsu_s,i,j*phi[i]*factor);
T Traits
Definition: convectiondiffusion.hh:80
GV::Grid::ctype DomainFieldType
Export type for domain field.
Definition: convectiondiffusion.hh:53
Definition: convectiondiffusion.hh:225
base class for parameter class
Definition: convectiondiffusion.hh:77
sparsity pattern generator
Definition: pattern.hh:13
const IG & ig
Definition: constraints.hh:148
static const int dim
Definition: adaptivity.hh:83
Implement jacobian_boundary() based on alpha_boundary()
Definition: numericaljacobian.hh:250
GV GridViewType
The type of the grid view the function lives on.
Definition: function.hh:114
Definition: adaptivity.hh:27
Dune::FieldVector< RF, GV::dimensionworld > RangeType
range type
Definition: convectiondiffusion.hh:65
GV::Traits::template Codim< 0 >::Entity ElementType
codim 0 entity
Definition: function.hh:117
Definition: convectiondiffusion.hh:158
traits class for two phase parameter class
Definition: convectiondiffusion.hh:41
DirichletBoundaryCondition_CD(const typename Traits::GridViewType &g_, const T &t_)
constructor
Definition: convectiondiffusion.hh:198
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate the GridFunction at given position.
Definition: convectiondiffusion.hh:201
GV::Traits::template Codim< 0 >::Entity ElementType
grid types
Definition: convectiondiffusion.hh:71
Implements linear and nonlinear versions of jacobian_apply_boundary() based on alpha_boundary() ...
Definition: numericaljacobianapply.hh:285
Traits::RangeFieldType j(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeFieldType u) const
Neumann boundary condition.
Definition: convectiondiffusion.hh:141
Default flags for all local operators.
Definition: flags.hh:18
const Entity & e
Definition: localfunctionspace.hh:111
Dune::FieldVector< GV::Grid::ctype, GV::dimension > DomainType
domain type in dim-size coordinates
Definition: function.hh:48
Implement jacobian_volume() based on alpha_volume()
Definition: numericaljacobian.hh:31
Default class for additional methods in instationary local operators.
Definition: idefault.hh:89
RF RangeFieldType
Export type for range field.
Definition: convectiondiffusion.hh:62
GV::Intersection IntersectionType
Definition: convectiondiffusion.hh:72
dimension of the domain
Definition: convectiondiffusion.hh:49
R RangeType
range type
Definition: function.hh:60
Traits::RangeType q(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeFieldType u) const
nonlinear flux vector
Definition: convectiondiffusion.hh:115
VTKWriter & w
Definition: function.hh:1101
bool isDirichlet(const I &intersection, const Dune::FieldVector< typename I::ctype, I::dimension-1 > &coord) const
Definition: convectiondiffusion.hh:171
Definition: constraintsparameters.hh:24
Definition: convectiondiffusion.hh:186
void alpha_volume(const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, R &r) const
Definition: convectiondiffusion.hh:249
void setTime(double t)
set time in parameter class
Definition: convectiondiffusion.hh:392
Traits::RangeFieldType g(const typename Traits::ElementType &e, const typename Traits::DomainType &x) const
Dirichlet boundary condition value.
Definition: convectiondiffusion.hh:132
Traits::RangeFieldType v(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeFieldType u) const
scalar nonlinearity in diffusion coefficient
Definition: convectiondiffusion.hh:100
Traits::RangeFieldType w(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeFieldType u) const
nonlinearity under gradient
Definition: convectiondiffusion.hh:92
Traits::PermTensorType D(const typename Traits::ElementType &e, const typename Traits::DomainType &x) const
tensor diffusion coefficient
Definition: convectiondiffusion.hh:108
Traits::RangeFieldType f(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeFieldType u) const
source/reaction term
Definition: convectiondiffusion.hh:84
bool isDirichlet(const I &intersection, const Dune::FieldVector< typename I::ctype, I::dimension-1 > &coord) const
Definition: convectiondiffusion.hh:122
Dune::FieldVector< DomainFieldType, dimDomain > DomainType
domain type
Definition: convectiondiffusion.hh:56
Implements linear and nonlinear versions of jacobian_apply_volume() based on alpha_volume() ...
Definition: numericaljacobianapply.hh:32
Dune::FieldMatrix< RangeFieldType, dimDomain, dimDomain > PermTensorType
permeability tensor type
Definition: convectiondiffusion.hh:68
Dune::PDELab::GridFunctionTraits< typename T::Traits::GridViewType, typename T::Traits::RangeFieldType, 1, Dune::FieldVector< typename T::Traits::RangeFieldType, 1 > > Traits
Definition: convectiondiffusion.hh:195
BCTypeParam_CD(const typename T::Traits::GridViewType &gv_, const T &t_)
Definition: convectiondiffusion.hh:165
Dune::FieldVector< DomainFieldType, dimDomain-1 > IntersectionDomainType
domain type
Definition: convectiondiffusion.hh:59
Definition: nonlinearconvectiondiffusionfem.hh:226
GV GridViewType
the grid view
Definition: convectiondiffusion.hh:44
leaf of a function tree
Definition: function.hh:576
const Traits::GridViewType & getGridView() const
Definition: convectiondiffusion.hh:208
void alpha_boundary(const IG &ig, const LFSU &lfsu_s, const X &x_s, const LFSV &lfsv_s, R &r_s) const
Definition: convectiondiffusion.hh:331
traits class holding the function signature, same as in local function
Definition: function.hh:175