Skip to content

Commit 31bd154

Browse files
committed
projection
1 parent bd45235 commit 31bd154

File tree

1 file changed

+30
-12
lines changed

1 file changed

+30
-12
lines changed

SU2_CFD/src/solvers/CTurbSSTSolver.cpp

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,31 +1046,49 @@ su2double CTurbSSTSolver::GetNearest_Neighbor(CGeometry *geometry, unsigned lon
10461046
dist_min = 0.0;
10471047
for (size_t iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); iNeigh++) {
10481048
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;
10491065

1050-
su2double distance2 = GeometryToolbox::SquaredDistance(nDim,
1051-
geometry->nodes->GetCoord(iPoint),
1052-
geometry->nodes->GetCoord(jPoint));
1053-
// Take the interior node that is closest to the wall node.
1054-
if ((geometry->nodes->GetViscousBoundary(jPoint) == false) && (distance < dist_min)) {
10551066
Point_Normal = jPoint;
1056-
dist_min = sqrt(distance2);
1067+
dist_min = projdistance;
10571068
}
10581069
}
10591070

10601071

10611072
if (Point_Normal==0) {
1062-
cout << "no point found at i = " << iPoint << endl;
1073+
//cout << "no point found at i = " << iPoint << endl;
10631074
su2double Area = 0.0;
10641075
su2double TwoVol = 2.0* (geometry->nodes->GetVolume(iPoint) + geometry->nodes->GetPeriodicVolume(iPoint));
1076+
1077+
//for (auto iVertex = 0u; iVertex < geometry->nVertex[iMarker]; iVertex++) {
1078+
10651079
for (size_t iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) {
10661080
size_t iEdge = geometry->nodes->GetEdge(iPoint, iNeigh);
1067-
const su2double* Normal = geometry->edges->GetNormal(iEdge);
1068-
Area = GeometryToolbox::Norm(nDim, Normal);
1081+
size_t jPoint = geometry->nodes->GetPoint(iPoint, iNeigh);
1082+
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+
}
10691089

1070-
dist_min += TwoVol / Area;
1071-
cout << " distmin = " << dist_min << " , vol = "<<TwoVol << " , Area=" << Area<< endl;
10721090
}
1073-
cout << "distmin = " << dist_min << " , vol = "<<TwoVol << " , Area=" << Area<< endl;
1091+
//cout << "distmin = " << dist_min << " , vol = "<<TwoVol << " , Area=" << Area<< endl;
10741092
}
10751093

10761094
return (dist_min);

0 commit comments

Comments
 (0)