-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path4_function_spaces.html
326 lines (312 loc) · 27.6 KB
/
4_function_spaces.html
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
<!DOCTYPE html>
<html lang="en" data-content_root="./">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>4. Function spaces: associating data with meshes — Finite element course 2024.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=03e43079" />
<link rel="stylesheet" type="text/css" href="_static/fenics.css?v=7793b76c" />
<link rel="stylesheet" type="text/css" href="_static/proof.css" />
<link rel="stylesheet" type="text/css" href="_static/sphinx-design.min.css?v=95c83b7e" />
<script src="_static/documentation_options.js?v=7ff0cb77"></script>
<script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/proof.js"></script>
<script src="_static/design-tabs.js?v=36754332"></script>
<script async="async" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="5. Functions in finite element spaces" href="5_functions.html" />
<link rel="prev" title="3. Meshes" href="3_meshes.html" />
<!--[if lte IE 6]>
<link rel="stylesheet" href="_static/ie6.css" type="text/css" media="screen" charset="utf-8" />
<![endif]-->
<link rel="stylesheet" href="_static/featured.css">
<link rel="shortcut icon" href="_static/icon.ico" />
</head><body>
<div class="wrapper">
<a href="index.html"><img src="_static/banner.svg" width="900px" alt="FInAT Project Banner" /></a>
<div id="access">
<div class="menu">
<ul>
<li class="page_item"><a href="https://github.com/finite-element/finite-element-course" title="GitHub">GitHub</a></li>
</ul>
</div><!-- .menu -->
</div><!-- #access -->
</div><!-- #wrapper -->
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="function-spaces-associating-data-with-meshes">
<span id="secfunctionspaces"></span><h1><span class="section-number">4. </span>Function spaces: associating data with meshes<a class="headerlink" href="#function-spaces-associating-data-with-meshes" title="Link to this heading">¶</a></h1>
<p>A finite element space over a mesh is constructed by associating a
finite element with each cell of the mesh. We will refer to the basis
functions of this finite element space as <em>global</em> basis functions,
while those of the finite element itself we will refer to as <em>local</em>
basis functions. We can establish the relationship between the finite
element and each cell of the mesh by associating the nodes (and
therefore the local basis functions) of the finite element with the
topological entities of the mesh. This is a two stage process. First,
we associate the nodes of the finite element with the local
topological entities of the reference cell. This is often referred to
as <em>local numbering</em>. Then we associate the correct number of degrees
of freedom (i.e. number of basis functions) with each global mesh
entity. This is the <em>global numbering</em>.</p>
<section id="local-numbering-and-continuity">
<h2><span class="section-number">4.1. </span>Local numbering and continuity<a class="headerlink" href="#local-numbering-and-continuity" title="Link to this heading">¶</a></h2>
<details class="sd-sphinx-override sd-dropdown sd-card sd-mb-3">
<summary class="sd-summary-title sd-card-header">
<span class="sd-summary-text">A video recording of the following material is available here.</span><span class="sd-summary-state-marker sd-summary-chevron-right"><svg version="1.1" width="1.5em" height="1.5em" class="sd-octicon sd-octicon-chevron-right" viewBox="0 0 24 24" aria-hidden="true"><path d="M8.72 18.78a.75.75 0 0 1 0-1.06L14.44 12 8.72 6.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018l6.25 6.25a.75.75 0 0 1 0 1.06l-6.25 6.25a.75.75 0 0 1-1.06 0Z"></path></svg></span></summary><div class="sd-summary-content sd-card-body docutils">
<div class="vimeo docutils container">
<iframe src="https://player.vimeo.com/video/495269291"
frameborder="0" allow="autoplay; fullscreen"
allowfullscreen></iframe></div>
<p class="sd-card-text">Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=69f99985-13ba-4151-8e5a-ac9f01303711">watch this video on Panopto</a></p>
</div>
</details><p>Which nodes should be associated with which topological entities? The
answer to this question depends on the degree of continuity required
between adjacent cells. The nodes associated with topological entites
on the boundaries of cells (the vertices in one dimension, the
vertices and edges in two dimensions, and the vertices, edges and
faces in three dimensions) are shared between cells. The basis
functions associated with nodes on the cell boundary will therefore be
continuous between the cells which share that boundary.</p>
<p>For the Lagrange element family, we require global <span class="math notranslate nohighlight">\(C_0\)</span>
continuity. This implies that the basis functions are continuous
everywhere. This has the following implications for the association of
basis functions with local topological entites:</p>
<dl class="simple">
<dt>vertices</dt><dd><p>At the function vertices we can achieve continuity by requiring
that there be a node associated with each mesh vertex. The basis
function associated with that node will therefore be continuous. Since
we have a nodal basis, all the other basis functions will vanish at
the vertex so the global space will be continuous at this point.</p>
</dd>
<dt>edges</dt><dd><p>Where the finite element space has at least 2 dimensions we need to
ensure continuity along edges. The restriction of a degree <span class="math notranslate nohighlight">\(p\)</span>
polynomial over a <span class="math notranslate nohighlight">\(d\)</span>-dimensional cell to an edge of that cell will
be a one dimensional degree <span class="math notranslate nohighlight">\(p\)</span> polynomial. To fully specify this
polynomial along an edge requires <span class="math notranslate nohighlight">\(p+1\)</span> nodes. However there will
already be two nodes associated with the vertices of the edge, so
<span class="math notranslate nohighlight">\(p-1\)</span> additional nodes will be associated with the edge.</p>
</dd>
<dt>faces</dt><dd><p>For three-dimensional (tetrahedral) elements, the basis
functions must also be continuous across faces. This requires that
sufficient nodes lie on the face to fully specify a two dimensional
degree <span class="math notranslate nohighlight">\(p\)</span> polynomial. However the vertices and edges of the face
already have nodes associated with them, so the number of nodes
required to be associated with the face itself is actually the
number required to represent a degree <span class="math notranslate nohighlight">\(p-2\)</span> polynomial in two
dimensions given by the combination <span class="math notranslate nohighlight">\(\binom{p-1}{2}\)</span>.</p>
</dd>
</dl>
<p>This pattern holds more generally: for a <span class="math notranslate nohighlight">\(C_0\)</span> function space, the
number of nodes which must be associated with a local topological
entity of dimension <span class="math notranslate nohighlight">\(d\)</span> is <span class="math notranslate nohighlight">\(\binom{p-1}{d}\)</span>.</p>
<p><a class="reference internal" href="#figlagrange-nodes-association"><span class="std std-numref">Fig. 4.1</span></a> illustrates the association of nodes with
reference entities for Lagrange elements on triangles.</p>
<figure class="align-default" id="id2">
<span id="figlagrange-nodes-association"></span><a class="reference internal image-reference" href="_images/lagrange_nodes.svg"><img alt="_images/lagrange_nodes.svg" src="_images/lagrange_nodes.svg" style="width: 70%;" />
</a>
<figcaption>
<p><span class="caption-number">Fig. 4.1 </span><span class="caption-text">Association of nodes with reference entities for the degree 1, 2,
and 3 equispaced Lagrange elements on triangles. Black nodes are
associated with vertices, red nodes with edges and blue nodes with
the cell (face). This is the same figure as <a class="reference internal" href="2_finite_elements.html#figlagrange-nodes"><span class="std std-numref">Fig. 2.1</span></a>.</span><a class="headerlink" href="#id2" title="Link to this image">¶</a></p>
</figcaption>
</figure>
</section>
<section id="implementing-local-numbering">
<h2><span class="section-number">4.2. </span>Implementing local numbering<a class="headerlink" href="#implementing-local-numbering" title="Link to this heading">¶</a></h2>
<details class="sd-sphinx-override sd-dropdown sd-card sd-mb-3">
<summary class="sd-summary-title sd-card-header">
<span class="sd-summary-text">A video recording of the following material is available here.</span><span class="sd-summary-state-marker sd-summary-chevron-right"><svg version="1.1" width="1.5em" height="1.5em" class="sd-octicon sd-octicon-chevron-right" viewBox="0 0 24 24" aria-hidden="true"><path d="M8.72 18.78a.75.75 0 0 1 0-1.06L14.44 12 8.72 6.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018l6.25 6.25a.75.75 0 0 1 0 1.06l-6.25 6.25a.75.75 0 0 1-1.06 0Z"></path></svg></span></summary><div class="sd-summary-content sd-card-body docutils">
<div class="vimeo docutils container">
<iframe src="https://player.vimeo.com/video/495269640"
frameborder="0" allow="autoplay; fullscreen"
allowfullscreen></iframe></div>
<p class="sd-card-text">Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=ea5c76aa-db4c-45b8-a0f9-ac9f01303687">watch this video on Panopto</a></p>
</div>
</details><p>Local numbering can be implemented by adding an additional data
structure to the <a class="reference internal" href="fe_utils.html#fe_utils.finite_elements.FiniteElement" title="fe_utils.finite_elements.FiniteElement"><code class="xref py py-class docutils literal notranslate"><span class="pre">FiniteElement</span></code></a>
class. For each local entity this must record the local nodes
associated with that entity. This can be achieved using a dictionary
of dictionaries structure. For example employing the local numbering
of nodes employed in <a class="reference internal" href="2_finite_elements.html#figlagrange-nodes"><span class="std std-numref">Fig. 2.1</span></a>, the <code class="docutils literal notranslate"><span class="pre">entity_node</span></code>
dictionary for the degree three equispaced Lagrange element on a triangle is
given by:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">entity_node</span> <span class="o">=</span> <span class="p">{</span><span class="mi">0</span><span class="p">:</span> <span class="p">{</span><span class="mi">0</span><span class="p">:</span> <span class="p">[</span><span class="mi">0</span><span class="p">],</span>
<span class="mi">1</span><span class="p">:</span> <span class="p">[</span><span class="mi">1</span><span class="p">],</span>
<span class="mi">2</span><span class="p">:</span> <span class="p">[</span><span class="mi">2</span><span class="p">]},</span>
<span class="mi">1</span><span class="p">:</span> <span class="p">{</span><span class="mi">0</span><span class="p">:</span> <span class="p">[</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">],</span>
<span class="mi">1</span><span class="p">:</span> <span class="p">[</span><span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">],</span>
<span class="mi">2</span><span class="p">:</span> <span class="p">[</span><span class="mi">7</span><span class="p">,</span> <span class="mi">8</span><span class="p">]},</span>
<span class="mi">2</span><span class="p">:</span> <span class="p">{</span><span class="mi">0</span><span class="p">:</span> <span class="p">[</span><span class="mi">9</span><span class="p">]}}</span>
</pre></div>
</div>
<p>Note that the order of the nodes in each list is important: it must
always consistently reflect the orientation of the relevant entity in
order that all the cells which share that entity consistently
interpret the nodes. In this case this has been achieved by listing
the nodes in order given by the direction of the orientation of each edge.</p>
<div class="proof proof-type-exercise" id="id3">
<span id="ex-local"></span>
<div class="proof-title">
<span class="proof-type">Exercise 4.44</span>
</div><div class="proof-content">
<p>Extend the <code class="xref py py-meth docutils literal notranslate"><span class="pre">__init__()</span></code> method of
<a class="reference internal" href="fe_utils.html#fe_utils.finite_elements.LagrangeElement" title="fe_utils.finite_elements.LagrangeElement"><code class="xref py py-class docutils literal notranslate"><span class="pre">LagrangeElement</span></code></a> so that it
passes the correct <code class="docutils literal notranslate"><span class="pre">entity_node</span></code> dictionary to the
<a class="reference internal" href="fe_utils.html#fe_utils.finite_elements.FiniteElement" title="fe_utils.finite_elements.FiniteElement"><code class="xref py py-class docutils literal notranslate"><span class="pre">FiniteElement</span></code></a> it creates.</p>
<p>The <code class="docutils literal notranslate"><span class="pre">test/test_08_entity_nodes.py</span></code> script tests this functionality.</p>
</div></div></section>
<section id="global-numbering">
<h2><span class="section-number">4.3. </span>Global numbering<a class="headerlink" href="#global-numbering" title="Link to this heading">¶</a></h2>
<details class="sd-sphinx-override sd-dropdown sd-card sd-mb-3">
<summary class="sd-summary-title sd-card-header">
<span class="sd-summary-text">A video recording of the following material is available here.</span><span class="sd-summary-state-marker sd-summary-chevron-right"><svg version="1.1" width="1.5em" height="1.5em" class="sd-octicon sd-octicon-chevron-right" viewBox="0 0 24 24" aria-hidden="true"><path d="M8.72 18.78a.75.75 0 0 1 0-1.06L14.44 12 8.72 6.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018l6.25 6.25a.75.75 0 0 1 0 1.06l-6.25 6.25a.75.75 0 0 1-1.06 0Z"></path></svg></span></summary><div class="sd-summary-content sd-card-body docutils">
<div class="vimeo docutils container">
<iframe src="https://player.vimeo.com/video/495269832"
frameborder="0" allow="autoplay; fullscreen"
allowfullscreen></iframe></div>
<p class="sd-card-text">Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=930f2ddb-fe7b-4286-b82b-ac9f013036e5">watch this video on Panopto</a></p>
</div>
</details><p>Given a mesh and a finite element, the global numbering task is to
uniquely associate the appropriate number of global node numbers with
each global entity. One such numbering <a class="footnote-reference brackets" href="#globalnumbering" id="id1" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a> is to
allocate global numbers in ascending entity dimension order, and
within each dimension in order of the index of each global topological
entity. The formula for the first global node associated with entity
<span class="math notranslate nohighlight">\((d, i)\)</span> is then:</p>
<div class="math notranslate nohighlight" id="equation-4-function-spaces-0">
<span class="eqno">(4.2)<a class="headerlink" href="#equation-4-function-spaces-0" title="Link to this equation">¶</a></span>\[G(d, i) = \left(\sum_{\delta < d} N_\delta E_\delta\right) + iN_d\]</div>
<p>where <span class="math notranslate nohighlight">\(N_d\)</span> is the number of nodes which this finite element
associates with a single entity of dimension <span class="math notranslate nohighlight">\(d\)</span>, and <span class="math notranslate nohighlight">\(E_d\)</span> is the number
of dimension <span class="math notranslate nohighlight">\(d\)</span> entities in the mesh. The full list of nodes
associated with entity <span class="math notranslate nohighlight">\((d, i)\)</span> is therefore:</p>
<div class="math notranslate nohighlight" id="equation-4-function-spaces-1">
<span class="eqno">(4.3)<a class="headerlink" href="#equation-4-function-spaces-1" title="Link to this equation">¶</a></span>\[[G(d, i), \ldots, G(d,i) + N_d - 1]\]</div>
</section>
<section id="the-cell-node-map">
<span id="cell-node"></span><h2><span class="section-number">4.4. </span>The cell-node map<a class="headerlink" href="#the-cell-node-map" title="Link to this heading">¶</a></h2>
<details class="sd-sphinx-override sd-dropdown sd-card sd-mb-3">
<summary class="sd-summary-title sd-card-header">
<span class="sd-summary-text">A video recording of the following material is available here.</span><span class="sd-summary-state-marker sd-summary-chevron-right"><svg version="1.1" width="1.5em" height="1.5em" class="sd-octicon sd-octicon-chevron-right" viewBox="0 0 24 24" aria-hidden="true"><path d="M8.72 18.78a.75.75 0 0 1 0-1.06L14.44 12 8.72 6.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018l6.25 6.25a.75.75 0 0 1 0 1.06l-6.25 6.25a.75.75 0 0 1-1.06 0Z"></path></svg></span></summary><div class="sd-summary-content sd-card-body docutils">
<div class="vimeo docutils container">
<iframe src="https://player.vimeo.com/video/495271441"
frameborder="0" allow="autoplay; fullscreen"
allowfullscreen></iframe></div>
<p class="sd-card-text">Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=bddd29be-60eb-43f3-b487-ac9f013036b7">watch this video on Panopto</a></p>
</div>
</details><p>The primary use to which we wish to put the finite element spaces we
are constructing is, naturally, the solution of finite element
problems. The principle operation we will therefore need to support is
integration over the mesh of mathematical expressions involving
functions in finite element spaces. This will be accomplished by
integrating over each cell in turn, and then summing over all
cells. This means that a key operation we will need is to find the
nodes associated with a given cell.</p>
<p>It is usual in finite element software to explicitly store the map
from cells to adjacent nodes as a two-dimensional array with one row
corresponding to each cell, and with columns corresponding to the
local node numbers. The entries in this map will have the following values:</p>
<div class="math notranslate nohighlight" id="equation-eqcellnode">
<span class="eqno">(4.4)<a class="headerlink" href="#equation-eqcellnode" title="Link to this equation">¶</a></span>\[M[c, e(\delta, \epsilon)] = [G(\delta, i), \ldots, G(\delta,i) + N_\delta - 1] \qquad\forall 0\leq\delta\leq\dim(c), \forall 0\leq\epsilon < \hat{E}_\delta\]</div>
<p>where:</p>
<div class="math notranslate nohighlight" id="equation-4-function-spaces-2">
<span class="eqno">(4.5)<a class="headerlink" href="#equation-4-function-spaces-2" title="Link to this equation">¶</a></span>\[i = \operatorname{Adj}_{\dim(c), \delta}[c, \epsilon],\]</div>
<p><span class="math notranslate nohighlight">\(e(\delta, \epsilon)\)</span> is the local entity-node list for this finite
element for the <span class="math notranslate nohighlight">\((\delta, \epsilon)\)</span> local entity,
<span class="math notranslate nohighlight">\(\operatorname{Adj}\)</span> has the meaning given under <a class="reference internal" href="1_quadrature.html#secadjacency"><span class="std std-ref">Python implementations of reference elements</span></a>,
<span class="math notranslate nohighlight">\(\hat{E}_\delta\)</span> is the number of dimension <span class="math notranslate nohighlight">\(\delta\)</span> entities in each
cell, and <span class="math notranslate nohighlight">\(G\)</span> and <span class="math notranslate nohighlight">\(N\)</span> have the meanings given above. This algorithm
requires a trivial extension to adjacency:</p>
<div class="math notranslate nohighlight" id="equation-4-function-spaces-3">
<span class="eqno">(4.6)<a class="headerlink" href="#equation-4-function-spaces-3" title="Link to this equation">¶</a></span>\[\operatorname{Adj}_{\dim(c),\dim(c)}[c, 0] = c\]</div>
<div class="admonition hint">
<p class="admonition-title">Hint</p>
<p>In <a class="reference internal" href="#equation-eqcellnode">(4.4)</a>, notice that for each value of <span class="math notranslate nohighlight">\(\delta\)</span> and
<span class="math notranslate nohighlight">\(\epsilon\)</span>, <span class="math notranslate nohighlight">\(e(\delta, \epsilon)\)</span> is a vector of indices, so the
equation sets the value of zero, one, or more defined entries in row <span class="math notranslate nohighlight">\(c\)</span>
of <span class="math notranslate nohighlight">\(M\)</span> for each <span class="math notranslate nohighlight">\(\delta\)</span> and <span class="math notranslate nohighlight">\(\epsilon\)</span>.</p>
</div>
</section>
<section id="implementing-function-spaces-in-python">
<h2><span class="section-number">4.5. </span>Implementing function spaces in Python<a class="headerlink" href="#implementing-function-spaces-in-python" title="Link to this heading">¶</a></h2>
<details class="sd-sphinx-override sd-dropdown sd-card sd-mb-3">
<summary class="sd-summary-title sd-card-header">
<span class="sd-summary-text">A video recording of the following material is available here.</span><span class="sd-summary-state-marker sd-summary-chevron-right"><svg version="1.1" width="1.5em" height="1.5em" class="sd-octicon sd-octicon-chevron-right" viewBox="0 0 24 24" aria-hidden="true"><path d="M8.72 18.78a.75.75 0 0 1 0-1.06L14.44 12 8.72 6.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018l6.25 6.25a.75.75 0 0 1 0 1.06l-6.25 6.25a.75.75 0 0 1-1.06 0Z"></path></svg></span></summary><div class="sd-summary-content sd-card-body docutils">
<div class="vimeo docutils container">
<iframe src="https://player.vimeo.com/video/495272295"
frameborder="0" allow="autoplay; fullscreen"
allowfullscreen></iframe></div>
<p class="sd-card-text">Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=55f96f95-c934-4756-b75e-ac9f01305188">watch this video on Panopto</a></p>
</div>
</details><p>As noted above, a finite element space associates a mesh and a finite
element, and contains (in some form) a global numbering of the nodes.</p>
<div class="proof proof-type-exercise" id="id4">
<span id="ex-function-space"></span>
<div class="proof-title">
<span class="proof-type">Exercise 4.45</span>
</div><div class="proof-content">
<p>Implement the <code class="xref py py-meth docutils literal notranslate"><span class="pre">__init__()</span></code> method of
<a class="reference internal" href="fe_utils.html#fe_utils.function_spaces.FunctionSpace" title="fe_utils.function_spaces.FunctionSpace"><code class="xref py py-class docutils literal notranslate"><span class="pre">fe_utils.function_spaces.FunctionSpace</span></code></a>. The key operation
is to set
<a class="reference internal" href="fe_utils.html#fe_utils.function_spaces.FunctionSpace.cell_nodes" title="fe_utils.function_spaces.FunctionSpace.cell_nodes"><code class="xref py py-attr docutils literal notranslate"><span class="pre">cell_nodes</span></code></a> using
<a class="reference internal" href="#equation-eqcellnode">(4.4)</a>.</p>
<p>You can plot the numbering you have created with the
<code class="docutils literal notranslate"><span class="pre">plot_function_space_nodes</span></code> script. As usual, run the
script passing the <code class="docutils literal notranslate"><span class="pre">-h</span></code> option to discover the required
arguments.</p>
</div></div><div class="admonition hint">
<p class="admonition-title">Hint</p>
<p>Many of the terms in <a class="reference internal" href="#equation-eqcellnode">(4.4)</a> are implemented in the
objects in <a class="reference internal" href="fe_utils.html#module-fe_utils" title="fe_utils"><code class="xref py py-mod docutils literal notranslate"><span class="pre">fe_utils</span></code></a>. For example:</p>
<ul>
<li><p><span class="math notranslate nohighlight">\(\operatorname{Adj}_{\dim(c), \delta}\)</span> is implemented by the
<a class="reference internal" href="fe_utils.html#fe_utils.mesh.Mesh.adjacency" title="fe_utils.mesh.Mesh.adjacency"><code class="xref py py-meth docutils literal notranslate"><span class="pre">adjacency()</span></code></a> method of the
<a class="reference internal" href="fe_utils.html#fe_utils.mesh.Mesh" title="fe_utils.mesh.Mesh"><code class="xref py py-class docutils literal notranslate"><span class="pre">Mesh</span></code></a>.</p></li>
<li><p>You have <span class="math notranslate nohighlight">\(e(\delta, \epsilon)\)</span> as
<a class="reference internal" href="fe_utils.html#fe_utils.finite_elements.FiniteElement.entity_nodes" title="fe_utils.finite_elements.FiniteElement.entity_nodes"><code class="xref py py-data docutils literal notranslate"><span class="pre">entity_nodes</span></code></a>. Note
that in this case you need separate square brackets for each
index:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">element</span><span class="o">.</span><span class="n">entity_nodes</span><span class="p">[</span><span class="n">delta</span><span class="p">][</span><span class="n">epsilon</span><span class="p">]</span>
</pre></div>
</div>
</li>
</ul>
</div>
<div class="admonition hint">
<p class="admonition-title">Hint</p>
<p><a class="reference internal" href="fe_utils.html#fe_utils.function_spaces.FunctionSpace.cell_nodes" title="fe_utils.function_spaces.FunctionSpace.cell_nodes"><code class="xref py py-attr docutils literal notranslate"><span class="pre">cell_nodes</span></code></a> needs to
be integer-valued. If you choose to use <a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.zeros.html#numpy.zeros" title="(in NumPy v2.2)"><code class="xref py py-func docutils literal notranslate"><span class="pre">numpy.zeros()</span></code></a>
to create a matrix which you then populate with values, you
need to explicitly specify that you want a matrix of
integers. This can be achieved by passing the <code class="docutils literal notranslate"><span class="pre">dtype</span></code> argument
to <a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.zeros.html#numpy.zeros" title="(in NumPy v2.2)"><code class="xref py py-func docutils literal notranslate"><span class="pre">numpy.zeros()</span></code></a>. For example <code class="docutils literal notranslate"><span class="pre">numpy.zeros((nrows,</span> <span class="pre">ncols),</span> <span class="pre">dtype=int)</span></code>.</p>
</div>
<p class="rubric">Footnotes</p>
<aside class="footnote-list brackets">
<aside class="footnote brackets" id="globalnumbering" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#id1">1</a><span class="fn-bracket">]</span></span>
<p>Many correct global numberings are possible,
that presented here is simple and correct, but not
optimal from the perspective of the memory
layout of the resulting data.</p>
</aside>
</aside>
</section>
</section>
<div class="clearer"></div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer" role="contentinfo">
© Copyright 2014-2024, David A. Ham and Colin J. Cotter.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.4.7.
</div>
</body>
</html>