| 1 |
// ------------------------------------------------------------------------ |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 4 |
// Copyright (C) 2010 - 2023 by the deal.II authors |
| 5 |
// |
| 6 |
// This file is part of the deal.II library. |
| 7 |
// |
| 8 |
// Part of the source code is dual licensed under Apache-2.0 WITH |
| 9 |
// LLVM-exception OR LGPL-2.1-or-later. Detailed license information |
| 10 |
// governing the source code and code contributions can be found in |
| 11 |
// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II. |
| 12 |
// |
| 13 |
// ------------------------------------------------------------------------ |
| 14 |
|
| 15 |
#ifndef dealii_fe_dg_vector_h |
| 16 |
#define dealii_fe_dg_vector_h |
| 17 |
|
| 18 |
#include <deal.II/base/config.h> |
| 19 |
|
| 20 |
#include <deal.II/base/geometry_info.h> |
| 21 |
#include <deal.II/base/polynomial.h> |
| 22 |
#include <deal.II/base/polynomials_bdm.h> |
| 23 |
#include <deal.II/base/polynomials_nedelec.h> |
| 24 |
#include <deal.II/base/polynomials_raviart_thomas.h> |
| 25 |
#include <deal.II/base/table.h> |
| 26 |
#include <deal.II/base/tensor_product_polynomials.h> |
| 27 |
|
| 28 |
#include <deal.II/fe/fe.h> |
| 29 |
#include <deal.II/fe/fe_poly_tensor.h> |
| 30 |
|
| 31 |
#include <vector> |
| 32 |
|
| 33 |
DEAL_II_NAMESPACE_OPEN |
| 34 |
|
| 35 |
/** |
| 36 |
* DG elements based on vector valued polynomials. |
| 37 |
* |
| 38 |
* These elements use vector valued polynomial spaces as they have been |
| 39 |
* introduced for H<sup>div</sup> and H<sup>curl</sup> conforming finite |
| 40 |
* elements, but do not use the usual continuity of these elements. Thus, they |
| 41 |
* are suitable for DG and hybrid formulations involving these function |
| 42 |
* spaces. |
| 43 |
* |
| 44 |
* The template argument <tt>PolynomialType</tt> refers to a vector valued |
| 45 |
* polynomial space like PolynomialsRaviartThomas or PolynomialsNedelec. Note |
| 46 |
* that the dimension of the polynomial space and the argument <tt>dim</tt> |
| 47 |
* must coincide. |
| 48 |
* |
| 49 |
* @ingroup febase |
| 50 |
*/ |
| 51 |
template <typename PolynomialType, int dim, int spacedim = dim> |
| 52 |
class FE_DGVector : public FE_PolyTensor<dim, spacedim> |
| 53 |
{ |
| 54 |
public: |
| 55 |
/** |
| 56 |
* Constructor for the vector element of degree @p p. |
| 57 |
*/ |
| 58 |
FE_DGVector(const unsigned int p, MappingKind m); |
| 59 |
|
| 60 |
/** |
| 61 |
* Return a string that uniquely identifies a finite element. This class |
| 62 |
* returns `FE_DGVector_` plus a piece of the name that is taken from what |
| 63 |
* the polynomial object returns, plus `<dim>(degree)`, with @p dim and @p degree |
| 64 |
* replaced by appropriate values. |
| 65 |
*/ |
| 66 |
virtual std::string |
| 67 |
get_name() const override; |
| 68 |
|
| 69 |
virtual std::unique_ptr<FiniteElement<dim, spacedim>> |
| 70 |
clone() const override; |
| 71 |
|
| 72 |
/** |
| 73 |
* This function returns @p true, if the shape function @p shape_index has |
| 74 |
* non-zero function values somewhere on the face @p face_index. |
| 75 |
* |
| 76 |
* For this element, we always return @p true. |
| 77 |
*/ |
| 78 |
virtual bool |
| 79 |
has_support_on_face(const unsigned int shape_index, |
| 80 |
const unsigned int face_index) const override; |
| 81 |
|
| 82 |
virtual std::size_t |
| 83 |
memory_consumption() const override; |
| 84 |
|
| 85 |
private: |
| 86 |
/** |
| 87 |
* Only for internal use. Its full name is @p get_dofs_per_object_vector |
| 88 |
* function and it creates the @p dofs_per_object vector that is needed |
| 89 |
* within the constructor to be passed to the constructor of @p |
| 90 |
* FiniteElementData. |
| 91 |
*/ |
| 92 |
static std::vector<unsigned int> |
| 93 |
get_dpo_vector(const unsigned int degree); |
| 94 |
|
| 95 |
/** |
| 96 |
* Fields of cell-independent data. |
| 97 |
* |
| 98 |
* For information about the general purpose of this class, see the |
| 99 |
* documentation of the base class. |
| 100 |
*/ |
| 101 |
class InternalData : public FiniteElement<dim>::InternalDataBase |
| 102 |
{ |
| 103 |
public: |
| 104 |
/** |
| 105 |
* Array with shape function values in quadrature points. There is one row |
| 106 |
* for each shape function, containing values for each quadrature point. |
| 107 |
* Since the shape functions are vector-valued (with as many components as |
| 108 |
* there are space dimensions), the value is a tensor. |
| 109 |
* |
| 110 |
* In this array, we store the values of the shape function in the |
| 111 |
* quadrature points on the unit cell. The transformation to the real |
| 112 |
* space cell is then simply done by multiplication with the Jacobian of |
| 113 |
* the mapping. |
| 114 |
*/ |
| 115 |
std::vector<std::vector<Tensor<1, dim>>> shape_values; |
| 116 |
|
| 117 |
/** |
| 118 |
* Array with shape function gradients in quadrature points. There is one |
| 119 |
* row for each shape function, containing values for each quadrature |
| 120 |
* point. |
| 121 |
* |
| 122 |
* We store the gradients in the quadrature points on the unit cell. We |
| 123 |
* then only have to apply the transformation (which is a matrix-vector |
| 124 |
* multiplication) when visiting an actual cell. |
| 125 |
*/ |
| 126 |
std::vector<std::vector<Tensor<2, dim>>> shape_gradients; |
| 127 |
}; |
| 128 |
Table<3, double> interior_weights; |
| 129 |
}; |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
/** |
| 134 |
* A vector-valued DG element based on the polynomials space of FE_Nedelec. |
| 135 |
* This class implements a "broken" finite element |
| 136 |
* space that is discontinuous between cells and on each cell has shape |
| 137 |
* functions that equal those of the Nedelec element. |
| 138 |
* |
| 139 |
* The related class FE_DGRaviartThomas is used in step-61. |
| 140 |
* @ingroup fe |
| 141 |
*/ |
| 142 |
template <int dim, int spacedim = dim> |
| 143 |
class FE_DGNedelec : public FE_DGVector<PolynomialsNedelec<dim>, dim, spacedim> |
| 144 |
{ |
| 145 |
public: |
| 146 |
/** |
| 147 |
* Constructor for the discontinuous Nédélec element of degree |
| 148 |
* @p p. |
| 149 |
*/ |
| 150 |
FE_DGNedelec(const unsigned int p); |
| 151 |
|
| 152 |
/** |
| 153 |
* Return a string that uniquely identifies a finite element. This class |
| 154 |
* returns <tt>FE_DGNedelec<dim>(degree)</tt>, with @p dim and @p degree |
| 155 |
* replaced by appropriate values. |
| 156 |
*/ |
| 157 |
virtual std::string |
| 158 |
get_name() const override; |
| 159 |
}; |
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
/** |
| 164 |
* A vector-valued DG element based on the polynomials space of |
| 165 |
* FE_RaviartThomas. This class implements a "broken" finite element |
| 166 |
* space that is discontinuous between cells and on each cell has shape |
| 167 |
* functions that equal those of the Raviart-Thomas element. |
| 168 |
* |
| 169 |
* The class is used in step-61. |
| 170 |
* |
| 171 |
* @ingroup fe |
| 172 |
*/ |
| 173 |
template <int dim, int spacedim = dim> |
| 174 |
class FE_DGRaviartThomas |
| 175 |
: public FE_DGVector<PolynomialsRaviartThomas<dim>, dim, spacedim> |
| 176 |
{ |
| 177 |
public: |
| 178 |
/** |
| 179 |
* Constructor for the Raviart-Thomas element of degree @p p. |
| 180 |
*/ |
| 181 |
FE_DGRaviartThomas(const unsigned int p); |
| 182 |
|
| 183 |
/** |
| 184 |
* Return a string that uniquely identifies a finite element. This class |
| 185 |
* returns <tt>FE_DGRaviartThomas<dim>(degree)</tt>, with @p dim and @p |
| 186 |
* degree replaced by appropriate values. |
| 187 |
*/ |
| 188 |
virtual std::string |
| 189 |
get_name() const override; |
| 190 |
}; |
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
/** |
| 195 |
* A vector-valued DG element based on the polynomials space of FE_BDM. |
| 196 |
* This class implements a "broken" finite element |
| 197 |
* space that is discontinuous between cells and on each cell has shape |
| 198 |
* functions that equal those of the BDM element. |
| 199 |
* |
| 200 |
* The related class FE_DGRaviartThomas is used in step-61. |
| 201 |
* |
| 202 |
* @ingroup fe |
| 203 |
*/ |
| 204 |
template <int dim, int spacedim = dim> |
| 205 |
class FE_DGBDM : public FE_DGVector<PolynomialsBDM<dim>, dim, spacedim> |
| 206 |
{ |
| 207 |
public: |
| 208 |
/** |
| 209 |
* Constructor for the discontinuous BDM element of degree @p p. |
| 210 |
*/ |
| 211 |
FE_DGBDM(const unsigned int p); |
| 212 |
|
| 213 |
/** |
| 214 |
* Return a string that uniquely identifies a finite element. This class |
| 215 |
* returns <tt>FE_DGBDM<dim>(degree)</tt>, with @p dim and @p degree |
| 216 |
* replaced by appropriate values. |
| 217 |
*/ |
| 218 |
virtual std::string |
| 219 |
get_name() const override; |
| 220 |
}; |
| 221 |
|
| 222 |
|
| 223 |
DEAL_II_NAMESPACE_CLOSE |
| 224 |
|
| 225 |
#endif |