CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Bugs (https://www.cfd-online.com/Forums/openfoam-bugs/)
-   -   Bug in SpalartAllmaras (https://www.cfd-online.com/Forums/openfoam-bugs/62331-bug-spalartallmaras.html)

seb62 January 27, 2009 08:28

Hi all, I was working on a
 
Hi all,

I was working on a turbulent flat plate with the
Spalart Allmaras model, and the results were not fine.
So I had a look at the source code and I think there is something wrong.
The version implemented in openFOAM 1.5 is the Spalart Allmaras with fv3 function. This version
also requires to modify fv2, which is not done (the correct fv2 consistent with the use of fv3 is on the commented line) :


tmp<volscalarfield> SpalartAllmaras::fv2
(
const volScalarField& chi,
const volScalarField& fv1
) const
{
return 1.0 - chi/(1.0 + chi*fv1);
//return 1.0/pow3(scalar(1) + chi/Cv2);
}

Thus I think either the commented fv2 should be used keeping fv3 unchanged, or fv3 should be set to 1, keeping fv2 unchanged.
For testing, I did the latter, removing fv3 in the expression for Stilda, which gives the basic form of Spalart Allmaras model :

volScalarField Stilda =
sqrt(2.0)*mag(skew(fvc::grad(U_)))
+ fv2(chi, fv1)*nuTilda_/sqr(kappa_*d_);


After recompiling, the velocity profiles and local friction agree very well with theory and other CFD codes.

Seb

henry January 27, 2009 09:59

Thanks for studying this code
 
Thanks for studying this code in detail and for the bug report, yes you are correct, this is currently inconsistent. We originally implemented the standard SA model and it worked well for simple cases but when we moved to complex problems, in particular F1 cars, it proved unstable. We then implemented the "correction" from

"An Unstructured Grid Generation and Adaptive Solution Technique for High Reynolds Number Compressible Flows"
G.A. Ashford,
Ph.D. thesis, University of Michigan, 1996.

and this proved much more stable. However it looks like while switching between the models at some point the fv2 has been left inconsistent with fv3. Could you please check if you get the correct behavior with the alternative fv2 and fv3?

Thanks

H

seb62 January 27, 2009 10:25

Yes I will check with the fv3
 
Yes I will check with the fv3 version.
My test cases are however simpler than F1 cars (flat plate and backward facing step).

The fv3 version seems to be corrected for low Re flows, at least from this source :

http://turbmodels.larc.nasa.gov/spalart.html

Thanks for your comment on SA instability.

Seb

eugene January 27, 2009 10:33

The LES versions of the Spalar
 
The LES versions of the Spalart-Allmaras model do have the correct implementation and exhibit what appears to be the correct behaviour.

Eugene

henry January 27, 2009 11:00

Hi Sébastien, Thanks for th
 
Hi Sébastien,

Thanks for the interesting link, it seems they are not very happy with the fv3 term: " It was devised to prevent negative values of the source term, and is not recommended because of unusual transition behavior at low Reynolds numbers (see Spalart, P. R., AIAA 2000-2306, 2000)." but the source term going negative does happen in complex flow cases and causes nuTilda to go negative! so we need a fix of some kind. It is not clear if any of the alternative formulations are preferable, perhaps the SA-Edwards or SA-salsa are better; at least they both have a well-posed generation term.

H

elorriaux January 27, 2009 12:01

Thanks Sébastien, I was als
 
Thanks Sébastien,

I was also getting unbelievable results on a train drag computation case with SpalartAllmaras. Since the results are satisfaying with a RNGkEps model, I was also thinking to look after the SA coeffs. You found the problem before me, thanks ;)

I'll try to run the case again as soon as I have free CPU time.

Bye, Etienne.

henry January 27, 2009 16:23

I have pushed the change to fv
 
I have pushed the change to fv2 to OpenFOAM-1.5.x, please let me know if this resolves the issues with this model.

Thanks

H

egp January 27, 2009 18:26

I agree that the fv3 term need
 
I agree that the fv3 term needs to be blitzed. I did a little study of this about a year ago. Here are a couple of figures to highlight the effect of turning this term off.

http://www.cfd-online.com/OpenFOAM_D.../126/10824.gif

http://www.cfd-online.com/OpenFOAM_D.../126/10823.png

henry January 28, 2009 03:18

In these comparisons did you c
 
In these comparisons did you check that the fv2 term was set consistently for the cases with and without the fv3 term? The initial comparisons we did after introducing the fv3 term showed very similar results to the standard model but with improved stability which is why we kept it. Unfortunately at some point since then the fv2 has been set inconsistently with the fv3 term; this is now fixed in 1.5.x.

I would be more than happy to drop the fv3 term if a form of the SA model can be found which does not suffer from the stability problems related to negative production in the original model. Has anyone tested the many variants? They are pretty easy to implement and I would be happy to add the promising ones to the set of turbulence models in OpenFOAM if there is interest.

H

egp January 28, 2009 07:05

Henry, These plots were mad
 
Henry,

These plots were made doing exactly what Sebastien suggested in the original post of this thread, i.e., setting fv3 = 1, and keeping fv2 as implemented. This should give the original SA formulation.

Around the same time, I did a study of ALL of the RANS turbulence models for turbulent flat plate boundary layer, and found that most of them give poor results.

Here is a plot of some of them.
http://www.cfd-online.com/OpenFOAM_D...your_image.gif

SA with fv3=1 and LaunderSharma give pretty good results. LienCubicLowRe (including a few mods that I tested) gives horrible results. kEpsilon with wall functions is OK, as long as user is careful to avoid outer part of buffer layer (cf. y+ 30 vs. 115).

The take away points from this study were:

1. be very careful if accurate prediction of wall-shear stress (and drag) is required. SA and LaunderSharma seem to do the best. Menter's kOmegaSST (no wall functions) that was out on the wiki also does a pretty good job (has that been adopted in 1.5?).

2. just because there are models in OpenFOAM, doesn't imply that they have been validated for your problem. BUYER BEWARE....

3. OpenFOAM sorely needs adaptive wall functions which can seemlessly transition from sublayer resolution to wall-function resolution.

Eric

egp January 28, 2009 07:10

http://www.cfd-online.com/Open
 
http://www.cfd-online.com/OpenFOAM_D.../126/10832.png

egp January 28, 2009 07:11

http://www.cfd-online.com/Open
 
http://www.cfd-online.com/OpenFOAM_D...your_image.gif

henry January 28, 2009 07:16

When you ran with fv3 != 1 cou
 
When you ran with fv3 != 1 could you clarify which form of fv2 you running with?

H

egp January 28, 2009 07:16

Damn it, the image posting gre
 
Damn it, the image posting gremlins are back...

egp January 28, 2009 07:20

tmp SpalartAll
 
tmp<volscalarfield> SpalartAllmaras::fv2
(
const volScalarField& chi,
const volScalarField& fv1
) const
{
return 1.0 - chi/(1.0 + chi*fv1);
//return pow(scalar(1) + chi/Cv2, -3);
}

henry January 28, 2009 07:28

That form is correct for fv3 =
 
That form is correct for fv3 = 1 but to run with fv3 != 1 you will need to run with the second expression commented out, see the original post. If you have time to test this that would be great.

H

egp January 28, 2009 07:33

Sure, I'd be happy to test it.
 
Sure, I'd be happy to test it. I have all of the files, so it should be quick. I'll post results later today.

paulo January 28, 2009 09:24

Hi All, Maybe this is a stu
 
Hi All,

Maybe this is a stupid question, but I won't sleep today if I don't ask ;-)

I've read somewhere in this forum that the OF solvers (simpleFoam in particular) only have turbulence models with wall functions.

Is it true, i.e., my solution must have y+ about 30, or can I have smaller values with the viscous sublayer modeled?

Thanks in advance,

Paulo Rocha

seb62 January 28, 2009 09:57

I ran simulations for the fv3
 
I ran simulations for the fv3 version of SA, on 3 flat plate meshes (y+ around 0.2 ; 1 and 25). Reynolds number at the end of the plate is 4.10^6. There is hardly no difference compared to the basic version, except that close to the inlet, the local friction goes to a minimum before rising and going close the theoretical curve. With the basic version, the local friction keeps on decreasing, as the theoretical one does.

By the way, Etienne, as you say the RNG k epsilon gives good results, could you tell me which type of mesh you use at the walls (fine or wall-function type mesh)?

Thanks

Seb

henry January 28, 2009 10:00

Not true, there are several lo
 
Not true, there are several low-Re turbulence models included in OpenFOAM:

LamBremhorstKE
LaunderSharmaKE
LienCubicKELowRe
LienLeschzinerLowRe
SpalartAllmaras

all of which will run without wall-functions. With SpalartAllmaras wall-functions are optional and should be used where the mesh is not fine enough to resolve the boundary-layer.

H

henry January 28, 2009 10:23

Hi Sébastien, Thanks for te
 
Hi Sébastien,

Thanks for testing the two variants. For general use we will keep the version with fv3 but if there is interest we could add a switch to allow users to run the standard form or we could derive the version with fv3 from the standard form so that either would be run-time selectable.

Do you have an interest in any of the other SA variants?

H

paulo January 28, 2009 11:39

Thanks a lot Henry for the inf
 
Thanks a lot Henry for the info,

This means that I can switch wall functions on / off only changing the boundary type ?

Thanks again,

Best regards,

Paulo Rocha

henry January 28, 2009 13:10

With SpalartAllmaras yes wall-
 
With SpalartAllmaras yes wall-functions are selected as boundary conditions on nut. The other low-Re models do not use wall-functions, optionally or otherwise.

H

paulo January 28, 2009 15:05

Thank you very much Henry.
 
Thank you very much Henry.

Paulo Rocha.

paulo January 28, 2009 15:09

Thank you very much Henry.
 
Thank you very much Henry.

Paulo Rocha.

egp January 28, 2009 22:00

Here is a comparison of 3 case
 
Here is a comparison of 3 cases for a flat plate at Re = 1e6 with sublayer resolution.

Case 1: fv3 != 1, fv2=1.0 - chi/(1.0 + chi*fv1), incorrect, but current distro.
Case 2: fv3 = 1, fv2=1.0 - chi/(1.0 + chi*fv1), baseline SA
Case 3: fv3 != 1, fv2=1.0/pow3(scalar(1) + chi/Cv2_), NASA LaRC fv3 formulation

I would vote for baseline SA as standard implementation in OF. If you read http://turbmodels.larc.nasa.gov/spalart.html, you will see that the fv3 model is not recommended.


http://www.cfd-online.com/OpenFOAM_D...your_image.gif

http://www.cfd-online.com/OpenFOAM_D...your_image.gif

egp January 28, 2009 22:11

http://www.cfd-online.com/Open
 
http://www.cfd-online.com/OpenFOAM_D.../126/10846.png
http://www.cfd-online.com/OpenFOAM_D.../126/10847.png

seb62 January 29, 2009 03:03

Hi Henry, I should say that
 
Hi Henry,

I should say that I am working in industry
and for the moment we are testing openFOAM
on various flows. So we haven't yet studied in details which SA we would like to have, but
talking briefly with some collegues, the SA
with Edwards correction and rotation/curvature correction seem interesting.

Seb

seb62 January 29, 2009 03:07

Hi Henry, I should say that
 
Hi Henry,

I should say that I am working in industry
and for the moment we are testing openFOAM
on various flows. So we haven't yet studied in details which SA we would like to have, but
talking briefly with some collegues, the SA
with Edwards correction and rotation/curvature correction seem interesting.

Seb

henry January 29, 2009 03:20

Hi Eric, Thanks for the com
 
Hi Eric,

Thanks for the comparison, it confirms what we suspected that with the correct fv2 the fv3 term behaves satisfactorally.

> I would vote for baseline SA as standard implementation in OF. If you read
> http://turbmodels.larc.nasa.gov/spalart.html, you will see that the fv3 model is not recommended.

Not recommended but necessary for stability for complex flows as I have explained in this thread. What I would like to know is what is the "recommended" variant which solved the problem of negative generation?

Hi Sébastien,

I also think that the Edwards variant is interesting. It seems more natural to me that the turbulence production should be based on shear rather than rotation. Perhaps we should give this one a go.

H

wei_wu February 11, 2010 11:30

Hello, Mr Weller
I'm using the Spalart-Allmaras model with roughness wall functions to calculate the wall roughness problem. Do you know what roughness wall functions are they using and what is the source paper?

Thanks

Wei



Quote:

Originally Posted by henry (Post 208700)
Not true, there are several low-Re turbulence models included in OpenFOAM:

LamBremhorstKE
LaunderSharmaKE
LienCubicKELowRe
LienLeschzinerLowRe
SpalartAllmaras

all of which will run without wall-functions. With SpalartAllmaras wall-functions are optional and should be used where the mesh is not fine enough to resolve the boundary-layer.

H


charlie February 16, 2010 16:47

Quote:

Originally Posted by henry (Post 208685)
Hi Sébastien,

Thanks for the interesting link, it seems they are not very happy with the fv3 term: " It was devised to prevent negative values of the source term, and is not recommended because of unusual transition behavior at low Reynolds numbers (see Spalart, P. R., AIAA 2000-2306, 2000)." but the source term going negative does happen in complex flow cases and causes nuTilda to go negative! so we need a fix of some kind. It is not clear if any of the alternative formulations are preferable, perhaps the SA-Edwards or SA-salsa are better; at least they both have a well-posed generation term.

H

Dear Dr. Weller, dear all,

Thanks for this interesting and important discussion. I brushed with this issue recently, when implementing the original SA formulation in our in-house solver: I found the same stability problem in very specific regions of the flow in a "slightly complex" test case. I contacted the model authors and they recommended some additional limiters to prevent Stilde from reaching zero or going negative, which fixes this problem. The limiter we implemented is:

chi >= 1E-03
sTilde >= 1E-05*U_ref/L_ref

(we have a user-defined reference length and velocity, however it is simply important to make sure sTilde doesn't reach zero).

After that discussion, the LaRC web page you have cited was updated with a one-line note at the end of the original SA model description.

I wouldn't recommend the SA-Edwards model, as contrary to the authors' intention, it doesn't give the same results as the original model (rather, significantly reduced skin friction).

My hope is that by implementing the original SA with these limiters, you will be able to keep the model to a single, all-purpose variant that corresponds to the "industry standard".

Best regards,

Charlie.

henry February 17, 2010 04:55

I am not a big fan of clipping; I would prefer an approach where the formulation of the terms naturally obey the physical constraints. Do you have results that show that the original formulation with the clipping is better than the "Ashford" correction we currently use and distribute with OpenFOAM?

H

charlie February 17, 2010 11:37

Dear Henry,

I understand and share your concern - these things are certainly "not nice". However, in this case I was happy with the modification, for the following reasons:
  • It does not give rise to discontinuities in the converged solution (i.e. sTilde remains above zero everywhere), rather simply prevents a stable but spurious branch in the system of model equations.
  • It is "sanctioned" by the model authors and standard in the implementation of the original S-A model in many solvers, including the NASA solvers.

Now to your question:
Do you have results that show that the original formulation with the clipping is better than the "Ashford" correction we currently use and distribute with OpenFOAM?

I'm not familiar with the "Ashford" correction and didn't manage to find the PhD thesis easily, but assume this refers to the f_v3 modification. The f_v3 was by the way proposed by Spalart as an attempt to fix the problem of negative sTilde without clipping. I don't have results to show that the original+clipping is better than f_v3, since I haven't tried f_v3. All I have are citations that discourage the use of f_v3, for example Spalart writes in "Trends in Turbulence Treatments" (AIAA 2000-2306):

"...the f_v3 function, which we have recommended privately to some users. The f_v3 formula has an odd effect on transition at low Reynolds numbers, which we never fully understood. It was devised to prevent negative values of sTilde. We now recommend, instead, taking for sTilde the larger of the original f_v1 definition and 0.3 x S."

So, in summary, I just have "hearsay" and no concrete results of my own to say that one is better than the other. However, reputable and authoritative sources discourage the use of the unpublished f_v3. I would therefore personally be happier to see the original model with clipping as the standard OpenFOAM implementation. However, due to the source code acces it would of course be no problem for me to implement my preferred version should you decide to go for f_v3! :)

I hope this information is useful.

Best regards,

Charlie.

impecca November 6, 2010 17:47

Hi, I am following up LES version of Spalart-allmaras and have some questions.

Why fv3 is (which is from V1.7) ?

00067 tmp<volScalarField> SpalartAllmaras::fv3() const
00068 {
00069 volScalarField chi = nuTilda_/nu();
00070 volScalarField chiByCv2 = (1/Cv2_)*chi;
00071
00072 return
00073 (scalar(1) + chi*fv1())
00074 *(1/Cv2_)
00075 *(3*(scalar(1) + chiByCv2) + sqr(chiByCv2))
00076 /pow3(scalar(1) + chiByCv2);
00077 }


rather than

fv3 = (1 + chi*fv1)*(1-fv2)/chi;

which is from SA-fv3 (http://turbmodels.larc.nasa.gov/spalart.html )

If this is because 'negative source' term which Henry mentioned on this thread, is there any reference for the current version?


Thanks

Yusik

boger December 1, 2010 13:59

This appears to be an issue again in 1.6-ext. In particular, 1.6-ext has fv2 = 1.0 - chi/(1.0 + chi*fv1), but also has fv3 != 0, which is the "Case 1" combination in Eric's earlier post that produces incorrect results.

It looks like the fv2 term was changed recently to move away from the "SA-fv3" model, but in that case, fv3 needs to be removed from the calculation of Stilda as well.

vkrastev February 1, 2011 11:26

In OF-1.6 the SA implementation is the so called SA-fv3 one, with fv2 consistent with the presence of fv3...This means that using this kind of implementation my calculations should be stable, but after reading all the replies in this tread still I don't understand if they should be also reliable...ok for the stability of the SA-fv3 model in complex cases, but what about the accuracy? However, I have also another question about the SA model usage: I've had a look into the source code for the nutSpalartAllmarasWallFunction and the nutSpalartAllmarasStandardWallFunction....Well, the latter is consistent with the nutWallFunction used in other RANS turbulence models, but the former seems to me quite obscure: can someone give me a brief explanation of what exactly it does? And, finally, does the SA model require to set nutSpalartAllmarasWallFunction for low-Re calculations? If it so, is this wall function suitable also for coarser grids or should it be replaced by nutSpalartAllmarasStandardWallFunction in such cases?

Thank you in advance for any opinion and/or suggestion

V.

boger February 1, 2011 12:02

I can't answer all of your questions, but I can tell you that nutSpalartAllmarasWallFunction is finding the friction velocity by solving Spalding's law of the wall, which is a non-linear equation for the law-of-the-wall that is valid from the wall out through the logarithmic region. The only place I could quickly find it written is in Eq 59 of this link.

vkrastev February 1, 2011 12:21

Quote:

Originally Posted by boger (Post 293125)
I can't answer all of your questions, but I can tell you that nutSpalartAllmarasWallFunction is finding the friction velocity by solving Spalding's law of the wall, which is a non-linear equation for the law-of-the-wall that is valid from the wall out through the logarithmic region. The only place I could quickly find it written is in Eq 59 of this link.

Ok, so if I understand properly from the reference this is simply a more general form of wall function (compared with the standard one), wich gives a continuos solution for the friction velocity also in the buffer layer: this solution is then used to enforce a proper value for nut in the first computational node, right? In practice, this wall function could be (in principle) applied also to other RANS models, but if so I'm wondering why the OF programmers have decided to call it "SpalartAllmarasWallFunction"...However, thanks a lot, your link and reply were really helpful!

Best Regards

V.

0.1 watts May 30, 2012 14:25

Quote:

Originally Posted by impecca (Post 282477)
Hi, I am following up LES version of Spalart-allmaras and have some questions.

Why fv3 is (which is from V1.7) ?

Code:

00067 tmp<volScalarField> SpalartAllmaras::fv3() const
00068 {
00069    volScalarField chi = nuTilda_/nu();
00070    volScalarField chiByCv2 = (1/Cv2_)*chi;
00071
00072    return
00073        (scalar(1) + chi*fv1())
00074        *(1/Cv2_)
00075        *(3*(scalar(1) + chiByCv2) + sqr(chiByCv2))
00076        /pow3(scalar(1) + chiByCv2);
00077 }

rather than

fv3 = (1 + chi*fv1)*(1-fv2)/chi;

which is from SA-fv3 (http://turbmodels.larc.nasa.gov/spalart.html )

If this is because 'negative source' term which Henry mentioned on this thread, is there any reference for the current version?


Thanks

Yusik

This calculation of fv3 is still present in 2.1 and 2.0.1 in both the DES and RANS formulations (and by extension the DDES model too). I believe it must produce different results to the NASA description.

Is this term perhaps referenced to Ashford's thesis? I can't access it so I would be grateful if anyone can confirm whether it came from his thesis, or if not where it came from (or whether it is a bug).

EDIT: From looking at open access papers that do cite his thesis, I see that the fv3 term is the same as the NASA description but different to what's in the OF source code, so I suspect it doesn't come from Ashford.


All times are GMT -4. The time now is 22:12.