Skip to content

Commit a2b3693

Browse files
author
rois1995
committed
- Fix Normal Distance bug
1 parent 510f2af commit a2b3693

4 files changed

Lines changed: 31 additions & 2 deletions

File tree

Common/include/geometry/CGeometry.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1843,6 +1843,13 @@ class CGeometry {
18431843
*/
18441844
virtual void SetWallDistance(su2double val) {}
18451845

1846+
/*!
1847+
* \brief Set wall distances a specific value and at a specific point
1848+
* \param[in] iPoint - i-th point to set the wall distance.
1849+
* \param[in] val - new value for the wall distance at the input point.
1850+
*/
1851+
virtual void SetWallDistance(unsigned long iPoint, su2double val) {}
1852+
18461853
/*!
18471854
* \brief Compute the distances to the closest vertex on viscous walls over the entire domain
18481855
* \param[in] config_container - Definition of the particular problem.

Common/include/geometry/CPhysicalGeometry.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,13 @@ class CPhysicalGeometry final : public CGeometry {
811811
}
812812
}
813813

814+
/*!
815+
* \brief Set wall distance of i-th point to a specific value
816+
*/
817+
void SetWallDistance(unsigned long iPoint, su2double val) override {
818+
nodes->SetWall_Distance(iPoint, val);
819+
}
820+
814821
/*!
815822
* \brief For streamwise periodicity, find & store a unique reference node on the designated periodic inlet.
816823
* \param[in] config - Definition of the particular problem.

Common/src/geometry/CGeometry.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4119,7 +4119,20 @@ void CGeometry::ComputeWallDistance(const CConfig* const* config_container, CGeo
41194119
* This is necessary, because before a computed distance is set, it will be checked
41204120
* whether the new distance is smaller than the currently stored one. ---*/
41214121
CGeometry* geometry = geometry_container[iZone][iInst][MESH_0];
4122-
if (wallDistanceNeeded[iZone]) geometry->SetWallDistance(numeric_limits<su2double>::max());
4122+
if (wallDistanceNeeded[iZone]){
4123+
geometry->SetWallDistance(numeric_limits<su2double>::max());
4124+
4125+
const auto nMarker = geometry->GetnMarker();
4126+
for (auto iMarker = 0; iMarker < config_container[iZone]->GetnMarker_All(); iMarker++) {
4127+
if (!config_container[iZone]->GetViscous_Wall(iMarker)) continue;
4128+
4129+
SU2_OMP_FOR_STAT(OMP_MIN_SIZE)
4130+
for (auto iVertex = 0u; iVertex < geometry->nVertex[iMarker]; iVertex++) {
4131+
const auto iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
4132+
geometry->SetWallDistance(iPoint, 0.0);
4133+
}
4134+
}
4135+
}
41234136
}
41244137

41254138
/*--- Loop over all zones and compute the ADT based on the viscous walls in that zone ---*/

Common/src/geometry/CPhysicalGeometry.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10559,7 +10559,9 @@ void CPhysicalGeometry::SetWallDistance(CADTElemClass* WallADT, const CConfig* c
1055910559

1056010560
WallADT->DetermineNearestElement(nodes->GetCoord(iPoint), dist, markerID, elemID, rankID);
1056110561

10562-
if (dist < nodes->GetWall_Distance(iPoint)) {
10562+
if (nodes->GetWall_Distance(iPoint) == 0) dist = 0;
10563+
10564+
if (dist < nodes->GetWall_Distance(iPoint) || dist == 0) {
1056310565
nodes->SetWall_Distance(iPoint, dist, rankID, iZone, markerID, elemID);
1056410566
}
1056510567
}

0 commit comments

Comments
 (0)