Documentation 6b54b78464
Loading...
Searching...
No Matches
CPrimalGridFEM.hpp
Go to the documentation of this file.
1/*!
2 * \file CPrimalGridFEM.hpp
3 * \brief Headers of the main subroutines for storing the primal grid structure.
4 * The subroutines and functions are in the <i>CPrimalGridFEM.cpp</i> file.
5 * \author F. Palacios
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 "CPrimalGrid.hpp"
32#include "../../option_structure.hpp"
33
34/*!
35 * \class CPrimalGridFEM
36 * \brief Class to define primal grid element for the FEM solver.
37 * \version 8.5.0 "Harrier"
38 */
39class CPrimalGridFEM final : public CPrimalGrid {
40 private:
41 unsigned long elemIDGlobal; /*!< \brief Global element ID of this element. */
42 unsigned long offsetDOFsSolGlobal; /*!< \brief Global offset of the solution DOFs of this element. */
43 unsigned long color; /*!< \brief Color of the element in the partitioning strategy. */
44
45 unsigned short VTK_Type; /*!< \brief Element type using the VTK convention. */
46 unsigned short nPolyGrid; /*!< \brief Polynomial degree for the geometry of the element. */
47 unsigned short nPolySol; /*!< \brief Polynomial degree for the solution of the element. */
48 unsigned short nDOFsGrid; /*!< \brief Number of DOFs for the geometry of the element. */
49 unsigned short nDOFsSol; /*!< \brief Number of DOFs for the solution of the element. */
50 unsigned short nFaces; /*!< \brief Number of faces of the element. */
51
52 bool JacobianConsideredConstant; /*!< \brief Whether or not the Jacobian of the transformation to
53 is (almost) constant. */
54
55 public:
56 /*!
57 * \brief Constructor using data to initialize the element.
58 * \param[in] dataElem - Meta and connectivity data for this element.
59 * \param[in,out] offsetDOFs - The offset of the solution DOFs for this element.
60 */
61 CPrimalGridFEM(const unsigned long* dataElem, unsigned long& offsetSolDOFs);
62
63 /*!
64 * \brief Get the number of nodes that composes a face of an element.
65 * \param[in] val_face - Local index of the face.
66 * \return Number of nodes that composes a face of an element.
67 */
68 inline unsigned short GetnNodesFace(unsigned short val_face) const override {
69 return std::numeric_limits<unsigned short>::max();
70 }
71
72 /*!
73 * \brief Get the face index of an element.
74 * \param[in] val_face - Local index of the face.
75 * \param[in] val_index - Local (to the face) index of the nodes that compose the face.
76 * \return Local (to the element) index of the nodes that compose the face.
77 */
78 inline unsigned short GetFaces(unsigned short val_face, unsigned short val_index) const override {
79 return std::numeric_limits<unsigned short>::max();
80 }
81
82 /*!
83 * \brief Get the local index of the neighbors to a node (given the local index).
84 * \param[in] val_node - Local (to the element) index of a node.
85 * \param[in] val_index - Local (to the neighbor nodes of val_node) index of the nodes that are neighbor to val_node.
86 * \return Local (to the element) index of the nodes that are neighbor to val_node.
87 */
88 inline unsigned short GetNeighbor_Nodes(unsigned short val_node, unsigned short val_index) const override {
89 return std::numeric_limits<unsigned short>::max();
90 }
91
92 /*!
93 * \brief Get the number of nodes of an element.
94 * \return Number of nodes that composes an element.
95 */
96 inline unsigned short GetnNodes(void) const override { return nDOFsGrid; }
97
98 /*!
99 * \brief Get the number of faces of an element.
100 * \return Number of faces of an element.
101 */
102 inline unsigned short GetnFaces(void) const override { return nFaces; }
103
104 /*!
105 * \brief Get the number of neighbors nodes of a node.
106 * \param[in] val_node - Local (to the element) index of a node.
107 * \return Number if neighbors of a node val_node.
108 */
109 inline unsigned short GetnNeighbor_Nodes(unsigned short val_node) const override {
110 return std::numeric_limits<unsigned short>::max();
111 }
112
113 /*!
114 * \brief Change the orientation of an element.
115 */
116 inline void Change_Orientation(void) override {}
117
118 /*!
119 * \brief Make available the global ID of this element.
120 * \return The global ID of this element.
121 */
122 inline unsigned long GetGlobalElemID(void) const override { return elemIDGlobal; }
123
124 /*!
125 * \brief Make available the global offset of the solution DOFs of this element.
126 * \return The global offset of the solution DOFs.
127 */
128 inline unsigned long GetGlobalOffsetDOFsSol(void) const override { return offsetDOFsSolGlobal; }
129
130 /*!
131 * \brief Get the Maximum number of nodes of a face of an element.
132 * \return Maximum number of nodes of a face of an element.
133 */
134 inline unsigned short GetMaxNodesFace(void) const override { return std::numeric_limits<unsigned short>::max(); }
135
136 /*!
137 * \brief Get the type of the element using VTK nomenclature.
138 * \return Type of the element using VTK nomenclature.
139 */
140 inline unsigned short GetVTK_Type(void) const override { return VTK_Type; }
141
142 /*!
143 * \brief Get the polynomial degree of the grid for this element.
144 * \return The polynomial degree of the grid.
145 */
146 inline unsigned short GetNPolyGrid(void) const override { return nPolyGrid; }
147
148 /*!
149 * \brief Get the polynomial degree of the solution for this element.
150 * \return The polynomial degree of the solution.
151 */
152 inline unsigned short GetNPolySol(void) const override { return nPolySol; }
153
154 /*!
155 * \brief Function to make available the number of DOFs of the grid in the element.
156 * \return The number of DOFs of the grid in the element.
157 */
158 inline unsigned short GetNDOFsGrid(void) const override { return nDOFsGrid; }
159
160 /*!
161 * \brief Function to make available the number of DOFs of the solution in the element.
162 * \return The number of DOFs of the solution in the element.
163 */
164 inline unsigned short GetNDOFsSol(void) const override { return nDOFsSol; }
165
166 /*!
167 * \brief Get all the corner points of all the faces of this element. It must be made sure
168 that the numbering of the faces is identical to the numbering used for the
169 standard elements.
170 * \param[out] nFaces - Number of faces of this element.
171 * \param[out] nPointsPerFace - Number of corner points for each of the faces.
172 * \param[out] faceConn - Global IDs of the corner points of the faces.
173 */
174 void GetCornerPointsAllFaces(unsigned short& numFaces, unsigned short nPointsPerFace[],
175 unsigned long faceConn[6][4]) const override;
176
177 /*!
178 * \brief Static member function to get the local the corner points of all the faces
179 of this element. It must be made sure that the numbering of the faces is
180 identical to the numbering used for the standard elements.
181 * \param[in] elementType - Type of the element using the VTK convention.
182 * \param[in] nPoly - Polynomial degree of the element.
183 * \param[in] nDOFs - Number of DOFs of the element.
184 * \param[out] nFaces - Number of faces of this element.
185 * \param[out] nPointsPerFace - Number of corner points for each of the faces.
186 * \param[out] faceConn - Global IDs of the corner points of the faces.
187 */
188 static void GetLocalCornerPointsAllFaces(unsigned short elementType, unsigned short nPoly, unsigned short nDOFs,
189 unsigned short& numFaces, unsigned short nPointsPerFace[],
190 unsigned long faceConn[6][4]);
191 /*!
192 * \brief Function to get whether or not the Jacobian is considered constant.
193 * \return True if the Jacobian is (almost) constant and false otherwise.
194 */
195 inline bool GetJacobianConsideredConstant(void) const override { return JacobianConsideredConstant; }
196
197 /*!
198 * \brief Set the color of the element.
199 * \param[in] val_color - New color of the element.
200 */
201 inline void SetColor(unsigned long val_color) override { color = val_color; }
202
203 /*!
204 * \brief Get the color of the element for the partitioning.
205 * return - The color of the element in the partitioning.
206 */
207 inline unsigned long GetColor(void) const override { return color; }
208
209 /*!
210 * \brief Function to set the value of JacobianConsideredConstant.
211 * \param[in] val_JacobianConsideredConstant - The value to be set for JacobianConsideredConstant.
212 */
213 inline void SetJacobianConsideredConstant(bool val_JacobianConsideredConstant) override {
214 JacobianConsideredConstant = val_JacobianConsideredConstant;
215 }
216
217 /*!
218 * \brief Function to correct the offset of the global DOFs.
219 * \param[in] val_offsetRank - The offset that must be added for this rank.
220 */
221 inline void AddOffsetGlobalDOFs(const unsigned long val_offsetRank) override {
222 offsetDOFsSolGlobal += val_offsetRank;
223 }
224};
Headers of the main subroutines for storing the primal grid structure. The subroutines and functions ...
Class to define primal grid element for the FEM solver.
Definition CPrimalGridFEM.hpp:39
unsigned short GetFaces(unsigned short val_face, unsigned short val_index) const override
Get the face index of an element.
Definition CPrimalGridFEM.hpp:78
unsigned short GetnNeighbor_Nodes(unsigned short val_node) const override
Get the number of neighbors nodes of a node.
Definition CPrimalGridFEM.hpp:109
void SetJacobianConsideredConstant(bool val_JacobianConsideredConstant) override
Function to set the value of JacobianConsideredConstant.
Definition CPrimalGridFEM.hpp:213
unsigned short GetMaxNodesFace(void) const override
Get the Maximum number of nodes of a face of an element.
Definition CPrimalGridFEM.hpp:134
unsigned short GetVTK_Type(void) const override
Get the type of the element using VTK nomenclature.
Definition CPrimalGridFEM.hpp:140
unsigned short GetNDOFsSol(void) const override
Function to make available the number of DOFs of the solution in the element.
Definition CPrimalGridFEM.hpp:164
unsigned long GetGlobalElemID(void) const override
Make available the global ID of this element.
Definition CPrimalGridFEM.hpp:122
unsigned long GetGlobalOffsetDOFsSol(void) const override
Make available the global offset of the solution DOFs of this element.
Definition CPrimalGridFEM.hpp:128
bool GetJacobianConsideredConstant(void) const override
Function to get whether or not the Jacobian is considered constant.
Definition CPrimalGridFEM.hpp:195
void GetCornerPointsAllFaces(unsigned short &numFaces, unsigned short nPointsPerFace[], unsigned long faceConn[6][4]) const override
Get all the corner points of all the faces of this element. It must be made sure that the numbering o...
Definition CPrimalGridFEM.cpp:204
void Change_Orientation(void) override
Change the orientation of an element.
Definition CPrimalGridFEM.hpp:116
unsigned short GetnNodesFace(unsigned short val_face) const override
Get the number of nodes that composes a face of an element.
Definition CPrimalGridFEM.hpp:68
static void GetLocalCornerPointsAllFaces(unsigned short elementType, unsigned short nPoly, unsigned short nDOFs, unsigned short &numFaces, unsigned short nPointsPerFace[], unsigned long faceConn[6][4])
Static member function to get the local the corner points of all the faces of this element....
Definition CPrimalGridFEM.cpp:52
unsigned short GetnFaces(void) const override
Get the number of faces of an element.
Definition CPrimalGridFEM.hpp:102
unsigned long GetColor(void) const override
Get the color of the element for the partitioning. return - The color of the element in the partition...
Definition CPrimalGridFEM.hpp:207
unsigned short GetNPolySol(void) const override
Get the polynomial degree of the solution for this element.
Definition CPrimalGridFEM.hpp:152
unsigned short GetnNodes(void) const override
Get the number of nodes of an element.
Definition CPrimalGridFEM.hpp:96
void SetColor(unsigned long val_color) override
Set the color of the element.
Definition CPrimalGridFEM.hpp:201
unsigned short GetNDOFsGrid(void) const override
Function to make available the number of DOFs of the grid in the element.
Definition CPrimalGridFEM.hpp:158
void AddOffsetGlobalDOFs(const unsigned long val_offsetRank) override
Function to correct the offset of the global DOFs.
Definition CPrimalGridFEM.hpp:221
unsigned short GetNPolyGrid(void) const override
Get the polynomial degree of the grid for this element.
Definition CPrimalGridFEM.hpp:146
unsigned short GetNeighbor_Nodes(unsigned short val_node, unsigned short val_index) const override
Get the local index of the neighbors to a node (given the local index).
Definition CPrimalGridFEM.hpp:88
Class to define the numerical primal grid.
Definition CPrimalGrid.hpp:45