Skip to content

Commit 875bfc1

Browse files
committed
Merge branch 'FvanSteen-develop' into rbf_deformation
2 parents 5627e49 + 740efab commit 875bfc1

19 files changed

+3072
-1643
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,10 @@ su2preconfig.timestamp
103103

104104
# Clangd server files
105105
.cache
106+
107+
108+
109+
ninja-win.zip
110+
ninja.exe
111+
.gitignore
112+
Docs/html

Common/include/CConfig.hpp

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ class CConfig {
190190
nMarker_ActDiskBemOutlet_Axis, /*!< \brief Number of actuator disk BEM outlet markers passed to MARKER_ACTDISK_BEM_AXIS. */
191191
nMarker_Deform_Mesh_Sym_Plane, /*!< \brief Number of markers with symmetric deformation */
192192
nMarker_Deform_Mesh, /*!< \brief Number of deformable markers at the boundary. */
193+
nMarker_Deform_Mesh_Internal, /*!< \brief Number of internal markers allowed to freely deform. */
193194
nMarker_Fluid_Load, /*!< \brief Number of markers in which the flow load is computed/employed. */
194195
nMarker_Fluid_InterfaceBound, /*!< \brief Number of fluid interface markers. */
195196
nMarker_CHTInterface, /*!< \brief Number of conjugate heat transfer interface markers. */
@@ -241,6 +242,7 @@ class CConfig {
241242
*Marker_NearFieldBound, /*!< \brief Near Field boundaries markers. */
242243
*Marker_Deform_Mesh, /*!< \brief Deformable markers at the boundary. */
243244
*Marker_Deform_Mesh_Sym_Plane, /*!< \brief Marker with symmetric deformation. */
245+
*Marker_Deform_Mesh_Internal, /*!< \brief Internal marker allowed to freely deform. */
244246
*Marker_Fluid_Load, /*!< \brief Markers in which the flow load is computed/employed. */
245247
*Marker_Fluid_InterfaceBound, /*!< \brief Fluid interface markers. */
246248
*Marker_CHTInterface, /*!< \brief Conjugate heat transfer interface markers. */
@@ -661,6 +663,10 @@ class CConfig {
661663
su2double Deform_Tol_Factor; /*!< \brief Factor to multiply smallest volume for deform tolerance (0.001 default) */
662664
su2double Deform_Coeff; /*!< \brief Deform coeffienct */
663665
su2double Deform_Limit; /*!< \brief Deform limit */
666+
DEFORM_KIND Deform_Kind; /*!< \brief Type of mesh deformation */
667+
bool RBF_DataReduction; /*!< \brief Determines use of data reduction methods for RBF mesh deformation. */
668+
su2double RBF_GreedyTolerance; /*!< \brief Tolerance used in the greedy data reduction for RBF mesh deformation. */
669+
su2double RBF_GreedyCorrectionFactor; /*!< \brief Correction factor used in the greedy algorithm for RBF mesh deformation. */
664670
unsigned short FFD_Continuity; /*!< \brief Surface continuity at the intersection with the FFD */
665671
unsigned short FFD_CoordSystem; /*!< \brief Define the coordinates system */
666672
su2double Deform_ElasticityMod, /*!< \brief Young's modulus for volume deformation stiffness model */
@@ -757,6 +763,7 @@ class CConfig {
757763
*Marker_All_Moving, /*!< \brief Global index for moving surfaces using the grid information. */
758764
*Marker_All_Deform_Mesh, /*!< \brief Global index for deformable markers at the boundary. */
759765
*Marker_All_Deform_Mesh_Sym_Plane, /*!< \brief Global index for markers with symmetric deformations. */
766+
*Marker_All_Deform_Mesh_Internal, /*!< \brief Global index for internal markers with free deformation. */
760767
*Marker_All_Fluid_Load, /*!< \brief Global index for markers in which the flow load is computed/employed. */
761768
*Marker_All_PyCustom, /*!< \brief Global index for Python customizable surfaces using the grid information. */
762769
*Marker_All_Designing, /*!< \brief Global index for moving using the grid information. */
@@ -774,6 +781,7 @@ class CConfig {
774781
*Marker_CfgFile_Moving, /*!< \brief Global index for moving surfaces using the config information. */
775782
*Marker_CfgFile_Deform_Mesh, /*!< \brief Global index for deformable markers at the boundary. */
776783
*Marker_CfgFile_Deform_Mesh_Sym_Plane, /*!< \brief Global index for markers with symmetric deformations. */
784+
*Marker_CfgFile_Deform_Mesh_Internal, /*!< \brief Global index for internal markers with free deformation. */
777785
*Marker_CfgFile_Fluid_Load, /*!< \brief Global index for markers in which the flow load is computed/employed. */
778786
*Marker_CfgFile_PyCustom, /*!< \brief Global index for Python customizable surfaces using the config information. */
779787
*Marker_CfgFile_DV, /*!< \brief Global index for design variable markers using the config information. */
@@ -3471,6 +3479,14 @@ class CConfig {
34713479
*/
34723480
void SetMarker_All_Deform_Mesh_Sym_Plane(unsigned short val_marker, unsigned short val_deform) { Marker_All_Deform_Mesh_Sym_Plane[val_marker] = val_deform; }
34733481

3482+
/*!
3483+
* \brief Set if a marker <i>val_marker</i> allows deformation at the boundary.
3484+
* \param[in] val_marker - Index of the marker in which we are interested.
3485+
* \param[in] val_interface - 0 or 1 depending if the the marker is or not a DEFORM_MESH_SYM_PLANE marker.
3486+
*/
3487+
void SetMarker_All_Deform_Mesh_Internal(unsigned short val_marker, unsigned short val_deform) { Marker_All_Deform_Mesh_Internal[val_marker] = val_deform; }
3488+
3489+
34743490
/*!
34753491
* \brief Set if a in marker <i>val_marker</i> the flow load will be computed/employed.
34763492
* \param[in] val_marker - Index of the marker in which we are interested.
@@ -3636,6 +3652,13 @@ class CConfig {
36363652
*/
36373653
unsigned short GetMarker_All_Deform_Mesh_Sym_Plane(unsigned short val_marker) const { return Marker_All_Deform_Mesh_Sym_Plane[val_marker]; }
36383654

3655+
/*!
3656+
* \brief Get whether marker <i>val_marker</i> is a DEFORM_MESH_SYM_PLANE marker
3657+
* \param[in] val_marker - 0 or 1 depending if the the marker belongs to the DEFORM_MESH_SYM_PLANE subset.
3658+
* \return 0 or 1 depending if the marker belongs to the DEFORM_MESH_SYM_PLANE subset.
3659+
*/
3660+
unsigned short GetMarker_All_Deform_Mesh_Internal(unsigned short val_marker) const { return Marker_All_Deform_Mesh_Internal[val_marker]; }
3661+
36393662
/*!
36403663
* \brief Get whether marker <i>val_marker</i> is a Fluid_Load marker
36413664
* \param[in] val_marker - 0 or 1 depending if the the marker belongs to the Fluid_Load subset.
@@ -4349,6 +4372,30 @@ class CConfig {
43494372
*/
43504373
bool GetFFD_Symmetry_Plane(void) const { return FFD_Symmetry_Plane; }
43514374

4375+
/*!
4376+
* \brief Get the type of mesh deformation method.
4377+
* \return type of mesh deformation.
4378+
*/
4379+
DEFORM_KIND GetDeform_Kind() const { return Deform_Kind; }
4380+
4381+
/*!
4382+
* \brief Determines use of data reduction methods for RBF mesh deformation.
4383+
* \return <code>TRUE</code> means that data reduction is used.
4384+
*/
4385+
bool GetRBF_DataReduction(void) const { return RBF_DataReduction; }
4386+
4387+
/*!
4388+
* \brief Determines use of data reduction methods for RBF mesh deformation.
4389+
* \return <code>TRUE</code> means that data reduction is used.
4390+
*/
4391+
su2double GetRBF_DataRedTolerance(void) const { return RBF_GreedyTolerance; }
4392+
4393+
/*!
4394+
* \brief Determines use of data reduction methods for RBF mesh deformation.
4395+
* \return <code>TRUE</code> means that data reduction is used.
4396+
*/
4397+
su2double GetRBF_DataRedCorrectionFactor(void) const { return RBF_GreedyCorrectionFactor; }
4398+
43524399
/*!
43534400
* \brief Get the kind of SU2 software component.
43544401
* \return Kind of the SU2 software component.
@@ -6363,6 +6410,12 @@ class CConfig {
63636410
*/
63646411
unsigned short GetMarker_CfgFile_Deform_Mesh_Sym_Plane(const string& val_marker) const;
63656412

6413+
/*!
6414+
* \brief Get the DEFORM_MESH_INTERNAL information from the config definition for the marker <i>val_marker</i>.
6415+
* \return DEFORM_MESH_INTERNAL information of the boundary in the config information for the marker <i>val_marker</i>.
6416+
*/
6417+
unsigned short GetMarker_CfgFile_Deform_Mesh_Internal(const string& val_marker) const;
6418+
63666419
/*!
63676420
* \brief Get the Fluid_Load information from the config definition for the marker <i>val_marker</i>.
63686421
* \return Fluid_Load information of the boundary in the config information for the marker <i>val_marker</i>.
@@ -6724,6 +6777,12 @@ class CConfig {
67246777
*/
67256778
unsigned short GetMarker_Deform_Mesh_Sym_Plane(const string& val_marker) const;
67266779

6780+
/*!
6781+
* \brief Get the internal index for a DEFORM_MESH_SYM_PLANE boundary <i>val_marker</i>.
6782+
* \return Internal index for a DEFORM_MESH_SYM_PLANE boundary <i>val_marker</i>.
6783+
*/
6784+
unsigned short GetMarker_Deform_Mesh_Internal(const string& val_marker) const;
6785+
67276786
/*!
67286787
* \brief Get a bool for whether the marker is deformed. <i>val_marker</i>.
67296788
* \param[in] val_marker - Name of the marker to test.
Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
/*!
2+
* \file CLinearElasticity.hpp
3+
* \brief Headers of the CLinearElasticity class.
4+
* \author F. Palacios, A. Bueno, T. Economon, S. Padron.
5+
* \version 8.0.1 "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-2023, 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+
#include "CVolumetricMovement.hpp"
30+
#include "../linear_algebra/CSysMatrix.hpp"
31+
#include "../linear_algebra/CSysVector.hpp"
32+
#include "../linear_algebra/CSysSolve.hpp"
33+
34+
/*!
35+
* \class CLinearElasticity
36+
* \brief Class for moving the volumetric numerical grid using the linear elasticity analogy.
37+
* \author F. Palacios, A. Bueno, T. Economon, S. Padron.
38+
*/
39+
40+
class CLinearElasticity final: public CVolumetricMovement{
41+
protected:
42+
unsigned short nVar; /*!< \brief Number of variables. */
43+
44+
unsigned long nPoint; /*!< \brief Number of points. */
45+
unsigned long nPointDomain; /*!< \brief Number of points in the domain. */
46+
47+
unsigned long nIterMesh; /*!< \brief Number of iterations in the mesh update. +*/
48+
49+
50+
#ifndef CODI_FORWARD_TYPE
51+
CSysMatrix<su2mixedfloat> StiffMatrix; /*!< \brief Stiffness matrix of the elasticity problem. */
52+
CSysSolve<su2mixedfloat> System; /*!< \brief Linear solver/smoother. */
53+
#else
54+
CSysMatrix<su2double> StiffMatrix;
55+
CSysSolve<su2double> System;
56+
#endif
57+
CSysVector<su2double> LinSysSol;
58+
CSysVector<su2double> LinSysRes;
59+
60+
public:
61+
/*!
62+
* \brief Constructor of the class.
63+
*/
64+
CLinearElasticity(CGeometry* geometry, CConfig* config);
65+
66+
/*!
67+
* \brief Destructor of the class.
68+
*/
69+
~CLinearElasticity() override;
70+
71+
/*!
72+
* \brief Grid deformation using the spring analogy method.
73+
* \param[in] geometry - Geometrical definition of the problem.
74+
* \param[in] config - Definition of the particular problem.
75+
* \param[in] UpdateGeo - Update geometry.
76+
* \param[in] Derivative - Compute the derivative (disabled by default). Does not actually deform the grid if enabled.
77+
*/
78+
void SetVolume_Deformation(CGeometry* geometry, CConfig* config, bool UpdateGeo, bool Derivative,
79+
bool ForwardProjectionDerivative);
80+
81+
/*!
82+
* \brief Update the value of the coordinates after the grid movement.
83+
* \param[in] geometry - Geometrical definition of the problem.
84+
* \param[in] config - Definition of the particular problem.
85+
*/
86+
void UpdateGridCoord(CGeometry* geometry, CConfig* config);
87+
88+
/*!
89+
* \brief Update the derivatives of the coordinates after the grid movement.
90+
* \param[in] geometry - Geometrical definition of the problem.
91+
* \param[in] config - Definition of the particular problem.
92+
*/
93+
void UpdateGridCoord_Derivatives(CGeometry* geometry, CConfig* config, bool ForwardProjectionDerivative);
94+
95+
/*!
96+
* \brief Compute the minimum distance to the nearest solid surface.
97+
* \param[in] geometry - Geometrical definition of the problem.
98+
* \param[in] config - Definition of the particular problem.
99+
*/
100+
void ComputeSolid_Wall_Distance(CGeometry* geometry, CConfig* config, su2double& MinDistance,
101+
su2double& MaxDistance) const;
102+
103+
/*!
104+
* \brief Compute the stiffness matrix for grid deformation using spring analogy.
105+
* \param[in] geometry - Geometrical definition of the problem.
106+
* \param[in] config - Definition of the particular problem.
107+
* \return Value of the length of the smallest edge of the grid.
108+
*/
109+
su2double SetFEAMethodContributions_Elem(CGeometry* geometry, CConfig* config);
110+
111+
/*!
112+
* \brief Build the stiffness matrix for a 3-D hexahedron element. The result will be placed in StiffMatrix_Elem.
113+
* \param[in] geometry - Geometrical definition of the problem.
114+
* \param[in] config - Definition of the particular problem.
115+
* \param[in] StiffMatrix_Elem - Element stiffness matrix to be filled.
116+
* \param[in] CoordCorners - Index value for Node 1 of the current hexahedron.
117+
* \param[in] PointCorners - Index values for element corners
118+
* \param[in] nNodes - Number of nodes defining the element.
119+
* \param[in] scale
120+
*/
121+
void SetFEA_StiffMatrix2D(CGeometry* geometry, CConfig* config, su2double** StiffMatrix_Elem,
122+
unsigned long PointCorners[8], su2double CoordCorners[8][3],
123+
unsigned short nNodes, su2double ElemVolume, su2double ElemDistance) ;
124+
125+
/*!
126+
* \brief Build the stiffness matrix for a 3-D hexahedron element. The result will be placed in StiffMatrix_Elem.
127+
* \param[in] geometry - Geometrical definition of the problem.
128+
* \param[in] config - Definition of the particular problem.
129+
* \param[in] StiffMatrix_Elem - Element stiffness matrix to be filled.
130+
* \param[in] CoordCorners - Index value for Node 1 of the current hexahedron.
131+
* \param[in] PointCorners - Index values for element corners
132+
* \param[in] nNodes - Number of nodes defining the element.
133+
* \param[in] scale
134+
*/
135+
void SetFEA_StiffMatrix3D(CGeometry* geometry, CConfig* config, su2double** StiffMatrix_Elem,
136+
unsigned long PointCorners[8], su2double CoordCorners[8][3],
137+
unsigned short nNodes, su2double ElemVolume, su2double ElemDistance);
138+
139+
/*!
140+
* \brief Add the stiffness matrix for a 2-D triangular element to the global stiffness matrix for the entire mesh
141+
* (node-based). \param[in] geometry - Geometrical definition of the problem. \param[in] StiffMatrix_Elem - Element
142+
* stiffness matrix to be filled. \param[in] PointCorners - Index values for element corners \param[in] nNodes -
143+
* Number of nodes defining the element.
144+
*/
145+
void AddFEA_StiffMatrix(CGeometry* geometry, su2double** StiffMatrix_Elem,
146+
unsigned long PointCorners[8], unsigned short nNodes);
147+
148+
/*!
149+
* \brief Shape functions and derivative of the shape functions
150+
* \param[in] Xi - Local coordinates.
151+
* \param[in] Eta - Local coordinates.
152+
* \param[in] Zeta - Local coordinates.
153+
* \param[in] CoordCorners - Coordiantes of the corners.
154+
* \param[in] DShapeFunction - Shape function information
155+
*/
156+
su2double ShapeFunc_Hexa(su2double Xi, su2double Eta, su2double Zeta, su2double CoordCorners[8][3],
157+
su2double DShapeFunction[8][4]);
158+
159+
/*!
160+
* \brief Shape functions and derivative of the shape functions
161+
* \param[in] Xi - Local coordinates.
162+
* \param[in] Eta - Local coordinates.
163+
* \param[in] Zeta - Local coordinates.
164+
* \param[in] CoordCorners - Coordiantes of the corners.
165+
* \param[in] DShapeFunction - Shape function information
166+
*/
167+
su2double ShapeFunc_Tetra(su2double Xi, su2double Eta, su2double Zeta, su2double CoordCorners[8][3],
168+
su2double DShapeFunction[8][4]);
169+
170+
/*!
171+
* \brief Shape functions and derivative of the shape functions
172+
* \param[in] Xi - Local coordinates.
173+
* \param[in] Eta - Local coordinates.
174+
* \param[in] Zeta - Local coordinates.
175+
* \param[in] CoordCorners - Coordiantes of the corners.
176+
* \param[in] DShapeFunction - Shape function information
177+
*/
178+
su2double ShapeFunc_Pyram(su2double Xi, su2double Eta, su2double Zeta, su2double CoordCorners[8][3],
179+
su2double DShapeFunction[8][4]);
180+
181+
/*!
182+
* \brief Shape functions and derivative of the shape functions
183+
* \param[in] Xi - Local coordinates.
184+
* \param[in] Eta - Local coordinates.
185+
* \param[in] Zeta - Local coordinates.
186+
* \param[in] CoordCorners - Coordiantes of the corners.
187+
* \param[in] DShapeFunction - Shape function information
188+
*/
189+
su2double ShapeFunc_Prism(su2double Xi, su2double Eta, su2double Zeta, su2double CoordCorners[8][3],
190+
su2double DShapeFunction[8][4]);
191+
192+
/*!
193+
* \brief Shape functions and derivative of the shape functions
194+
* \param[in] Xi - Local coordinates.
195+
* \param[in] Eta - Local coordinates.
196+
* \param[in] CoordCorners - Coordiantes of the corners.
197+
* \param[in] DShapeFunction - Shape function information
198+
*/
199+
su2double ShapeFunc_Triangle(su2double Xi, su2double Eta, su2double CoordCorners[8][3],
200+
su2double DShapeFunction[8][4]);
201+
202+
/*!
203+
* \brief Shape functions and derivative of the shape functions
204+
* \param[in] Xi - Local coordinates.
205+
* \param[in] Eta - Local coordinates.
206+
* \param[in] CoordCorners - Coordiantes of the corners.
207+
* \param[in] DShapeFunction - Shape function information
208+
*/
209+
su2double ShapeFunc_Quadrilateral(su2double Xi, su2double Eta, su2double CoordCorners[8][3],
210+
su2double DShapeFunction[8][4]);
211+
212+
/*!
213+
* \brief Check the domain points vertex that are going to be moved.
214+
* \param[in] geometry - Geometrical definition of the problem.
215+
* \param[in] config - Definition of the particular problem.
216+
*/
217+
void SetDomainDisplacements(CGeometry* geometry, CConfig* config);
218+
219+
/*!
220+
* \brief Check the boundary vertex that are going to be moved.
221+
* \param[in] geometry - Geometrical definition of the problem.
222+
* \param[in] config - Definition of the particular problem.
223+
*/
224+
void SetBoundaryDisplacements(CGeometry* geometry, CConfig* config);
225+
226+
/*!
227+
* \brief Set the derivatives of the boundary nodes.
228+
* \param[in] geometry - Geometrical definition of the problem.
229+
* \param[in] config - Definition of the particular problem.
230+
*/
231+
void SetBoundaryDerivatives(CGeometry* geometry, CConfig* config, bool ForwardProjectionDerivative);
232+
233+
/*!
234+
* \brief Store the number of iterations when moving the mesh.
235+
* \param[in] val_nIterMesh - Number of iterations.
236+
*/
237+
inline void Set_nIterMesh(unsigned long val_nIterMesh) { nIterMesh = val_nIterMesh; }
238+
239+
/*!
240+
* \brief Retrieve the number of iterations when moving the mesh.
241+
* \param[out] Number of iterations.
242+
*/
243+
inline unsigned long Get_nIterMesh() const { return nIterMesh; }
244+
};
245+
246+

0 commit comments

Comments
 (0)