Update CTurbSSTSolver.cpp to fix bug on calculating MuT by ShiheJia · Pull Request #2453 · su2code/SU2

@ShiheJia

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.

@ShiheJia

@bigfooted

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

@ShiheJia

@ShiheJia

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

A flatplate case is listed below.

pcarruscag


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);

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?

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.

pcarruscag

@bigfooted

@ShiheJia

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

github-5

@joshkellyjak

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

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

@joshkellyjak

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

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

@bigfooted

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

@pcarruscag

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

@ShiheJia

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

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

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

@bigfooted

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

@joshkellyjak

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

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

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