CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

nutRoughWallFunction and Surface Roughness Documented

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree22Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 31, 2009, 02:48
Default nutRoughWallFunction and Surface Roughness Documented
  #1
Member
 
Alan Russell
Join Date: Aug 2009
Location: Boise, Idaho USA
Posts: 61
Rep Power: 16
AlanR is on a distinguished road
In the interest of documentation, I offer the following:
I'm modeling atmospheric boundary layer flow and need to use rough walls with carefully defined surface roughness. A forum search turned up a nice piece of code to implement the FLUENT surface roughness http://www.cfd-online.com/Forums/ope...roughness.html. I decided to try it - only to find that it's obsoleted by a new function in 1.6 - which I didn't see in the release notes.

Using a standard RAS k-epsilon turbulence model, in the /0/nut file replace 'nutWallFunction' with 'nutRoughWallFunction.' To make this work, you need to specify Ks (sand grain roughness height in meters) and Cs, the roughness constant (the link above takes you to the wiki and a good explanation of the model. After some trial and error, I found the correct syntax (for roughness height = 1 mm and Cs = 0.5 is the FLUENT default value - appropriate for pipe flow).

{
type nutRoughWallFunction::Ks;
value uniform 0.001;
type nutRoughWallFunction::Cs;
value uniform 0.5;
}

After finding this, I searched nutRoughWallFunction in the forums. There is a thread in bug fixes: apparently the code in 1.6 resets itself and gives very low values of roughness. This was fixed in version 1.6.x (reported in October). The current git version of 1.6.x should work correctly.

For anyone interested in atmospheric roughness, there's a simple conversion. This was part of my master's thesis (my research done in Fluent, I'm now switching to OpenFOAM). Ks = atmospheric roughness height * 30. Cs = 0.327. I found this in a peer reviewed journal, tested it in FLUENT simulations, and subsequently found very similar conversions in other journal articles.

Please correct my documentation if anyone finds mistakes - I'm still pretty new at this. Also, please feel free to add. I spent several hours today figuring this out - I learned quite a bit and got surface roughness working in my simulation. I have learned a lot from this forum over the last few months - today, I'm taking the opportunity to give something in return.
AlanR is offline   Reply With Quote

Old   February 12, 2010, 10:56
Default
  #2
Member
 
Aniko Rakai
Join Date: Oct 2009
Location: Geneva
Posts: 30
Rep Power: 16
ancsa is on a distinguished road
Hi Alan, I followed your instructions and so far everythings goes fine, thanks, I think you saved me a few hours of forum search at least, I used the git version straigh.

And I'm also trying to use it for atmospheric flows
ancsa is offline   Reply With Quote

Old   February 12, 2010, 15:20
Default
  #3
Member
 
Alan Russell
Join Date: Aug 2009
Location: Boise, Idaho USA
Posts: 61
Rep Power: 16
AlanR is on a distinguished road
Ancsa, I'm glad the message was useful to someone - you are the first to reply.

How are you generating meshes? I'm having my share of problems with snappyHexMesh - I can only get down 10 meter resolution before I run into problems - cells in the x direction get refined and in the y direction do not. Do you have a good method?
Thanks, Alan
AlanR is offline   Reply With Quote

Old   February 15, 2010, 04:43
Default
  #4
Member
 
Aniko Rakai
Join Date: Oct 2009
Location: Geneva
Posts: 30
Rep Power: 16
ancsa is on a distinguished road
I'm sorry but I have no good method, I have just started with OpenFOAM and I'm using an ex-fluent mesh to compare the results.
ancsa is offline   Reply With Quote

Old   February 16, 2010, 09:43
Default
  #5
Member
 
Sylvain Aguinaga
Join Date: Feb 2010
Posts: 41
Rep Power: 16
Sylvain is on a distinguished road
Hi Alan,

Thanks for the contribution. I’m also working on the surface roughness problem for atmospheric flow. I followed your advices, it’s working but it seems that the values you specify in the nut file are not taken into account. For example, if you specify negative values or extremely high values for Ks an Cs, the results are always the same. I have recompiled the git version and specified Ks and Cs as you did, but it is always the same. Did you try to specify obvious rubbish (Chris Greeshields all rights reserved)?

I have asked my colleagues regarding the atmospheric roughness, you can indeed specify Ks=30*atmospheric roughness, but you have also to modify Cs to compensate. The problem is that the Ks you obtain is much more important than the wall cell size. Ks cannot be greater than half the wall cell size. Following a paper from Blocken 2007 you can specify Ks as half the wall cell size (almost) and you specify Cs according a formula Cs=E/Ks*z0 with E=9.73 and z0 the real roughness value. In Fluent, it seems that you cannot specify a Cs greater than 1, expect via an UDF. That’s why it would be nice if you could do it in OpenFOAM.

Regarding the snappyHexMesh thing I’m not yet so confident, but the cells should be split by 2^level in the three directions. More, if you use the add_layers you should be able to specify a small cell size at the wall. Meshing complex topology will be my next step, once I have understood how the roughness is working on a simple plate.

Thanks again for you help.

Sylvain
Sylvain is offline   Reply With Quote

Old   February 16, 2010, 10:36
Default
  #6
Member
 
Aniko Rakai
Join Date: Oct 2009
Location: Geneva
Posts: 30
Rep Power: 16
ancsa is on a distinguished road
Isn't it from the nutRoughWallFunctionFvPatchScalarField.C filter out the small Ks values?:
scalar Edash = E_;

if (KsPlus > 2.25)
{
Edash /= fnRough(KsPlus, Cs_[faceI]);
}

if Ks is too small the original E is taken into consideration as I understand.

I will also check the difference running with nut and nutRough wall function.
ancsa is offline   Reply With Quote

Old   March 22, 2010, 11:20
Default roughnessHeight and roughnessConstant
  #7
New Member
 
Join Date: Mar 2010
Posts: 6
Rep Power: 16
Heesei is on a distinguished road
Hi Sylvain

I have just seen your message and I have the same problem as you: reconstructing the results of Blocken et al. (2007) does not work. Specifying different values for Ks and Cs always leads to the same result. I suppose this is the reason for the strange plots I get.

Have you already managed to solve the problem? It would be nice if you could give me a hint how to get a (more or less) horizontally homogeneous wind profile.

Thanks in advance.

Irina
Heesei is offline   Reply With Quote

Old   March 22, 2010, 11:29
Default
  #8
Member
 
Alan Russell
Join Date: Aug 2009
Location: Boise, Idaho USA
Posts: 61
Rep Power: 16
AlanR is on a distinguished road
Irina,
I ran a simulation over a flat domain yesterday (by mistake actually) and ended up with a nicely converged solution and a consistent profile. I set Ks = 1.2 and Cs = 0.327. The model was simpleFoam, K-epsilon. I set the inlet profile using timeVeryingMappedFixedValue and it hardly changed across the domain - roughly 1 km wide.
You also need to be careful with k and epsilon, both of which can affect the profile across the domain.
Alan
AlanR is offline   Reply With Quote

Old   April 16, 2010, 09:38
Default Sensitivity of Ks value for nutRoughwallfunction
  #9
Member
 
Maruthamuthu Venkatraman
Join Date: Mar 2009
Location: Norway
Posts: 80
Rep Power: 17
maruthamuthu_venkatraman is on a distinguished road
Hello,
I tried to set various values for Ks in the input to account for roughness by using nutroughwallFunction. But its seems the results are same for ks = 0 and ks=0.01.
cs = 0.5 for both cases.

yplus is set for 30,
k is set to kqRwallfunction and
omega as omegaWallfunction.

Any hints will be useful

Thanks
maruthamuthu_venkatraman is offline   Reply With Quote

Old   April 16, 2010, 11:56
Default
  #10
Member
 
Sylvain Aguinaga
Join Date: Feb 2010
Posts: 41
Rep Power: 16
Sylvain is on a distinguished road
Hello,

I didn’t succeed to solve this problem and unfortunately I have no many time to work on this subject. Anyway I ran simulations in a very simple case (2D, log profile at the inlet) with different values of roughness, even negative, always leading to the same result regarding the pressure and velocity field.
I thought that the model didn’t read the values prescribed in the nut file. But if you turn on the debug mode associated with the nutRoughwallfunction you can see that the model do take into account the values ( you have Kplus negative also). So I guess the problem is not in the nutRoughwallfunction model, but rather in the way it is communicating with the turbulence model.

I really don’t know, but this roughness issue is annoying me!!!

Regards
Sylvain is offline   Reply With Quote

Old   April 16, 2010, 13:15
Default
  #11
Member
 
Maruthamuthu Venkatraman
Join Date: Mar 2009
Location: Norway
Posts: 80
Rep Power: 17
maruthamuthu_venkatraman is on a distinguished road
Thanks for your reply. Iam attending OF Workshop in Chalmers, may be we will discuss about this issue and shall see the possibilities to fix it. In the meanwhile we shall wait for some other foam users or the developers comments about it.

Have a good weekend!
maruthamuthu_venkatraman is offline   Reply With Quote

Old   April 29, 2010, 05:13
Default
  #12
New Member
 
Adrian Stalder
Join Date: Mar 2010
Posts: 10
Rep Power: 16
Adrian is on a distinguished road
Hello everyone

I encountered the same problem as most of you, the Ks and Cs values are not taken into account. I was working with a 2D domain and a pressure difference implemented between two sides. The logarithmic profile develops nicely but it only changes with the pressure, not with the Ks/Cs values.

So did anyone find out something new about this problem?

Cheers Adrian
Adrian is offline   Reply With Quote

Old   May 5, 2010, 05:53
Default Bug in nutRoughWallFunction
  #13
New Member
 
Join Date: Mar 2010
Posts: 6
Rep Power: 16
Heesei is on a distinguished road
I started a new thread

http://www.cfd-online.com/Forums/ope...ues-ks-cs.html

and finally got the answer to this problem from gocarts:

"nutRoughWallFunction in OpenFOAM 1.6 doesn't work correctly due to a bug. Try the latest 1.6.x from the git repository for the corrected version."


Kind regards,

Irina
Heesei is offline   Reply With Quote

Old   May 5, 2010, 06:38
Default
  #14
Member
 
Sylvain Aguinaga
Join Date: Feb 2010
Posts: 41
Rep Power: 16
Sylvain is on a distinguished road
Thanks Irina for your help.

I didn't succeed in compiling the whole git version and couldn't test it. Did it solve your problem, is it working now? I can recompile "by hand" the nutRoughWallFunction of the git, but is the problem just located in this function or in another one (turbulence model for example).

Thanks again for your help.

Sylvain
Sylvain is offline   Reply With Quote

Old   May 5, 2010, 07:11
Default
  #15
Member
 
Aniko Rakai
Join Date: Oct 2009
Location: Geneva
Posts: 30
Rep Power: 16
ancsa is on a distinguished road
In the first post of this thread Alan also mentioned the bug.

So all your problem is because you didn't use the git version? I think it's better using that one, since all new bug fixes are there, while the compiled version is not getting newer as I see. For example there was also a bug in omegaNutWallFunction. There is a good script at in the forum somewhere to do that.

If with the git version you manage, please post here.
ancsa is offline   Reply With Quote

Old   May 5, 2010, 09:17
Default
  #16
Member
 
Sylvain Aguinaga
Join Date: Feb 2010
Posts: 41
Rep Power: 16
Sylvain is on a distinguished road
Alan indeed mentions that bug. As I wasn't able to compile the whole git version (the compilation is crashing on OpenSuse and I didn't found why) I only recompiled the nutRoughWallFunction, but it didn't change anything. I took a look inside the function and I didn't see much difference, maybe I have to take a closer look. So my point is that maybe the problem is occurring elsewhere (but where?). I will try to find a computer where the git version is compiling so that I can try and see if the bug is solved with the latest version.
Sylvain is offline   Reply With Quote

Old   May 28, 2010, 11:11
Question Specify different roughness
  #17
Senior Member
 
maddalena's Avatar
 
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23
maddalena will become famous soon enough
Dear all,
I would like to specify different roughness on a same surface.
I am thinking on something like:
if x < 1 than Cs = n1 Ks = m1
elseif 1<x<2 than Cs = n2 Ks = m2
elseif x > 2 than cd = n3 Ks = m3
end
Alternatively, I can divide the surface in different patches, and specify the roughness for each one.
Does anybody know if one of these two solution is already implemented in OF?
Any other suggestion is welcome!
Thank you, maddalena
maddalena is offline   Reply With Quote

Old   May 28, 2010, 17:19
Default
  #18
Senior Member
 
maddalena's Avatar
 
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23
maddalena will become famous soon enough
Quote:
Originally Posted by AlanR View Post
Using a standard RAS k-epsilon turbulence model, in the /0/nut file replace 'nutWallFunction' with 'nutRoughWallFunction.' To make this work, you need to specify Ks (sand grain roughness height in meters) and Cs, the roughness constant (the link above takes you to the wiki and a good explanation of the model. After some trial and error, I found the correct syntax (for roughness height = 1 mm and Cs = 0.5 is the FLUENT default value - appropriate for pipe flow).

{
type nutRoughWallFunction::Ks;
value uniform 0.001;
type nutRoughWallFunction::Cs;
value uniform 0.5;
}

After finding this, I searched nutRoughWallFunction in the forums. There is a thread in bug fixes: apparently the code in 1.6 resets itself and gives very low values of roughness. This was fixed in version 1.6.x (reported in October). The current git version of 1.6.x should work correctly.
Well.. Since nutRoughWallFunction is defined in 0/nut file for every patch, I simply need to define a different Ks and Cs for the patch I want a different roughness... Yeah, that's sound obvious now!

mad
maddalena is offline   Reply With Quote

Old   June 3, 2010, 14:04
Default
  #19
Senior Member
 
Daniele
Join Date: Feb 2010
Posts: 134
Rep Power: 16
Daniele111 is on a distinguished road
Hi
I'm trying to simulate an atmospheric boundary layer, for K and epsilon what kind of boundary conditions impose you on top and bottom?

Thanks
Daniele111 is offline   Reply With Quote

Old   June 4, 2010, 12:48
Default
  #20
Senior Member
 
Daniele
Join Date: Feb 2010
Posts: 134
Rep Power: 16
Daniele111 is on a distinguished road
In my atmospheric boundary layer simulation, i have this problem, I impose a logarithmic velocity profile at inlet, but when I plot it in paraview in a semilog plot, I don't have a straight line, but two always at 1m from the bottom...I don't understand...the plot of a log in a semilog plot would a straight line. Help me please!

Thanks
Attached Images
File Type: jpg v.jpg (77.1 KB, 390 views)
Daniele111 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Surface roughness in Flow-3d Marco FLOW-3D 3 June 3, 2018 03:15
[Gmsh] Error : Self intersecting surface mesh, computing intersections & Error : Impossible velan OpenFOAM Meshing & Mesh Conversion 3 October 22, 2015 12:05
[Gmsh] Problem with Gmsh nishant_hull OpenFOAM Meshing & Mesh Conversion 23 August 5, 2015 03:09
[Gmsh] boundaries with gmshToFoam‏ ouafa OpenFOAM Meshing & Mesh Conversion 7 May 21, 2010 13:43
CFX4.3 -build analysis form Chie Min CFX 5 July 13, 2001 00:19


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