CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   smallestDist / y distance problem (

romant February 21, 2011 06:54

smallestDist / y distance problem
1 Attachment(s)

I have noticed that the smallestDist function in the class cellDistFuncs

seems to calculate the smallest difference in a way that it gives the wrong distance. I attached a picture in order to show what I mean. The distance towards the center of the channel seems to be right, but when the distances of the cells closer to the wall are supposed to be calculated, they are not the what one expects. In the attached pictures, the only walls are the boundaries on top and bottom. And it reports the cells closest to the wall to have a distance of 1.08 mm. The whole channel on the other hand, as one can see, is only 5.4mm wide.

Does anybody know why this behavior is like this? It doesn't make sense to me.

jms March 17, 2011 08:32

Hi Roman,

I am struggling a lot with this issue too. Have you got any insight for that?
I am doing cfd around an airfoil and I need the correct value of this distance in order to calculate yPlus.

Keep me updated if you get sth! I will do so too!



romant March 17, 2011 08:43

y plus calculations

in case you want to calculate y plus for compressible flow and turbulence models with wall functions you should be able to do this with


for LES turbulence models and Reynolds average turbulence models, respectively. For y plus calculations for low Reynolds number turbulence models, you might also wanna follow this thread here which deals with a new calculation tool for y plus. let's hope this might also get fixed in the new release of OF.

jms March 17, 2011 08:51


Thank you for your advice. I already know that. I am using RANS, so I started using yPlusRAS but it gives y* instead of y+ (see this thread if you want to read about this...).
Thus, I am using one code from one guy which is an adaptation of yPlusLES to RANS. here you can find it. To calculate y + as you can see in the thread I have sent to you you need the 1st cell height, i.e. I would need the tool you were referring to in the message running well.

Anyway...if you know how to fix this calculation of the nearWall tool, let me know!



romant March 17, 2011 09:01

I think one way to do this could be by taking the distance normal from the cellCenter (cell at the wall) to the faceCenter (wallpatch). Since the velocity is stored at the cell center, this should then give the velocity at the cell center of the first cell and your y distance from the wall.

jms March 17, 2011 09:07

Thanks Roman. I know this, but I am not very into programming OpenFOAM, this is why I was looking for a code with this already implemented.

Thank you anyway,



romant March 17, 2011 09:08

maybe I will try this out soon, but unfortunately I don't have too much time at the moment. Hopefully, over the coming weeks I will be able to do some more programming.

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