Documentation 6b54b78464
Loading...
Searching...
No Matches
CVertex.hpp
Go to the documentation of this file.
1/*!
2 * \file CVertex.hpp
3 * \brief Headers of the main subroutines for doing the complete dual grid structure.
4 * The subroutines and functions are in the <i>CVertex.cpp</i> file.
5 * \author F. Palacios, T. Economon
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 "CDualGrid.hpp"
32
33/*!
34 * \class CVertex
35 * \brief Class for vertex definition (equivalent to edges, but for the boundaries).
36 * \author F. Palacios
37 */
38class CVertex : public CDualGrid {
39 protected:
40 unsigned long Nodes[1]; /*!< \brief Vector to store the global nodes of an element. */
41 su2double Normal[3] = {0.0}; /*!< \brief Normal coordinates of the element and its center of gravity. */
42 su2double Aux_Var; /*!< \brief Auxiliar variable defined only on the surface. */
43 su2double CartCoord[3] = {0.0}; /*!< \brief Vertex cartesians coordinates. */
44 su2double VarCoord[3] = {0.0}; /*!< \brief Used for storing the coordinate variation due to a surface modification. */
45 long PeriodicPoint[5] = {-1}; /*!< \brief Store the periodic point of a boundary (iProcessor, iPoint) */
46 bool ActDisk_Perimeter = false; /*!< \brief Identify nodes at the perimeter of the actuator disk */
47 short Rotation_Type; /*!< \brief Type of rotation associated with the vertex (MPI and periodic) */
48 unsigned long Normal_Neighbor; /*!< \brief Index of the closest, most normal, neighbor. */
49 su2double NearestNeighborDist = 0.0; /*!< \brief Distance to nearest internal neighbor that is not a wall. */
50 su2double Basis_Function[3] = {0.0}; /*!< \brief Basis function values for interpolation across zones. */
51
52 public:
53 /*!
54 * \brief Constructor of the class.
55 * \param[in] val_point - Node of the vertex.
56 * \param[in] val_nDim - Number of dimensions of the problem.
57 */
58 CVertex(unsigned long val_point, unsigned short val_nDim);
59
60 /*!
61 * \brief Get the number of nodes of a vertex.
62 * \return Number of nodes that set a vertex (1).
63 */
64 inline unsigned short GetnNodes() const override { return 1; }
65
66 /*!
67 * \brief Get the node of the vertex.
68 * \return Index of the node that compose the vertex.
69 */
70 inline unsigned long GetNode() const { return Nodes[0]; }
71
72 /*!
73 * \brief Set the face that correspond to a vertex.
74 * \param[in] val_coord_Edge_CG - Coordinates of the centre of gravity of the edge.
75 * \param[in] val_coord_FaceElem_CG - Coordinates of the centre of gravity of the face of an element.
76 * \param[in] val_coord_Elem_CG - Coordinates of the centre of gravity of the element.
77 * \return Compute the normal (dimensional) to the face that makes the vertex.
78 */
79 void SetNodes_Coord(const su2double* val_coord_Edge_CG, const su2double* val_coord_FaceElem_CG,
80 const su2double* val_coord_Elem_CG) override;
81
82 /*!
83 * \overload
84 * \param[in] val_coord_Edge_CG - Coordinates of the centre of gravity of the edge.
85 * \param[in] val_coord_Elem_CG - Coordinates of the centre of gravity of the element.
86 * \return Compute the normal (dimensional) to the face that makes the vertex.
87 */
88 void SetNodes_Coord(const su2double* val_coord_Edge_CG, const su2double* val_coord_Elem_CG) override;
89
90 /*!
91 * \brief Copy the the normal vector of a face.
92 * \param[in] val_normal - Vector where the subroutine is goint to copy the normal (dimensional).
93 */
94 inline void GetNormal(su2double* val_normal) const override {
95 for (unsigned short iDim = 0; iDim < nDim; iDim++) val_normal[iDim] = Normal[iDim];
96 }
97
98 /*!
99 * \brief Get the normal to a face of the control volume asociated with a vertex.
100 * \return Dimensional normal vector, the modulus is the area of the face.
101 */
102 inline su2double* GetNormal() override { return Normal; }
103
104 /*!
105 * \brief Get the ith component of the normal.
106 */
107 inline su2double GetNormal(unsigned short iDim) const { return Normal[iDim]; }
108
109 /*!
110 * \brief Initialize normal vector.
111 */
112 inline void SetZeroValues() override {
113 for (unsigned short iDim = 0; iDim < nDim; iDim++) Normal[iDim] = 0.0;
114 }
115
116 /*!
117 * \brief Set the value of an auxiliary variable for gradient computation.
118 * \param[in] val_auxvar - Value of the auxiliar variable.
119 */
120 inline void SetAuxVar(su2double val_auxvar) { Aux_Var = val_auxvar; }
121
122 /*!
123 * \brief Get the value of an auxiliary variable for gradient computation.
124 * \return Value of the auxiliar variable.
125 */
126 inline su2double GetAuxVar() const { return Aux_Var; }
127
128 /*!
129 * \brief Add the value of an auxiliary variable for gradient computation.
130 * \param[in] val_auxvar - Value of the auxiliar variable.
131 */
132 inline void AddAuxVar(su2double val_auxvar) { Aux_Var += val_auxvar; }
133
134 /*!
135 * \brief Set the normal vector.
136 * \param[in] val_face_normal - Vector to initialize the normal vector.
137 * \return Value of the normal vector.
138 */
139 inline void SetNormal(const su2double* val_face_normal) override {
140 for (unsigned short iDim = 0; iDim < nDim; iDim++) Normal[iDim] = val_face_normal[iDim];
141 }
142
143 /*!
144 * \brief Add a vector to the normal vector.
145 * \param[in] val_face_normal - Vector to add to the normal vector.
146 */
147 inline void AddNormal(const su2double* val_face_normal) override {
148 for (unsigned short iDim = 0; iDim < nDim; iDim++) Normal[iDim] += val_face_normal[iDim];
149 }
150
151 /*!
152 * \brief Set the value of the coordinate variation due to a surface modification.
153 * \param[in] val_varcoord - Variation of the coordinate.
154 */
155 inline void SetVarCoord(const su2double* val_varcoord) {
156 for (unsigned short iDim = 0; iDim < nDim; iDim++) VarCoord[iDim] = val_varcoord[iDim];
157 }
158
159 /*!
160 * \brief Add the value of the coordinate variation due to a surface modification.
161 * \param[in] val_varcoord - Variation of the coordinate.
162 */
163 inline void AddVarCoord(const su2double* val_varcoord) {
164 for (unsigned short iDim = 0; iDim < nDim; iDim++) VarCoord[iDim] += val_varcoord[iDim];
165 }
166
167 /*!
168 * \brief Get the value of the coordinate variation due to a surface modification.
169 * \return Variation of the coordinate.
170 */
171 inline su2double* GetVarCoord() { return VarCoord; }
172
173 /*!
174 * \brief Set the value of the cartesian coordinate for the vertex.
175 * \param[in] val_coord - Value of the cartesian coordinate.
176 */
177 inline void SetCoord(const su2double* val_coord) override {
178 for (unsigned short iDim = 0; iDim < nDim; iDim++) CartCoord[iDim] = val_coord[iDim];
179 }
180
181 /*!
182 * \brief Get the value of the cartesian coordinate for the vertex.
183 * \return Value of the cartesian coordinate of the vertex.
184 */
185 inline su2double* GetCoord() override { return CartCoord; }
186
187 /*!
188 * \brief Get the value of the cartesian coordinate for the vertex.
189 * \param[in] val_dim - Variable of the dimension.
190 * \return Value of the cartesian coordinate of the vertex.
191 */
192 inline su2double GetCoord(unsigned short val_dim) const { return CartCoord[val_dim]; }
193
194 /*!
195 * \brief Set the type of rotation associated to the vertex.
196 * \param[in] val_rotation_type - Value of the rotation that will be applied to the solution at the vertex
197 */
198 inline void SetRotation_Type(short val_rotation_type) { Rotation_Type = val_rotation_type; }
199
200 /*!
201 * \brief Get the type of rotation associated to the vertex.
202 * \return Value of the rotation that must be applied to the solution of the vertex
203 */
204 inline short GetRotation_Type() const { return Rotation_Type; }
205
206 /*!
207 * \overload
208 * \param[in] val_periodicpoint - Value of periodic point of the vertex.
209 * \param[in] val_processor - Processor where the point belong.
210 */
211 inline void SetDonorPoint(long val_periodicpoint, long val_processor) {
212 PeriodicPoint[0] = val_periodicpoint;
213 PeriodicPoint[1] = val_processor;
214 PeriodicPoint[2] = 0;
215 }
216
217 /*!
218 * \overload
219 * \param[in] val_periodicpoint - Value of periodic point of the vertex.
220 * \param[in] val_processor - Processor where the point belong.
221 */
222 inline void SetDonorPoint(long val_periodicpoint, long val_periodicglobalindex, long val_periodicvertex,
223 long val_periodicmarker, long val_processor) {
224 PeriodicPoint[0] = val_periodicpoint;
225 PeriodicPoint[1] = val_processor;
226 PeriodicPoint[2] = val_periodicglobalindex;
227 PeriodicPoint[3] = val_periodicvertex;
228 PeriodicPoint[4] = val_periodicmarker;
229 }
230
231 /*!
232 * \overload
233 * \param[in] val_periodicpoint - Value of periodic point of the vertex.
234 * \param[in] val_processor - Processor where the point belong.
235 * \param[in] val_globalindex - Global index of the donor point.
236 */
237 inline void SetDonorPoint(long val_periodicpoint, long val_processor, long val_globalindex) {
238 PeriodicPoint[0] = val_periodicpoint;
239 PeriodicPoint[1] = val_processor;
240 PeriodicPoint[2] = val_globalindex;
241 }
242
243 /*!
244 * \overload
245 * \param[in] val_periodicpoint - Value of periodic point of the vertex.
246 * \param[in] val_processor - Processor where the point belong.
247 */
248 inline void SetActDisk_Perimeter(bool val_actdisk_perimeter) { ActDisk_Perimeter = val_actdisk_perimeter; }
249
250 /*!
251 * \brief Get the value of the periodic point of a vertex.
252 * \return Value of the periodic point of a vertex.
253 */
254 inline long GetDonorPoint() const { return PeriodicPoint[0]; }
255
256 /*!
257 * \brief Get the value of the periodic point of a vertex.
258 * \return Value of the periodic point of a vertex.
259 */
260 inline long GetDonorMarker() const { return PeriodicPoint[4]; }
261
262 /*!
263 * \brief Get the value of the periodic point of a vertex.
264 * \return Value of the periodic point of a vertex.
265 */
266 inline long GetDonorVertex() const { return PeriodicPoint[3]; }
267
268 /*!
269 * \brief Get the value of the periodic point of a vertex.
270 * \return Value of the periodic point of a vertex.
271 */
272 inline long GetDonorGlobalIndex() const { return PeriodicPoint[2]; }
273
274 /*!
275 * \brief Get the value of the periodic point of a vertex.
276 * \return Value of the periodic point of a vertex.
277 */
278 inline long GetGlobalDonorPoint() const { return PeriodicPoint[2]; }
279
280 /*!
281 * \brief Get the value of the periodic point of a vertex.
282 * \return Value of the periodic point of a vertex.
283 */
284 inline long GetDonorProcessor() const { return PeriodicPoint[1]; }
285
286 /*!
287 * \brief Get the value of the periodic point of a vertex, and its somain
288 * \return Value of the periodic point of a vertex, and the domain.
289 */
290 inline long* GetPeriodicPointDomain() { return PeriodicPoint; }
291
292 /*!
293 * \brief Get the value of the periodic point of a vertex, and its somain
294 * \return Value of the periodic point of a vertex, and the domain.
295 */
296 inline bool GetActDisk_Perimeter() const { return ActDisk_Perimeter; }
297
298 /*!
299 * \brief Set the finite element basis functions needed for interpolation.
300 * \param[in] val_node - a node index of the owner element.
301 * \param[in] val_basis - basis function value for the node.
302 */
303 inline void SetBasisFunction(unsigned short val_node, su2double val_basis) { Basis_Function[val_node] = val_basis; }
304
305 /*!
306 * \brief Get the finite element basis functions needed for interpolation.
307 * \param[in] val_node - a node index of the owner element.
308 * \return Value of the basis function for this node.
309 */
310 inline su2double GetBasisFunction(unsigned short val_node) { return Basis_Function[val_node]; }
311
312 /*!
313 * \brief Set the index of the closest neighbor to a point on the boundaries.
314 * \param[in] val_Normal_Neighbor - Index of the closest neighbor.
315 */
316 inline void SetNormal_Neighbor(unsigned long val_Normal_Neighbor) { Normal_Neighbor = val_Normal_Neighbor; }
317
318 /*!
319 * \brief Get the value of the closest neighbor.
320 * \return Index of the closest neighbor.
321 */
322 inline unsigned long GetNormal_Neighbor() const { return Normal_Neighbor; }
323
324 /*!
325 * \brief Set the distance of the nearest internal neighbor that is not a wall.
326 */
328
329 /*!
330 * \brief Get the distance to the nearest internal neighbor that is not a wall.
331 */
333};
Headers of the main subroutines for doing the complete dual grid structure. The subroutines and funct...
Class for controlling the dual volume definition. The dual volume is compose by three main elements: ...
Definition CDualGrid.hpp:44
static unsigned short nDim
Number of dimensions of the problem.
Definition CDualGrid.hpp:46
Class for vertex definition (equivalent to edges, but for the boundaries).
Definition CVertex.hpp:38
void SetNormal(const su2double *val_face_normal) override
Set the normal vector.
Definition CVertex.hpp:139
unsigned short GetnNodes() const override
Get the number of nodes of a vertex.
Definition CVertex.hpp:64
su2double CartCoord[3]
Vertex cartesians coordinates.
Definition CVertex.hpp:43
su2double * GetCoord() override
Get the value of the cartesian coordinate for the vertex.
Definition CVertex.hpp:185
su2double VarCoord[3]
Used for storing the coordinate variation due to a surface modification.
Definition CVertex.hpp:44
su2double Normal[3]
Normal coordinates of the element and its center of gravity.
Definition CVertex.hpp:41
long PeriodicPoint[5]
Store the periodic point of a boundary (iProcessor, iPoint)
Definition CVertex.hpp:45
unsigned long Nodes[1]
Vector to store the global nodes of an element.
Definition CVertex.hpp:40
long GetDonorVertex() const
Get the value of the periodic point of a vertex.
Definition CVertex.hpp:266
long GetDonorGlobalIndex() const
Get the value of the periodic point of a vertex.
Definition CVertex.hpp:272
void SetDonorPoint(long val_periodicpoint, long val_processor, long val_globalindex)
Definition CVertex.hpp:237
su2double * GetNormal() override
Get the normal to a face of the control volume asociated with a vertex.
Definition CVertex.hpp:102
su2double Aux_Var
Auxiliar variable defined only on the surface.
Definition CVertex.hpp:42
void SetNearestNeighborDistance(const su2double &val)
Set the distance of the nearest internal neighbor that is not a wall.
Definition CVertex.hpp:327
long GetDonorProcessor() const
Get the value of the periodic point of a vertex.
Definition CVertex.hpp:284
void SetZeroValues() override
Initialize normal vector.
Definition CVertex.hpp:112
void SetNormal_Neighbor(unsigned long val_Normal_Neighbor)
Set the index of the closest neighbor to a point on the boundaries.
Definition CVertex.hpp:316
void SetActDisk_Perimeter(bool val_actdisk_perimeter)
Definition CVertex.hpp:248
su2double * GetVarCoord()
Get the value of the coordinate variation due to a surface modification.
Definition CVertex.hpp:171
void AddVarCoord(const su2double *val_varcoord)
Add the value of the coordinate variation due to a surface modification.
Definition CVertex.hpp:163
su2double NearestNeighborDist
Distance to nearest internal neighbor that is not a wall.
Definition CVertex.hpp:49
void SetDonorPoint(long val_periodicpoint, long val_periodicglobalindex, long val_periodicvertex, long val_periodicmarker, long val_processor)
Definition CVertex.hpp:222
void GetNormal(su2double *val_normal) const override
Copy the the normal vector of a face.
Definition CVertex.hpp:94
void SetCoord(const su2double *val_coord) override
Set the value of the cartesian coordinate for the vertex.
Definition CVertex.hpp:177
su2double GetBasisFunction(unsigned short val_node)
Get the finite element basis functions needed for interpolation.
Definition CVertex.hpp:310
bool ActDisk_Perimeter
Identify nodes at the perimeter of the actuator disk.
Definition CVertex.hpp:46
su2double GetNormal(unsigned short iDim) const
Get the ith component of the normal.
Definition CVertex.hpp:107
su2double GetCoord(unsigned short val_dim) const
Get the value of the cartesian coordinate for the vertex.
Definition CVertex.hpp:192
void AddAuxVar(su2double val_auxvar)
Add the value of an auxiliary variable for gradient computation.
Definition CVertex.hpp:132
short Rotation_Type
Type of rotation associated with the vertex (MPI and periodic)
Definition CVertex.hpp:47
long GetDonorPoint() const
Get the value of the periodic point of a vertex.
Definition CVertex.hpp:254
void SetAuxVar(su2double val_auxvar)
Set the value of an auxiliary variable for gradient computation.
Definition CVertex.hpp:120
const su2double & GetNearestNeighborDistance() const
Get the distance to the nearest internal neighbor that is not a wall.
Definition CVertex.hpp:332
bool GetActDisk_Perimeter() const
Get the value of the periodic point of a vertex, and its somain.
Definition CVertex.hpp:296
su2double Basis_Function[3]
Basis function values for interpolation across zones.
Definition CVertex.hpp:50
long GetGlobalDonorPoint() const
Get the value of the periodic point of a vertex.
Definition CVertex.hpp:278
void SetVarCoord(const su2double *val_varcoord)
Set the value of the coordinate variation due to a surface modification.
Definition CVertex.hpp:155
void SetRotation_Type(short val_rotation_type)
Set the type of rotation associated to the vertex.
Definition CVertex.hpp:198
void SetBasisFunction(unsigned short val_node, su2double val_basis)
Set the finite element basis functions needed for interpolation.
Definition CVertex.hpp:303
short GetRotation_Type() const
Get the type of rotation associated to the vertex.
Definition CVertex.hpp:204
void AddNormal(const su2double *val_face_normal) override
Add a vector to the normal vector.
Definition CVertex.hpp:147
void SetNodes_Coord(const su2double *val_coord_Edge_CG, const su2double *val_coord_FaceElem_CG, const su2double *val_coord_Elem_CG) override
Set the face that correspond to a vertex.
Definition CVertex.cpp:35
unsigned long GetNode() const
Get the node of the vertex.
Definition CVertex.hpp:70
void SetDonorPoint(long val_periodicpoint, long val_processor)
Definition CVertex.hpp:211
unsigned long Normal_Neighbor
Index of the closest, most normal, neighbor.
Definition CVertex.hpp:48
unsigned long GetNormal_Neighbor() const
Get the value of the closest neighbor.
Definition CVertex.hpp:322
su2double GetAuxVar() const
Get the value of an auxiliary variable for gradient computation.
Definition CVertex.hpp:126
long * GetPeriodicPointDomain()
Get the value of the periodic point of a vertex, and its somain.
Definition CVertex.hpp:290
long GetDonorMarker() const
Get the value of the periodic point of a vertex.
Definition CVertex.hpp:260
passivedouble su2double
Definition code_config.hpp:181