3.6-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
nonconformingfecache.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*****************************************************************************
4 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
24#ifndef DUMUX_DISCRETIZATION_NONCONFORMING_FECACHE_HH
25#define DUMUX_DISCRETIZATION_NONCONFORMING_FECACHE_HH
26
27#include <memory>
28
29#include <dune/common/exceptions.hh>
30#include <dune/geometry/type.hh>
31
32#include <dune/localfunctions/crouzeixraviart.hh>
33#include <dune/localfunctions/rannacherturek.hh>
34#include <dune/localfunctions/common/virtualinterface.hh>
35#include <dune/localfunctions/common/virtualwrappers.hh>
36
37namespace Dumux {
38
39template< class CoordScalar, class Scalar, unsigned int dim>
41{
42 static_assert(dim == 2 || dim == 3, "Non-conforming FE spaces only implemented for 2D and 3D grids");
43
44 // These are so-called non-conforming finite element spaces
45 // the local basis is only continuous at given points on the faces
46 using RT = Dune::RannacherTurekLocalFiniteElement<CoordScalar, Scalar, dim>;
47 using CR = Dune::CrouzeixRaviartLocalFiniteElement<CoordScalar, Scalar, dim>;
48
49public:
50 using FiniteElementType = Dune::LocalFiniteElementVirtualInterface<typename RT::Traits::LocalBasisType::Traits>;
51
53 : rtBasis_(std::make_unique<Dune::LocalFiniteElementVirtualImp<RT>>(RT{}))
54 , crBasis_(std::make_unique<Dune::LocalFiniteElementVirtualImp<CR>>(CR{}))
55 {}
56
58 const FiniteElementType& get(const Dune::GeometryType& gt) const
59 {
60 if (gt.isSimplex())
61 return *crBasis_;
62 else if (gt.isCube())
63 return *rtBasis_;
64 else
65 DUNE_THROW(Dune::NotImplemented,
66 "Non-conforming local finite element for geometry type " << gt
67 );
68 }
69
70private:
71 std::unique_ptr<FiniteElementType> rtBasis_;
72 std::unique_ptr<FiniteElementType> crBasis_;
73};
74
75} // end namespace Dumux
76
77#endif
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
Definition: deprecated.hh:149
Definition: nonconformingfecache.hh:41
Dune::LocalFiniteElementVirtualInterface< typename RT::Traits::LocalBasisType::Traits > FiniteElementType
Definition: nonconformingfecache.hh:50
NonconformingFECache()
Definition: nonconformingfecache.hh:52
const FiniteElementType & get(const Dune::GeometryType &gt) const
Get local finite element for given GeometryType.
Definition: nonconformingfecache.hh:58