Skip to content

Commit

Permalink
projection
Browse files Browse the repository at this point in the history
  • Loading branch information
bigfooted committed Jan 10, 2025
1 parent bd45235 commit 31bd154
Showing 1 changed file with 30 additions and 12 deletions.
42 changes: 30 additions & 12 deletions SU2_CFD/src/solvers/CTurbSSTSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1046,31 +1046,49 @@ su2double CTurbSSTSolver::GetNearest_Neighbor(CGeometry *geometry, unsigned lon
dist_min = 0.0;
for (size_t iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); iNeigh++) {
size_t jPoint = geometry->nodes->GetPoint(iPoint, iNeigh);
if (geometry->nodes->GetViscousBoundary(jPoint) == false) {
su2double distance[MAXNDIM] = {0.0};

Check notice

Code scanning / CodeQL

Declaration hides variable Note

Variable distance hides another variable of the same name (on
line 1040
).
// compute distance between ipoint and jpoint (vector)
GeometryToolbox::Distance(nDim,
geometry->nodes->GetCoord(iPoint),
geometry->nodes->GetCoord(jPoint),
distance);
// get the edge
size_t iEdge = geometry->nodes->GetEdge(iPoint, iNeigh);
const su2double* Normal = geometry->edges->GetNormal(iEdge);
const su2double Area = GeometryToolbox::Norm(nDim, Normal);
su2double projdistance = abs(GeometryToolbox::DotProduct(nDim,distance,Normal) / Area);


// Take the interior node that is closest to the wall node.
// cout << "projected distance = " << projdistance << " , area="<< Area << endl;

su2double distance2 = GeometryToolbox::SquaredDistance(nDim,
geometry->nodes->GetCoord(iPoint),
geometry->nodes->GetCoord(jPoint));
// Take the interior node that is closest to the wall node.
if ((geometry->nodes->GetViscousBoundary(jPoint) == false) && (distance < dist_min)) {
Point_Normal = jPoint;
dist_min = sqrt(distance2);
dist_min = projdistance;
}
}


if (Point_Normal==0) {
cout << "no point found at i = " << iPoint << endl;
//cout << "no point found at i = " << iPoint << endl;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
su2double Area = 0.0;
su2double TwoVol = 2.0* (geometry->nodes->GetVolume(iPoint) + geometry->nodes->GetPeriodicVolume(iPoint));

//for (auto iVertex = 0u; iVertex < geometry->nVertex[iMarker]; iVertex++) {

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

for (size_t iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) {
size_t iEdge = geometry->nodes->GetEdge(iPoint, iNeigh);
const su2double* Normal = geometry->edges->GetNormal(iEdge);
Area = GeometryToolbox::Norm(nDim, Normal);
size_t jPoint = geometry->nodes->GetPoint(iPoint, iNeigh);

if (geometry->nodes->GetViscousBoundary(jPoint) == true) {
const su2double* Normal = geometry->edges->GetNormal(iEdge);
Area = GeometryToolbox::Norm(nDim, Normal);
dist_min += TwoVol / Area;
//cout << " distmin = " << dist_min << " , vol = "<<TwoVol << " , Area=" << Area<< endl;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
}

dist_min += TwoVol / Area;
cout << " distmin = " << dist_min << " , vol = "<<TwoVol << " , Area=" << Area<< endl;
}
cout << "distmin = " << dist_min << " , vol = "<<TwoVol << " , Area=" << Area<< endl;
//cout << "distmin = " << dist_min << " , vol = "<<TwoVol << " , Area=" << Area<< endl;
}

return (dist_min);
Expand Down

0 comments on commit 31bd154

Please sign in to comment.