forked from cedrict/fieldstone
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbernstein.tex
More file actions
200 lines (167 loc) · 7.76 KB
/
Copy pathbernstein.tex
File metadata and controls
200 lines (167 loc) · 7.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
\begin{flushright} {\tiny {\color{gray} bernstein.tex}} \end{flushright}
The $n+1$ Bernstein basis polynomials of degree $n$ on the interval $[0,1]$
are defined as \footnote{\url{https://en.wikipedia.org/wiki/Bernstein_polynomial}}
\index{general}{Bernstein Polynomials}
\[
b_{m,n}(x) = \left( \begin{array}{c} n \\ m \end{array}\right) x^m(1-x)^{n-m}
\qquad m=0,1,...n
\]
The first few Bernstein polynomials are
\begin{eqnarray}
b_{0,0}(x) &=& 1 \\
b_{0,1}(x) &=& 1-x \nn\\
b_{1,1}(x) &=& x \\
b_{0,2}(x) &=& (1-x)^2 \nn\\
b_{1,2}(x) &=& 2x(1-x) \nn\\
b_{2,2}(x) &=& x^2
\end{eqnarray}
\includegraphics[width=5cm]{images/bernstein/b0.pdf}
\includegraphics[width=5cm]{images/bernstein/b1.pdf}
\includegraphics[width=5cm]{images/bernstein/b2.pdf}
We see that the zero-th and first order polynomials are the same as the linear basis functions defined in
Section~\ref{sec:elts1D}. However the second order polynomials (and higher) differ from the second-order
basis functions.
Also, the Bernstein polynomials have a lot of properties, but one that is of importance to us
is the following: $b_{m,n}(x) \geq 0 \quad \forall x\in [0,1]$, i.e. the polynomials
are positive. This is however not true for basis functions for $n\geq 2$.
Another important property shared with basis functions is that their sum over the interval is
exactly 1, i.e. $\sum_m b_{m,n}(x)=1$.
In order to facilitate the comparison between the 2nd-order basis functions and Bernstein
polynomials, I will express the latter as a function of the reduced coordinate
$r\in[-1,1]=2(x-1/2)$ (or $x=(r+1)/2$). We have then:
\begin{eqnarray}
b_{0,2}(r) &=& \frac{1}{4}(1-r)^2 \nn\\
b_{1,2}(r) &=& \frac{1}{2}(1-r^2) \nn\\
b_{2,2}(r) &=& \frac{1}{4}(1+r)^2
\end{eqnarray}
Both 2nd-order Bernstein polynomials and basis functions are plotted here under:
\begin{center}
\includegraphics[width=7cm]{images/bernstein/b2_.pdf}
\includegraphics[width=7cm]{images/bernstein/N2_.pdf}\\
{\captionfont Left: Second-order Bernstein polynomials; right: 2nd-order basis functions.}
\end{center}
Having reached this point, the burning question is why should we care?
\paragraph{Example 1}
In order to answer this question, let us carry out the following
experiment: each node $i$ in the element carries a field value $f_i$ and for simplicity,
we choose $f_0=f(r=-1)=1$, $f_1=f(r=0)=0$, $f_2=f(r=+1)=0$.
Then, we can compute the value of the field inside of the element
as we usually do in the FE methodology:
\[
f^h(r) = \sum_{i=0}^2 f_i N_i(r) = f_0 N_0(r) = N_0(r) = \frac{1}{2}r(r-1)
\]
This means that although the field $f$ is always positive (or null) inside the element
its representation with the basis functions is negative over half (!) of the element
(see purple curve on the right panel above).
If we now turn to the Bernstein polynomials:
\[
f^h(r) = \sum_{i=0}^2 b_{i,2} = b_{0,2} = \frac{1}{4}(1-r)^2
\]
which is {\it always} positive over the interval $[-1,+1]$,
and looking at the purple curve on the left panel above,
we see that the value decreases monotonously when we go away from node 1, and reaches
zero at the other end of the element.
Also:
\[
\text{Shape function: } \int_{-1}^{+1} f^h(r)dr = \int_{-1}^{+1} \frac{1}{2}r(r-1) dr = \frac{1}{3}
\]
\[
\text{Bernstein polynomial: } \int_{-1}^{+1} f^h(r)dr = \int_{-1}^{+1} \frac{1}{4}(1-r)^2 dr= \frac{2}{3}
\]
Analytical value for the integral can be obtained by splitting the integral as $\int_{-1}^0 + \int_0^{+1}$.
The left part can be represented by a line of equation $-r$ and the right part simply by 0, so that the
integral is equal to 1/2. We then see that the Shape function-based interpolation underestimates
the integral while the Bernstein polynomial-based interpolation overestimates it.
\paragraph{Example 2}
We now choose $f_0=f(r=-1)=1$, $f_1=f(r=1)=0$, $f_2=f(r=+1)=0$. Then
\[
f^h(r) = \sum_{i=0}^2 f_i N_i(r) = f_0 N_0(r) f(1) N_1(r)
= N_0(r) + N_1(r) = \frac{1}{2}r(r-1) + 1-r^2 = -\frac{1}{2}r^2 -\frac{1}{2}r +1
\]
Looking now at the Bernstein polynomials:
\[
f^h(r) = \sum_{i=0}^2 b_{i,2} = b_{0,2} + b_{1,2} = \frac{1}{4}(1-r)^2 + \frac{1}{2}(1-r^2)
= -\frac{1}{4}r^2-\frac{1}{2}r+\frac{3}{4}
\]
If we now plot both approximations:
\begin{center}
\includegraphics[width=7cm]{images/bernstein/N2__.pdf}
\end{center}
We see that in this case the basis function-based approximation yields values
above 1 over half of the element while the Bernstein polynomial-based
approximation remains between 0 and 1 as expected.
\paragraph{Approximation of polynomials}
Let us now explore another aspect of such an interpolation based on the Bernstein polynomials
and assume that $f(r)=C$. Then
\[
f^h(r) = \sum_{i=0}^2 f_i b_{i,2}(r) = C \sum_{i=0}^2 b_{i,2}(r) = C \cdot 1 = C
\]
Such interpolation can exactly represent a constant field.
Let us assume that $f(r)=ar+b$. Then
\begin{eqnarray}
f^h(r)
&=& \sum_{i=0}^2 f(r_i) b_{i,2}(r) \nn\\
&=& \sum_{i=0}^2 (ar_i+b) b_{i,2}(r) \nn\\
&=& a\sum_{i=0}^2 r_i b_{i,2}(r) + b \sum_{i=1}^3 b_{i,2}(r) \nn\\
&=& a (-b_{0,2}(r)+b_{2,2}(r)) + b \cdot 1 \nn\\
&=& ar+b
\end{eqnarray}
Such interpolation can exactly represent a linear field.
Let us assume that $f(r)=ar^2+br+c$. Then
\begin{eqnarray}
f^h(r)
&=& \sum_{i=0}^2 f(r_i) b_{i,2}(r) \nn \\
&=& \sum_{i=0}^2 (ar^2+br+c) b_{i,2}(r) \nn\\
&=& \sum_{i=0}^2 r_i^2 b_{i,2}(r) + b \sum_{i=0}^2 r_i b_{i,2}(r) + c \sum_{i=0}^2 b_{i,2}(r) \nn\\
&=& a\sum_{i=0}^2 r_i^2 b_{i,2}(r) + br + c \nn\\
&=& a (b_{0,2}(r) + b_{2,2}(r)) + br + c \nn\\
&=& a\frac{1}{2}(1+r^2) + br + c
\end{eqnarray}
which is not equal to $f(r)$.
On the other hand it is trivial to show that
\begin{eqnarray}
f^h(r)
&=& \sum_{i=0}^2 f(r_i) N_i(r) \nn \\
&=& \sum_{i=0}^2 (ar_i^2+br_i+c) N_i(r) \nn \\
&=& a \sum_{i=0}^2 r_i^2 N_i(r) + b \sum_{i=0}^2 r_i N_i(r) + c \sum_{i=0}^2 N_i(r) \nn \\
&=& a \sum_{i=0}^2 r_i^2 N_i(r) + b \sum_{i=0}^2 r_i N_i(r) + c \nn\\
&=& a (N_0(r)+N_2(r)) + b (-N_0(r) +N_2(r)) + c \nn\\
&=& a r^2 + b r+ c
\end{eqnarray}
To hammer the point once more: let $f(r)=r^2+r+1$.
Then
\begin{eqnarray}
f^h_{Q_1}
&=& f(-1) \frac{1}{2}(1-r) + f(+1) \frac{1}{2}(1+r) \nn\\
&=& \frac{1}{2}(1-r) + 3 \frac{1}{2}(1+r) \nn\\
&=& 2-r \\
f^h_{Q_2} &=& r^2+r+1 \\
f^h_{B_2} &=& \frac{1}{2} (1+r^2)+r+1
\end{eqnarray}
We see on the following figure that although Bernstein polynomials cannot
represent $f(r)$ exactly they still do a better job than first order basis functions
($Q_1$ projection).
\begin{center}
\includegraphics[width=7cm]{images/bernstein/hammer.pdf}
\end{center}
As a conclusion there is a trade-off: 2nd-order Bernstein polynomials {\it always} yield positive
values when the field is positive (as opposed to 2nd-order basis functions) but they cannot
represent exactly a 2nd-order polynomial field (while basis functions can).
The positivity can be really critical in geodynamical simulations: a negative density makes no sense,
and a negative viscosity even less!
The 2nd-order Bernstein polynomials are used in Stone \ref{f64}. The actual context of this stone is not
important. Fields such as density and viscosity are known on the
9 nodes of the $Q_2$ element and need to be projected onto the 9 quadrature points.
For instance, these nodal fields are given by:
\begin{center}
\includegraphics[width=7cm]{images/bernstein/rhonodal.png}
\includegraphics[width=7cm]{images/bernstein/etaeffnodal.png}
\end{center}
The resulting fields on the quadrature points are shown:
\begin{center}
\includegraphics[width=7cm]{images/bernstein/qrho.png}
\includegraphics[width=7cm]{images/bernstein/qetaeff.png}
\end{center}
The bottom row is obtained with the basis functions while the top row is obtained with the Bernstein
polynomials as interpolants. The thin blue line actually indicated points with negative viscosity and
on the left the colour bar shows densities below the value of 1890 (lowest density in the domain).