Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CTurbSSTSolver.cpp to fix bug on calculating MuT #2453

Merged
merged 1 commit into from
Feb 27, 2025

Conversation

ShiheJia
Copy link
Contributor

@ShiheJia ShiheJia commented Feb 25, 2025

Proposed Changes

When calculating the turb viscosity MuT for the SST 2003 version, the variable StrainMag is needed. However, in the current code, we use the wrong CVariable class to get the StrainMag so that we only get 0. The turb variable class should be replaced by the flow variable class.
CurrentCode

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.

@bigfooted
Copy link
Contributor

Yep, setStrainMag updates the flownodes only. Can you update the regression tests?

@ShiheJia
Copy link
Contributor Author

I run a flatplate case and the results are shown below.
It seems that the fixed code can accelerate the convergence very slightly, but the results deviates from SA a lot. I'm not sure how this happened and whether it was harmful.
github-1
github-2
github-3
github-4

@ShiheJia
Copy link
Contributor Author

Yep, setStrainMag updates the flownodes only. Can you update the regression tests?

A flatplate case is listed below.

@@ -230,7 +230,7 @@ void CTurbSSTSolver::Postprocessing(CGeometry *geometry, CSolver **solver_contai
const su2double dist = geometry->nodes->GetWall_Distance(iPoint);

const su2double VorticityMag = max(GeometryToolbox::Norm(3, flowNodes->GetVorticity(iPoint)), 1e-12);
const su2double StrainMag = max(nodes->GetStrainMag(iPoint), 1e-12);
const su2double StrainMag = max(flowNodes->GetStrainMag(iPoint), 1e-12);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you looked for other uses of GetStrainMag to check if they are ok?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have checked the other part of code and they are all ok.

@bigfooted
Copy link
Contributor

bigfooted commented Feb 25, 2025

Yep, setStrainMag updates the flownodes only. Can you update the regression tests?

A flatplate case is listed below.

Here are the results from the nasa website. It looks like they also see a difference between SA and SST, maybe you can check if this corresponds to your results
https://turbmodels.larc.nasa.gov/flatplate.html

Our validation case is here:
https://su2code.github.io/tutorials/Turbulent_Flat_Plate/
is this the same as your setup?

@ShiheJia
Copy link
Contributor Author

ShiheJia commented Feb 25, 2025

Yep, setStrainMag updates the flownodes only. Can you update the regression tests?

A flatplate case is listed below.

Here are the results from the nasa website. It looks like they also see a difference between SA and SST, maybe you can check if this corresponds to your results
https://turbmodels.larc.nasa.gov/flatplate.html

Our validation case is here: https://su2code.github.io/tutorials/Turbulent_Flat_Plate/ is this the same as your setup?

The case above is just the SU2 validation case, with a finer mesh.
The results from NASA do show that SST will get a lower cf, however, it seems that the difference between SA and SST is larger in SU2.

@ShiheJia
Copy link
Contributor Author

github-5

@joshkellyjak
Copy link
Contributor

I run a flatplate case and the results are shown below. It seems that the fixed code can accelerate the convergence very slightly, but the results deviates from SA a lot. I'm not sure how this happened and whether it was harmful.

Are you confident that this is converging? Two orders of magnitude seems rather small, maybe this could explain the discrepancy you are observing?

@ShiheJia
Copy link
Contributor Author

From the CD, I think the case has converged.
I will try the mesh from NASA, and we can exclude the grid effects.

@joshkellyjak
Copy link
Contributor

From the CD, I think the case has converged. I will try the mesh from NASA, and we can exclude the grid effects.

Cool, I eagerly await the results!

@joshkellyjak
Copy link
Contributor

This also fixes an issue I found in #2446. Thank you!

@bigfooted
Copy link
Contributor

The case is not converging but stalling, this can also be a reason that drag is not going down. maybe reduce the cfl.

@pcarruscag
Copy link
Member

Converging well or not, this was certainly a bug.
@ShiheJia do you know what is the process to update the regression tests?

@ShiheJia
Copy link
Contributor Author

Converging well or not, this was certainly a bug. @ShiheJia do you know what is the process to update the regression tests?

Actually I know a little about that.

@ShiheJia
Copy link
Contributor Author

From the CD, I think the case has converged. I will try the mesh from NASA, and we can exclude the grid effects.

Cool, I eagerly await the results!

It seems the new code is alright. The new SST in SU2 is closer to CFL3D and FUN3D, although there is still small difference.
github-1
github-2
github-3
github-4

@bigfooted
Copy link
Contributor

ok, those results, especially Cf_x, look pretty convincing. What did you change?

@bigfooted
Copy link
Contributor

For updating regression tests, you will se a lot of cases that use the SST model that now have different results:

test_vals (stored): -4.029282, -2.181911, -7.734686, 0.000000, -0.939944
sim_vals (computed): -3.597708, -2.983823, -8.354806, 0.000000, -0.916525

So you will need to change the 'stored' values in Testcases/parallel_regression.py, serial_regression.py, etc. with the 'computed' values. You can download the logfiles from github and use them to update the regression files.

@ShiheJia
Copy link
Contributor Author

I use the config and mesh files in https://github.com/su2code/VandV/tree/master/rans/flatplate.
The provided mesh is finer in the normal direction than the initial mesh.

@joshkellyjak
Copy link
Contributor

It seems the new code is alright. The new SST in SU2 is closer to CFL3D and FUN3D, although there is still small difference.

Beautiful!

@ShiheJia
Copy link
Contributor Author

For updating regression tests, you will se a lot of cases that use the SST model that now have different results:

test_vals (stored): -4.029282, -2.181911, -7.734686, 0.000000, -0.939944
sim_vals (computed): -3.597708, -2.983823, -8.354806, 0.000000, -0.916525

So you will need to change the 'stored' values in Testcases/parallel_regression.py, serial_regression.py, etc. with the 'computed' values. You can download the logfiles from github and use them to update the regression files.

I have tried a lot but I failed to do that. I am not very familiar with the Github process. Maybe someone more skilled can help with updating the regression files.

@pcarruscag pcarruscag changed the base branch from develop to fix_cornernode_normal February 27, 2025 09:18
@pcarruscag
Copy link
Member

I'll merge into another branch where we need to update tests for SST

@pcarruscag pcarruscag merged commit 59f3561 into su2code:fix_cornernode_normal Feb 27, 2025
29 of 37 checks passed
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.

4 participants