Skip to content

Commit e261bb6

Browse files
authored
Merge pull request #2216 from su2code/fix_double_deformation
Fix double deformation of points shared by multiple markers
2 parents 0f211b5 + 544f6fd commit e261bb6

File tree

2 files changed

+57
-2
lines changed

2 files changed

+57
-2
lines changed

SU2_CFD/include/variables/CMeshBoundVariable.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,17 +131,22 @@ class CMeshBoundVariable final : public CMeshVariable {
131131
}
132132

133133
/*!
134-
* \brief Get whether a node is on the boundary
134+
* \brief Get whether a node is on the boundary.
135135
*/
136136
inline bool Get_isVertex(unsigned long iPoint) const override {
137137
return VertexMap.GetIsVertex(iPoint);
138138
}
139139

140140
/*!
141-
* \brief Set whether a node is on the boundary
141+
* \brief Set whether a node is on the boundary.
142142
*/
143143
inline void Set_isVertex(unsigned long iPoint, bool isVertex) override {
144144
VertexMap.SetIsVertex(iPoint,isVertex);
145145
}
146146

147+
/*!
148+
* \brief Get the vertex map used by this class.
149+
*/
150+
inline const CVertexMap<unsigned>& GetVertexMap() const { return VertexMap; }
151+
147152
};

SU2_CFD/src/solvers/CMeshSolver.cpp

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,12 @@ void CMeshSolver::Surface_Pitching(CGeometry *geometry, CConfig *config, unsigne
978978
unsigned long iPoint, iVertex;
979979
string Marker_Tag, Moving_Tag;
980980

981+
/*--- Keep track of points that have been moved to avoid double
982+
* deformation on points that appear on multiple markers. ---*/
983+
984+
const auto& VertexMap = static_cast<const CMeshBoundVariable*>(nodes)->GetVertexMap();
985+
std::vector<uint8_t> iPointMoved(VertexMap.GetnVertex(), false);
986+
981987
/*--- Retrieve values from the config file ---*/
982988

983989
deltaT = config->GetDelta_UnstTimeND();
@@ -1054,6 +1060,13 @@ void CMeshSolver::Surface_Pitching(CGeometry *geometry, CConfig *config, unsigne
10541060
* motions that may be applied, e.g. plunging. ---*/
10551061

10561062
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
1063+
1064+
/*--- Avoid moving points twice. ---*/
1065+
auto vertexIndex = iPoint;
1066+
VertexMap.GetVertexIndex(vertexIndex);
1067+
if (iPointMoved[vertexIndex]) continue;
1068+
iPointMoved[vertexIndex] = true;
1069+
10571070
su2double Coord[3] = {0.0};
10581071
for (iDim = 0; iDim < nDim; ++iDim) {
10591072
Coord[iDim] = nodes->GetMesh_Coord(iPoint, iDim) + nodes->GetBound_Disp(iPoint, iDim);
@@ -1097,6 +1110,12 @@ void CMeshSolver::Surface_Rotating(CGeometry *geometry, CConfig *config, unsigne
10971110
unsigned long iPoint, iVertex;
10981111
string Marker_Tag, Moving_Tag;
10991112

1113+
/*--- Keep track of points that have been moved to avoid double
1114+
* deformation on points that appear on multiple markers. ---*/
1115+
1116+
const auto& VertexMap = static_cast<const CMeshBoundVariable*>(nodes)->GetVertexMap();
1117+
std::vector<uint8_t> iPointMoved(VertexMap.GetnVertex(), false);
1118+
11001119
/*--- Retrieve values from the config file ---*/
11011120

11021121
deltaT = config->GetDelta_UnstTimeND();
@@ -1163,6 +1182,13 @@ void CMeshSolver::Surface_Rotating(CGeometry *geometry, CConfig *config, unsigne
11631182
* motions that may be applied, e.g. plunging. ---*/
11641183

11651184
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
1185+
1186+
/*--- Avoid moving points twice. ---*/
1187+
auto vertexIndex = iPoint;
1188+
VertexMap.GetVertexIndex(vertexIndex);
1189+
if (iPointMoved[vertexIndex]) continue;
1190+
iPointMoved[vertexIndex] = true;
1191+
11661192
su2double Coord[3] = {0.0};
11671193
for (iDim = 0; iDim < nDim; ++iDim) {
11681194
Coord[iDim] = nodes->GetMesh_Coord(iPoint, iDim) + nodes->GetBound_Disp(iPoint, iDim);
@@ -1264,6 +1290,12 @@ void CMeshSolver::Surface_Plunging(CGeometry *geometry, CConfig *config, unsigne
12641290
string Marker_Tag, Moving_Tag;
12651291
unsigned short iDim;
12661292

1293+
/*--- Keep track of points that have been moved to avoid double
1294+
* deformation on points that appear on multiple markers. ---*/
1295+
1296+
const auto& VertexMap = static_cast<const CMeshBoundVariable*>(nodes)->GetVertexMap();
1297+
std::vector<uint8_t> iPointMoved(VertexMap.GetnVertex(), false);
1298+
12671299
/*--- Retrieve values from the config file ---*/
12681300

12691301
deltaT = config->GetDelta_UnstTimeND();
@@ -1327,6 +1359,12 @@ void CMeshSolver::Surface_Plunging(CGeometry *geometry, CConfig *config, unsigne
13271359

13281360
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
13291361

1362+
/*--- Avoid moving points twice. ---*/
1363+
auto vertexIndex = iPoint;
1364+
VertexMap.GetVertexIndex(vertexIndex);
1365+
if (iPointMoved[vertexIndex]) continue;
1366+
iPointMoved[vertexIndex] = true;
1367+
13301368
for (iDim = 0; iDim < nDim; iDim++)
13311369
VarCoordAbs[iDim] = nodes->GetBound_Disp(iPoint, iDim) + VarCoord[iDim];
13321370

@@ -1379,6 +1417,12 @@ void CMeshSolver::Surface_Translating(CGeometry *geometry, CConfig *config, unsi
13791417
string Marker_Tag, Moving_Tag;
13801418
unsigned short iDim;
13811419

1420+
/*--- Keep track of points that have been moved to avoid double
1421+
* deformation on points that appear on multiple markers. ---*/
1422+
1423+
const auto& VertexMap = static_cast<const CMeshBoundVariable*>(nodes)->GetVertexMap();
1424+
std::vector<uint8_t> iPointMoved(VertexMap.GetnVertex(), false);
1425+
13821426
/*--- Retrieve values from the config file ---*/
13831427

13841428
deltaT = config->GetDelta_UnstTimeND();
@@ -1437,6 +1481,12 @@ void CMeshSolver::Surface_Translating(CGeometry *geometry, CConfig *config, unsi
14371481

14381482
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
14391483

1484+
/*--- Avoid moving points twice. ---*/
1485+
auto vertexIndex = iPoint;
1486+
VertexMap.GetVertexIndex(vertexIndex);
1487+
if (iPointMoved[vertexIndex]) continue;
1488+
iPointMoved[vertexIndex] = true;
1489+
14401490
for (iDim = 0; iDim < nDim; iDim++)
14411491
VarCoordAbs[iDim] = nodes->GetBound_Disp(iPoint, iDim) + VarCoord[iDim];
14421492

0 commit comments

Comments
 (0)