CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Bugs (http://www.cfd-online.com/Forums/openfoam-bugs/)
-   -   Wrong calculation of nut in the kOmegaSST turbulence model (http://www.cfd-online.com/Forums/openfoam-bugs/81601-wrong-calculation-nut-komegasst-turbulence-model.html)

 FelixL November 1, 2010 09:00

Wrong calculation of nut in the kOmegaSST turbulence model

5 Attachment(s)
Hello all,

lately there were a few threads coming up in the forums (eg. http://www.cfd-online.com/Forums/ope...lat-plate.html or http://www.cfd-online.com/Forums/ope...behaviour.html) discussing an unusual behavior of the kOmegaSST turbulence model when using meshes that had near wall y+ values of 1 and below.

While the kOmegaSST turbulence model was originally implemented in OpenFOAM for the use with wall functions, this implementation actually should also work (with satisfying accuracy) in the near wall regions without the use of any damping functions (as with many other turbulence model based on k and omega, see [1]). Also computations by the NASA show a very good behavior of the kOmegaSST turbulence model applied on very fine grids without the use of wallfunctions.

To further investigate the uncommon behavior of the kOmegaSST model in OpenFOAM I tried to reproduce the aforementioned NASA flat plate test case. I used three different grids for this case:
• Coarse Grid: 70x50 cells, max. y+ = 1.80
• Medium Grid: 140x100 cells, max. y+ = 1.05
• Fine Grid: 280x200 cells, max. y+ = 0.62
The boundary conditions and dimensions of the domain were the same as the ones in the NASA computations. On the wall I used for the turbulent quantities:
• k: fixedValue 0
• omega: omegaWallFunction
• nut: fixedValue 0
All computations were accomplished with a 2nd order convection scheme (SFCD) on all divergence terms.

The results for the skin friction coefficient can be seen in the first attachement. As already discovered by the member cboss in the thread http://www.cfd-online.com/Forums/ope...lat-plate.html , the grid independent solution for the skin friction coefficient (when using grids with a wall y+ of the order of 1) seems to be too high.

This made me look deeper into the source code of kOmegaSST and I found the problem: The magnitude of the strain rate tensor is defined as

[2]

In OpenFOAM the function mag() calculates the magnitude of the strain rate tensor differently:

(see programmer's guide)

So the difference between these two methods is a factor of .

In the production term G for the k equation of the kOmegaSST model in OpenFOAM this discrepancy is being considered by setting

Code:

    volScalarField S2 = magSqr(symm(fvc::grad(U_)));     volScalarField G("RASModel::G", nut_*2*S2);
As you can see, the factor 2 has been introduced to account for the missing factor of . However, in the definition of nut, namely

[3],

this factor is missing in turbulenceModels/incompressible/RAS/kOmegaSST.C, lines 240 and 392:

Code:

nut_ = a1_*k_/max(a1_*omega_, F2()*mag(symm(fvc::grad(U_))));
Code:

nut_ = a1_*k_/max(a1_*omega_, F2()*sqrt(S2));
This results in too high values for the turbulent viscosity in regions, where is greater than and explains the observed overprediction of the skin friction coefficient.

The correct calculation of nut requires the intruduction of the missing factor , to be consistent with OpenFOAM's calculation of the strain rate tensor magnitude:

Code:

nut_ = a1_*k_/max(a1_*omega_,  F2()*sqrt(scalar(2))*mag(symm(fvc::grad(U_))));
Code:

nut_ =  a1_*k_/max(a1_*omega_, F2()*sqrt(scalar(2)*S2));
With this correction I redid the aforementioned simulations. In the second attachement you can see the new behaviour of the skin fiction coefficient as the grid is systematically refined. As expected, the values are lower than before and the grid independent solution seems to be closer to the reference data.

In the third attachement the wall-normal distribution of the dimensionless eddy viscosity for the original and the corrected kOmegaSST implementation can be seen at the location of x=0.97m. The original model clearly overpredicted the eddy viscosity at y>0.005m, while the corrected calculation of nut now yields results more closely to the reference data of the NASA calculations.

So far I've only tested the incompressible version of the kOmegaSST model. I am not entirely sure if the same problem exists with the compressible kOmegaSST implementation - the source code looks a bit different, I have to take a deeper look at it some time.

I hope, this little correction resolves the issues encountered when applying the kOmegaSST model to very fine meshes, fully releasing the power of OpenFOAM's new blended wall functions, making the kOmegaSST turbulence model applicable to a wider range of y+ values.

Greetings,
Felix.

[1] WILCOX, David C.: "Turbulence Modeling for CFD", 3rd Edition, p. 178
[2] http://turbmodels.larc.nasa.gov/sst.html
[3] http://cfd.mace.manchester.ac.uk/flo...-SST-paper.pdf

 FelixL November 1, 2010 09:06

5 Attachment(s)
Sorry about the transparent background of the attached PNG images. Here are the images with a white background.

 Peter85 November 5, 2010 04:46

Hey! I found another post concerning this (#4 onwards):
http://www.cfd-online.com/Forums/ope...komegasst.html

It is not a mistake in the implementation, the programmer just used another paper as reference

 FelixL November 11, 2010 13:58

Hey, Peter,

I searched through different Papers regarding the Menter SST turbulence model and couldn't find another definition of S other than there. Are you sure about that special paper with another definition of nut? It truely puzzles me, why just this definition was used in the implementation for OpenFOAM, when Menter's original definition of the stress limiter in the nut equation (like I stated above) leads to much better results (at least for wall bounded flows)?

Greetings,
Felix

 Peter85 November 14, 2010 16:58

Hi Felix,

unfortunately, I don't have the paper, so I can't tell you if the implemented model is consistent with the paper. You can find the name of the paper within the headerfile of the SST-code:
Menter, F., Esch, T.
"Elements of Industrial Heat Transfer Prediction"
16th Brazilian Congress of Mechanical Engineering (COBEM),
Nov. 2001
If you have a look on the topic I posted above, you will get more information, they were discussing the same problem, beginning with post number 4. For further information I suggest contacting Henry, the person who implemented the SST-model. He answered a lot of questions about this model in the topic posted above.

Peter

 juho November 15, 2010 05:08

Hi Peter and Felix,

It seems that the issue has been corrected in the 1.7.x version last thursday.

Commit: https://github.com/OpenCFD/OpenFOAM-...f7a0b26d64265d

 jms February 8, 2011 09:07

Dear Felix,

I am running OpenFOAM 1.7.1 and I would like to include this change you mention on the first message of this thread in order to improve the drag coefficient calculation. But, to be honest I don´t know how to do it (I am running it from a cluster where I don´t have the permission of modifying files, so I should do my own solver by copy-pasting files and recompiling). Could you explain me how? Or maybe there ir any other thread where this is explained...

Regards,

José

 makaveli_lcf February 8, 2011 09:10

José

it is fixed in 1.7.1 (read last post)

 jms February 8, 2011 10:17

Hello!

I checked on the file kOmegaSST.C in the cluster whre I am working it was not fixed there... :S.

 FelixL February 8, 2011 11:02

Hello, José,

the kOmegaSST turbulence model was fixed in OF 1.7.x which is being regularly updated and realeased via git. OF 1.7.1 doesn't have the newest changes and additions that 1.7.x has.

To change kOmegaSST without actually modifying the original files you probably have to compile your own library and put it into the \$FOAM_USER_LIBBIN directory. This tutorial will help you: http://openfoamwiki.net/index.php/Si....28OF-1.4.1.29

Hint: you can use the source files of the git-repository if you like:
https://github.com/OpenCFD/OpenFOAM-.../RAS/kOmegaSST

Greetings,
Felix.

 jms February 14, 2011 11:18

Hello Felix,

I hope everything is ok. I am still working on studying flow around airfoils and I would like to apply any transition model for the boundary layer. I have read on some other threads that there is not any of these models implemented in OpenFOAM yet. is it true? or does it exist any?
If not...do you know if the transition point can be fixed somehow in OpenFOAM?

Thank you very much for your help.

Regards,

José

 FelixL February 15, 2011 06:01

Hello, José,

there currently is no possibility to simulate laminar-turbulent transition within the standard distribution of OpenFOAM. Defining trip-terms or something like that is not possible, too, since this is rather challenging on unstructured meshes.

I was working on an implementation of the gamma-ReTheta transition model developed by Langtry and Menter and it looks promising. The implementation still needs a lot of testing which I haven't found the time for lately, so it's status is currently frozen. You might be lucky and find someone else who implemented and fully verified a transitional model in OpenFOAM.

Nonetheless these non-local transition models are pretty sensitive to freestream turbulence intensities (FSTI). If you're lacking data of FSTI, the location of transition onset pretty much relies on guesswork which I am not a real big fan of, to be honest.

In a nutshell: unfortunately it's not possible to simulate transiton with OF 1.7.1. (except for DNS, of course)

Greetings,
Felix.

 ivan_cozza February 17, 2011 04:50

Quote:
 Originally Posted by FelixL (Post 295295) Hello, José, there currently is no possibility to simulate laminar-turbulent transition within the standard distribution of OpenFOAM. Defining trip-terms or something like that is not possible, too, since this is rather challenging on unstructured meshes. I was working on an implementation of the gamma-ReTheta transition model developed by Langtry and Menter and it looks promising. The implementation still needs a lot of testing which I haven't found the time for lately, so it's status is currently frozen. You might be lucky and find someone else who implemented and fully verified a transitional model in OpenFOAM. Nonetheless these non-local transition models are pretty sensitive to freestream turbulence intensities (FSTI). If you're lacking data of FSTI, the location of transition onset pretty much relies on guesswork which I am not a real big fan of, to be honest. In a nutshell: unfortunately it's not possible to simulate transiton with OF 1.7.1. (except for DNS, of course) Greetings, Felix.
Felix,
I spend a lot of time in the past in trying to simulate transitional flows over airfoils with SST, so I have some freestream turbulence data and airfoils Cf measurements that could help in developing your transitional model. If you want, you can share your pieces of code, and I can try to validate it. Maybe it could be an opportunity to have a transitional model in OF!

Ivan

 salvoblack February 23, 2011 10:36

Hello,
I am preparing my thesis on the possibility of implementing a transitional model for OF.
Also would you give to me a great help!

 jms February 23, 2011 11:35

Dear Felix and "salvoblack",

I am doing my thesis about a study of thick airfoils and based on some results obtained with CFX I need to take into account transition if I want to get good/acceptable results.

Felix, if you have something already implemented I could try to apply it on my cases and of course send you the results I would get so you could use them as part of your validation if it works. I know this is the easiest way for me and that maybe it does not sound good for you.

But, anyway, I was thinking on starting to change the k-omega SST turbulence model on Monday next week to apply this transition by fixing the transition point. So I had thought on fixing the value of nut to 0 in the values inside what it should be the laminar boundary layer. Then, I would apply some kind of smoothing between the values of nut between this laminar boundary layer and the turbulent one.
My problem here it comes, I am new in making changes in OpenFOAM´s code and I would like to ask you something. How to select these cells where I want to fix this nut to 0? (let´s say they will be from the x coordinate where the airfoil start to the one where transition begins, and for vel=0 to vel=0.99*vel_fluid). Maybe you can send me an example of such a code, because I understand that explaining it may be cumbersome.

If you don´t want to send any of these through the forum, I can always give you my e-mail.

Thank you very much for your help.

Regards,

José

 FelixL February 23, 2011 12:48

4 Attachment(s)
Hello, everybody,

I didn't expect there to be such a high demand after the transitional model I tried to implement. It's the gamma-ReTheta turbulence model based upon the k-omega SST model and two additional transport equations to predict laminar-turbulent transition.

Since transition is a highly complicated phenomena, the model strongly depends upon correlations and even minor changes can drastically change the model's predictive behaviour. I strongly recommend to you to read the dissertation of Robert Langtry ("A Correlation-Based Transition Model using Local Variables for Unstructured Parallelized CFD codes", Stuttgart University) before using my implementation. It's important to understand the physics of this turbulence model!

I only tested the model on different test cases available through the ERCOFTAC database. These cases were all flat plate test cases with zero pressure gradient and different freestream turbulence intensity levels. I attached plots of skin friction coefficient for three different cases I calculated (T3A, T3AM, T3B).

The results are okay but there seem to be problems with too high Cf-values in the laminar and turbulent regime, especially visible for the T3AM and T3B cases. While other authors had similar problems, I think there's still something wrong with my implementation or how OF handles wall shear stresses. I doublechecked everything but I came to no success and for now my time for checking the model is up.

Long story short: I will upload the code tomorrow. BUT it is unfinished and untested. I did no calculations for nonzero pressure gradient cases and I didn't simulate anything else than flat plates! Please don't expect to be more accurate with this model - it could even be that you get worse results. Please bear this warning in mind, this turbulence model is powerful but no magic bullet.

Anyway, if you stumble upon something which might improve the model's performance in OF, feel free to share your ideas.

Greetings,
Felix.

 jms February 23, 2011 14:01

Dear Felix,

I look forward to try your code! I will tell you what I will get with it!

Regards,

José

 FelixL February 24, 2011 07:52

Hello, everyone,

I posted the code in this thread:
http://www.cfd-online.com/Forums/ope...nal-flows.html

Greetings,
Felix.

 timo_IHS March 9, 2011 14:33

Hello all,

I'm running a simulation of a standard guide vane. When I use the old version of the SST-model (without this factor sqrt(2) in nut, red curve), my simulation converges very well, but the loss in total pressure is more than 10% higher than the same simulation with a commercial code (CC).

So inserting this factor like in the current version leads to a very unstable result, green curve. But this is closer to the result of the CC.

So I've found in the help of the CC or also in this newer paper (okay about SAS)
"Development and Application of SST-SAS Turbulence Model in the DESIDER Project"; Egorov, Menter; 2008
that the production term in the omega-equation is not like in OF:
Code:

gamma(F1)*2*S2
but more like:
Code:

gamma(F1)*omega_/k_*nut_2*S2
This leads to a really more stable result (blue curve), which is not too far from the result of the CC.

http://www.cfd-online.com/Forums/mem...ptot-norm.htmlhttp://www.cfd-online.com/Forums/mem...ptot-norm.htmlhttp://www.cfd-online.com/Forums/mem...ptot-norm.htmlhttp://www.cfd-online.com/Forums/mem...ptot-norm.htmlhttp://www.cfd-online.com/Forums/mem...-ptot-norm.png

But running a diffuser with this last version (with sqrt(2) and modified omega-equation) I don't get the expected separation.

Is there a switch between the "version", like depending on the pressure gradient or something like that?

Has anybody experience with this or any comments?

Cheers

 FelixL March 15, 2011 09:24

Hello, Timo,

I checked the paper and couldn't find any info about how they calculate the eddy viscosity. Do they apply the usual formula, applying a stress limiter (like in OF)?

or do they use a formulation without the application of a stress limiter term?

If it's the latter case, then both omega source term definitions in OF and your commercial code are equal.

Otherwise, this seems to me like the omega source term implementation of the Wilcox-k-omega turbulence model (see http://turbmodels.larc.nasa.gov/wilcox.html ). Since both turbulence models are related, a deviation of Menter's formulation shouldn't be too much of an issue.

When using the original implementation in OF, the omega source term is everywhere equal to . With your implementation it is additionally dependent on wall distance - viz. close to the wall (where F2=1) it is approx. , further away from the wall it is the same like in the original implementation. Maybe this behavior improves your numerical stability. I currently don't have the time to go deeper into it, sorry.

So much about the theortetical stuff... what I don't understand is what you mean by "unstable result, but closer to the result of the cc". If you have a result which is actually quite close to the results of the cc (that don't neccesarily have to be correct!) then why did you change the code? I don't understand the term unstable - unstable simulations usually lead to unphysical results or crashes.

Regarding the separation point: is this the same case or were you speaking about two different cases? Is separation better predicted when not using your modification? Couldn't this be a shortcoming of the SST model in general?

Of course does your modification alter the turbulence model's capabilities. It's still a model (amongst the two equation turbulence models one with the most closure coefficients!), so it's difficult to get it to perform nicely for every testcase.

Sorry about these pretty general answers, but I can't be more specific without more knowledge about grids, numerical schemes, fluid properties etc.

Greetings,
Felix.

All times are GMT -4. The time now is 11:13.