CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Definition of y+ in yPlusRAS (1.7.1) (https://www.cfd-online.com/Forums/openfoam-programming-development/80595-definition-y-yplusras-1-7-1-a.html)

camoesas October 17, 2011 07:48

I get 0 on every wall for fully resolved boundary layers. As reported here: http://www.cfd-online.com/Forums/ope...earstress.html

For wallFunction I get value but I canīt assess them...

Saxwax October 18, 2011 19:53

y+ = y*
 
Hi Cameosas,

Glad to hear that the file compiled, not sure about the 0 for fully resolved boundary layers. It is possible that I used the old version of Niklas' yPlus utility. Have you checked that?

Vaina74, I'm not sure which version of the FLUENT manual you are quoting. In the version that I have (Version 12 April 2009) the section Near-Wall Treatment for Wall Bounded FLows contains the following quote:

"It should be noted that, in ANSYS FLUENT, the laws-of-the-wall for mean velocity and temperature are based on the wall unit, y*, rather than y+. These quantities are approximately equal in equilibrium turbulent boundary layers."

Comparing the equations for y+ and y* we can see that the only difference between the two are the frictionVelocity, Cmu^0.25 and k^0.5 terms.

y+ = rho*frictionVelocity*y/mu

y* = rho*(Cmu^0.25)*(k^0.5)*y/mu

For equilibrium turbulent boundary layers (ETBL) frictionVelocity = (Cmu^0.25)*(k^0.5) (Ferziger), i.e. y+ is equal to y*.

If you are using standard wall functions for flows with an ETBL then y*, or yPlusRAS, probably will give you a good enough indication of the appropriateness of your cell size.

Not sure if that helps (it definitely wont if I am wrong :D). Let me know your thoughts on this one. It would be good to have a better idea on why things are the way they are in OpenFOAM.

Regards,

D.

camoesas October 20, 2011 04:09

HI Saxwax,

I have downloaded both, but I am using the newer version. :confused:

Saxwax October 24, 2011 23:50

Nut?
 
Cameosas,

The way I see it, based on the equation used to calculate the cell y+ value in the yPlus utility there are three possible reasons why a value of exactly zero would be output:

1) y = 0
2) snGrad = 0
3) nut = 0

Two of these are very easy to check, y and nut. The third is also probably quite easy to check (edit yPlus utility to output snGrad instead) - I haven't tried this.

My guess would be that nut is the likely culprit. Either a boundary condition at the wall is set to nut = 0, or the wall function being used (i.e. nutkWallFunction) is calculating the nut value at some (or all) points to be zero. I'd either have a look at the nut file or colour the wall patch by nut in Paraview.

I have noticed the same zero values being output by yPlus. A quick check showed that the nut field had several cells showing up as zero (nutkWallFunction). I'm not really sure if this is the expected behavior or not. Someone else can probably answer that.

Regards,

D.

camoesas October 25, 2011 10:00

HI Saxwax,

Thats a really good hint! Thanks!
I get zero values for:

Code:

yPlus.boundaryField()[patchi] = y[patchi]
AND for:

Code:

yPlus.boundaryField()[patchi] = mut.boundaryField()[patchi]
(I am using the compressible version)

Code:

yPlus.boundaryField()[patchi] =
          mag(U.boundaryField()[patchi].snGrad());

gives non zero values. in the order of 1e3

Code:

        yPlus.boundaryField()[patchi] =
          (RASModel->mu().boundaryField()[patchi]/rho.boundaryField()[patchi]);

gives non zero values in the order of 1e-5

camoesas October 26, 2011 03:06

I have defined the walls for mut like:

Code:

    {
        type            mutkWallFunction;
        value          uniform 0;
    }

Thats like its defined in the tutorials...:confused:

Saxwax November 1, 2011 19:11

Cameosas,

Are the zero values for mut and y in the same cells (or all the cells)? If so I would guess that the mutkWallFunction uses y to calculate the mut value. You could check this by looking at the mutkWallFunction.C source code. This way you would know that the zero values originate from y. If not well then I am not really sure. Again, looking at the source code may help.

Regards,

D.

idefix June 10, 2013 03:56

Hello,

I just want to check that yPlusRAS is calculating the right thing.
So I calculated yPlus with yPlusRAS and by hand with this equation:

yPlus= Cmu^(0.25) * y * k^(0.5) / nu

with:
Cmu =0.09
y = 0.00125 (it is the cell height / 2 because I am looking at the cell directly at the wall)
k = 0.19 (from paraview)
nu = 1.0e-6

So i get: yPlus = 298

yPlusRAS says: yPlus = 6.7

The domain is a rectangular channel, so Iīve got a nice grid.
To get the yPlus from yPlusRAS I should use y = 2.8e-5

Can somebody help me what is wrong?

Thanks a lot

idefix June 11, 2013 03:00

I found my mistake

the yPlus = 6.7 was shown in paraview.
If I look at the output in the shell after I tipped yPlusRAS I see complete different values in comparison to the values in paraview.
But the values in the output are the values I calculated by hand.
So the interpolation in paraview was the problem.

But still one simple question is left:
I have a rectangular channel and I decided to use wall functions for k, epsilon and nut.
Am I right that the distance from the wall to the cell centre of the first cell at the wall has to be smaller than yPlus = 11?
If itīs not, do I get a wrong result?
I am also not sure what k I should use for calculating yPlus.
At the beginning I only have the k which I enter in the k-file. But at the end of my simulation the k at the wall has changed. So yPlus has changed too. So maybe after the run I know that my grid should be smaller.
How can I solve this problem?

thanks a lot for your help

Marvin_Rauch August 6, 2014 13:18

Sorry for bumping that old thread.

Has anyone a compiling version of the right "yPlus" for OF 2.3. Or can anyone tell me what I have to change in the original yPlusRAS.H to calculate the right yPlus. I'm quite new to openFOAM so I'm greatful for any hint that teaches me how to write my own sourcecode. ;)
Actually I'm just grepping through source code on and on with little progress.


Unlike OF 1.7, in OF 2.3 I can't find yPlus.H there is only yPlusRAS.H which somehow calculates yPlus using the nutWallFunctionFvPatchScalarField. :confused:

New_OpenFOAM_user September 9, 2014 13:01

Quote:

Originally Posted by Marvin_Rauch (Post 504694)
Sorry for bumping that old thread.

Has anyone a compiling version of the right "yPlus" for OF 2.3. Or can anyone tell me what I have to change in the original yPlusRAS.H to calculate the right yPlus. I'm quite new to openFOAM so I'm greatful for any hint that teaches me how to write my own sourcecode. ;)
Actually I'm just grepping through source code on and on with little progress.


Unlike OF 1.7, in OF 2.3 I can't find yPlus.H there is only yPlusRAS.H which somehow calculates yPlus using the nutWallFunctionFvPatchScalarField. :confused:

Hi Marvin,

I am struggling with the same problem. Have you found a way of calculating y+ yet?

I have found other yPlus utilities in similar threads (See link below) and tried to apply them to my model, but since I'm working with a high Re turbulence model (and the code is written for low Re models) I get y+ values of zero. This is not necessarily the problem, though. I might just be implementing it completely incorrectly.

Here is the link to the other posts on this topic that I read:
http://www.cfd-online.com/Forums/ope...estcase-5.html. Post #93 is where I found the utility I mentioned.

I have also wondered how openFoam v. 2.3.x calculates y* and whether it is possible to find a relation between y* and y+ and modify the values that are generated by yPlusRAS?

I have scoured through the nutWallFunctionFvPatchScalarField, but since my programming is rusty I can't figure out how y* is calculated.

Any help would be greatly appreciated.
Thanks,
Chrissy

Marvin_Rauch September 15, 2014 04:14

Hey Chrissy,

I am sorry but my final approach was now to use CFX to compute yPlus values instead.

I haven't found a relation between y* and y+. What I have noticed is that the yStar values from CFX are more than ten times higher if the prisms are very thin (12 prism layers and more, enough to resolve the boundary layer). For meshes with 3 prism layers, yStar and yPlus were only slightly different (both average and min max).

What I need to add is that OF is directly computing on teds and CFX is using the nodes to create a polyeder mesh around them. Therefore the elements slighly differ.

You are right with the nutFunction. They are essential for yPlus computation. For example if you resolve the BL (set nut = computed) you can't compute yPlus any more.

I found nutkWallfunction:
const scalar Cmu25 = pow025(Cmu_);

tmp<scalarField> tnutw(new scalarField(patch().size(), 0.0));
scalarField& nutw = tnutw();

forAll(nutw, faceI)
{
label faceCellI = patch().faceCells()[faceI];

scalar yPlus = Cmu25*y[faceI]*sqrt(k[faceCellI])/nuw[faceI];

if (yPlus > yPlusLam_)
{
nutw[faceI] = nuw[faceI]*(yPlus*kappa_/log(E_*yPlus) - 1.0);
}
}

return tnutw;
}

maybe it is the definition you are looking for. I hope I could help you little. But now I have to return writing my thesis ;)

Greets

Marvin

LukaD July 7, 2015 08:53

1 Attachment(s)
I've changed the file previously uploaded here. This file works for OF 2.3.1 and calculates y+ instead of y*.

KateEisenhower August 24, 2015 10:50

Hello,

I know it sounds a bit odd but could anybody explain how to compile these little utilities? I don't even know where to put this file or doesn't it matter at all.

Best regards,

Kate

Quote:

Originally Posted by LukaD (Post 554163)
I've changed the file previously uploaded here. This file works for OF 2.3.1 and calculates y+ instead of y*.


LukaD August 24, 2015 11:00

1 Attachment(s)
Dear Kate,

The file I have uploaded is a C++ file that still has to be compiled. Attached is the directory that also includes the Make file. Unpack this into OpenFOAM/username-version/applications/yPlus. Then you can compile the utility by going to this directory in a terminal and typing
Code:

wmake
If successful, the yPlus utility should be accessible from the terminal afterwards, so go to your case directory and type
Code:

yPlus
or
Code:

yPlus -compressible
to execute it.

I hope this explanation clears things up.

KateEisenhower August 26, 2015 02:37

Hello Luka,

many thanks for your support. Unfortunately it doesn't work. Please note that I run OpenFOAM on OS X Yosemite. When you are talking about the OpenFOAM directory, I assume you mean the OpenFOAM sparseboundle which I have to mount every time I restart my system. This contains two folders, OpenFOAM-2.3.1 and kateeisenhower-2.3.1. However the folder kateeisenhower-2.3.1 only contains a folder run which is empty. So I unpacked the download into OpenFOAM/OpenFOAM-2.3.1/applications and tried to compile the source code with wmake. I got the following output:

Code:

Last login: Wed Aug 26 08:23:03 on ttys006
Kates-MacBook-Pro:~ kateeisenhower$ hdiutil attach -mountpoint $HOME/OpenFOAM OpenFOAM.sparsebundle
/dev/disk2                  GUID_partition_scheme                 
/dev/disk2s1                EFI                                   
/dev/disk2s2                Apple_HFS                              /Users/kateeisenhower/OpenFOAM
Kates-MacBook-Pro:~ kateeisenhower$ source $HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc
Using paraview in directory /Applications/paraview.app
Kates-MacBook-Pro:~ kateeisenhower$ cd /Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/applications/yPlus
Kates-MacBook-Pro:yPlus kateeisenhower$ wmake
Making dependency list for source file yPlus.C
could not open file fluidThermo.H for source file yPlus.C due to No such file or directory
SOURCE=yPlus.C ;  clang++ -m64 -DdarwinIntel64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -Wno-overloaded-virtual -Wno-unused-comparison -Wno-deprecated-register -O3  -DNoRepository -ftemplate-depth-100 -I/Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/meshTools/lnInclude -I/Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/transportModels -I/Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/turbulenceModels -I/Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions -I/Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions -I/Users/kateeisenhower/OpenFOAM/kateeisenhower-2.3.1/src/thermophysicalModels/basic/lnInclude -I/Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude -IlnInclude -I. -I/Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude -I/Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/OSspecific/POSIX/lnInclude  -fPIC -Ddarwin -std=c++11 -c $SOURCE -o Make/darwinIntel64ClangDPOpt/yPlus.o
In file included from yPlus.C:32:
In file included from /Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude/fvCFD.H:6:
In file included from /Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/Time.H:47:
In file included from /Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/TimeState.H:38:
In file included from /Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/dimensionedScalar.H:38:
In file included from /Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/dimensionedType.H:40:
In file included from /Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/dimensionSet.H:46:
In file included from /Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/scalarField.H:38:
In file included from /Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/Field.H:394:
/Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/Field.C:461:10: warning:
      reference cannot be bound to dereferenced null pointer in well-defined C++
      code; pointer may be assumed to always convert to true
      [-Wundefined-bool-conversion]
    && &mapper.directAddressing()
    ~~  ^~~~~~~~~~~~~~~~~~~~~~~~~
/Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/FieldMapper.H:71:35: note:
      'directAddressing' returns a reference
        virtual const labelUList& directAddressing() const
                                  ^
In file included from yPlus.C:32:
In file included from /Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude/fvCFD.H:6:
In file included from /Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/Time.H:47:
In file included from /Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/TimeState.H:38:
In file included from /Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/dimensionedScalar.H:38:
In file included from /Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/dimensionedType.H:40:
In file included from /Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/dimensionSet.H:46:
In file included from /Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/scalarField.H:38:
In file included from /Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/Field.H:394:
/Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/Field.C:496:14: warning:
      reference cannot be bound to dereferenced null pointer in well-defined C++
      code; pointer may be assumed to always convert to true
      [-Wundefined-bool-conversion]
        && &mapper.directAddressing()
        ~~  ^~~~~~~~~~~~~~~~~~~~~~~~~
/Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/FieldMapper.H:71:35: note:
      'directAddressing' returns a reference
        virtual const labelUList& directAddressing() const
                                  ^
In file included from yPlus.C:32:
In file included from /Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude/fvCFD.H:8:
In file included from /Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude/fvc.H:39:
In file included from /Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude/surfaceInterpolate.H:41:
In file included from /Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude/surfaceInterpolationScheme.H:234:
In file included from /Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude/surfaceInterpolationScheme.C:30:
In file included from /Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude/volFields.H:40:
In file included from /Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude/fvPatchField.H:588:
/Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude/fvPatchField.C:253:14: warning:
      reference cannot be bound to dereferenced null pointer in well-defined C++
      code; pointer may be assumed to always convert to true
      [-Wundefined-bool-conversion]
        && &mapper.directAddressing()
        ~~  ^~~~~~~~~~~~~~~~~~~~~~~~~
/Users/kateeisenhower/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/FieldMapper.H:71:35: note:
      'directAddressing' returns a reference
        virtual const labelUList& directAddressing() const
                                  ^
yPlus.C:37:10: fatal error: 'fluidThermo.H' file not found
#include "fluidThermo.H"
        ^
3 warnings and 1 error generated.
make: *** [Make/darwinIntel64ClangDPOpt/yPlus.o] Error 1
Kates-MacBook-Pro:yPlus kateeisenhower $

Do you think there is something wrong with my installation, doesn't it work on OS X or did I simply do it wrong?

Best regards,

Kate
Quote:

Originally Posted by LukaD (Post 560856)
Dear Kate,

The file I have uploaded is a C++ file that still has to be compiled. Attached is the directory that also includes the Make file. Unpack this into OpenFOAM/username-version/applications/yPlus. Then you can compile the utility by going to this directory in a terminal and typing
Code:

wmake
If successful, the yPlus utility should be accessible from the terminal afterwards, so go to your case directory and type
Code:

yPlus
or
Code:

yPlus -compressible
to execute it.

I hope this explanation clears things up.


LukaD August 26, 2015 03:29

Hi Kate,

I think the warnings are indeed a result of you working on OS X, but I also think you can safely ignore them. The error, on the other hand, is important but easily resolved. The clue is found in the following line

Code:

yPlus.C:37:10: fatal error: 'fluidThermo.H' file not found
The compiler does not know where to find the relevant C++ code with the thermodynamic modelling of the fluid. This is because I use custom code for this. If you go to "options" file in the Make directory, change the following line
Code:

-I$(WM_PROJECT_USER_DIR)/src/thermophysicalModels/basic/lnInclude \
to
Code:

-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
This should point to the "normal" thermophysical modelling files, resulting in an error-free compilation.

As a side note, it is common practice to put the "applications" directory you just created in the same directory as run (kateeisenhower-2.3.1). However, I do not think this is the cause for your warnings and errors.

KateEisenhower August 26, 2015 05:30

1 Attachment(s)
Hi Luka,

thanks for the explanation. I understood why I got this error in the first place. But it still doesn't work. I keep getting some warnings which I don't understand. Nethertheless I tried

Code:

yPlus
in a case directory. Terminal keeps telling me it doesn't know this command, even after I tried in a new Terminal window. Please see the attached output.

Best regards,

Kate

LukaD August 28, 2015 07:48

Hi Kate,

After some googling, it looks like this error is Mac OS-related. Since I'm not familiar with this setup and the resulting error, I'm afraid I can't help you.

KateEisenhower August 29, 2015 10:49

Hi Luka, no problem, thank you for trying!


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