Documentation 6b54b78464
Loading...
Searching...
No Matches
CElement.hpp
Go to the documentation of this file.
1/*!
2 * \file CElement.hpp
3 * \brief Main header of the Finite Element structure declaring the abstract
4 * interface and the available finite element types.
5 * \author R. Sanchez
6 * \version 8.5.0 "Harrier"
7 *
8 * SU2 Project Website: https://su2code.github.io
9 *
10 * The SU2 Project is maintained by the SU2 Foundation
11 * (http://su2foundation.org)
12 *
13 * Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md)
14 *
15 * SU2 is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU Lesser General Public
17 * License as published by the Free Software Foundation; either
18 * version 2.1 of the License, or (at your option) any later version.
19 *
20 * SU2 is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
24 *
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with SU2. If not, see <http://www.gnu.org/licenses/>.
27 */
28
29#pragma once
30
31#include "CGaussVariable.hpp"
32#include "CElementProperty.hpp"
33#include <vector>
34
35/*!
36 * \class CElement
37 * \ingroup FemAlgos
38 * \brief Abstract class for defining finite elements.
39 * \note Usage: Element instances are used to compute gradients (in reference or current
40 * coordinates), element matrices (stiffness, mass, etc.), and nodal residuals.
41 * The use-case is to set the coordinates, compute the gradients, and then
42 * incrementally build the matrices using the various "Add_XXX" methods.
43 * \note Implementation: This base class provides a generic interface to an element,
44 * so that client numerics do not need to care about specific details (e.g. shape
45 * functions). However, more efficient code can be generated by caring about them,
46 * we try to strike a balance by tailoring the gradient computation to the specific
47 * sizes (number of integration points, nodes, and dimensions) of derived elements.
48 * This is done via the intermediate template class CElementWithKnownSizes from
49 * which derived elements can inherit the implementation of "ComputeGrad_XXX".
50 * To do so their constructors should consist of:
51 * - Call CElementWithKnownSizes's ctor to allocate parent class members.
52 * - Populate the "GaussWeights", and set the shape function values (Ni) in "GaussPoint".
53 * - Populate the "GaussCoords" and "dNiXj" fields of CElementWithKnownSizes.
54 * - Define the coordinates for nodal extrapolation of quantities at the Gauss points.
55 * Derived elements can also implement cheap methods of computing their area/volume.
56 * \author R. Sanchez
57 */
58class CElement {
59 protected:
60 enum : size_t { MAXNDIM = 3 };
61
62 std::vector<CGaussVariable> GaussPoint; /*!< \brief Vector of Gaussian Points. */
63
64 su2activematrix CurrentCoord; /*!< \brief Coordinates in the current frame. */
65 su2activematrix RefCoord; /*!< \brief Coordinates in the reference frame. */
66 su2activevector GaussWeight; /*!< \brief Weight of the Gaussian Points for the integration. */
67 su2activematrix NodalExtrap; /*!< \brief Coordinates of the nodal points for Gaussian extrapolation. */
68 su2activematrix NodalStress; /*!< \brief Stress at the nodes. */
69
70 su2activevector NodalTemperature; /*!< \brief Temperature at the nodes. */
71
72 /*--- Stiffness and load matrices. ---*/
73 std::vector<su2activematrix> Kab; /*!< \brief Structure for the constitutive component of the tangent matrix. */
74 su2activematrix Mab; /*!< \brief Structure for the nodal components of the mass matrix. */
75 su2activematrix Ks_ab; /*!< \brief Structure for the stress component of the tangent matrix. */
76 su2activematrix Kt_a; /*!< \brief Matrix of nodal stress terms for residual computation. */
77 su2activematrix FDL_a; /*!< \brief Matrix of dead loads for residual computation. */
78
79 su2double el_Pressure = 0.0; /*!< \brief Pressure in the element. */
80
81 unsigned long iProp = 0; /*!< \brief ID of the Element Property. */
82 unsigned long iDV = 0; /*!< \brief ID of the Design Variable (if it is element based). */
83 unsigned long iDe = 0; /*!< \brief ID of the dielectric elastomer. */
84
85 unsigned short nGaussPoints; /*!< \brief Number of gaussian points. */
86 unsigned short nNodes; /*!< \brief Number of geometric points. */
87 unsigned short nDim; /*!< \brief Number of dimension of the problem. */
88
89 su2activematrix HiHj = 0.0; /*!< \brief Scalar product of 2 ansatz functions. */
90 std::vector<std::vector<su2activematrix>>
91 DHiDHj; /*!< \brief Scalar product of the gradients of 2 ansatz functions. */
92
93 public:
94 enum FrameType { REFERENCE = 1, CURRENT = 2 }; /*!< \brief Type of nodal coordinates. */
95
96 /*!
97 * \brief Default constructor of the class, deleted to make sure derived
98 * classes always call the allocating constructor.
99 */
100 CElement(void) = delete;
101
102 /*!
103 * \brief Constructor of the class.
104 * \param[in] ngauss - Number of Gaussian integration points.
105 * \param[in] nnodes - Number of nodes of the element.
106 * \param[in] ndim - Number of dimensions of the problem (2D, 3D).
107 */
108 CElement(unsigned short ngauss, unsigned short nnodes, unsigned short ndim);
109
110 /*!
111 * \brief Destructor of the class.
112 */
113 virtual ~CElement(void) = default;
114
115 /*!
116 * \brief Set the value of the gradient of the shape functions wrt the reference configuration.
117 * \note The reference coordinates need to be set before calling this method.
118 */
119 virtual void ComputeGrad_Linear(void) = 0;
120
121 /*!
122 * \brief Set the value of the gradient of the shape functions wrt the current configuration.
123 * \note The current coordinates need to be set before calling this method.
124 */
125 virtual void ComputeGrad_NonLinear(void) = 0;
126
127 /*!
128 * \brief Set the value of the gradient of the shape functions wrt the reference configuration.
129 * \note This method assumes that we have a surface element embedded in higher dimensions.
130 */
131 virtual void ComputeGrad_SurfaceEmbedded(void) = 0;
132
133 /*!
134 * \brief Sets matrices to 0.
135 */
136 void ClearElement(void);
137
138 /*!
139 * \brief Retrieve the number of nodes of the element.
140 * \return Number of nodes of the element.
141 */
142 inline unsigned short GetnNodes(void) const { return nNodes; }
143
144 /*!
145 * \brief Retrieve the number of nodes of the element.
146 * \return Number of Gaussian Points of the element.
147 */
148 inline unsigned short GetnGaussPoints(void) const { return nGaussPoints; }
149
150 /*!
151 * \brief Set the value of the coordinate of the nodes in the reference configuration.
152 * \param[in] iNode - Index of node.
153 * \param[in] iDim - Dimension.
154 * \param[in] val_CoordRef - Value of the coordinate.
155 */
156 inline void SetRef_Coord(unsigned short iNode, unsigned short iDim, const su2double& val_CoordRef) {
157 RefCoord(iNode, iDim) = val_CoordRef;
158 }
159
160 /*!
161 * \brief Set the value of the coordinate of the nodes in the current configuration.
162 * \param[in] iNode - Index of node.
163 * \param[in] iDim - Dimension.
164 * \param[in] val_CoordRef - Value of the coordinate.
165 */
166 inline void SetCurr_Coord(unsigned short iNode, unsigned short iDim, const su2double& val_CoordCurr) {
167 CurrentCoord(iNode, iDim) = val_CoordCurr;
168 }
169
170 /*!
171 * \brief Set the value of the temperature of a node.
172 */
173 inline void SetTemperature(unsigned short iNode, const su2double& val_Temperature) {
174 NodalTemperature[iNode] = val_Temperature;
175 }
176
177 /*!
178 * \brief Set the value of the temperature of all nodes.
179 */
180 inline void SetTemperature(const su2double& val_Temperature) { NodalTemperature = val_Temperature; }
181
182 /*!
183 * \brief Get the value of the coordinate of the nodes in the reference configuration.
184 * \param[in] iNode - Index of node.
185 * \param[in] iDim - Dimension.
186 * \return Reference coordinate.
187 */
188 inline su2double GetRef_Coord(unsigned short iNode, unsigned short iDim) const { return RefCoord(iNode, iDim); }
189
190 /*!
191 * \brief Get the value of the coordinate of the nodes in the current configuration.
192 * \param[in] iNode - Index of node.
193 * \param[in] iDim - Dimension.
194 * \return Current coordinate.
195 */
196 inline su2double GetCurr_Coord(unsigned short iNode, unsigned short iDim) const { return CurrentCoord(iNode, iDim); }
197
198 /*!
199 * \brief Get the value of the temperature at a Gaussian integration point.
200 */
201 inline su2double GetTemperature(unsigned short iGauss) const {
202 su2double Temperature = 0;
203 for (auto iNode = 0u; iNode < nNodes; ++iNode) {
204 Temperature += GetNi(iNode, iGauss) * NodalTemperature[iNode];
205 }
206 return Temperature;
207 }
208
209 /*!
210 * \brief Get the weight of the corresponding Gaussian Point.
211 * \param[in] iGauss - index of the Gaussian point.
212 * \return Weight.
213 */
214 inline su2double GetWeight(unsigned short iGauss) const { return GaussWeight(iGauss); }
215
216 /*!
217 * \brief Get the Jacobian respect to the reference configuration for the Gaussian Point iGauss.
218 * \param[in] iGauss - index of the Gaussian point.
219 * \return Jacobian.
220 */
221 inline su2double GetJ_X(unsigned short iGauss) const { return GaussPoint[iGauss].GetJ_X(); }
222
223 /*!
224 * \brief Get the jacobian respect to the current configuration for the Gaussian Point iGauss.
225 * \param[in] iGauss - index of the Gaussian point.
226 * \return Jacobian.
227 */
228 inline su2double GetJ_x(unsigned short iGauss) const { return GaussPoint[iGauss].GetJ_x(); }
229
230 /*!
231 * \brief Retrieve the value of the pressure in the element for incompressible materials.
232 * \return Value of the pressure.
233 */
234 inline su2double GetElement_Pressure(void) const { return el_Pressure; }
235
236 /*!
237 * \brief Add the value of the diagonal term for the mass matrix.
238 * \param[in] nodeA - index of Node a.
239 * \param[in] nodeB - index of Node b.
240 * \param[in] val_Ks_ab - value of the term that will constitute the diagonal of the stress contribution.
241 */
242 inline void Add_Mab(unsigned short nodeA, unsigned short nodeB, const su2double& val_Mab) {
243 Mab(nodeA, nodeB) += val_Mab;
244 }
245
246 /*!
247 * \brief Add the value of a submatrix K relating nodes a and b, for the constitutive term.
248 * \param[in] nodeA - index of Node a.
249 * \param[in] nodeB - index of Node b.
250 * \param[in] val_Kab - value of the matrix K.
251 */
252 template <typename Matrix>
253 inline void Add_Kab(unsigned short nodeA, unsigned short nodeB, Matrix& val_Kab) {
254 for (unsigned short iDim = 0; iDim < nDim; iDim++)
255 for (unsigned short jDim = 0; jDim < nDim; jDim++) Kab[nodeA](nodeB, iDim * nDim + jDim) += val_Kab[iDim][jDim];
256 }
257
258 /*!
259 * \brief Add the value of a submatrix K relating nodes a and b, for the constitutive term (symmetric terms need
260 * transpose) \param[in] nodeA - index of Node a. \param[in] nodeB - index of Node b. \param[in] val_Kab - value of
261 * the matrix K.
262 */
263 template <typename Matrix>
264 inline void Add_Kab_T(unsigned short nodeA, unsigned short nodeB, Matrix& val_Kab) {
265 for (unsigned short iDim = 0; iDim < nDim; iDim++)
266 for (unsigned short jDim = 0; jDim < nDim; jDim++) Kab[nodeA](nodeB, iDim * nDim + jDim) += val_Kab[jDim][iDim];
267 }
268
269 /*!
270 * \brief Add the value of the diagonal term for the stress contribution to the stiffness of the system.
271 * \param[in] nodeA - index of Node a.
272 * \param[in] nodeB - index of Node b.
273 * \param[in] val_Ks_ab - value of the term that will constitute the diagonal of the stress contribution.
274 */
275 inline void Add_Ks_ab(unsigned short nodeA, unsigned short nodeB, const su2double& val_Ks_ab) {
276 Ks_ab(nodeA, nodeB) += val_Ks_ab;
277 }
278
279 /*!
280 * \brief Add the value of the nodal stress term for the computation of the residual.
281 * \param[in] nodeA - index of Node a.
282 * \param[in] val_Kt_a - value of the term that will constitute the diagonal of the stress contribution.
283 */
284 inline void Add_Kt_a(unsigned short nodeA, const su2double* val_Kt_a) {
285 for (unsigned short iDim = 0; iDim < nDim; iDim++) Kt_a(nodeA, iDim) += val_Kt_a[iDim];
286 }
287
288 /*!
289 * \brief Add the value of the dead load for the computation of the residual.
290 * \param[in] nodeA - index of Node a.
291 * \param[in] val_FDL_a - value of the term that will constitute the diagonal of the stress contribution.
292 */
293 inline void Add_FDL_a(unsigned short nodeA, const su2double* val_FDL_a) {
294 for (unsigned short iDim = 0; iDim < nDim; iDim++) FDL_a(nodeA, iDim) += val_FDL_a[iDim];
295 }
296
297 /*!
298 * \brief Restarts the values of stress in the element.
299 */
300 inline void ClearStress(void) { NodalStress.setConstant(0.0); }
301
302 /*!
303 * \brief Return the value of the diagonal term for the mass matrix, relating nodes a and b.
304 * \param[in] nodeA - index of Node a.
305 * \param[in] nodeB - index of Node b.
306 * \return Value of the diagonal term of Mab.
307 */
308 inline su2double Get_Mab(unsigned short nodeA, unsigned short nodeB) const { return Mab(nodeA, nodeB); }
309
310 /*!
311 * \brief Return the value of the submatrix K relating nodes a and b.
312 * \param[in] nodeA - index of Node a.
313 * \param[in] nodeB - index of Node b.
314 * \return Values of the matrix K.
315 */
316 inline const su2double* Get_Kab(unsigned short nodeA, unsigned short nodeB) const { return Kab[nodeA][nodeB]; }
317
318 /*!
319 * \brief Return the value of the diagonal term for the stress contribution, relating nodes a and b.
320 * \param[in] nodeA - index of Node a.
321 * \param[in] nodeB - index of Node b.
322 * \return Value of the matrix Ks.
323 */
324 inline su2double Get_Ks_ab(unsigned short nodeA, unsigned short nodeB) const { return Ks_ab(nodeA, nodeB); }
325
326 /*!
327 * \brief Return the values of the nodal stress components of the residual for node a.
328 * \param[in] nodeA - index of Node a.
329 * \return Values of the stress term.
330 */
331 inline const su2double* Get_Kt_a(unsigned short nodeA) const { return Kt_a[nodeA]; }
332
333 /*!
334 * \brief Return the values of the dead load components of the residual for node a.
335 * \param[in] nodeA - index of Node a.
336 * \return Value of the dead loads.
337 */
338 inline const su2double* Get_FDL_a(unsigned short nodeA) const { return FDL_a[nodeA]; }
339
340 /*!
341 * \brief Retrieve the value of the shape functions.
342 * \param[in] iNode - Index of the node.
343 * \param[in] iGauss - Index of the Gaussian Point.
344 * \return Gradient of the shape function related to node iNode and evaluated at Gaussian Point iGauss
345 */
346 inline su2double GetNi(unsigned short iNode, unsigned short iGauss) const { return GaussPoint[iGauss].GetNi(iNode); }
347
348 /*!
349 * \brief Retrieve the value of the gradient of the shape functions respect to the reference configuration.
350 * \param[in] iNode - Index of the node.
351 * \param[in] iGauss - Index of the Gaussian Point.
352 * \param[in] iDim - Coordinate index.
353 * \return Gradient of the shape function related to node iNode and evaluated at Gaussian Point iGauss
354 */
355 inline su2double GetGradNi_X(unsigned short iNode, unsigned short iGauss, unsigned short iDim) const {
356 return GaussPoint[iGauss].GetGradNi_Xj(iNode, iDim);
357 }
358
359 /*!
360 * \brief Retrieve the value of the gradient of the shape functions respect to the current configuration.
361 * \param[in] iNode - Index of the node.
362 * \param[in] iGauss - Index of the Gaussian Point.
363 * \param[in] iDim - Coordinate index.
364 * \return Gradient of the shape function related to node iNode and evaluated at Gaussian Point iGauss
365 */
366 inline su2double GetGradNi_x(unsigned short iNode, unsigned short iGauss, unsigned short iDim) const {
367 return GaussPoint[iGauss].GetGradNi_xj(iNode, iDim);
368 }
369
370 /*!
371 * \brief Retrieve the value of the gradient of the shape functions respect to the reference configuration.
372 * \param[in] iNode - Index of the node.
373 * \param[in] iGauss - Index of the Gaussian Point.
374 * \return Value of the shape function at the nodes for extrapolation purposes
375 */
376 inline su2double GetNi_Extrap(unsigned short iNode, unsigned short iGauss) const {
377 return NodalExtrap(iNode, iGauss);
378 }
379
380 /*!
381 * \brief Add a value to the nodal stress for an element.
382 * \param[in] iNode - Index of the node.
383 * \param[in] iVar - Variable index.
384 * \param[in] val_Stress - Value of the stress added.
385 */
386 inline void Add_NodalStress(unsigned short iNode, unsigned short iVar, const su2double& val_Stress) {
387 NodalStress(iNode, iVar) += val_Stress;
388 }
389
390 /*!
391 * \brief Retrieve the value of the nodal stress for an element.
392 * \param[in] iNode - Index of the node.
393 * \param[in] iVar - Variable index.
394 * \return Value of the stress.
395 */
396 inline su2double Get_NodalStress(unsigned short iNode, unsigned short iVar) const { return NodalStress(iNode, iVar); }
397
398 /*!
399 * \brief Store the values of the identifiers for element properties.
400 * \param[in] element_property - element properties container.
401 */
402 inline void Set_ElProperties(const CProperty* element_property) {
403 iDV = element_property->GetDV();
404 iProp = element_property->GetMat_Prop();
405 iDe = element_property->GetElectric_Prop();
406 }
407
408 /*!
409 * \brief Store the value of the identifier for the Dielectric Elastomers.
410 * \param[in] val_iDe - identifier of the DE property.
411 */
412 inline void Set_iDe(unsigned long val_iDe) { iDe = val_iDe; }
413
414 /*!
415 * \brief Return the value of the identifier for the Dielectric Elastomers.
416 * \return Identifier of the DE property.
417 */
418 inline unsigned long Get_iDe(void) const { return iDe; }
419
420 /*!
421 * \brief Return the value of the identifier for the Design Variable.
422 * \return Identifier of the DV.
423 */
424 inline unsigned long Get_iDV(void) const { return iDV; }
425
426 /*!
427 * \brief Return the value of the identifier for the Element Property.
428 * \return Identifier of the property.
429 */
430 inline unsigned long Get_iProp(void) const { return iProp; }
431
432 /*!
433 * \brief Compute the value of the length of the element.
434 * \param[in] mode - Type of coordinates to consider in the computation.
435 * \return Length of the (1D) element.
436 */
437 inline virtual su2double ComputeLength(const FrameType mode = REFERENCE) const { return 0.0; }
438
439 /*!
440 * \brief Compute the value of the area of the element.
441 * \param[in] mode - Type of coordinates to consider in the computation.
442 * \return Area of the (2D) element.
443 */
444 inline virtual su2double ComputeArea(const FrameType mode = REFERENCE) const { return 0.0; }
445
446 /*!
447 * \brief Compute the value of the volume of the element.
448 * \param[in] mode - Type of coordinates to consider in the computation.
449 * \return Volume of the (3D) element.
450 */
451 inline virtual su2double ComputeVolume(const FrameType mode = REFERENCE) const { return 0.0; }
452
453 /*!
454 * \brief Compute the value of the area of the element in current coordinates (wrapper to ComputeArea(CURRENT)).
455 * \return Current area of the (2D) element.
456 */
457 inline su2double ComputeCurrentArea(void) const { return ComputeArea(CURRENT); }
458
459 /*!
460 * \brief Compute the value of the volume of the element in current coordinates (wrapper to ComputeVolume(CURRENT)).
461 * \return Current volume of the (3D) element.
462 */
463 inline su2double ComputeCurrentVolume(void) const { return ComputeVolume(CURRENT); }
464
465 /*!
466 * \brief Register the current and reference coordinates of the element as pre-accumulation inputs
467 * the latter are needed for compatibility with shape derivatives, there is no problem registering
468 * because inactive variables are ignored.
469 */
470 inline void SetPreaccIn_Coords(bool nonlinear = true) {
472 if (nonlinear) AD::SetPreaccIn(CurrentCoord.data(), nNodes * MAXNDIM);
473 }
474
475 /*!
476 * \brief Register the stress residual as a pre-accumulation output. When computing the element
477 * stiffness matrix this is the only term that sees its way into the RHS of the system.
478 */
480
481 /*!
482 * \brief Register the mass matrix as a pre-accumulation output.
483 */
485
486 /*!
487 * \brief Register the dead load as a pre-accumulation output.
488 */
490
491 /*!
492 * \brief Add the scalar product of the shape functions to the tangent matrix.
493 * \param[in] nodeA - index of Node a.
494 * \param[in] nodeB - index of Node b.
495 * \param[in] val - value of the scalar product of ansatz function.
496 */
497 inline void Add_HiHj(su2double val, unsigned short nodeA, unsigned short nodeB) { HiHj[nodeA][nodeB] += val; }
498
499 /*!
500 * \brief Add the scalar product of the gradients of shape functions to the tangent matrix.
501 * \param[in] nodeA - index of Node a.
502 * \param[in] nodeB - index of Node b.
503 * \param[in] val - value of the scalar product of gradients of ansatz function.
504 */
505 template <class MatrixType>
506 inline void Add_DHiDHj(const MatrixType& val, unsigned short nodeA, unsigned short nodeB) {
507 unsigned short iDim, jDim;
508 for (iDim = 0; iDim < nDim; iDim++) {
509 for (jDim = 0; jDim < nDim; jDim++) {
510 DHiDHj[nodeA][nodeB][iDim][jDim] += val[iDim][jDim];
511 }
512 }
513 }
514
515 /*!
516 * \brief Add the transposed scalar product of the gradients of shape functions to the tangent matrix.
517 * \param[in] nodeA - index of Node a.
518 * \param[in] nodeB - index of Node b.
519 * \param[in] val - value of the term that will contribute.
520 */
521 template <class MatrixType>
522 inline void Add_DHiDHj_T(const MatrixType& val, unsigned short nodeA, unsigned short nodeB) {
523 unsigned short iDim, jDim;
524 for (iDim = 0; iDim < nDim; iDim++) {
525 for (jDim = 0; jDim < nDim; jDim++) {
526 DHiDHj[nodeA][nodeB][iDim][jDim] += val[jDim][iDim];
527 }
528 }
529 }
530
531 /*!
532 * \brief Get the scalar product of the shape functions to the tangent matrix.
533 * \param[in] nodeA - index of Node a.
534 * \param[in] nodeB - index of Node b.
535 * \param[out] val - value of the scalar product of ansatz function.
536 */
537 inline su2double Get_HiHj(unsigned short nodeA, unsigned short nodeB) { return HiHj[nodeA][nodeB]; }
538
539 /*!
540 * \brief Get the scalar product of the gradients of shape functions to the tangent matrix.
541 * \param[in] nodeA - index of Node a.
542 * \param[in] nodeB - index of Node b.
543 * \return val - value of the scalar product of gradients of ansatz function.
544 */
545 inline su2activematrix& Get_DHiDHj(unsigned short nodeA, unsigned short nodeB) { return DHiDHj[nodeA][nodeB]; }
546};
547
548/*!
549 * \class CElementWithKnownSizes
550 * \ingroup FemAlgos
551 * \brief Templated class to implement the computation of gradients for specific element sizes.
552 * \author P. Gomes, R. Sanchez
553 */
554template <unsigned short NGAUSS, unsigned short NNODE, unsigned short NDIM>
556 private:
557 FORCEINLINE static su2double JacobianAdjoint(const su2double Jacobian[][1], su2double ad[][1]) {
558 /*--- Adjoint to Jacobian, we put 1.0 here so that ad/detJac is the inverse later ---*/
559 ad[0][0] = 1.0;
560 /*--- Determinant of Jacobian ---*/
561 return Jacobian[0][0];
562 }
563
564 FORCEINLINE static su2double JacobianAdjoint(const su2double Jacobian[][2], su2double ad[][2]) {
565 ad[0][0] = Jacobian[1][1];
566 ad[0][1] = -Jacobian[0][1];
567 ad[1][0] = -Jacobian[1][0];
568 ad[1][1] = Jacobian[0][0];
569 /*--- Determinant of Jacobian ---*/
570 return ad[0][0] * ad[1][1] - ad[0][1] * ad[1][0];
571 }
572
573 FORCEINLINE static su2double JacobianAdjoint(const su2double Jacobian[][3], su2double ad[][3]) {
574 ad[0][0] = Jacobian[1][1] * Jacobian[2][2] - Jacobian[1][2] * Jacobian[2][1];
575 ad[0][1] = Jacobian[0][2] * Jacobian[2][1] - Jacobian[0][1] * Jacobian[2][2];
576 ad[0][2] = Jacobian[0][1] * Jacobian[1][2] - Jacobian[0][2] * Jacobian[1][1];
577 ad[1][0] = Jacobian[1][2] * Jacobian[2][0] - Jacobian[1][0] * Jacobian[2][2];
578 ad[1][1] = Jacobian[0][0] * Jacobian[2][2] - Jacobian[0][2] * Jacobian[2][0];
579 ad[1][2] = Jacobian[0][2] * Jacobian[1][0] - Jacobian[0][0] * Jacobian[1][2];
580 ad[2][0] = Jacobian[1][0] * Jacobian[2][1] - Jacobian[1][1] * Jacobian[2][0];
581 ad[2][1] = Jacobian[0][1] * Jacobian[2][0] - Jacobian[0][0] * Jacobian[2][1];
582 ad[2][2] = Jacobian[0][0] * Jacobian[1][1] - Jacobian[0][1] * Jacobian[1][0];
583 /*--- Determinant of Jacobian ---*/
584 return Jacobian[0][0] * ad[0][0] + Jacobian[0][1] * ad[1][0] + Jacobian[0][2] * ad[2][0];
585 }
586
587 protected:
588 static_assert(NDIM == 1 || NDIM == 2 || NDIM == 3, "ComputeGrad_impl expects 1D, 2D or 3D");
589
590 su2double GaussCoord[NGAUSS][NDIM]; /*!< \brief Coordinates of the integration points. */
591 su2double dNiXj[NGAUSS][NNODE][NDIM]; /*!< \brief Shape function derivatives evaluated at the Gauss points. */
592
593 /*!
594 * \brief Constructor of the class.
595 * \note This constructor is protected to prevent this class from being instantiated.
596 * Its only role is to ensure the parent constructor is called with the right arguments.
597 */
598 CElementWithKnownSizes() : CElement(NGAUSS, NNODE, NDIM) {}
599
600 /*!
601 * \brief Implementation of gradient computation leveraging the static sizes.
602 * \param[in] FRAME - template, REFERENCE or CURRENT coordinates.
603 */
604 template <FrameType FRAME>
605 void ComputeGrad_impl(void) {
606 su2double Jacobian[NDIM][NDIM], ad[NDIM][NDIM];
607 unsigned short iNode, iDim, jDim, iGauss;
608
609 /*--- Select the appropriate source for the nodal coordinates depending on the frame requested
610 for the gradient computation, REFERENCE (undeformed) or CURRENT (deformed) ---*/
611 const su2activematrix& Coord = (FRAME == REFERENCE) ? RefCoord : CurrentCoord;
612
613 for (iGauss = 0; iGauss < NGAUSS; iGauss++) {
614 /*--- Jacobian transformation ---*/
615 /*--- This does dX/dXi transpose ---*/
616
617 for (iDim = 0; iDim < NDIM; iDim++)
618 for (jDim = 0; jDim < NDIM; jDim++) Jacobian[iDim][jDim] = 0.0;
619
620 for (iNode = 0; iNode < NNODE; iNode++)
621 for (iDim = 0; iDim < NDIM; iDim++)
622 for (jDim = 0; jDim < NDIM; jDim++) Jacobian[iDim][jDim] += Coord(iNode, jDim) * dNiXj[iGauss][iNode][iDim];
623
624 if (NDIM == 1) {
625 /*--- Obviously the Jacobian is the slope of the line ---*/
626 Jacobian[0][0] = (Coord[1][0] - Coord[0][0]);
627 }
628
629 /*--- Adjoint to the Jacobian and determinant ---*/
630
631 auto detJac = JacobianAdjoint(Jacobian, ad);
632
633 if (FRAME == REFERENCE)
634 GaussPoint[iGauss].SetJ_X(detJac);
635 else
636 GaussPoint[iGauss].SetJ_x(detJac);
637
638 /*--- Jacobian inverse (it was already computed as transpose) ---*/
639
640 for (iDim = 0; iDim < NDIM; iDim++)
641 for (jDim = 0; jDim < NDIM; jDim++) Jacobian[iDim][jDim] = ad[iDim][jDim] / detJac;
642
643 /*--- Derivatives with respect to global coordinates ---*/
644
645 for (iNode = 0; iNode < NNODE; iNode++) {
646 for (iDim = 0; iDim < NDIM; iDim++) {
647 su2double GradNi_Xj = 0.0;
648 for (jDim = 0; jDim < NDIM; jDim++) GradNi_Xj += Jacobian[iDim][jDim] * dNiXj[iGauss][iNode][jDim];
649
650 if (FRAME == REFERENCE)
651 GaussPoint[iGauss].SetGradNi_Xj(GradNi_Xj, iDim, iNode);
652 else
653 GaussPoint[iGauss].SetGradNi_xj(GradNi_Xj, iDim, iNode);
654 }
655 }
656 }
657 }
658
659 template <FrameType FRAME>
661 /*--- Select the appropriate source for the nodal coordinates depending on the frame requested
662 for the gradient computation, REFERENCE (undeformed) or CURRENT (deformed) ---*/
663 const su2activematrix& Coord = (FRAME == REFERENCE) ? RefCoord : CurrentCoord;
664
665 if (NDIM == 1) {
666 unsigned short iNode, iDim, iGauss;
667 su2double Jacobian[2];
668 su2double val_grad;
669
670 Jacobian[0] = (Coord[1][0] - Coord[0][0]);
671 Jacobian[1] = (Coord[1][1] - Coord[0][1]);
672 const su2double JTJ = Jacobian[0] * Jacobian[0] + Jacobian[1] * Jacobian[1];
673 const su2double volJacobian = sqrt(JTJ);
674
675 for (iGauss = 0; iGauss < NGAUSS; iGauss++) {
676 GaussPoint[iGauss].SetJ_X(volJacobian);
677
678 for (iNode = 0; iNode < NNODE; iNode++) {
679 for (iDim = 0; iDim < NDIM + 1; iDim++) {
680 val_grad = Jacobian[iDim] * dNiXj[iGauss][iNode][0] / JTJ;
681 GaussPoint[iGauss].SetGradNi_Xj(val_grad, iDim, iNode);
682 }
683 }
684 }
685
686 } else if (NDIM == 2) {
687 su2double Jacobian[NDIM + 1][NDIM], JTJ[NDIM][NDIM];
688 su2double volJacobian;
689 unsigned short iShape, iDim, jDim, jVertex, kDim, iGauss;
690
691 for (iGauss = 0; iGauss < NGAUSS; iGauss++) {
692 /*--- Jacobian transformation ---*/
693 /*--- This does dX/dXi transpose ---*/
694 if (NNODE == 3) {
695 for (iDim = 0; iDim < NDIM + 1; iDim++) {
696 for (jVertex = 0; jVertex < NDIM; jVertex++) {
697 Jacobian[iDim][jVertex] = Coord[jVertex + 1][iDim] - Coord[0][iDim];
698 }
699 }
700 }
701 if (NNODE == 4) {
702 for (iDim = 0; iDim < NDIM + 1; iDim++) {
703 Jacobian[iDim][0] = (Coord[1][iDim] - Coord[0][iDim]) / 2;
704 Jacobian[iDim][1] = (Coord[3][iDim] - Coord[0][iDim]) / 2;
705 }
706 }
707
708 for (iDim = 0; iDim < NDIM; iDim++) {
709 for (jDim = 0; jDim < NDIM; jDim++) {
710 JTJ[iDim][jDim] = 0.0;
711 for (kDim = 0; kDim < NDIM + 1; kDim++) {
712 JTJ[iDim][jDim] += Jacobian[kDim][iDim] * Jacobian[kDim][jDim];
713 }
714 }
715 }
716
717 /*--- matrix volume of Jacobian ---*/
718 const su2double detJacobian = JTJ[0][0] * JTJ[1][1] - JTJ[0][1] * JTJ[1][0];
719
720 volJacobian = sqrt(detJacobian);
721
722 GaussPoint[iGauss].SetJ_X(volJacobian);
723
724 /*--- Derivatives with respect to global coordinates ---*/
725
726 su2double JTJinv[2][2];
727 JTJinv[0][0] = JTJ[1][1] / detJacobian;
728 JTJinv[1][1] = JTJ[0][0] / detJacobian;
729 JTJinv[0][1] = -JTJ[0][1] / detJacobian;
730 JTJinv[1][0] = -JTJ[1][0] / detJacobian;
731
732 su2double Jdagger[2][3];
733
734 for (iDim = 0; iDim < NDIM; iDim++) {
735 for (jDim = 0; jDim < NDIM + 1; jDim++) {
736 Jdagger[iDim][jDim] = 0.0;
737 for (kDim = 0; kDim < NDIM; kDim++) {
738 Jdagger[iDim][jDim] += JTJinv[iDim][kDim] * Jacobian[jDim][kDim];
739 }
740 }
741 }
742
743 su2double GradOut[NDIM + 1];
744 for (iShape = 0; iShape < NNODE; iShape++) {
745 for (iDim = 0; iDim < NDIM + 1; iDim++) {
746 GradOut[iDim] = 0.0;
747 for (jDim = 0; jDim < NDIM; jDim++) {
748 GradOut[iDim] += Jdagger[jDim][iDim] * dNiXj[iGauss][iShape][jDim];
749 }
750 GaussPoint[iGauss].SetGradNi_Xj(GradOut[iDim], iDim, iShape);
751 }
752 }
753 }
754 }
755 }
756
757 public:
758 /*!
759 * \brief Set the value of the gradient of the shape functions wrt the reference configuration.
760 */
761 void ComputeGrad_Linear(void) final { ComputeGrad_impl<REFERENCE>(); }
762
763 /*!
764 * \brief Set the value of the gradient of the shape functions wrt the current configuration.
765 */
766 void ComputeGrad_NonLinear(void) final { ComputeGrad_impl<CURRENT>(); }
767
768 /*!
769 * \brief Overload needed for deformed 2D elements on a surface in 3D or 1D elements on a 2D curve.
770 */
771 void ComputeGrad_SurfaceEmbedded() final { ComputeGrad_impl_surf_embedded<REFERENCE>(); }
772};
773
774/*!
775 * \class CTRIA1
776 * \ingroup FemAlgos
777 * \brief Tria element with 1 Gauss Points
778 * \author R. Sanchez
779 */
780class CTRIA1 final : public CElementWithKnownSizes<1, 3, 2> {
781 private:
782 enum : unsigned short { NGAUSS = 1 };
783 enum : unsigned short { NNODE = 3 };
784 enum : unsigned short { NDIM = 2 };
785
786 public:
787 /*!
788 * \brief Constructor of the class.
789 */
790 CTRIA1();
791
792 /*!
793 * \brief Compute the value of the area of the element.
794 * \param[in] mode - Type of coordinates to consider in the computation.
795 * \return Area of the element.
796 */
797 su2double ComputeArea(const FrameType mode = REFERENCE) const override;
798};
799
800/*!
801 * \class CQUAD4
802 * \ingroup FemAlgos
803 * \brief Quadrilateral element with 4 Gauss Points
804 * \author R. Sanchez
805 */
806class CQUAD4 final : public CElementWithKnownSizes<4, 4, 2> {
807 private:
808 enum : unsigned short { NGAUSS = 4 };
809 enum : unsigned short { NNODE = 4 };
810 enum : unsigned short { NDIM = 2 };
811
812 public:
813 /*!
814 * \brief Constructor of the class.
815 */
816 CQUAD4();
817
818 /*!
819 * \brief Shape functions (Ni) evaluated at point Xi,Eta.
820 */
821 inline static void ShapeFunctions(const su2double& Xi, const su2double& Eta, su2double* Ni) {
822 Ni[0] = 0.25 * (1.0 - Xi) * (1.0 - Eta);
823 Ni[1] = 0.25 * (1.0 + Xi) * (1.0 - Eta);
824 Ni[2] = 0.25 * (1.0 + Xi) * (1.0 + Eta);
825 Ni[3] = 0.25 * (1.0 - Xi) * (1.0 + Eta);
826 }
827
828 /*!
829 * \brief Shape function Jacobian (dNi) evaluated at point Xi,Eta.
830 */
831 inline static void ShapeFunctionJacobian(const su2double& Xi, const su2double& Eta, su2double dNi[][2]) {
832 dNi[0][0] = -0.25 * (1.0 - Eta);
833 dNi[0][1] = -0.25 * (1.0 - Xi);
834 dNi[1][0] = 0.25 * (1.0 - Eta);
835 dNi[1][1] = -0.25 * (1.0 + Xi);
836 dNi[2][0] = 0.25 * (1.0 + Eta);
837 dNi[2][1] = 0.25 * (1.0 + Xi);
838 dNi[3][0] = -0.25 * (1.0 + Eta);
839 dNi[3][1] = 0.25 * (1.0 - Xi);
840 }
841
842 /*!
843 * \brief Compute the value of the area of the element.
844 * \param[in] mode - Type of coordinates to consider in the computation.
845 * \return Area of the element.
846 */
847 su2double ComputeArea(const FrameType mode = REFERENCE) const override;
848};
849
850/*!
851 * \class CTETRA1
852 * \ingroup FemAlgos
853 * \brief Tetrahedral element with 1 Gauss Point
854 * \author R. Sanchez
855 */
856class CTETRA1 final : public CElementWithKnownSizes<1, 4, 3> {
857 private:
858 enum : unsigned short { NGAUSS = 1 };
859 enum : unsigned short { NNODE = 4 };
860 enum : unsigned short { NDIM = 3 };
861
862 public:
863 /*!
864 * \brief Constructor of the class.
865 */
866 CTETRA1();
867
868 /*!
869 * \brief Compute the value of the volume of the element.
870 * \return Volume of the element.
871 */
872 su2double ComputeVolume(const FrameType mode = REFERENCE) const override;
873};
874
875/*!
876 * \class CHEXA8
877 * \ingroup FemAlgos
878 * \brief Hexahedral element with 8 Gauss Points
879 * \author R. Sanchez
880 */
881class CHEXA8 final : public CElementWithKnownSizes<8, 8, 3> {
882 private:
883 enum : unsigned short { NGAUSS = 8 };
884 enum : unsigned short { NNODE = 8 };
885 enum : unsigned short { NDIM = 3 };
886
887 public:
888 /*!
889 * \brief Constructor of the class.
890 */
891 CHEXA8();
892
893 /*!
894 * \brief Compute the value of the volume of the element.
895 * \param[in] mode - Type of coordinates to consider in the computation.
896 * \return Volume of the element.
897 */
898 su2double ComputeVolume(const FrameType mode = REFERENCE) const override;
899};
900
901/*!
902 * \class CPYRAM5
903 * \ingroup FemAlgos
904 * \brief Pyramid element with 5 Gauss Points
905 * \author R. Sanchez, F. Palacios, A. Bueno, T. Economon, S. Padron.
906 */
907class CPYRAM5 final : public CElementWithKnownSizes<5, 5, 3> {
908 private:
909 enum : unsigned short { NGAUSS = 5 };
910 enum : unsigned short { NNODE = 5 };
911 enum : unsigned short { NDIM = 3 };
912
913 public:
914 /*!
915 * \brief Constructor of the class.
916 */
917 CPYRAM5();
918
919 /*!
920 * \brief Compute the value of the volume of the element.
921 * \param[in] mode - Type of coordinates to consider in the computation.
922 * \return Volume of the element.
923 */
924 su2double ComputeVolume(const FrameType mode = REFERENCE) const override;
925};
926
927/*!
928 * \class CPRISM6
929 * \ingroup FemAlgos
930 * \brief Prism element with 6 Gauss Points
931 * \author R. Sanchez, F. Palacios, A. Bueno, T. Economon, S. Padron.
932 * \version 8.5.0 "Harrier"
933 */
934class CPRISM6 final : public CElementWithKnownSizes<6, 6, 3> {
935 private:
936 enum : unsigned short { NGAUSS = 6 };
937 enum : unsigned short { NNODE = 6 };
938 enum : unsigned short { NDIM = 3 };
939
940 public:
941 /*!
942 * \brief Constructor of the class.
943 */
944 CPRISM6();
945
946 /*!
947 * \brief Compute the value of the volume of the element.
948 * \param[in] mode - Type of coordinates to consider in the computation.
949 * \return Volume of the element.
950 */
951 su2double ComputeVolume(const FrameType mode = REFERENCE) const override;
952};
953
954/*!
955 * \class CTRIA3
956 * \ingroup FemAlgos
957 * \brief Tria element with 3 Gauss Points
958 * \author T.Dick
959 */
960class CTRIA3 final : public CElementWithKnownSizes<3, 3, 2> {
961 private:
962 enum : unsigned short { NGAUSS = 3 };
963 enum : unsigned short { NNODE = 3 };
964 enum : unsigned short { NDIM = 2 };
965
966 public:
967 /*!
968 * \brief Constructor of the class.
969 */
970 CTRIA3();
971
972 /*!
973 * \brief Compute the value of the area of the element.
974 * \param[in] mode - Type of coordinates to consider in the computation.
975 * \return Area of the element.
976 */
977 su2double ComputeArea(const FrameType mode = REFERENCE) const override;
978};
979
980/*!
981 * \class CTETRA4
982 * \ingroup FemAlgos
983 * \brief Tetrahedral element with 4 Gauss Points
984 * \author T.Dick
985 */
986class CTETRA4 final : public CElementWithKnownSizes<4, 4, 3> {
987 private:
988 enum : unsigned short { NGAUSS = 4 };
989 enum : unsigned short { NNODE = 4 };
990 enum : unsigned short { NDIM = 3 };
991
992 public:
993 /*!
994 * \brief Constructor of the class.
995 */
996 CTETRA4();
997
998 /*!
999 * \brief Compute the value of the area of the element.
1000 * \param[in] mode - Type of coordinates to consider in the computation.
1001 * \return Area of the element.
1002 */
1003 su2double ComputeVolume(const FrameType mode = REFERENCE) const override;
1004};
1005
1006/*!
1007 * \class CPYRAM6
1008 * \ingroup FemAlgos
1009 * \brief Pyramid element with 6 Gauss Points
1010 * \author T.Dick
1011 */
1012class CPYRAM6 final : public CElementWithKnownSizes<6, 5, 3> {
1013 private:
1014 enum : unsigned short { NGAUSS = 6 };
1015 enum : unsigned short { NNODE = 5 };
1016 enum : unsigned short { NDIM = 3 };
1017
1018 public:
1019 /*!
1020 * \brief Constructor of the class.
1021 */
1022 CPYRAM6();
1023
1024 /*!
1025 * \brief Compute the value of the volume of the element.
1026 * \param[in] mode - Type of coordinates to consider in the computation.
1027 * \return Volume of the element.
1028 */
1029 su2double ComputeVolume(const FrameType mode = REFERENCE) const override;
1030};
1031
1032/*!
1033 * \class CLINE
1034 * \ingroup FemAlgos
1035 * \brief Line element with 2 Gauss Points
1036 * \author T.Dick
1037 */
1038class CLINE final : public CElementWithKnownSizes<2, 2, 1> {
1039 private:
1040 enum : unsigned short { NGAUSS = 2 };
1041 enum : unsigned short { NNODE = 2 };
1042 enum : unsigned short { NDIM = 1 };
1043
1044 public:
1045 /*!
1046 * \brief Constructor of the class.
1047 */
1048 CLINE();
1049
1050 /*!
1051 * \brief Compute the value of the area of the element.
1052 * \param[in] mode - Type of coordinates to consider in the computation.
1053 * \return Area of the element.
1054 */
1055 su2double ComputeLength(const FrameType mode = REFERENCE) const override;
1056};
Light classes to define finite element properties.
Light-weight class to store Gaussian point information.
A templated matrix/vector-like object.
Definition C2DContainer.hpp:374
void setConstant(const Scalar_t &value) noexcept
Set value of all entries to "value".
Definition C2DContainer.hpp:549
Templated class to implement the computation of gradients for specific element sizes.
Definition CElement.hpp:555
void ComputeGrad_impl(void)
Implementation of gradient computation leveraging the static sizes.
Definition CElement.hpp:605
void ComputeGrad_Linear(void) final
Set the value of the gradient of the shape functions wrt the reference configuration.
Definition CElement.hpp:761
void ComputeGrad_NonLinear(void) final
Set the value of the gradient of the shape functions wrt the current configuration.
Definition CElement.hpp:766
CElementWithKnownSizes()
Constructor of the class.
Definition CElement.hpp:598
void ComputeGrad_SurfaceEmbedded() final
Overload needed for deformed 2D elements on a surface in 3D or 1D elements on a 2D curve.
Definition CElement.hpp:771
void ComputeGrad_impl_surf_embedded()
Definition CElement.hpp:660
su2double GaussCoord[NGAUSS][NDIM]
Coordinates of the integration points.
Definition CElement.hpp:590
su2double dNiXj[NGAUSS][NNODE][NDIM]
Shape function derivatives evaluated at the Gauss points.
Definition CElement.hpp:591
Abstract class for defining finite elements.
Definition CElement.hpp:58
void Add_Kab(unsigned short nodeA, unsigned short nodeB, Matrix &val_Kab)
Add the value of a submatrix K relating nodes a and b, for the constitutive term.
Definition CElement.hpp:253
void Add_Mab(unsigned short nodeA, unsigned short nodeB, const su2double &val_Mab)
Add the value of the diagonal term for the mass matrix.
Definition CElement.hpp:242
su2double GetWeight(unsigned short iGauss) const
Get the weight of the corresponding Gaussian Point.
Definition CElement.hpp:214
su2double GetNi_Extrap(unsigned short iNode, unsigned short iGauss) const
Retrieve the value of the gradient of the shape functions respect to the reference configuration.
Definition CElement.hpp:376
void SetTemperature(unsigned short iNode, const su2double &val_Temperature)
Set the value of the temperature of a node.
Definition CElement.hpp:173
const su2double * Get_FDL_a(unsigned short nodeA) const
Return the values of the dead load components of the residual for node a.
Definition CElement.hpp:338
su2double Get_NodalStress(unsigned short iNode, unsigned short iVar) const
Retrieve the value of the nodal stress for an element.
Definition CElement.hpp:396
su2double GetGradNi_x(unsigned short iNode, unsigned short iGauss, unsigned short iDim) const
Retrieve the value of the gradient of the shape functions respect to the current configuration.
Definition CElement.hpp:366
unsigned long iDV
ID of the Design Variable (if it is element based).
Definition CElement.hpp:82
@ MAXNDIM
Definition CElement.hpp:60
void SetCurr_Coord(unsigned short iNode, unsigned short iDim, const su2double &val_CoordCurr)
Set the value of the coordinate of the nodes in the current configuration.
Definition CElement.hpp:166
unsigned long Get_iProp(void) const
Return the value of the identifier for the Element Property.
Definition CElement.hpp:430
void ClearElement(void)
Sets matrices to 0.
Definition CElement.cpp:70
void Add_Ks_ab(unsigned short nodeA, unsigned short nodeB, const su2double &val_Ks_ab)
Add the value of the diagonal term for the stress contribution to the stiffness of the system.
Definition CElement.hpp:275
su2double GetCurr_Coord(unsigned short iNode, unsigned short iDim) const
Get the value of the coordinate of the nodes in the current configuration.
Definition CElement.hpp:196
virtual ~CElement(void)=default
Destructor of the class.
unsigned long iDe
ID of the dielectric elastomer.
Definition CElement.hpp:83
const su2double * Get_Kt_a(unsigned short nodeA) const
Return the values of the nodal stress components of the residual for node a.
Definition CElement.hpp:331
void ClearStress(void)
Restarts the values of stress in the element.
Definition CElement.hpp:300
su2double GetNi(unsigned short iNode, unsigned short iGauss) const
Retrieve the value of the shape functions.
Definition CElement.hpp:346
su2double GetJ_x(unsigned short iGauss) const
Get the jacobian respect to the current configuration for the Gaussian Point iGauss.
Definition CElement.hpp:228
su2double GetGradNi_X(unsigned short iNode, unsigned short iGauss, unsigned short iDim) const
Retrieve the value of the gradient of the shape functions respect to the reference configuration.
Definition CElement.hpp:355
void Set_ElProperties(const CProperty *element_property)
Store the values of the identifiers for element properties.
Definition CElement.hpp:402
std::vector< su2activematrix > Kab
Structure for the constitutive component of the tangent matrix.
Definition CElement.hpp:73
void Set_iDe(unsigned long val_iDe)
Store the value of the identifier for the Dielectric Elastomers.
Definition CElement.hpp:412
void SetRef_Coord(unsigned short iNode, unsigned short iDim, const su2double &val_CoordRef)
Set the value of the coordinate of the nodes in the reference configuration.
Definition CElement.hpp:156
virtual void ComputeGrad_NonLinear(void)=0
Set the value of the gradient of the shape functions wrt the current configuration.
void SetPreaccOut_Mab(void)
Register the mass matrix as a pre-accumulation output.
Definition CElement.hpp:484
su2double ComputeCurrentArea(void) const
Compute the value of the area of the element in current coordinates (wrapper to ComputeArea(CURRENT))...
Definition CElement.hpp:457
su2double Get_HiHj(unsigned short nodeA, unsigned short nodeB)
Get the scalar product of the shape functions to the tangent matrix.
Definition CElement.hpp:537
const su2double * Get_Kab(unsigned short nodeA, unsigned short nodeB) const
Return the value of the submatrix K relating nodes a and b.
Definition CElement.hpp:316
void Add_HiHj(su2double val, unsigned short nodeA, unsigned short nodeB)
Add the scalar product of the shape functions to the tangent matrix.
Definition CElement.hpp:497
su2activematrix HiHj
Scalar product of 2 ansatz functions.
Definition CElement.hpp:89
unsigned long Get_iDe(void) const
Return the value of the identifier for the Dielectric Elastomers.
Definition CElement.hpp:418
void Add_Kt_a(unsigned short nodeA, const su2double *val_Kt_a)
Add the value of the nodal stress term for the computation of the residual.
Definition CElement.hpp:284
su2double GetJ_X(unsigned short iGauss) const
Get the Jacobian respect to the reference configuration for the Gaussian Point iGauss.
Definition CElement.hpp:221
void SetPreaccIn_Coords(bool nonlinear=true)
Register the current and reference coordinates of the element as pre-accumulation inputs the latter a...
Definition CElement.hpp:470
unsigned short GetnNodes(void) const
Retrieve the number of nodes of the element.
Definition CElement.hpp:142
su2activematrix NodalStress
Stress at the nodes.
Definition CElement.hpp:68
std::vector< std::vector< su2activematrix > > DHiDHj
Scalar product of the gradients of 2 ansatz functions.
Definition CElement.hpp:91
su2activematrix Kt_a
Matrix of nodal stress terms for residual computation.
Definition CElement.hpp:76
unsigned short nNodes
Number of geometric points.
Definition CElement.hpp:86
void Add_Kab_T(unsigned short nodeA, unsigned short nodeB, Matrix &val_Kab)
Add the value of a submatrix K relating nodes a and b, for the constitutive term (symmetric terms nee...
Definition CElement.hpp:264
unsigned long Get_iDV(void) const
Return the value of the identifier for the Design Variable.
Definition CElement.hpp:424
void Add_DHiDHj(const MatrixType &val, unsigned short nodeA, unsigned short nodeB)
Add the scalar product of the gradients of shape functions to the tangent matrix.
Definition CElement.hpp:506
void SetTemperature(const su2double &val_Temperature)
Set the value of the temperature of all nodes.
Definition CElement.hpp:180
su2activematrix CurrentCoord
Coordinates in the current frame.
Definition CElement.hpp:64
su2double ComputeCurrentVolume(void) const
Compute the value of the volume of the element in current coordinates (wrapper to ComputeVolume(CURRE...
Definition CElement.hpp:463
unsigned short GetnGaussPoints(void) const
Retrieve the number of nodes of the element.
Definition CElement.hpp:148
su2activematrix RefCoord
Coordinates in the reference frame.
Definition CElement.hpp:65
void SetPreaccOut_FDL_a(void)
Register the dead load as a pre-accumulation output.
Definition CElement.hpp:489
su2activematrix NodalExtrap
Coordinates of the nodal points for Gaussian extrapolation.
Definition CElement.hpp:67
virtual su2double ComputeLength(const FrameType mode=REFERENCE) const
Compute the value of the length of the element.
Definition CElement.hpp:437
su2double GetTemperature(unsigned short iGauss) const
Get the value of the temperature at a Gaussian integration point.
Definition CElement.hpp:201
unsigned long iProp
ID of the Element Property.
Definition CElement.hpp:81
void Add_DHiDHj_T(const MatrixType &val, unsigned short nodeA, unsigned short nodeB)
Add the transposed scalar product of the gradients of shape functions to the tangent matrix.
Definition CElement.hpp:522
su2activematrix FDL_a
Matrix of dead loads for residual computation.
Definition CElement.hpp:77
su2double GetRef_Coord(unsigned short iNode, unsigned short iDim) const
Get the value of the coordinate of the nodes in the reference configuration.
Definition CElement.hpp:188
su2activevector NodalTemperature
Temperature at the nodes.
Definition CElement.hpp:70
FrameType
Definition CElement.hpp:94
@ REFERENCE
Definition CElement.hpp:94
@ CURRENT
Definition CElement.hpp:94
su2double Get_Mab(unsigned short nodeA, unsigned short nodeB) const
Return the value of the diagonal term for the mass matrix, relating nodes a and b.
Definition CElement.hpp:308
void Add_FDL_a(unsigned short nodeA, const su2double *val_FDL_a)
Add the value of the dead load for the computation of the residual.
Definition CElement.hpp:293
void Add_NodalStress(unsigned short iNode, unsigned short iVar, const su2double &val_Stress)
Add a value to the nodal stress for an element.
Definition CElement.hpp:386
su2double GetElement_Pressure(void) const
Retrieve the value of the pressure in the element for incompressible materials.
Definition CElement.hpp:234
virtual void ComputeGrad_Linear(void)=0
Set the value of the gradient of the shape functions wrt the reference configuration.
std::vector< CGaussVariable > GaussPoint
Vector of Gaussian Points.
Definition CElement.hpp:62
su2activematrix & Get_DHiDHj(unsigned short nodeA, unsigned short nodeB)
Get the scalar product of the gradients of shape functions to the tangent matrix.
Definition CElement.hpp:545
su2double el_Pressure
Pressure in the element.
Definition CElement.hpp:79
su2activematrix Mab
Structure for the nodal components of the mass matrix.
Definition CElement.hpp:74
virtual void ComputeGrad_SurfaceEmbedded(void)=0
Set the value of the gradient of the shape functions wrt the reference configuration.
unsigned short nDim
Number of dimension of the problem.
Definition CElement.hpp:87
CElement(void)=delete
Default constructor of the class, deleted to make sure derived classes always call the allocating con...
virtual su2double ComputeVolume(const FrameType mode=REFERENCE) const
Compute the value of the volume of the element.
Definition CElement.hpp:451
su2activevector GaussWeight
Weight of the Gaussian Points for the integration.
Definition CElement.hpp:66
unsigned short nGaussPoints
Number of gaussian points.
Definition CElement.hpp:85
virtual su2double ComputeArea(const FrameType mode=REFERENCE) const
Compute the value of the area of the element.
Definition CElement.hpp:444
su2double Get_Ks_ab(unsigned short nodeA, unsigned short nodeB) const
Return the value of the diagonal term for the stress contribution, relating nodes a and b.
Definition CElement.hpp:324
su2activematrix Ks_ab
Structure for the stress component of the tangent matrix.
Definition CElement.hpp:75
void SetPreaccOut_Kt_a(void)
Register the stress residual as a pre-accumulation output. When computing the element stiffness matri...
Definition CElement.hpp:479
Hexahedral element with 8 Gauss Points.
Definition CElement.hpp:881
su2double ComputeVolume(const FrameType mode=REFERENCE) const override
Compute the value of the volume of the element.
Definition CHEXA8.cpp:174
CHEXA8()
Constructor of the class.
Definition CHEXA8.cpp:30
Line element with 2 Gauss Points.
Definition CElement.hpp:1038
CLINE()
Constructor of the class.
Definition CLINE.cpp:30
su2double ComputeLength(const FrameType mode=REFERENCE) const override
Compute the value of the area of the element.
Definition CLINE.cpp:59
Prism element with 6 Gauss Points.
Definition CElement.hpp:934
su2double ComputeVolume(const FrameType mode=REFERENCE) const override
Compute the value of the volume of the element.
Definition CPRISM6.cpp:150
CPRISM6()
Constructor of the class.
Definition CPRISM6.cpp:30
Pyramid element with 5 Gauss Points.
Definition CElement.hpp:907
CPYRAM5()
Constructor of the class.
Definition CPYRAM5.cpp:30
su2double ComputeVolume(const FrameType mode=REFERENCE) const override
Compute the value of the volume of the element.
Definition CPYRAM5.cpp:135
Pyramid element with 6 Gauss Points.
Definition CElement.hpp:1012
su2double ComputeVolume(const FrameType mode=REFERENCE) const override
Compute the value of the volume of the element.
Definition CPYRAM6.cpp:139
CPYRAM6()
Constructor of the class.
Definition CPYRAM6.cpp:30
Base class for defining element properties.
Definition CElementProperty.hpp:37
virtual unsigned long GetElectric_Prop(void) const
Get index of the electric properties.
Definition CElementProperty.hpp:66
virtual unsigned long GetDV(void) const
Get index of the design variable.
Definition CElementProperty.hpp:71
unsigned long GetMat_Prop(void) const
Get index of the physical properties.
Definition CElementProperty.hpp:61
Quadrilateral element with 4 Gauss Points.
Definition CElement.hpp:806
static void ShapeFunctionJacobian(const su2double &Xi, const su2double &Eta, su2double dNi[][2])
Shape function Jacobian (dNi) evaluated at point Xi,Eta.
Definition CElement.hpp:831
CQUAD4()
Constructor of the class.
Definition CQUAD4.cpp:30
su2double ComputeArea(const FrameType mode=REFERENCE) const override
Compute the value of the area of the element.
Definition CQUAD4.cpp:91
static void ShapeFunctions(const su2double &Xi, const su2double &Eta, su2double *Ni)
Shape functions (Ni) evaluated at point Xi,Eta.
Definition CElement.hpp:821
Tetrahedral element with 1 Gauss Point.
Definition CElement.hpp:856
su2double ComputeVolume(const FrameType mode=REFERENCE) const override
Compute the value of the volume of the element.
Definition CTETRA1.cpp:83
CTETRA1()
Constructor of the class.
Definition CTETRA1.cpp:31
Tetrahedral element with 4 Gauss Points.
Definition CElement.hpp:986
su2double ComputeVolume(const FrameType mode=REFERENCE) const override
Compute the value of the area of the element.
Definition CTETRA4.cpp:97
CTETRA4()
Constructor of the class.
Definition CTETRA4.cpp:31
Tria element with 1 Gauss Points.
Definition CElement.hpp:780
CTRIA1()
Constructor of the class.
Definition CTRIA1.cpp:30
su2double ComputeArea(const FrameType mode=REFERENCE) const override
Compute the value of the area of the element.
Definition CTRIA1.cpp:71
Tria element with 3 Gauss Points.
Definition CElement.hpp:960
su2double ComputeArea(const FrameType mode=REFERENCE) const override
Compute the value of the area of the element.
Definition CTRIA3.cpp:77
CTRIA3()
Constructor of the class.
Definition CTRIA3.cpp:30
Scalar_t * data() noexcept
Definition C2DContainer.hpp:222
#define FORCEINLINE
Definition code_config.hpp:44
passivedouble su2double
Definition code_config.hpp:181
FORCEINLINE ARRAY_T sqrt(const ARRAY_T &x)
Definition special_vectorization.hpp:116
void SetPreaccOut(Ts &&... data)
Sets the scalar outputs of a preaccumulation section.
Definition ad_structure.hpp:222
void SetPreaccIn(Ts &&... data)
Sets the scalar inputs of a preaccumulation section.
Definition ad_structure.hpp:186