CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   yPlusLES: compressible flow (https://www.cfd-online.com/Forums/openfoam-post-processing/117857-yplusles-compressible-flow.html)

openfoammaofnepo February 2, 2014 07:18

Yes, thanks. Strongly support your jobs!!

wyldckat February 2, 2014 12:20

Quick note: I've adapted the official bug fix to my repository, but there is a somewhat small discrepancy in the results achieved with the function object versus my custom utility.
The reason is likely because I'm using the "rho" from the thermodynamic model, while the function object is using the one from the turbulence model.

I have not yet changed this, because it's a bit complicated to do so. There is an issue open for fixing this, so for anyone reading this, feel free to contribute: https://github.com/wyldckat/yPlusLES...sible/issues/1

openfoammaofnepo April 10, 2014 09:15

Just comment here:

In openfoam, to correctly predict the y+, we need the the velocity gradient at the wall snGrad. Actually, this is just just a difference using the deltaCoeff and velocity difference, so in LES, if the first cell is very far from the wall, the y+ that OF give will not be very accurate.

This is my personal understanding, Please comment as well if what I am saying is not reasonable.

OFFO

Quote:

Originally Posted by wyldckat (Post 471818)
Hi openfoammaofnepo,

OK, let's see how I can manage LaTeX equations here on the forum... based on these wiki pages:
The fully extended equation is: y^+ \equiv y \, \frac{\sqrt{\frac{\mu \left(\frac{\partial u}{\partial y} \right)_{y=0}}{\rho}}}{\frac{\mu}{\rho}}

In contrast, the equation present on the utility is this (if I'm not mistaken): y^+ \equiv y \, \frac {\sqrt{ \mu_{Eff} \, \|{\frac{\partial u}{\partial y}}\| } } {\mu}

:) Yes, you are correct!!! It's missing a \rho inside the square root! Feel free to report this at the official bug tracker: http://www.openfoam.org/bugs/ - since this problem is present in the original code of the function object "yPlusLES".

If you don't want to report this yourself, I can report this for you.

Best regards,
Bruno


wyldckat April 10, 2014 16:03

Hi OFFO,

Quote:

Originally Posted by openfoammaofnepo (Post 485226)
In openfoam, to correctly predict the y+, we need the the velocity gradient at the wall snGrad. Actually, this is just just a difference using the deltaCoeff and velocity difference, so in LES, if the first cell is very far from the wall, the y+ that OF give will not be very accurate.

Technically, the first cell is never far away from the wall, as it is glued to the wall :D. But that cell might be very large and its centre might be very far away from the wall. ;)
The thing is that if the cell centre is very far away, then the y+ value will probably be very large as well, which would make it a bit redundant to know if the y+ is 1002 or 1100, since... well, it's clearly still in the region where we can use the wall function. And in such a case, it probably means that your mesh needs some fine tuning.

But there are a few other problems associated with this:
  • If the wall function does need y+ for the model calculation, then it might overestimate or underestimate the expectable turbulence values near the wall.
  • If the cell is distorted and it's centre isn't aligned with the normal of the wall, then the y+ might range from "not very accurate" to "very wrong".
Sometime ago there was a bug report/discussion regarding the wall distance calculation... actually, there are two:
edit: my guess is that those bug reports won't be closed, unless there is explicit sponsorship for those fixes to be implemented.

Best regards,
Bruno

openfoammaofnepo April 11, 2014 05:36

Thank you for your comments.

For wall function in RANS for mut (mutUWallFunction):
Since log law will be used for the first cell near the wall, then we must make that y lie in the log-law region (y+>30);

For wall function in LES for muSsgs (USpaldingWallFunction):
Since this wall law is semi-emperical formula to fit the linear law and log law, so this law can be used in whole inner turbulent boundary layer, i.e. viscous sublayer, buffer layer and log law regions. So for this case, y+ is only reqiured to lie in inner layer, instead of only log law.

About the way to calculate the y+, actually, in the implementations for MutUWallFunction
Code:

OpenFOAM-2.1.x / src / turbulenceModels / compressible / RAS / derivedFvPatchFields / wallFunctions / mutWallFunctions / mutUWallFunction / mutUWallFunctionFvPatchScalarField.C
, we have another form:

Code:

tmp<scalarField> mutUWallFunctionFvPatchScalarField::calcYPlus
(
    const scalarField& magUp
) const
{
    const label patchI = patch().index();

    const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
    const scalarField& y = rasModel.y()[patchI];
    const fvPatchScalarField& rhow = rasModel.rho().boundaryField()[patchI];
    const fvPatchScalarField& muw = rasModel.mu().boundaryField()[patchI];

    tmp<scalarField> tyPlus(new scalarField(patch().size(), 0.0));
    scalarField& yPlus = tyPlus();

    forAll(yPlus, faceI)
    {
        scalar kappaRe = kappa_*magUp[faceI]*y[faceI]/(muw[faceI]/rhow[faceI]);

        scalar yp = yPlusLam_;
        scalar ryPlusLam = 1.0/yp;

        int iter = 0;
        scalar yPlusLast = 0.0;

        do
        {
            yPlusLast = yp;
            yp = (kappaRe + yp)/(1.0 + log(E_*yp));

        } while (mag(ryPlusLam*(yp - yPlusLast)) > 0.01 && ++iter < 10);

        yPlus[faceI] = max(0.0, yp);
    }

    return tyPlus;
}

This approach is based on the log law and y+ is iteratively predicted from that law.

OFFO

Quote:

Originally Posted by wyldckat (Post 485318)
Hi OFFO,


Technically, the first cell is never far away from the wall, as it is glued to the wall :D. But that cell might be very large and its centre might be very far away from the wall. ;)
The thing is that if the cell centre is very far away, then the y+ value will probably be very large as well, which would make it a bit redundant to know if the y+ is 1002 or 1100, since... well, it's clearly still in the region where we can use the wall function. And in such a case, it probably means that your mesh needs some fine tuning.

But there are a few other problems associated with this:
  • If the wall function does need y+ for the model calculation, then it might overestimate or underestimate the expectable turbulence values near the wall.
  • If the cell is distorted and it's centre isn't aligned with the normal of the wall, then the y+ might range from "not very accurate" to "very wrong".
Sometime ago there was a bug report/discussion regarding the wall distance calculation... actually, there are two:
edit: my guess is that those bug reports won't be closed, unless there is explicit sponsorship for those fixes to be implemented.

Best regards,
Bruno


wyldckat April 11, 2014 17:32

Hi OFFO,

Problem is that most (if not all) implementations will require the distance of the centre of the cell (or at least I think it is) to be accurate enough, otherwise all y+ calculations will be too different from the "real" values.

I took a quick look at where y+ was used in the source code:
  • Many of the "Mut" and "Nut" fields for the wall functions depend on y+.
  • There are several other situations where y+ is also used, mostly related to turbulence modelling.
I guess that the 2 bug reports I mention in the previous post are referring to exactly this issue you're mentioning, namely that a non-accurate calculation of y will lead to non-accurate y+ and therefore affect the turbulence models. And as I wrote before, it's unlikely that this issue will be fixed without a support contract being hired from them. Which makes sense, since this requires a lot of validation tests and performance assessments.


With some effort, it's possible to adapt the code made available on the second bug report: http://www.openfoam.org/mantisbt/view.php?id=968 - the idea would be to copy-paste-rename the turbulence models you want to use and modify them to use this new wall distance calculation, instead of the standard one.

Best regards,
Bruno

openfoammaofnepo April 11, 2014 17:43

What you said is correct. The discussion with you always make me learn lots of knowledge about Openfoam. Thank you.

OFFO

pratik30 March 19, 2015 11:15

Hello
This post has been a great help for me.I am currently working in of version 2.3.0.I tried to calculate y+ for compressible flow but it is still asking for nuSgs file.

I tried the method mentioned above of compiling the yPlusCompreesibleWLES file with wmake however i got the error message:

Code:

Making dependency list for source file yPlusLESCompressible.C
SOURCE=yPlusLESCompressible.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam230/src/meshTools/lnInclude -I/opt/openfoam230/src/turbulenceModels -I/opt/openfoam230/src/turbulenceModels/LES/LESdeltas/lnInclude -I/opt/openfoam230/src/thermophysicalModels/basic/lnInclude -I/opt/openfoam230/src/transportModels -I/opt/openfoam230/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam230/src/OpenFOAM/lnInclude -I/opt/openfoam230/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/yPlusLESCompressible.o
yPlusLESCompressible.C: In function ‘void calcIncompressibleYPlus(const Foam::fvMesh&, const Foam::Time&, const volVectorField&, Foam::volScalarField&)’:
yPlusLESCompressible.C:60:22: error: ‘sgsModel’ was not declared in this scope
 volScalarField nuEff(sgsModel->nuEff());
                      ^
yPlusLESCompressible.C: In function ‘void calcCompressibleYPlus(const Foam::fvMesh&, const Foam::Time&, const volVectorField&, Foam::volScalarField&)’:
yPlusLESCompressible.C:126:1: error: no matching function for call to ‘Foam::compressible::LESModel::New(Foam::volScalarField&, const volVectorField&, Foam::surfaceScalarField&, Foam::basicThermo&)’
 )
 ^
yPlusLESCompressible.C:126:1: note: candidate is:
In file included from yPlusLESCompressible.C:40:0:
/opt/openfoam230/src/turbulenceModels/compressible/LES/LESModel/LESModel.H:150:34: note: static Foam::autoPtr<Foam::compressible::LESModel> Foam::compressible::LESModel::New(const volScalarField&, const volVectorField&, const surfaceScalarField&, const Foam::fluidThermo&, const Foam::word&)
        static autoPtr<LESModel> New
                                  ^
/opt/openfoam230/src/turbulenceModels/compressible/LES/LESModel/LESModel.H:150:34: note:  no known conversion for argument 4 from ‘Foam::basicThermo’ to ‘const Foam::fluidThermo&’
make: *** [Make/linux64GccDPOpt/yPlusLESCompressible.o] Error 1
pratik@ubuntu:~/OpenFOAM/yPlusLESCompressible$ wclean
pratik@ubuntu:~/OpenFOAM/yPlusLESCompressible$ wmake
Making dependency list for source file yPlusLESCompressible.C
SOURCE=yPlusLESCompressible.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam230/src/meshTools/lnInclude -I/opt/openfoam230/src/turbulenceModels -I/opt/openfoam230/src/turbulenceModels/LES/LESdeltas/lnInclude -I/opt/openfoam230/src/thermophysicalModels/basic/lnInclude -I/opt/openfoam230/src/transportModels -I/opt/openfoam230/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam230/src/OpenFOAM/lnInclude -I/opt/openfoam230/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/yPlusLESCompressible.o
yPlusLESCompressible.C: In function ‘void calcIncompressibleYPlus(const Foam::fvMesh&, const Foam::Time&, const volVectorField&, Foam::volScalarField&)’:
yPlusLESCompressible.C:60:22: error: ‘sgsModel’ was not declared in this scope
 volScalarField nuEff(sgsModel->nuEff());
                      ^
yPlusLESCompressible.C: In function ‘void calcCompressibleYPlus(const Foam::fvMesh&, const Foam::Time&, const volVectorField&, Foam::volScalarField&)’:
yPlusLESCompressible.C:126:1: error: no matching function for call to ‘Foam::compressible::LESModel::New(Foam::volScalarField&, const volVectorField&, Foam::surfaceScalarField&, Foam::basicThermo&)’
 )
 ^
yPlusLESCompressible.C:126:1: note: candidate is:
In file included from yPlusLESCompressible.C:40:0:
/opt/openfoam230/src/turbulenceModels/compressible/LES/LESModel/LESModel.H:150:34: note: static Foam::autoPtr<Foam::compressible::LESModel> Foam::compressible::LESModel::New(const volScalarField&, const volVectorField&, const surfaceScalarField&, const Foam::fluidThermo&, const Foam::word&)
        static autoPtr<LESModel> New
                                  ^
/opt/openfoam230/src/turbulenceModels/compressible/LES/LESModel/LESModel.H:150:34: note:  no known conversion for argument 4 from ‘Foam::basicThermo’ to ‘const Foam::fluidThermo&’
make: *** [Make/linux64GccDPOpt/yPlusLESCompressible.o] Error 1

Is there a zip file available for openfoam version 2.3.0?
Kindly help me to resolve the same

Pratik

openfoammaofnepo March 21, 2015 15:47

Does it mean that the versions of y+ utility and your openfoam used are not compatiable with each other?


Quote:

Originally Posted by pratik30 (Post 537217)
Hello
This post has been a great help for me.I am currently working in of version 2.3.0.I tried to calculate y+ for compressible flow but it is still asking for nuSgs file.

I tried the method mentioned above of compiling the yPlusCompreesibleWLES file with wmake however i got the error message:

Code:

Making dependency list for source file yPlusLESCompressible.C
SOURCE=yPlusLESCompressible.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam230/src/meshTools/lnInclude -I/opt/openfoam230/src/turbulenceModels -I/opt/openfoam230/src/turbulenceModels/LES/LESdeltas/lnInclude -I/opt/openfoam230/src/thermophysicalModels/basic/lnInclude -I/opt/openfoam230/src/transportModels -I/opt/openfoam230/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam230/src/OpenFOAM/lnInclude -I/opt/openfoam230/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/yPlusLESCompressible.o
yPlusLESCompressible.C: In function ‘void calcIncompressibleYPlus(const Foam::fvMesh&, const Foam::Time&, const volVectorField&, Foam::volScalarField&)’:
yPlusLESCompressible.C:60:22: error: ‘sgsModel’ was not declared in this scope
 volScalarField nuEff(sgsModel->nuEff());
                      ^
yPlusLESCompressible.C: In function ‘void calcCompressibleYPlus(const Foam::fvMesh&, const Foam::Time&, const volVectorField&, Foam::volScalarField&)’:
yPlusLESCompressible.C:126:1: error: no matching function for call to ‘Foam::compressible::LESModel::New(Foam::volScalarField&, const volVectorField&, Foam::surfaceScalarField&, Foam::basicThermo&)’
 )
 ^
yPlusLESCompressible.C:126:1: note: candidate is:
In file included from yPlusLESCompressible.C:40:0:
/opt/openfoam230/src/turbulenceModels/compressible/LES/LESModel/LESModel.H:150:34: note: static Foam::autoPtr<Foam::compressible::LESModel> Foam::compressible::LESModel::New(const volScalarField&, const volVectorField&, const surfaceScalarField&, const Foam::fluidThermo&, const Foam::word&)
        static autoPtr<LESModel> New
                                  ^
/opt/openfoam230/src/turbulenceModels/compressible/LES/LESModel/LESModel.H:150:34: note:  no known conversion for argument 4 from ‘Foam::basicThermo’ to ‘const Foam::fluidThermo&’
make: *** [Make/linux64GccDPOpt/yPlusLESCompressible.o] Error 1
pratik@ubuntu:~/OpenFOAM/yPlusLESCompressible$ wclean
pratik@ubuntu:~/OpenFOAM/yPlusLESCompressible$ wmake
Making dependency list for source file yPlusLESCompressible.C
SOURCE=yPlusLESCompressible.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam230/src/meshTools/lnInclude -I/opt/openfoam230/src/turbulenceModels -I/opt/openfoam230/src/turbulenceModels/LES/LESdeltas/lnInclude -I/opt/openfoam230/src/thermophysicalModels/basic/lnInclude -I/opt/openfoam230/src/transportModels -I/opt/openfoam230/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam230/src/OpenFOAM/lnInclude -I/opt/openfoam230/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/yPlusLESCompressible.o
yPlusLESCompressible.C: In function ‘void calcIncompressibleYPlus(const Foam::fvMesh&, const Foam::Time&, const volVectorField&, Foam::volScalarField&)’:
yPlusLESCompressible.C:60:22: error: ‘sgsModel’ was not declared in this scope
 volScalarField nuEff(sgsModel->nuEff());
                      ^
yPlusLESCompressible.C: In function ‘void calcCompressibleYPlus(const Foam::fvMesh&, const Foam::Time&, const volVectorField&, Foam::volScalarField&)’:
yPlusLESCompressible.C:126:1: error: no matching function for call to ‘Foam::compressible::LESModel::New(Foam::volScalarField&, const volVectorField&, Foam::surfaceScalarField&, Foam::basicThermo&)’
 )
 ^
yPlusLESCompressible.C:126:1: note: candidate is:
In file included from yPlusLESCompressible.C:40:0:
/opt/openfoam230/src/turbulenceModels/compressible/LES/LESModel/LESModel.H:150:34: note: static Foam::autoPtr<Foam::compressible::LESModel> Foam::compressible::LESModel::New(const volScalarField&, const volVectorField&, const surfaceScalarField&, const Foam::fluidThermo&, const Foam::word&)
        static autoPtr<LESModel> New
                                  ^
/opt/openfoam230/src/turbulenceModels/compressible/LES/LESModel/LESModel.H:150:34: note:  no known conversion for argument 4 from ‘Foam::basicThermo’ to ‘const Foam::fluidThermo&’
make: *** [Make/linux64GccDPOpt/yPlusLESCompressible.o] Error 1

Is there a zip file available for openfoam version 2.3.0?
Kindly help me to resolve the same

Pratik


pratik30 March 21, 2015 23:11

Thank you for your reply
I tried to follow the instructions given in the site to calculate yPlusLES for compressible flows: https://github.com/wyldckat/yPlusLES...ble/tree/of21x
However I got the error message mentioned in my earlier post when i used wmake. My OpenFoam version is 2.3.0 and i guess the file is not compatible with the version i use.

Pratik

wyldckat March 22, 2015 06:36

Greetings to all!

@Pratik: I've updated the instructions: https://github.com/wyldckat/yPlusLES...swcompressible

Best regards,
Bruno

pratik30 March 24, 2015 12:56

Quote:

Originally Posted by wyldckat (Post 537690)
Greetings to all!

@Pratik: I've updated the instructions: https://github.com/wyldckat/yPlusLES...swcompressible

Best regards,
Bruno

Thank you @Bruno, it Works.

openfoammaofnepo March 24, 2015 12:58

We have made a bug report to openfoam. Is this updated in the latest version of yPlus, like in your version?

Quote:

Originally Posted by pratik30 (Post 538028)
Thank you @Bruno, it Works.


pratik30 March 24, 2015 13:23

yPlusLES for compressible flow is available for openFoam 2.3.0 and is given in the website : https://github.com/wyldckat/yPlusLES...swcompressible

Howard March 27, 2015 10:53

Quote:

Originally Posted by openfoammaofnepo (Post 427980)
Hi All ,

I am new to openFOAM. I just finished a compressible LES with OpenFOAM. When I want to use yPlusLES to calculate the y+ in my case, I got the messege to provide nuSGS. I think this quantity is only for incompressible flows. Could anyone know how to calculate the y+ in compressible flows?

Thank you so much!

Hi, Friend. I would like to ask to use LES in OpenFoam, in the 'LESProperties' what's the meaning of 'turbulence on'?

openfoammaofnepo March 27, 2015 11:18

if you have turbulence off, how can you have the LES?

Quote:

Originally Posted by Howard (Post 538581)
Hi, Friend. I would like to ask to use LES in OpenFoam, in the 'LESProperties' what's the meaning of 'turbulence on'?


Dan Pearce August 27, 2015 07:25

Hi All,
Thanks for the discussion of the y+ treatment, following the thread from the start has been really helpful for me. I do have a couple of questions though, hence why I resurrected this thread...
I am running OF 2.4.0 on Ubuntu 14.04.
1. I tried to run yPlusLES on the throttle tutorial for cavitatingFoam but I got the error
keyword transportModel is undefined in dictionary "/home/dan/OpenFOAM/dan-2.4.0/run/tutorials/multiphase/cavitatingFoam/les/throttle/constant/transportProperties"

file: /home/dan/OpenFOAM/dan-2.4.0/run/tutorials/multiphase/cavitatingFoam/les/throttle/constant/transportProperties from line 18 to line 64.

From function dictionary::lookupEntry(const word&, bool, bool) const
in file db/dictionary/dictionary.C at line 442.
Is this due to the change in structure for multiphase transport properties dict between 2.4.0 and previous OF versions? should I log this as a bug?

2. The -compressible option has been removed, what is the correct useage now? Do I need to follow the instructions from wyldckat for v2.3.0 with some modifications to use the different transportProperties dict?

Thanks,
Dan

Edit: I found the problem (it should have been obvious to me earlier but anyway) is that the utility does not handle a multiphase definition of nu / mu. A work around is to assume that all cells close to the wall are alpha = 1 and at the end of the run, temporarily rem out the vapour phase definitions in the transportProperties file. Unfortunately in my case this assumption does not always hold true so now looking at making my own utility, I will post back if I have any success :)

wyldckat August 30, 2015 16:49

@Dan: Quick answers:


All times are GMT -4. The time now is 18:07.