diff --git a/SU2_CFD/include/variables/CMeshBoundVariable.hpp b/SU2_CFD/include/variables/CMeshBoundVariable.hpp index 3b26d60ac37..882c6513f63 100644 --- a/SU2_CFD/include/variables/CMeshBoundVariable.hpp +++ b/SU2_CFD/include/variables/CMeshBoundVariable.hpp @@ -131,17 +131,22 @@ class CMeshBoundVariable final : public CMeshVariable { } /*! - * \brief Get whether a node is on the boundary + * \brief Get whether a node is on the boundary. */ inline bool Get_isVertex(unsigned long iPoint) const override { return VertexMap.GetIsVertex(iPoint); } /*! - * \brief Set whether a node is on the boundary + * \brief Set whether a node is on the boundary. */ inline void Set_isVertex(unsigned long iPoint, bool isVertex) override { VertexMap.SetIsVertex(iPoint,isVertex); } + /*! + * \brief Get the vertex map used by this class. + */ + inline const CVertexMap& GetVertexMap() const { return VertexMap; } + }; diff --git a/SU2_CFD/src/solvers/CMeshSolver.cpp b/SU2_CFD/src/solvers/CMeshSolver.cpp index dc57fd6ce02..d270d3f3936 100644 --- a/SU2_CFD/src/solvers/CMeshSolver.cpp +++ b/SU2_CFD/src/solvers/CMeshSolver.cpp @@ -978,6 +978,12 @@ void CMeshSolver::Surface_Pitching(CGeometry *geometry, CConfig *config, unsigne unsigned long iPoint, iVertex; string Marker_Tag, Moving_Tag; + /*--- Keep track of points that have been moved to avoid double + * deformation on points that appear on multiple markers. ---*/ + + const auto& VertexMap = static_cast(nodes)->GetVertexMap(); + std::vector iPointMoved(VertexMap.GetnVertex(), false); + /*--- Retrieve values from the config file ---*/ deltaT = config->GetDelta_UnstTimeND(); @@ -1054,6 +1060,13 @@ void CMeshSolver::Surface_Pitching(CGeometry *geometry, CConfig *config, unsigne * motions that may be applied, e.g. plunging. ---*/ iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + + /*--- Avoid moving points twice. ---*/ + auto vertexIndex = iPoint; + VertexMap.GetVertexIndex(vertexIndex); + if (iPointMoved[vertexIndex]) continue; + iPointMoved[vertexIndex] = true; + su2double Coord[3] = {0.0}; for (iDim = 0; iDim < nDim; ++iDim) { 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 unsigned long iPoint, iVertex; string Marker_Tag, Moving_Tag; + /*--- Keep track of points that have been moved to avoid double + * deformation on points that appear on multiple markers. ---*/ + + const auto& VertexMap = static_cast(nodes)->GetVertexMap(); + std::vector iPointMoved(VertexMap.GetnVertex(), false); + /*--- Retrieve values from the config file ---*/ deltaT = config->GetDelta_UnstTimeND(); @@ -1163,6 +1182,13 @@ void CMeshSolver::Surface_Rotating(CGeometry *geometry, CConfig *config, unsigne * motions that may be applied, e.g. plunging. ---*/ iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + + /*--- Avoid moving points twice. ---*/ + auto vertexIndex = iPoint; + VertexMap.GetVertexIndex(vertexIndex); + if (iPointMoved[vertexIndex]) continue; + iPointMoved[vertexIndex] = true; + su2double Coord[3] = {0.0}; for (iDim = 0; iDim < nDim; ++iDim) { 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 string Marker_Tag, Moving_Tag; unsigned short iDim; + /*--- Keep track of points that have been moved to avoid double + * deformation on points that appear on multiple markers. ---*/ + + const auto& VertexMap = static_cast(nodes)->GetVertexMap(); + std::vector iPointMoved(VertexMap.GetnVertex(), false); + /*--- Retrieve values from the config file ---*/ deltaT = config->GetDelta_UnstTimeND(); @@ -1327,6 +1359,12 @@ void CMeshSolver::Surface_Plunging(CGeometry *geometry, CConfig *config, unsigne iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + /*--- Avoid moving points twice. ---*/ + auto vertexIndex = iPoint; + VertexMap.GetVertexIndex(vertexIndex); + if (iPointMoved[vertexIndex]) continue; + iPointMoved[vertexIndex] = true; + for (iDim = 0; iDim < nDim; iDim++) VarCoordAbs[iDim] = nodes->GetBound_Disp(iPoint, iDim) + VarCoord[iDim]; @@ -1379,6 +1417,12 @@ void CMeshSolver::Surface_Translating(CGeometry *geometry, CConfig *config, unsi string Marker_Tag, Moving_Tag; unsigned short iDim; + /*--- Keep track of points that have been moved to avoid double + * deformation on points that appear on multiple markers. ---*/ + + const auto& VertexMap = static_cast(nodes)->GetVertexMap(); + std::vector iPointMoved(VertexMap.GetnVertex(), false); + /*--- Retrieve values from the config file ---*/ deltaT = config->GetDelta_UnstTimeND(); @@ -1437,6 +1481,12 @@ void CMeshSolver::Surface_Translating(CGeometry *geometry, CConfig *config, unsi iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + /*--- Avoid moving points twice. ---*/ + auto vertexIndex = iPoint; + VertexMap.GetVertexIndex(vertexIndex); + if (iPointMoved[vertexIndex]) continue; + iPointMoved[vertexIndex] = true; + for (iDim = 0; iDim < nDim; iDim++) VarCoordAbs[iDim] = nodes->GetBound_Disp(iPoint, iDim) + VarCoord[iDim];