Skip to content

Conversation

@rois1995
Copy link
Contributor

Proposed Changes

This PR fixes the problems encountered in #2474, where for some points on a viscous wall the wall distance was higher than EPS, thus the normal distance introduced in #2392 will be wrong for any point connected to the incriminated ones. This will cause a large Omega at the wall when the SST model is considered.

Develop:
Problem

Current branch:
NoProblem

Here I initialize the wall distance on all the points belonging to a viscous boundary to 0, thus it won't be overwritten by the wall distance computed by the ADT tree.

Related Work

#2474 #2392

PR Checklist

Put an X by all that apply. You can fill this out after submitting the PR. If you have any questions, don't hesitate to ask! We want to help. These are a guide for you to know what the reviewers will be looking for in your contribution.

  • I am submitting my contribution to the develop branch.
  • My contribution generates no new compiler warnings (try with --warnlevel=3 when using meson).
  • My contribution is commented and consistent with SU2 style (https://su2code.github.io/docs_v7/Style-Guide/).
  • I used the pre-commit hook to prevent dirty commits and used pre-commit run --all to format old commits.
  • I have added a test case that demonstrates my contribution, if necessary.
  • I have updated appropriate documentation (Tutorials, Docs Page, config_template.cpp), if necessary.

@pcarruscag
Copy link
Member

This makes sense but I think there is an easier way, change

  for (const auto jPoint : geometry->nodes->GetPoints(iPoint)) {
    const su2double dist = geometry->nodes->GetWall_Distance(jPoint);
    if (dist > EPS) distance = fmin(distance, dist);
  }

to skip points on viscous walls (essentially what you are doing here).

@rois1995
Copy link
Contributor Author

This makes sense but I think there is an easier way, change

  for (const auto jPoint : geometry->nodes->GetPoints(iPoint)) {
    const su2double dist = geometry->nodes->GetWall_Distance(jPoint);
    if (dist > EPS) distance = fmin(distance, dist);
  }

to skip points on viscous walls (essentially what you are doing here).

I also was thinking about it but how do I know if the iPoint is on a viscous wall?

@pcarruscag
Copy link
Member

There is something in geometry->nodes-> I think.

@rois1995
Copy link
Contributor Author

rois1995 commented Mar 26, 2025

There is something in geometry->nodes-> I think.

Found it, geometry->nodes->GetViscousBoundary(iPoint) I guess. Something like this?

  for (const auto jPoint : geometry->nodes->GetPoints(iPoint)) {
    const su2double dist = geometry->nodes->GetViscousBoundary(jPoint) ? 0.0 : geometry->nodes->GetWall_Distance(jPoint);
    if (dist > EPS) distance = fmin(distance, dist);
  }

Isn't the proposed fix more general though? As the wall distance on the points on a viscous domain is exactly zero, so we don't have this kind of problems if it is ever needed anywhere else in the same way. Maybe I can do it within the CPhysicalGeometry function, something like

void SetWallDistance(su2double val, bool init=false) override {
    su2double valHere = 0.0;
    for (unsigned long iPoint = 0; iPoint < GetnPoint(); iPoint++) {
      valHere = val;
      if (init && nodes->GetViscousBoundary(iPoint)) valHere = 0;
      nodes->SetWall_Distance(iPoint, valHere);
    }
  }

In either cases I think it is a larger overhead than just cycling on all the viscous points and setting it to 0 after the first uniform initialization.

@pcarruscag
Copy link
Member

No I don't think it is because there is nothing wrong with the wall distance computation, the issue is in this normal neighbor distance function that is using an indirect way of detecting boundaries. Fix it there please.

@rois1995
Copy link
Contributor Author

No I don't think it is because there is nothing wrong with the wall distance computation, the issue is in this normal neighbor distance function that is using an indirect way of detecting boundaries. Fix it there please.

Sure, no problem!

rois1995 and others added 4 commits March 26, 2025 20:37
Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com>
Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com>
@YairMO
Copy link

YairMO commented Mar 27, 2025

Hi,

Would this guarantee zero wall distance at the wall? Or in other words, would this cover all possible cases of geomtries?
Why is guaranteeing a zero-wall distance not sufficient? Is it expensive in some way, or will it fail?

@pcarruscag
Copy link
Member

The issue is not computing the wall distance at the wall (which is numerically 0); it's computing the distance to the nearest internal node.
In any case no part of the code should be relying on the wall distance of wall nodes, I hope.

@YairMO
Copy link

YairMO commented Mar 27, 2025

Agreed.
I may have completely misunderstood the issue, but I thought that it was found that a node on the wall has a very small value of wall distance (for some reason). This value "passed" the if statement. As a result, the assigned distance for this node was its own (false) distance. Am I wrong?

Thank you, and sorry for the trouble

@pcarruscag
Copy link
Member

The small but nonzero value was interfering with the new way of computing the distance to the nearest node.

@rois1995 rois1995 merged commit 7eb74b2 into develop Mar 27, 2025
35 checks passed
@rois1995 rois1995 deleted the fix_NormalNeighborDistance branch March 27, 2025 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants