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
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
//! Interpolation functions and derivatives for geometric shapes (elements)
//!
//! # Definitions
//!
//! Here, we consider the following definitions:
//!
//! * `space_ndim` -- is the number of dimensions of the space under study (2 or 3)
//! * `geo_ndim` -- is the number of dimensions of the geometry element (shape).
//! For instance, a line in the 2D space has `geo_ndim = 1` and
//! `space_ndim = 2`. Another example: a triangle in the 3D space
//! has `geo_ndim = 2` and `space_ndim = 3`.
//! * `local` -- refers to a numbering scheme for the nodes of the shape (or element)
//! * `global` -- refers to a numbering scheme applied for the whole mesh
//! * `spatial (real) space` -- is the "real" space mapped by the x₀,x₁,x₂ coordinates (see figure below)
//! * `reference (natural) space` -- is the "virtual" space mapped by the ξ₀,ξ₁,ξ₂ coordinates (see figure below)
//!
//! **Note:** In the code, we use (r,s,t) as (ξ₀,ξ₁,ξ₂) and `ksi` to represent the vector `ξ`.
//!
//! 
//!
//! We also consider the following counting variables:
//!
//! * `nnode` -- (local) number of points (aka nodes) that define the shape/element.
//! * `npoint` -- (global) number of points in the whole mesh; not used in this module
//! but important to remember
//! * `nedge` -- number of edges on the shape (2D or 3D)
//! * `nface` -- number of faces on the shape (3D only)
//! * `edge_nnode` -- number of points/nodes that define the edge
//! * `face_nnode` -- number of points/nodes that define the face
//! * `face_nedge` -- number of edges on the face
//!
//! Geometry cases regarding the number of dimensions (geo vs space)
//!
//! 1. Case `CABLE` -- `geo_ndim = 1` and `space_ndim = 2 or 3`; e.g., line in 2D or 3D (cables and rods)
//! 2. Case `SHELL` -- `geo_ndim = 2` and `space_ndim = 3`; e.g. Tri or Qua in 3D (shells and surfaces)
//! 3. Case `SOLID` -- `geo_ndim = space_ndim`; e.g., Tri and Qua in 2D or Tet and Hex in 3D
//!
//! | `geo_ndim` | `space_ndim = 2` | `space_ndim = 3` |
//! |:----------:|:----------------:|:----------------:|
//! | 1 | `CABLE` | `CABLE` |
//! | 2 | `SOLID` | `SHELL` |
//! | 3 | impossible | `SOLID` |
//!
//! # Interpolation functions
//!
//! The interpolation functions are such that:
//!
//! ```text
//! → → → →
//! u(ξ) = Σ Nᵐ(ξ) uᵐ
//! m
//! ```
//!
//! for any quantity `uᵐ` specified at the nodes of an element/shape. Above, `ξ` is the (geo_ndim)
//! vector of reference coordinates, and `Nᵐ` are the (nnode) interpolation functions.
//!
//! Given an (nnode,ncol) **matrix** of nodal values `U`, we can calculate the (ncol) **vector** of
//! interpolated values `u` by means of
//!
//! ```text
//! u = Uᵀ ⋅ N
//! (ncol) (ncol,nnode) (nnode)
//! ```
//!
//! where `N` is an (nnode) **vector** formed with all `Nᵐ` values.
//!
//! # Isoparametric formulation
//!
//! The isoparametric formulation establishes that we can calculate the coordinates `x(ξ)`
//! within the shape/element from the shape functions `Nᵐ(ξ)` and the coordinates at each
//! node by using the formula:
//!
//! ```text
//! → → → →
//! x(ξ) = Σ Nᵐ(ξ) xᵐ
//! m
//! ```
//!
//! where `x` is the (space_ndim) vector of real coordinates, `ξ` is the (geo_ndim)
//! vector of reference coordinates, `Nᵐ` are the (nnode) interpolation functions,
//! and `xᵐ` are the (nnode) coordinates of each m-node of the geometric shape.
//!
//! Given an (nnode,space_ndim) **matrix** of coordinates `X`, we can calculate the
//! (space_ndim) **vector** of coordinates `x` by means of
//!
//! ```text
//! x = Xᵀ ⋅ N
//! ```
//!
//! where `N` is an (nnode) **vector** formed with all `Nᵐ` values.
//!
//! # Derivatives on the reference space and gradients on the real space
//!
//! Here, we consider two cases:
//!
//! * General case with geo_ndim = space_ndim; and
//! * Line in multi-dimensions with geo_ndim = 1 and space_ndim > 1.
//!
//! ## SOLID case with geo_ndim = space_ndim
//!
//! If `SOLID` (`geo_ndim = space_ndim = 2 or 3`), we define the Jacobian tensor as
//!
//! ```text
//! →
//! → dx → →
//! J(ξ) = —— = Σ xᵐ ⊗ Lᵐ
//! → m
//! dξ
//! ```
//!
//! where
//!
//! ```text
//! →
//! → → dNᵐ(ξ)
//! Lᵐ(ξ) = ——————
//! →
//! dξ
//! ```
//!
//! are the derivatives of each interpolation function `Nᵐ` with respect to the
//! reference coordinate. `Lᵐ` are (geo_ndim) vectors and can be organized in
//! an (nnode,geo_ndim) matrix `L` of **local** derivatives.
//!
//! We can write the Jacobian in matrix (space_ndim,geo_ndim) notation as follows
//!
//! ```text
//! J = Xᵀ · L
//! ```
//!
//! where `X` is the (nnode,space_ndim) matrix of coordinates and `L` is the (nnode,geo_ndim) matrix.
//!
//! Next, we define the gradient of interpolation functions (i.e., derivatives of interpolation
//! functions with respect to real coordinates) by means of
//!
//! ```text
//! →
//! → → dNᵐ(ξ)
//! Bᵐ(ξ) = ——————
//! →
//! dx
//! ```
//!
//! which can be organized in an (nnode,space_ndim) matrix `B`.
//!
//! The inverse Jacobian allows us to determine the gradient vectors `B` as follows
//!
//! ```text
//! → → → →
//! Bᵐ(ξ) = Lᵐ(ξ) · J⁻¹(ξ)
//! ```
//!
//! Or, in matrix notation,
//!
//! ```text
//! B = L · J⁻¹
//! ```
//!
//! where `B` is an (nnode,space_ndim) matrix.
//!
//! ## SHELL case with geo_ndim = 2 and space_ndim = 3
//!
//! In this case, the Jacobian matrix is (3,2) and can also be computed by the following matrix
//! multiplication
//!
//! ```text
//! dx
//! J(ξ) = ——
//! dξ
//! ```
//!
//! Or, in matrix notation,
//!
//! ```text
//! J = Jshell = Xᵀ · L
//! ```
//!
//! However, the inverse Jacobian and gradients are not available in this case.
//!
//! ## CABLE case with geo_ndim = 1 and space_ndim = 2 or 3
//!
//! In this case, the Jacobian equals the (space_ndim,1) base vector `g₁` which
//! is tangent to the line element, i.e.,
//!
//! ```text
//! →
//! → → → → → dx
//! J := Jcable(ξ) = g₁(ξ) = ——
//! dξ
//! matrix notation: Jcable = Xᵀ · L
//! ```
//!
//! We also consider a parametric coordinate `ℓ` which varies
//! from `0` to `ℓ_max` (the length of the line) according to
//!
//! ```text
//! ℓ_max
//! ℓ(ξ) = (1 + ξ) —————
//! 2
//!
//! 2 · ℓ
//! ξ(ℓ) = ————— - 1
//! ℓ_max
//! ```
//!
//! Note that:
//!
//! ```text
//! 0 ≤ ℓ ≤ ℓ_max
//!
//! -1 ≤ ξ ≤ +1
//! ```
//!
//! # Normal vectors
//!
//! ## CABLE case with geo_ndim = 1 and space_ndim = 2 or 3
//!
//! Base vector tangent to the line:
//!
//! ```text
//! →
//! dx
//! g₁(ξ) = —— = Xᵀ · L = first_column(J)
//! dξ
//! ```
//!
//! Normal vector:
//!
//! ```text
//! → → →
//! n = e₃ × g₁
//!
//! → →
//! ||n|| = ||g₁||
//! ```
//!
//! Thus
//!
//! ```text
//! → →
//! dℓ = ||g₁|| dξ = ||n|| dξ
//! ```
//!
//! For a straight line (segment):
//!
//! ```text
//! →
//! ||n|| = Δℓ / Δξ = L / 2
//! ```
//!
//! because all [GeoClass::Lin] have `Δξ = 2`.
//!
//! ## SHELL case with geo_ndim = 2 and space_ndim = 3
//!
//! Base vectors tangent to the surface:
//!
//! ```text
//! →
//! → → dx
//! g₁(ξ) = ——— = first_column(J)
//! dξ₁
//!
//! →
//! → → dx
//! g₂(ξ) = ——— = second_column(J)
//! dξ₂
//! ```
//!
//! Normal vector:
//!
//! ```text
//! → → →
//! n = g₁ × g₂
//! ```
//!
//! Thus
//!
//! ```text
//! →
//! dA := ||n|| dξ₁ dξ₂
//! ```
//!
//! For flat quadrilateral faces with sides perpendicular one with another
//!
//! ```text
//! →
//! ||n|| = A / (Δξ₁ Δξ₂) = A / 4
//! ```
//!
//! because all [GeoClass::Qua] have `Δξᵢ = 2`.
//!
//! # GeoKind and GeoClass
//!
//! [GeoKind] is perhaps the most important *enum* in this module.
//! It defines the actual *shape* used in finite element analyses.
//!
//! Below are some example of shapes, classified according to [GeoClass].
//! The numbers are the local numbers (nodes).
//!
//! # Lines -- Lin
//!
//! 
//!
//! # Triangles -- Tri
//!
//! 
//!
//! # Quadrilaterals -- Qua
//!
//! 
//!
//! # Tetrahedra -- Tet
//!
//! 
//!
//! # Hexahedra -- Hex
//!
//! 
//!
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;