| 1 |
// ------------------------------------------------------------------------ |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 4 |
// Copyright (C) 2003 - 2024 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_abf_h |
| 16 |
#define dealii_fe_abf_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_abf.h> |
| 23 |
#include <deal.II/base/table.h> |
| 24 |
#include <deal.II/base/tensor_product_polynomials.h> |
| 25 |
|
| 26 |
#include <deal.II/fe/fe.h> |
| 27 |
#include <deal.II/fe/fe_poly_tensor.h> |
| 28 |
|
| 29 |
#include <vector> |
| 30 |
|
| 31 |
DEAL_II_NAMESPACE_OPEN |
| 32 |
|
| 33 |
|
| 34 |
/** |
| 35 |
* @addtogroup fe |
| 36 |
* @{ |
| 37 |
*/ |
| 38 |
|
| 39 |
/** |
| 40 |
* Implementation of Arnold-Boffi-Falk (ABF) elements, conforming with the |
| 41 |
* space H<sup>div</sup>. These elements generate vector fields with normal |
| 42 |
* components continuous between mesh cells. |
| 43 |
* |
| 44 |
* These elements are based on an article from Arnold, Boffi and Falk: |
| 45 |
* Quadrilateral H(div) finite elements, SIAM J. Numer. Anal. Vol.42, No.6, |
| 46 |
* pp.2429-2451 |
| 47 |
* |
| 48 |
* In this article, the authors demonstrate that the usual RT elements and |
| 49 |
* also BDM and other proposed finite dimensional subspaces of H(div) do not |
| 50 |
* work properly on arbitrary FE grids. I.e. the convergence rates deteriorate |
| 51 |
* on these meshes. As a solution the authors propose the ABF elements, which |
| 52 |
* are implemented in this class. |
| 53 |
* |
| 54 |
* This class is not implemented for the codimension one case (<tt>spacedim != |
| 55 |
* dim</tt>). |
| 56 |
* |
| 57 |
* @todo Even if this element is implemented for two and three space |
| 58 |
* dimensions, the definition of the node values relies on consistently |
| 59 |
* oriented faces in 3d. Therefore, care should be taken on complicated |
| 60 |
* meshes. |
| 61 |
* |
| 62 |
* <h3>Interpolation</h3> |
| 63 |
* |
| 64 |
* The |
| 65 |
* @ref GlossInterpolation "interpolation" |
| 66 |
* operators associated with the RT element are constructed such that |
| 67 |
* interpolation and computing the divergence are commuting operations. We |
| 68 |
* require this from interpolating arbitrary functions as well as the |
| 69 |
* #restriction matrices. It can be achieved by two interpolation schemes, |
| 70 |
* the simplified one in FE_RaviartThomasNodal and the original one here: |
| 71 |
* |
| 72 |
* <h4>Node values on edges/faces</h4> |
| 73 |
* |
| 74 |
* On edges or faces, the |
| 75 |
* @ref GlossNodes "node values" |
| 76 |
* are the moments of the normal component of the interpolated function with |
| 77 |
* respect to the traces of the RT polynomials. Since the normal trace of the |
| 78 |
* RT space of degree <i>k</i> on an edge/face is the space |
| 79 |
* <i>Q<sub>k</sub></i>, the moments are taken with respect to this space. |
| 80 |
* |
| 81 |
* <h4>Interior node values</h4> |
| 82 |
* |
| 83 |
* Higher order RT spaces have interior nodes. These are moments taken with |
| 84 |
* respect to the gradient of functions in <i>Q<sub>k</sub></i> on the cell |
| 85 |
* (this space is the matching space for RT<sub>k</sub> in a mixed |
| 86 |
* formulation). |
| 87 |
* |
| 88 |
* <h4>Generalized support points</h4> |
| 89 |
* |
| 90 |
* The node values above rely on integrals, which will be computed by |
| 91 |
* quadrature rules themselves. The generalized support points are a set of |
| 92 |
* points such that this quadrature can be performed with sufficient accuracy. |
| 93 |
* The points needed are those of QGauss<sub>k+1</sub> on each face as well as |
| 94 |
* QGauss<sub>k</sub> in the interior of the cell (or none for |
| 95 |
* RT<sub>0</sub>). See the |
| 96 |
* @ref GlossGeneralizedSupport "glossary entry on generalized support points" |
| 97 |
* for more information. |
| 98 |
*/ |
| 99 |
template <int dim> |
| 100 |
class FE_ABF : public FE_PolyTensor<dim> |
| 101 |
{ |
| 102 |
public: |
| 103 |
/** |
| 104 |
* Constructor for the ABF element of degree @p p. |
| 105 |
*/ |
| 106 |
FE_ABF(const unsigned int p); |
| 107 |
|
| 108 |
/** |
| 109 |
* Return a string that uniquely identifies a finite element. This class |
| 110 |
* returns <tt>FE_ABF<dim>(degree)</tt>, with @p dim and @p degree replaced |
| 111 |
* by appropriate values. |
| 112 |
*/ |
| 113 |
virtual std::string |
| 114 |
get_name() const override; |
| 115 |
|
| 116 |
/** |
| 117 |
* This function returns @p true, if the shape function @p shape_index has |
| 118 |
* non-zero function values somewhere on the face @p face_index. |
| 119 |
* |
| 120 |
* Right now, this is only implemented for RT0 in 1d. Otherwise, returns |
| 121 |
* always @p true. |
| 122 |
*/ |
| 123 |
virtual bool |
| 124 |
has_support_on_face(const unsigned int shape_index, |
| 125 |
const unsigned int face_index) const override; |
| 126 |
|
| 127 |
// documentation inherited from the base class |
| 128 |
virtual void |
| 129 |
convert_generalized_support_point_values_to_dof_values( |
| 130 |
const std::vector<Vector<double>> &support_point_values, |
| 131 |
std::vector<double> &nodal_values) const override; |
| 132 |
|
| 133 |
virtual std::size_t |
| 134 |
memory_consumption() const override; |
| 135 |
|
| 136 |
virtual std::unique_ptr<FiniteElement<dim, dim>> |
| 137 |
clone() const override; |
| 138 |
|
| 139 |
private: |
| 140 |
/** |
| 141 |
* The order of the ABF element. The lowest order elements are usually |
| 142 |
* referred to as RT0, even though their shape functions are piecewise |
| 143 |
* quadratics. |
| 144 |
*/ |
| 145 |
const unsigned int rt_order; |
| 146 |
|
| 147 |
/** |
| 148 |
* Only for internal use. Its full name is @p get_dofs_per_object_vector |
| 149 |
* function and it creates the @p dofs_per_object vector that is needed |
| 150 |
* within the constructor to be passed to the constructor of @p |
| 151 |
* FiniteElementData. |
| 152 |
*/ |
| 153 |
static std::vector<unsigned int> |
| 154 |
get_dpo_vector(const unsigned int degree); |
| 155 |
|
| 156 |
/** |
| 157 |
* Initialize the @p generalized_support_points field of the FiniteElement |
| 158 |
* class and fill the tables with interpolation weights (#boundary_weights |
| 159 |
* and #interior_weights). Called from the constructor. |
| 160 |
* |
| 161 |
* See the |
| 162 |
* @ref GlossGeneralizedSupport "glossary entry on generalized support points" |
| 163 |
* for more information. |
| 164 |
*/ |
| 165 |
void |
| 166 |
initialize_support_points(const unsigned int rt_degree); |
| 167 |
|
| 168 |
/** |
| 169 |
* Initialize the interpolation from functions on refined mesh cells onto |
| 170 |
* the parent cell. According to the philosophy of the Raviart-Thomas |
| 171 |
* element, this restriction operator preserves the divergence of a function |
| 172 |
* weakly. |
| 173 |
*/ |
| 174 |
void |
| 175 |
initialize_restriction(); |
| 176 |
|
| 177 |
/** |
| 178 |
* Fields of cell-independent data. |
| 179 |
* |
| 180 |
* For information about the general purpose of this class, see the |
| 181 |
* documentation of the base class. |
| 182 |
*/ |
| 183 |
class InternalData : public FiniteElement<dim>::InternalDataBase |
| 184 |
{ |
| 185 |
public: |
| 186 |
/** |
| 187 |
* Array with shape function values in quadrature points. There is one row |
| 188 |
* for each shape function, containing values for each quadrature point. |
| 189 |
* Since the shape functions are vector-valued (with as many components as |
| 190 |
* there are space dimensions), the value is a tensor. |
| 191 |
* |
| 192 |
* In this array, we store the values of the shape function in the |
| 193 |
* quadrature points on the unit cell. The transformation to the real |
| 194 |
* space cell is then simply done by multiplication with the Jacobian of |
| 195 |
* the mapping. |
| 196 |
*/ |
| 197 |
std::vector<std::vector<Tensor<1, dim>>> shape_values; |
| 198 |
|
| 199 |
/** |
| 200 |
* Array with shape function gradients in quadrature points. There is one |
| 201 |
* row for each shape function, containing values for each quadrature |
| 202 |
* point. |
| 203 |
* |
| 204 |
* We store the gradients in the quadrature points on the unit cell. We |
| 205 |
* then only have to apply the transformation (which is a matrix-vector |
| 206 |
* multiplication) when visiting an actual cell. |
| 207 |
*/ |
| 208 |
std::vector<std::vector<Tensor<2, dim>>> shape_gradients; |
| 209 |
}; |
| 210 |
|
| 211 |
/** |
| 212 |
* These are the factors multiplied to a function in the |
| 213 |
* #generalized_face_support_points when computing the integration. They are |
| 214 |
* organized such that there is one row for each generalized face support |
| 215 |
* point and one column for each degree of freedom on the face. |
| 216 |
*/ |
| 217 |
Table<2, double> boundary_weights; |
| 218 |
/** |
| 219 |
* Precomputed factors for interpolation of interior degrees of freedom. The |
| 220 |
* rationale for this Table is the same as for #boundary_weights. Only, this |
| 221 |
* table has a third coordinate for the space direction of the component |
| 222 |
* evaluated. |
| 223 |
*/ |
| 224 |
Table<3, double> interior_weights; |
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
/** |
| 229 |
* These are the factors multiplied to a function in the |
| 230 |
* #generalized_face_support_points when computing the integration. They are |
| 231 |
* organized such that there is one row for each generalized face support |
| 232 |
* point and one column for each degree of freedom on the face. |
| 233 |
*/ |
| 234 |
Table<2, double> boundary_weights_abf; |
| 235 |
/** |
| 236 |
* Precomputed factors for interpolation of interior degrees of freedom. The |
| 237 |
* rationale for this Table is the same as for #boundary_weights. Only, this |
| 238 |
* table has a third coordinate for the space direction of the component |
| 239 |
* evaluated. |
| 240 |
*/ |
| 241 |
Table<3, double> interior_weights_abf; |
| 242 |
|
| 243 |
/** |
| 244 |
* Initialize the permutation pattern and the pattern of sign change. |
| 245 |
* |
| 246 |
* @note This function is not fully filled with the correct implementation |
| 247 |
* yet. It needs to be consistently implemented in a future release to work |
| 248 |
* on meshes that contain cells with flipped faces. |
| 249 |
*/ |
| 250 |
void |
| 251 |
initialize_quad_dof_index_permutation_and_sign_change(); |
| 252 |
|
| 253 |
// Allow access from other dimensions. |
| 254 |
template <int dim1> |
| 255 |
friend class FE_ABF; |
| 256 |
}; |
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
/** @} */ |
| 261 |
|
| 262 |
|
| 263 |
DEAL_II_NAMESPACE_CLOSE |
| 264 |
|
| 265 |
#endif |