Debian Codegraph @

include/deal.II/base/polynomials_rt_bubbles.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 #ifndef dealii_polynomials_rt_bubbles_h
16 #define dealii_polynomials_rt_bubbles_h
17
18
19 #include <deal.II/base/config.h>
20
21 #include <deal.II/base/exceptions.h>
22 #include <deal.II/base/point.h>
23 #include <deal.II/base/polynomial.h>
24 #include <deal.II/base/polynomials_raviart_thomas.h>
25 #include <deal.II/base/tensor.h>
26 #include <deal.II/base/tensor_polynomials_base.h>
27
28 #include <vector>
29
30 DEAL_II_NAMESPACE_OPEN
31
32 /**
33 * This class implements the <i>H<sup>div</sup></i>-conforming, vector-valued
34 * enhanced Raviart-Thomas polynomials.
35 *
36 * Similarly to the classical Raviart-Thomas space, the enhanced Raviart-Thomas
37 * polynomials are constructed such that the divergence is in the tensor product
38 * polynomial space <i>Q<sub>k-1</sub></i>.
39 *
40 * This space is of the form <i>V<sub>k</sub> = RT<sub>k-1</sub> +
41 * B<sub>k</sub></i>, where <i>B<sub>k</sub></i> is defined as follows:
42 * <dl>
43 * <dt> In 2d:</dt>
44 * <dd>
45 * @f{align*}{
46 * B_k^1(E) = \text{span}\left\{x^{a_1-1} y^{a_2}\begin{pmatrix} (a_2+1) x \\
47 * -a_1 y \end{pmatrix}\text{ : } a_2=k \right\} \\
48 * B_k^2(E) = \text{span}\left\{x^{b_1} y^{b_2-1}\begin{pmatrix} -b_2 x \\
49 * (b_1+1) y \end{pmatrix}\text{ : } b_1=k \right\}
50 * @f}
51 * </dd>
52 *
53 * <dt> In 3d: </dt>
54 * <dd>
55 * @f{align*}{
56 * B_k^1(E) = \text{span}\left\{x^{a_1-1} y^{a_2} z^{a_3}\begin{pmatrix}
57 * (a_2+a_3+2) x \\
58 * -a_1 y \\ -a_1 z \end{pmatrix}\text{ : } a_2=k \text{ or } a_3=k
59 * \right\},\\
60 * B_k^2(E) = \text{span}\left\{x^{b_1} y^{b_2-1} z^{b_3}\begin{pmatrix} -b_2
61 * x \\
62 * (b_1+b_3+2) y \\ -b_2 z \end{pmatrix}\text{ : } b_1=k \text{ or } b_3=k
63 * \right\},\\
64 * B_k^3(E) = \text{span}\left\{x^{c_1}y^{c_2}z^{c_3-1}\begin{pmatrix} -c_3 x
65 * \\ -c_3y \\ (c_1+c_2+2)z \end{pmatrix}\text{ : } c_1=k \text{ or } c_2=k
66 * \right\},
67 * @f}
68 * </dd>
69 * </dl>
70 * where $0 \le a_1, a_2, a_3 \le k$.
71 *
72 * @note Unlike the classical Raviart-Thomas space, the lowest order for the enhanced space
73 * is 1, similarly to the Brezzi-Douglas-Marini (BDM) polynomial space.
74 *
75 * The total dimension of the space <i>dim(V<sub>k</sub>) = d*(k+1)^d</i>, where
76 * <i>d</i> is the space dimension. This allows to associate shape functions
77 * with the Gauss-Lobatto quadrature points as shown in the figures below.
78 *
79 * <table> <tr> <td align="center">
80 * @image html rtbubbles.png
81 * </td></tr>
82 *
83 * <tr> <td align="center"> Left - $2d,\,k=3$,
84 * right - $3d,\,k=2$.</td></tr> </table>
85 *
86 * @ingroup Polynomials
87 */
88
89 template <int dim>
90 class PolynomialsRT_Bubbles : public TensorPolynomialsBase<dim>
91 {
92 public:
93 /**
94 * Constructor. Creates all basis functions for RT_bubbles polynomials of
95 * given degree.
96 */
97 PolynomialsRT_Bubbles(const unsigned int k);
98
99 /**
100 * Computes the value and the first and second derivatives of each RT_bubbles
101 * polynomial at @p unit_point.
102 *
103 * The size of the vectors must either be zero or equal <tt>n()</tt>. In
104 * the first case, the function will not compute these values.
105 */
106 void
107 evaluate(const Point<dim> &unit_point,
108 std::vector<Tensor<1, dim>> &values,
109 std::vector<Tensor<2, dim>> &grads,
110 std::vector<Tensor<3, dim>> &grad_grads,
111 std::vector<Tensor<4, dim>> &third_derivatives,
112 std::vector<Tensor<5, dim>> &fourth_derivatives) const override;
113
114 /**
115 * Return the name of the space, which is <tt>RT_Bubbles</tt>.
116 */
117 std::string
118 name() const override;
119
120 /**
121 * Return the number of polynomials in the space <tt>RT_Bubbles(degree)</tt>
122 * without requiring to build an object of PolynomialsRT-Bubbles. This is
123 * required by the FiniteElement classes.
124 */
125 static unsigned int
126 n_polynomials(const unsigned int degree);
127
128 /**
129 * @copydoc TensorPolynomialsBase::clone()
130 */
131 virtual std::unique_ptr<TensorPolynomialsBase<dim>>
132 clone() const override;
133
134 private:
135 /**
136 * An object representing the Raviart-Thomas part of the space
137 */
138 const PolynomialsRaviartThomas<dim> raviart_thomas_space;
139
140 /**
141 * Storage for monomials, we need all polynomials from degree zero
142 * to <i>k+1</i>.
143 */
144 std::vector<Polynomials::Polynomial<double>> monomials;
145 };
146
147
148 template <int dim>
149 inline std::string
150 PolynomialsRT_Bubbles<dim>::name() const
151 {
152 return "RT_bubbles";
153 }
154
155
156 DEAL_II_NAMESPACE_CLOSE
157
158 #endif