Debian Codegraph @

include/deal.II/base/polynomials_bernardi_raugel.h

raw
1 // ------------------------------------------------------------------------
2 //
3 // SPDX-License-Identifier: LGPL-2.1-or-later
4 // Copyright (C) 2018 - 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
16 #ifndef dealii_polynomials_bernardi_raugel_h
17 #define dealii_polynomials_bernardi_raugel_h
18
19 #include <deal.II/base/config.h>
20
21 #include <deal.II/base/geometry_info.h>
22 #include <deal.II/base/point.h>
23 #include <deal.II/base/polynomial.h>
24 #include <deal.II/base/polynomial_space.h>
25 #include <deal.II/base/tensor.h>
26 #include <deal.II/base/tensor_polynomials_base.h>
27 #include <deal.II/base/tensor_product_polynomials.h>
28
29 #include <vector>
30
31 DEAL_II_NAMESPACE_OPEN
32
33
34 /**
35 * This class implements the Bernardi-Raugel polynomials similarly to the
36 * description in the <i>Mathematics of Computation</i> paper from 1985 by
37 * Christine Bernardi and Geneviève Raugel.
38 *
39 * The Bernardi-Raugel polynomials are originally defined as an enrichment
40 * of the $(P_1)^d$ elements on simplicial meshes for Stokes problems by the
41 * addition of bubble functions, yielding a locking-free finite element which
42 * is a subset of $(P_2)^d$ elements. This implementation is an enrichment of
43 * $(Q_1)^d$ elements which is a subset of $(Q_2)^d$ elements for
44 * quadrilateral and hexahedral meshes.
45 *
46 * The $BR_1$ bubble functions are defined to have magnitude 1 at the center
47 * of face $e_i$ and direction $\mathbf{n}_i$ normal to face $e_i$, and
48 * magnitude 0 on all other vertices and faces. Ordering is consistent with
49 * the face numbering in GeometryInfo. The vector $\mathbf{n}_i$ points in
50 * the positive axis direction and not necessarily normal to the element for
51 * consistent orientation across edges.
52 *<dl>
53 * <dt> 2d bubble functions (in order)
54 * <dd> $x=0$ edge: $\mathbf{p}_1 = \mathbf{n}_1 (1-x)(y)(1-y)$
55 *
56 * $x=1$ edge: $\mathbf{p}_2 = \mathbf{n}_2 (x)(y)(1-y)$
57 *
58 * $y=0$ edge: $\mathbf{p}_3 = \mathbf{n}_3 (x)(1-x)(1-y)$
59 *
60 * $y=1$ edge: $\mathbf{p}_4 = \mathbf{n}_4 (x)(1-x)(y)$
61 *
62 * <dt> 3d bubble functions (in order)
63 * <dd> $x=0$ edge: $\mathbf{p}_1 = \mathbf{n}_1 (1-x)(y)(1-y)(z)(1-z)$
64 *
65 * $x=1$ edge: $\mathbf{p}_2 = \mathbf{n}_2 (x)(y)(1-y)(z)(1-z)$
66 *
67 * $y=0$ edge: $\mathbf{p}_3 = \mathbf{n}_3 (x)(1-x)(1-y)(z)(1-z)$
68 *
69 * $y=1$ edge: $\mathbf{p}_4 = \mathbf{n}_4 (x)(1-x)(y)(z)(1-z)$
70 *
71 * $z=0$ edge: $\mathbf{p}_5 = \mathbf{n}_5 (x)(1-x)(y)(1-y)(1-z)$
72 *
73 * $z=1$ edge: $\mathbf{p}_6 = \mathbf{n}_6 (x)(1-x)(y)(1-y)(z)$
74 *
75 *</dl>
76 *
77 * Then the $BR_1(E)$ polynomials are defined on quadrilaterals and hexahedra
78 * by $BR_1(E) = Q_1(E) \oplus \mbox{span}\{\mathbf{p}_i, i=1,...,2d\}$.
79 *
80 *
81 * @ingroup Polynomials
82 */
83 template <int dim>
84 class PolynomialsBernardiRaugel : public TensorPolynomialsBase<dim>
85 {
86 public:
87 /**
88 * Constructor. Creates all basis functions for Bernardi-Raugel polynomials
89 * of given degree.
90 *
91 * @arg k The degree of the Bernardi-Raugel-space, which is currently
92 * limited to the case <tt>k=1</tt>.
93 */
94 PolynomialsBernardiRaugel(const unsigned int k);
95
96 /**
97 * Return the name of the space, which is <tt>BernardiRaugel</tt>.
98 */
99 std::string
100 name() const override;
101
102 /**
103 * Compute the value and derivatives of each Bernardi-Raugel
104 * polynomial at @p unit_point.
105 *
106 * The size of the vectors must either be zero or equal <tt>n()</tt>. In
107 * the first case, the function will not compute these values.
108 */
109 void
110 evaluate(const Point<dim> &unit_point,
111 std::vector<Tensor<1, dim>> &values,
112 std::vector<Tensor<2, dim>> &grads,
113 std::vector<Tensor<3, dim>> &grad_grads,
114 std::vector<Tensor<4, dim>> &third_derivatives,
115 std::vector<Tensor<5, dim>> &fourth_derivatives) const override;
116
117 /**
118 * Return the number of polynomials in the space <tt>BR(degree)</tt> without
119 * requiring to build an object of PolynomialsBernardiRaugel. This is
120 * required by the FiniteElement classes.
121 */
122 static unsigned int
123 n_polynomials(const unsigned int k);
124
125 /**
126 * @copydoc TensorPolynomialsBase::clone()
127 */
128 virtual std::unique_ptr<TensorPolynomialsBase<dim>>
129 clone() const override;
130
131 private:
132 /**
133 * An object representing the polynomial space of Q
134 * functions which forms the <tt>BR</tt> polynomials through
135 * outer products of these with the corresponding unit ijk
136 * vectors.
137 */
138 const AnisotropicPolynomials<dim> polynomial_space_Q;
139
140 /**
141 * An object representing the polynomial space of bubble
142 * functions which forms the <tt>BR</tt> polynomials through
143 * outer products of these with the corresponding normals.
144 */
145 const AnisotropicPolynomials<dim> polynomial_space_bubble;
146
147 /**
148 * A static member function that creates the polynomial space we use to
149 * initialize the #polynomial_space_Q member variable.
150 */
151 static std::vector<std::vector<Polynomials::Polynomial<double>>>
152 create_polynomials_Q();
153
154 /**
155 * A static member function that creates the polynomial space we use to
156 * initialize the #polynomial_space_bubble member variable.
157 */
158 static std::vector<std::vector<Polynomials::Polynomial<double>>>
159 create_polynomials_bubble();
160 };
161
162
163 template <int dim>
164 inline std::string
165 PolynomialsBernardiRaugel<dim>::name() const
166 {
167 return "BernardiRaugel";
168 }
169
170
171 DEAL_II_NAMESPACE_CLOSE
172
173 #endif