Documentation 6b54b78464
Loading...
Searching...
No Matches
CVolumetricMovement.hpp
Go to the documentation of this file.
1/*!
2 * \file CVolumetricMovement.hpp
3 * \brief Headers of the CVolumetricMovement class.
4 * \author F. Palacios, A. Bueno, T. Economon, S. Padron.
5 * \version 8.5.0 "Harrier"
6 *
7 * SU2 Project Website: https://su2code.github.io
8 *
9 * The SU2 Project is maintained by the SU2 Foundation
10 * (http://su2foundation.org)
11 *
12 * Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md)
13 *
14 * SU2 is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * SU2 is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with SU2. If not, see <http://www.gnu.org/licenses/>.
26 */
27
28#pragma once
29
30#include "CGridMovement.hpp"
31
32/*!
33 * \class CVolumetricMovement
34 * \brief Class for moving the volumetric numerical grid.
35 * \author F. Palacios, A. Bueno, T. Economon, S. Padron.
36 */
38 protected:
39 unsigned short nDim; /*!< \brief Number of dimensions. */
40
41 public:
42 /*!
43 * \brief Constructor of the class.
44 */
46
47 /*!
48 * \brief Constructor of the Class.
49 */
50
52
53 /*!
54 * \brief Destructor of the class.
55 */
57
58 /*!
59 * \brief Update the dual grid after the grid movement (edges and control volumes).
60 * \param[in] geometry - Geometrical definition of the problem.
61 * \param[in] config - Definition of the particular problem.
62 */
63 void UpdateDualGrid(CGeometry* geometry, CConfig* config);
64
65 /*!
66 * \brief Update the coarse multigrid levels after the grid movement.
67 * \param[in] geometry - Geometrical definition of the problem.
68 * \param[in] config - Definition of the particular problem.
69 */
70 void UpdateMultiGrid(CGeometry** geometry, CConfig* config);
71
72 /*!
73 * \brief Compute the shape functions for hexahedron
74 * \param[in] CoordCorners - coordinates of the cornes of the hexahedron.
75 */
76 su2double GetHexa_Volume(su2double CoordCorners[8][3]) const;
77
78 /*!
79 * \brief Compute the shape functions for hexahedron
80 * \param[in] CoordCorners - coordinates of the cornes of the hexahedron.
81 */
82 su2double GetTetra_Volume(su2double CoordCorners[8][3]) const;
83
84 /*!
85 * \brief Compute the shape functions for hexahedron
86 * \param[in] CoordCorners - coordinates of the cornes of the hexahedron.
87 */
88 su2double GetPrism_Volume(su2double CoordCorners[8][3]) const;
89
90 /*!
91 * \brief Compute the shape functions for hexahedron
92 * \param[in] CoordCorners - coordinates of the cornes of the hexahedron.
93 */
94 su2double GetPyram_Volume(su2double CoordCorners[8][3]) const;
95
96 /*!
97 * \brief Compute the shape functions for hexahedron
98 * \param[in] CoordCorners - coordinates of the cornes of the hexahedron.
99 */
100 su2double GetTriangle_Area(su2double CoordCorners[8][3]) const;
101
102 /*!
103 * \brief Compute the shape functions for hexahedron
104 * \param[in] CoordCorners - coordinates of the cornes of the hexahedron.
105 */
106 su2double GetQuadrilateral_Area(su2double CoordCorners[8][3]) const;
107
108 /*!
109 * \brief Check for negative volumes (all elements) after performing grid deformation.
110 * \param[in] geometry - Geometrical definition of the problem.
111 * \param[in] Screen_Output - determines if text is written to screen
112 */
113 void ComputeDeforming_Element_Volume(CGeometry* geometry, su2double& MinVolume, su2double& MaxVolume,
114 bool Screen_Output);
115
116 /*!
117 * \brief Compute amount of nonconvex elements
118 * \param[in] geometry - Geometrical definition of the problem.
119 * \param[in] Screen_Output - determines if text is written to screen
120 */
121 void ComputenNonconvexElements(CGeometry* geometry, bool Screen_Output);
122
123 /*!
124 * \brief Unsteady grid movement using rigid mesh rotation.
125 * \param[in] geometry - Geometrical definition of the problem.
126 * \param[in] config - Definition of the particular problem.
127 * \param[in] iZone - Zone number in the mesh.
128 * \param[in] iter - Physical time iteration number.
129 */
130 void Rigid_Rotation(CGeometry* geometry, CConfig* config, unsigned short iZone, unsigned long iter);
131
132 /*!
133 * \brief Unsteady pitching grid movement using rigid mesh motion.
134 * \param[in] geometry - Geometrical definition of the problem.
135 * \param[in] config - Definition of the particular problem.
136 * \param[in] iZone - Zone number in the mesh.
137 * \param[in] iter - Physical time iteration number.
138 */
139 void Rigid_Pitching(CGeometry* geometry, CConfig* config, unsigned short iZone, unsigned long iter);
140
141 /*!
142 * \brief Unsteady plunging grid movement using rigid mesh motion.
143 * \param[in] geometry - Geometrical definition of the problem.
144 * \param[in] config - Definition of the particular problem.
145 * \param[in] iZone - Zone number in the mesh.
146 * \param[in] iter - Physical time iteration number.
147 */
148 void Rigid_Plunging(CGeometry* geometry, CConfig* config, unsigned short iZone, unsigned long iter);
149
150 /*!
151 * \brief Unsteady translational grid movement using rigid mesh motion.
152 * \param[in] geometry - Geometrical definition of the problem.
153 * \param[in] config - Definition of the particular problem.
154 * \param[in] iZone - Zone number in the mesh.
155 * \param[in] iter - Physical time iteration number.
156 */
157 void Rigid_Translation(CGeometry* geometry, CConfig* config, unsigned short iZone, unsigned long iter);
158
159 /*!
160 * \brief Scale the volume grid by a multiplicative factor.
161 * \param[in] geometry - Geometrical definition of the problem.
162 * \param[in] config - Definition of the particular problem.
163 * \param[in] UpdateGeo - Update geometry.
164 */
165 void SetVolume_Scaling(CGeometry* geometry, CConfig* config, bool UpdateGeo);
166
167 /*!
168 * \brief Translate the volume grid by a specified displacement vector.
169 * \param[in] geometry - Geometrical definition of the problem.
170 * \param[in] config - Definition of the particular problem.
171 * \param[in] UpdateGeo - Update geometry.
172 */
173 void SetVolume_Translation(CGeometry* geometry, CConfig* config, bool UpdateGeo);
174
175 /*!
176 * \brief Rotate the volume grid around a specified axis and angle.
177 * \param[in] geometry - Geometrical definition of the problem.
178 * \param[in] config - Definition of the particular problem.
179 * \param[in] UpdateGeo - Update geometry.
180 */
181 void SetVolume_Rotation(CGeometry* geometry, CConfig* config, bool UpdateGeo);
182
183 /*!
184 * \brief Grid deformation using the spring analogy method.
185 * \param[in] geometry - Geometrical definition of the problem.
186 * \param[in] config - Definition of the particular problem.
187 * \param[in] UpdateGeo - Update geometry.
188 * \param[in] Derivative - Compute the derivative (disabled by default). Does not actually deform the grid if enabled.
189 */
190 inline virtual void SetVolume_Deformation(CGeometry* geometry, CConfig* config, bool UpdateGeo,
191 bool Derivative = false, bool ForwardProjectionDerivative = false){};
192
193 /*!
194 * \brief Grid deformation using the spring analogy method.
195 * \param[in] geometry - Geometrical definition of the problem.
196 * \param[in] config - Definition of the particular problem.
197 * \param[in] UpdateGeo - Update geometry.
198 * \param[in] Derivative - Compute the derivative (disabled by default). Does not actually deform the grid if enabled.
199 */
200 inline virtual void SetVolume_Deformation_Elas(CGeometry* geometry, CConfig* config, bool UpdateGeo,
201 bool screen_output, bool Derivative = false) {}
202
203 /*!
204 * \brief Set the boundary dependencies in the mesh side of the problem
205 * \param[in] geometry - Geometrical definition of the problem.
206 * \param[in] config - Definition of the particular problem.
207 */
208 inline virtual void Boundary_Dependencies(CGeometry** geometry, CConfig* config) {}
209
210 /*!
211 * \brief Returns true if a marker should be deformed.
212 * \param[in] config - Definition of the particular problem.
213 * \param[in] iMarker - Index of marker in "marker all".
214 */
215 inline bool IsDeformationMarker(const CConfig* config, unsigned short iMarker) {
216 /*--- Get the SU2 module. SU2_CFD will use this routine for dynamically
217 deforming meshes (MARKER_MOVING), while SU2_DEF will use it for deforming
218 meshes after imposing design variable surface deformations (DV_MARKER). ---*/
219 const auto KindSU2 = config->GetKind_SU2();
220 const bool cfd = KindSU2 == SU2_COMPONENT::SU2_CFD;
221 const bool defDot = KindSU2 == SU2_COMPONENT::SU2_DEF || KindSU2 == SU2_COMPONENT::SU2_DOT;
222 const bool dvMarker = config->GetMarker_All_DV(iMarker) == YES;
223 const bool moving = config->GetMarker_All_Moving(iMarker) == YES;
224 return (cfd && ((config->GetDirectDiff() == D_DESIGN && dvMarker) || moving)) || (defDot && dvMarker);
225 }
226};
Headers of the CGridMovement class.
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
unsigned short GetDirectDiff() const
Get the direct differentation method.
Definition CConfig.hpp:9293
SU2_COMPONENT GetKind_SU2(void) const
Get the kind of SU2 software component.
Definition CConfig.hpp:4663
unsigned short GetMarker_All_Moving(unsigned short val_marker) const
Get the motion information for a marker val_marker.
Definition CConfig.hpp:3839
unsigned short GetMarker_All_DV(unsigned short val_marker) const
Get the DV information for a marker val_marker.
Definition CConfig.hpp:3832
Parent class for defining the geometry of the problem (complete geometry, multigrid agglomerated geom...
Definition CGeometry.hpp:75
Class for moving the surface and volumetric numerical grid (2D and 3D problems).
Definition CGridMovement.hpp:39
Class for moving the volumetric numerical grid.
Definition CVolumetricMovement.hpp:37
void Rigid_Translation(CGeometry *geometry, CConfig *config, unsigned short iZone, unsigned long iter)
Unsteady translational grid movement using rigid mesh motion.
Definition CVolumetricMovement.cpp:903
virtual void SetVolume_Deformation(CGeometry *geometry, CConfig *config, bool UpdateGeo, bool Derivative=false, bool ForwardProjectionDerivative=false)
Grid deformation using the spring analogy method.
Definition CVolumetricMovement.hpp:190
void UpdateMultiGrid(CGeometry **geometry, CConfig *config)
Update the coarse multigrid levels after the grid movement.
Definition CVolumetricMovement.cpp:50
su2double GetQuadrilateral_Area(su2double CoordCorners[8][3]) const
Compute the shape functions for hexahedron.
Definition CVolumetricMovement.cpp:228
void Rigid_Rotation(CGeometry *geometry, CConfig *config, unsigned short iZone, unsigned long iter)
Unsteady grid movement using rigid mesh rotation.
Definition CVolumetricMovement.cpp:481
void UpdateDualGrid(CGeometry *geometry, CConfig *config)
Update the dual grid after the grid movement (edges and control volumes).
Definition CVolumetricMovement.cpp:41
virtual void Boundary_Dependencies(CGeometry **geometry, CConfig *config)
Set the boundary dependencies in the mesh side of the problem.
Definition CVolumetricMovement.hpp:208
bool IsDeformationMarker(const CConfig *config, unsigned short iMarker)
Returns true if a marker should be deformed.
Definition CVolumetricMovement.hpp:215
void ComputeDeforming_Element_Volume(CGeometry *geometry, su2double &MinVolume, su2double &MaxVolume, bool Screen_Output)
Check for negative volumes (all elements) after performing grid deformation.
Definition CVolumetricMovement.cpp:65
unsigned short nDim
Number of dimensions.
Definition CVolumetricMovement.hpp:39
CVolumetricMovement()
Constructor of the class.
Definition CVolumetricMovement.cpp:30
void Rigid_Plunging(CGeometry *geometry, CConfig *config, unsigned short iZone, unsigned long iter)
Unsteady plunging grid movement using rigid mesh motion.
Definition CVolumetricMovement.cpp:775
~CVolumetricMovement() override
Destructor of the class.
su2double GetPrism_Volume(su2double CoordCorners[8][3]) const
Compute the shape functions for hexahedron.
Definition CVolumetricMovement.cpp:327
virtual void SetVolume_Deformation_Elas(CGeometry *geometry, CConfig *config, bool UpdateGeo, bool screen_output, bool Derivative=false)
Grid deformation using the spring analogy method.
Definition CVolumetricMovement.hpp:200
void Rigid_Pitching(CGeometry *geometry, CConfig *config, unsigned short iZone, unsigned long iter)
Unsteady pitching grid movement using rigid mesh motion.
Definition CVolumetricMovement.cpp:629
su2double GetPyram_Volume(su2double CoordCorners[8][3]) const
Compute the shape functions for hexahedron.
Definition CVolumetricMovement.cpp:284
su2double GetHexa_Volume(su2double CoordCorners[8][3]) const
Compute the shape functions for hexahedron.
Definition CVolumetricMovement.cpp:387
void ComputenNonconvexElements(CGeometry *geometry, bool Screen_Output)
Compute amount of nonconvex elements.
Definition CVolumetricMovement.cpp:143
su2double GetTetra_Volume(su2double CoordCorners[8][3]) const
Compute the shape functions for hexahedron.
Definition CVolumetricMovement.cpp:258
su2double GetTriangle_Area(su2double CoordCorners[8][3]) const
Compute the shape functions for hexahedron.
Definition CVolumetricMovement.cpp:209
void SetVolume_Translation(CGeometry *geometry, CConfig *config, bool UpdateGeo)
Translate the volume grid by a specified displacement vector.
Definition CVolumetricMovement.cpp:1045
void SetVolume_Scaling(CGeometry *geometry, CConfig *config, bool UpdateGeo)
Scale the volume grid by a multiplicative factor.
Definition CVolumetricMovement.cpp:1013
void SetVolume_Rotation(CGeometry *geometry, CConfig *config, bool UpdateGeo)
Rotate the volume grid around a specified axis and angle.
Definition CVolumetricMovement.cpp:1086
passivedouble su2double
Definition code_config.hpp:181
@ YES
Boolean definition of yes.
Definition option_structure.hpp:284
@ SU2_DEF
Running the SU2_DEF software.
@ SU2_DOT
Running the SU2_DOT software.
@ SU2_CFD
Running the SU2_CFD software.
@ D_DESIGN
Derivative w.r.t. the design??
Definition option_structure.hpp:2770