CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Relative roughness in openfoam (https://www.cfd-online.com/Forums/openfoam-solving/122276-relative-roughness-openfoam.html)

 inf.vish August 16, 2013 04:44

Relative roughness in openfoam

How to incorporate relative roughness in openfoam?

I am using pisoFoam to solve a simple turbulent flow through a pipe.
I want to validate the result using Moody's chart, where i specify reynolds number and relative roughness to openfoam and check if the frcition factor given by openfoam matches with the value from moody's chart.

Do we have to use nutkRoughWallFunction? If yes then what do Ks and Cs mean, and where do i find their values?
Also, what is the default relative roughness used by openfoam?

 Mojtaba.a August 16, 2013 05:06

Hi,

Blocken, B., Stathopoulos, T., Carmeliet, J., 2007.
CFD simulation of the atmospheric boundary layer: wall function problems.
Atmospheric Environment 41 (2), 238–252.

http://www.cfd-online.com/Forums/ope...h-surface.html

You can see nutkRoughWallFunction source file to see how are they defined.

Cs values is something between 0 to 1, but typically it is considered 0.5.

Ks (It is called equivalent sand-gran roughness height) differs from case to case, it is often calculated by:

Ks = (20 to 30)*y0

in which, y0 is aerodynamic roughness length. a rule of thumb for values of y0 is 0.1 of the real roughness value. for example if height of the roughness is 0.1 m then y0 would be 0.01 m.

I hope it helps a bit.
Best

 inf.vish August 16, 2013 06:01

Okay i just realised that my way of validating turbulent flow is wrong.

Can you tell me how to validate a turbulent flow using some analytical results, like we have poiseuille's law for laminar flow.

 Mojtaba.a August 16, 2013 08:29

Quote:
 Originally Posted by inf.vish (Post 446077) Okay i just realised that my way of validating turbulent flow is wrong. Can you tell me how to validate a turbulent flow using some analytical results, like we have poiseuille's law for laminar flow.
Well, I am not familiar with this but maybe you can validate it using analytical turbulent flow velocity profiles which are carried out of Moody's diagram.

hope it helps.

 inf.vish August 18, 2013 23:20

Quote:
 Originally Posted by Mojtaba.a (Post 446131) you can validate it using analytical turbulent flow velocity profiles which are carried out of Moody's diagram.
I do not quite get your point over here. The only way you can validate using Moody's chart is that you know Reynolds number and relative roughness and you obtain friction factor from openfoam and check whether that value matches with what is given by Moody's chart.

How do i calculate relative roughness from Ks and Cs values? And how do i get the friction factor from openfoam?

I read the nutkRoughWallFunction files and understood what Ks and Cs mean but there is no mention of how to obtain relative roughness from them.

 Mojtaba.a August 19, 2013 12:37

Quote:
 Originally Posted by inf.vish (Post 446531) I do not quite get your point over here. The only way you can validate using Moody's chart is that you know Reynolds number and relative roughness and you obtain friction factor from openfoam and check whether that value matches with what is given by Moody's chart. How do i calculate relative roughness from Ks and Cs values? And how do i get the friction factor from openfoam? I read the nutkRoughWallFunction files and understood what Ks and Cs mean but there is no mention of how to obtain relative roughness from them.

OK, first of all, what do you mean by relative roughness? do you mean y0?

I haven't worked with nutkRoughWallFunction for a while and forgot some, I think you define Ks values as an input data.

Well friction factor can be obtained using wall shear stress, as you know:

Cf=Tau/(0.5*rho*U^2)

In which Tau is wall shear stress.

You can calculate wall shear stress with a utility named as "wallShearStress" in openfoam. later you can calcluate Cf in paraview using its calculator according to rho and U values.

 inf.vish August 19, 2013 23:09

Quote:
 Originally Posted by Mojtaba.a (Post 446719) OK, first of all, what do you mean by relative roughness? do you mean y0? I haven't worked with nutkRoughWallFunction for a while and forgot some, I think you define Ks values as an input data. Well friction factor can be obtained using wall shear stress, as you know: Cf=Tau/(0.5*rho*U^2) In which Tau is wall shear stress. You can calculate wall shear stress with a utility named as "wallShearStress" in openfoam. later you can calcluate Cf in paraview using its calculator according to rho and U values.
Hmm. Okay I will try that. Relative roughness means e/D. The right hand scale on moody's chart.

Also, Cf is skin friction factor. I believe it is not the same as the friction factor f which is on the left hand scale of moody's chart. According to texts - friction factor is calculated experimentally. So the approach i am using is wrong.

 inf.vish August 19, 2013 23:57

1 Attachment(s)
There is one more problem though.

This is the test case i am trying out. Just to learn about turbulence. But even at 10^6 reynolds number i am getting laminar streamlines. Can you look up and tell me what is wrong with the problem. Assume smooth walls.
Attachment 24567

 Mojtaba.a August 20, 2013 04:02

Quote:
 Originally Posted by inf.vish (Post 446785) Hmm. Okay I will try that. Relative roughness means e/D. The right hand scale on moody's chart. Also, Cf is skin friction factor. I believe it is not the same as the friction factor f which is on the left hand scale of moody's chart. According to texts - friction factor is calculated experimentally. So the approach i am using is wrong.
Hmm, well I am not sure about this but as far as I know, Cf is called "Fanning friction factor". In the other hand, Fanning friction factor is one-fourth of the Darcy friction factor. As you know most of the time Darcy friction factor is used in Moody's diagram.

I couldn't get why your approach is wrong.

 inf.vish August 20, 2013 05:14

Quote:
 Originally Posted by Mojtaba.a (Post 446824) Hmm, well I am not sure about this but as far as I know, Cf is called "Fanning friction factor". In the other hand, Fanning friction factor is one-fourth of the Darcy friction factor. As you know most of the time Darcy friction factor is used in Moody's diagram. I couldn't get why your approach is wrong.
Yes you are quite right. Cf is called the fanning friction factor. And you can calculate Darcy friction factor using Colebrook equation.

Now my conclusion is - Obtain Fanning friction coefficient Cf using wallShearStress and then multiply it by 4 to get Darcy friction factor and use Moodys chart with Reynolds number and relative pipe roughness to verify the friction factor.

Thanks a lot. I think this solves my problem. Can you also take a look at another problem which i posted right before your current reply?

 Mojtaba.a August 20, 2013 05:23

Quote:
 Originally Posted by inf.vish (Post 446841) Thanks a lot. I think this solves my problem. Can you also take a look at another problem which i posted right before your current reply?
Well I'm not a turbulence expert, but sure, I will take a look at it :)

 inf.vish August 20, 2013 05:35

Quote:
 Originally Posted by Mojtaba.a (Post 446843) Well I'm not a turbulence expert, but sure, I will take a look at it :)
It is a very simple problem. I have been stuck on it for quite a while and honestly, it is getting quite frustrating now.

 inf.vish August 23, 2013 07:21

1 Attachment(s)
Quote:

Originally Posted by Mojtaba.a
Quote:

Originally Posted by inf.vish
Quote:
 Originally Posted by Mojtaba.a Dear Vishal, I haven't tried it yet. heavy days ;). Maybe your k values is too low or your epsilon values are too high.
Oh it's okay. I will try changing the values of k and epsilon. I read somewhere on the forum that the values of k and epsilon do not matter. So if i set them 0 it should simulate properly. am i right?

Nope, not 0. You have actually turned off turbulence. give flow some turbulence.
I don't know the approximated values of k & epsilon for your case but lets start by 0.1 for both of them.

If it is possible lets go back to thread and continue this in there.

best wishes,
Mojtaba

I tried with k and epsilon = 0.1
The results look similar. The velocity is not blowing. Input bein 1 m/s i am getting a maximum velocity of around 1.98 m/s.

The results still look laminar - Attachment 24777

 Mojtaba.a August 23, 2013 13:25

Quote:
 Originally Posted by inf.vish (Post 447675) I tried with k and epsilon = 0.1 The results look similar. The velocity is not blowing. Input bein 1 m/s i am getting a maximum velocity of around 1.98 m/s. The results still look laminar - Attachment 24777
Dear Vishal which turbulence model are you using and what are your yPlus values?

 inf.vish August 25, 2013 23:23

1 Attachment(s)
Quote:
 Originally Posted by Mojtaba.a (Post 447719) Dear Vishal which turbulence model are you using and what are your yPlus values?
Hello, Sorry for the late reply. Weekends.

These are my yPLus values Attachment 24826

Also, I am using k-epsilon turbulence model.

 Mojtaba.a August 26, 2013 02:12

Quote:
 Originally Posted by inf.vish (Post 447984) Hello, Sorry for the late reply. Weekends. These are my yPLus values Attachment 24826 Also, I am using k-epsilon turbulence model.
Well actually kE is not a very strong model in simulating near wall flows. Plus your y+ values are high for this purpose.

You have got to use kOmegaSST model alongside with a finer grid to be able to resolve the boundary layer.

Try take a look at these:

http://www.computationalfluiddynamic...t-cell-height/
http://www.computationalfluiddynamic...oundary-layer/
http://www.computationalfluiddynamic...oundary-layer/
http://www.computationalfluiddynamic...ds-number-cfd/
http://www.computationalfluiddynamic...-requirements/
http://www.computationalfluiddynamic...nce-modelling/

 inf.vish August 27, 2013 00:53

Quote:
 Originally Posted by Mojtaba.a (Post 448005) Well actually kE is not a very strong model in simulating near wall flows. Plus your y+ values are high for this purpose. You have got to use kOmegaSST model alongside with a finer grid to be able to resolve the boundary layer. Try take a look at these: http://www.computationalfluiddynamic...t-cell-height/ http://www.computationalfluiddynamic...oundary-layer/ http://www.computationalfluiddynamic...oundary-layer/ http://www.computationalfluiddynamic...ds-number-cfd/ http://www.computationalfluiddynamic...-requirements/ http://www.computationalfluiddynamic...nce-modelling/
I have no idea about y+. I am an undergraduate student and have to do openfoam as part of my internship. I have no prior knowledge of CFD and turbulence models. Thus it is very difficult for me to understand OpenFOAM. I will try reading the links you have given.

Also, for kOmegaSST what boundary conditions should i use?

Is it possible for you to simulate the problem and send me the files? I have been trying this problem for 3 weeks now and not able to understand anything.

 Mojtaba.a August 27, 2013 05:35

Quote:
 Originally Posted by inf.vish (Post 448229) I have no idea about y+. I am an undergraduate student and have to do openfoam as part of my internship. I have no prior knowledge of CFD and turbulence models. Thus it is very difficult for me to understand OpenFOAM. I will try reading the links you have given. Also, for kOmegaSST what boundary conditions should i use? Is it possible for you to simulate the problem and send me the files? I have been trying this problem for 3 weeks now and not able to understand anything.
for keOmegaSST, instead of having k and epsilon you have got k and omega.

you have to make a new initial boundary file named omega in your 0 directory and use omegaWallFunction for your wall boundaries. For example:

wall
{
type omegaWallFunction;
value uniform 0;
}

outlet
{
}

inlet
{
type fixedValue;
value uniform 0.0001;
}

try having a look at this thread:

http://www.cfd-online.com/Forums/ope...omega-sst.html

I hope it helps a bit :),
Best

 inf.vish August 27, 2013 06:58

Quote:
 Originally Posted by Mojtaba.a (Post 448274) for keOmegaSST, instead of having k and epsilon you have got k and omega. you have to make a new initial boundary file named omega in your 0 directory and use omegaWallFunction for your wall boundaries. For example: wall { type omegaWallFunction; value uniform 0; } outlet { type zeroGradient; } inlet { type fixedValue; value uniform 0.0001; } try having a look at this thread: http://www.cfd-online.com/Forums/ope...omega-sst.html I hope it helps a bit :), Best
Thanks I will try.
One more question, do the values of k and omega (or epsilon) affect the final solution?
I was trying out various values but found that for k>epsilon i get floating point exception on the courant number and for k<<epsilon (whatever be the value of k and epsilon) I obtain solutions which are very very close to each other.

from what i have read y+ should be between 30-300 right?

Also I was looking at pitzDaily example from pisoFoam>LES, there you can see vortices but on running the same simulation with say kE you do not get the vortices. I read somewhere on the forum that LES is better at capturing vortices as with kE or kOmega the viscous forces dampen the vortices.

 Mojtaba.a August 27, 2013 11:59

Quote:
 One more question, do the values of k and omega (or epsilon) affect the final solution?
They will effect the final results as they are the values for kinetic energy and dissipation frequency.

Quote:
 I was trying out various values but found that for k>epsilon i get floating point exception on the courant number and for k<

Quote:
 from what i have read y+ should be between 30-300 right?
If you are using wall functions, yes. But right now by using a low reynolds turbulence model this value have got to be less than 1.
Therefore by using kOmegaSST model, you have got to lower your y+ value to something lower than 1.

Quote:
 Also I was looking at pitzDaily example from pisoFoam>LES, there you can see vortices but on running the same simulation with say kE you do not get the vortices. I read somewhere on the forum that LES is better at capturing vortices as with kE or kOmega the viscous forces dampen the vortices.
That's right. LES is very powerful, hence it can resolve the whole boundary layer, but one drawback is its computational cost.

www.engmech.cz/2012/proceedings/pdf/195_Furst_J-FT.pdf‎

It uses openFOAM and a new turbulence model which is best for laminar turbulent transition modeling.

And plus take a look at this:
http://www.cfd-online.com/Forums/ope...el-low-re.html