Debian Codegraph @

include/deal.II/base/polynomials_hermite.h

raw
1 // ------------------------------------------------------------------------
2 //
3 // SPDX-License-Identifier: LGPL-2.1-or-later
4 // Copyright (C) 2023 - 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
16
17 #ifndef dealii_polynomials_hermite_h
18 #define dealii_polynomials_hermite_h
19
20 #include <deal.II/base/config.h>
21
22 #include <deal.II/base/enable_observer_pointer.h>
23 #include <deal.II/base/exceptions.h>
24 #include <deal.II/base/point.h>
25 #include <deal.II/base/polynomial.h>
26
27 #include <vector>
28
29
30
31 DEAL_II_NAMESPACE_OPEN
32
33 /**
34 * @addtogroup Polynomials
35 * @{
36 */
37
38 namespace Polynomials
39 {
40 /**
41 * This class implements Hermite interpolation polynomials (see
42 * @cite CiarletRiavart1972interpolation) enforcing the maximum
43 * possible level of regularity $r$ in the FEM basis given a
44 * polynomial degree of $2r+1$. The polynomials all represent
45 * either a non-zero shape value or derivative at $x=0$ and $x=1$
46 * on the reference interval $x \in [0,1]$.
47 *
48 * Indices $j = 0, 1, \dots, r$ refer to polynomials corresponding
49 * to a non-zero derivative (or shape value for $j=0$) of
50 * order $j$ at $x=0$, and indices $j = r+1, r+2, \dots, 2r+1$
51 * refer to polynomials with a non-zero derivative of order
52 * $j-(r+1)$ (or value for $j=r+1$) at $x=1$. In particular, the
53 * $0^{th}$ function has a value of $1$ at $x=0$, and the
54 * $(r+1)^{th}$ function has a value of $1$ at $x=1$.The basis is
55 * rescaled such that a function corresponding to a non-zero $j^{th}$
56 * derivative has derivative value $j! 4^{j}$ at the corresponding
57 * node. This is done to prevent the $L^{2}$-norm of the basis functions
58 * from reducing exponentially with the chosen regularity.
59 */
60 class PolynomialsHermite : public Polynomial<double>
61 {
62 public:
63 /**
64 * Constructor for an individual Hermite polynomial. We write $f_{j}$
65 * for a polynomial that has a non-zero $j^{th}$ derivative at $x=0$
66 * and $g_{j}$ for a polynomial with a non-zero $j^{th}$ derivative
67 * at $x=1$, meaning $f_{j}$ will have @p index $=j$ and $g_{j}$ will
68 * have @p index $= j + \mathtt{regularity} + 1$. The resulting
69 * polynomials will be degree $2\times \mathtt{regularity} +1$
70 * and obey the following conditions:
71 * @f{align*}{
72 * &\begin{matrix}
73 * \left. \frac{d^{i}}{dx^{i}} f_{j}(x) \right\vert_{x=0}
74 * = i! 4^{i} \delta_{i, j}, \hfill
75 * &\qquad \hfill 0 \leq i \leq \mathtt{regularity}, \\
76 * \left. \frac{d^{i}}{dx^{i}} f_{j}(x) \right\vert_{x=1}
77 * = 0, \hfill &\qquad \hfill 0 \leq i \leq \mathtt{regularity},
78 * \end{matrix} \qquad 0 \leq j \leq \mathtt{regularity}, \\
79 * &\begin{matrix}
80 * \left. \frac{d^{i}}{dx^{i}} g_{j}(x) \right\vert_{x=0}
81 * = 0, \hfill &\qquad \hfill 0 \leq i \leq \mathtt{regularity}, \\
82 * \left. \frac{d^{i}}{dx^{i}} g_{j}(x) \right\vert_{x=1}
83 * = i! 4^{i} \delta_{i, j}, \hfill
84 * &\qquad \hfill 0 \leq i \leq \mathtt{regularity},
85 * \end{matrix} \qquad 0 \leq j \leq \mathtt{regularity},
86 * @f}
87 * where $\delta_{i,j}$ is equal to $1$ whenever $i=j$,
88 * and equal to $0$ otherwise. These polynomials have explicit
89 * formulas given by
90 * @f{align*}{
91 * f_{j}(x) &= 4^{j} x^{j} (1-x)^{\mathtt{regularity}+1}
92 * \sum_{k=0}^{\mathtt{regularity} - j} \;^{\mathtt{regularity} + k} C_{k}
93 * x^{k}, \\ g_{j}(x) &= 4^{j} x^{\mathtt{regularity}+1} (x-1)^{j}
94 * \sum_{k=0}^{\mathtt{regularity} - j} \;^{\mathtt{regularity} + k} C_{k}
95 * (1-x)^{k},
96 * @f}
97 * where $^{n} C_{r} = \frac{n!}{r!(n-r)!}$ is the $r^{th}$ binomial
98 * coefficient of degree $n, \; 0 \leq r \leq n$.
99 *
100 * @param regularity The highest derivative for which the basis
101 * is used to enforce regularity.
102 * @param index The local index of the generated polynomial in the
103 * Hermite basis.
104 */
105 PolynomialsHermite(const unsigned int regularity, const unsigned int index);
106
107 /**
108 * This function generates a vector of Polynomial objects
109 * representing a complete basis of degree $2\times\mathtt{regularity} +1$
110 * on the reference interval $[0,1]$.
111 *
112 * @param regularity The generated basis can be used to strongly
113 * enforce continuity in all derivatives up to and including this
114 * order.
115 */
116 static std::vector<Polynomial<double>>
117 generate_complete_basis(const unsigned int regularity);
118
119 protected:
120 /**
121 * Degree of the polynomial basis being used.
122 */
123 unsigned int degree;
124
125 /**
126 * The order of the highest derivative in which the Hermite
127 * basis can be used to impose continuity across element
128 * boundaries. It's related to the degree $p$ by
129 * $p = 2 \times\mathtt{regularity} +1$.
130 */
131 unsigned int regularity;
132
133 /**
134 * This variable stores the derivative that the shape function
135 * corresponds to at the element boundary given by <code>side</code>.
136 */
137 unsigned int side_index;
138
139 /**
140 * This stores whether the shape function corresponds to a non-zero
141 * value or derivative at $x=0$ on the reference interval
142 * ($\mathtt{side} =0$) or at $x=1$ ($\mathtt{side} =1$).
143 */
144 unsigned int side;
145 };
146 } // namespace Polynomials
147 /** @} */
148
149 DEAL_II_NAMESPACE_CLOSE
150
151 #endif