@@ -1040,56 +1040,51 @@ su2double CTurbSSTSolver::GetNearest_Neighbor(CGeometry *geometry, unsigned lon
10401040 su2double distance = 0.0 ;
10411041 unsigned long Point_Normal;
10421042
1043- /* --- Compute closest normal neighbor, note that the normal are oriented inwards ---*/
1044- Point_Normal = 0 ;
1045- // we use distance
1046- dist_min = 0.0 ;
1047- for (size_t iNeigh = 0 ; iNeigh < geometry->nodes ->GetnPoint (iPoint); iNeigh++) {
1048- size_t jPoint = geometry->nodes ->GetPoint (iPoint, iNeigh);
1049- if (geometry->nodes ->GetViscousBoundary (jPoint) == false ) {
1050- su2double distance[MAXNDIM] = {0.0 };
1051- // compute distance between ipoint and jpoint (vector)
1052- GeometryToolbox::Distance (nDim,
1053- geometry->nodes ->GetCoord (iPoint),
1054- geometry->nodes ->GetCoord (jPoint),
1055- distance);
1056- // get the edge
1057- size_t iEdge = geometry->nodes ->GetEdge (iPoint, iNeigh);
1058- const su2double* Normal = geometry->edges ->GetNormal (iEdge);
1059- const su2double Area = GeometryToolbox::Norm (nDim, Normal);
1060- su2double projdistance = abs (GeometryToolbox::DotProduct (nDim,distance,Normal) / Area);
1061-
1062-
1063- // Take the interior node that is closest to the wall node.
1064- // cout << "projected distance = " << projdistance << " , area="<< Area << endl;
1065-
1066- Point_Normal = jPoint;
1067- dist_min = projdistance;
1068- }
1069- }
1070-
1043+ Point_Normal = 0 ;
1044+ dist_min = 0.0 ;
1045+ for (size_t iNeigh = 0 ; iNeigh < geometry->nodes ->GetnPoint (iPoint); iNeigh++) {
1046+ size_t jPoint = geometry->nodes ->GetPoint (iPoint, iNeigh);
1047+ if (geometry->nodes ->GetViscousBoundary (jPoint) == false ) {
1048+ su2double distance[MAXNDIM] = {0.0 };
1049+ // compute distance between ipoint and jpoint (vector)
1050+ GeometryToolbox::Distance (nDim,
1051+ geometry->nodes ->GetCoord (iPoint),
1052+ geometry->nodes ->GetCoord (jPoint),
1053+ distance);
1054+ // get the edge
1055+ size_t iEdge = geometry->nodes ->GetEdge (iPoint, iNeigh);
1056+ const su2double* Normal = geometry->edges ->GetNormal (iEdge);
1057+ const su2double Area = GeometryToolbox::Norm (nDim, Normal);
1058+ su2double projdistance = abs (GeometryToolbox::DotProduct (nDim,distance,Normal) / Area);
1059+
1060+ // Take the interior node that is closest to the wall node.
1061+ // cout << "projected distance = " << projdistance << " , area="<< Area << endl;
1062+
1063+ Point_Normal = jPoint;
1064+ dist_min = projdistance;
1065+ }
1066+ }
10711067
1072- if (Point_Normal==0 ) {
1073- // cout << "no point found at i = " << iPoint << endl;
1074- su2double Area = 0.0 ;
1075- su2double TwoVol = 2.0 * (geometry->nodes ->GetVolume (iPoint) + geometry->nodes ->GetPeriodicVolume (iPoint));
10761068
1077- // for (auto iVertex = 0u; iVertex < geometry->nVertex[iMarker]; iVertex++) {
1069+ if (Point_Normal==0 ) {
1070+ // cout << "no point found at i = " << iPoint << endl;
1071+ su2double Area = 0.0 ;
1072+ su2double TwoVol = 2.0 * (geometry->nodes ->GetVolume (iPoint) + geometry->nodes ->GetPeriodicVolume (iPoint));
10781073
1079- for (size_t iNeigh = 0 ; iNeigh < geometry->nodes ->GetnPoint (iPoint); ++iNeigh) {
1080- size_t iEdge = geometry->nodes ->GetEdge (iPoint, iNeigh);
1081- size_t jPoint = geometry->nodes ->GetPoint (iPoint, iNeigh);
1074+ for (size_t iNeigh = 0 ; iNeigh < geometry->nodes ->GetnPoint (iPoint); ++iNeigh) {
1075+ size_t iEdge = geometry->nodes ->GetEdge (iPoint, iNeigh);
1076+ size_t jPoint = geometry->nodes ->GetPoint (iPoint, iNeigh);
10821077
1083- if (geometry->nodes ->GetViscousBoundary (jPoint) == true ) {
1084- const su2double* Normal = geometry->edges ->GetNormal (iEdge);
1085- Area = GeometryToolbox::Norm (nDim, Normal);
1086- dist_min += TwoVol / Area;
1087- // cout << " distmin = " << dist_min << " , vol = "<<TwoVol << " , Area=" << Area<< endl;
1088- }
1078+ if (geometry->nodes ->GetViscousBoundary (jPoint) == true ) {
1079+ const su2double* Normal = geometry->edges ->GetNormal (iEdge);
1080+ Area = GeometryToolbox::Norm (nDim, Normal);
1081+ dist_min += TwoVol / Area;
1082+ // cout << " distmin = " << dist_min << " , vol = "<<TwoVol << " , Area=" << Area<< endl;
1083+ }
10891084
1090- }
1091- // cout << "distmin = " << dist_min << " , vol = "<<TwoVol << " , Area=" << Area<< endl;
1092- }
1085+ }
1086+ // cout << "distmin = " << dist_min << " , vol = "<<TwoVol << " , Area=" << Area<< endl;
1087+ }
10931088
10941089 return (dist_min);
10951090}
0 commit comments