
[Sponsors] 
May 3, 2005, 03:37 
Hello,
I want to simulate a

#1 
Member
Masashi IMANO
Join Date: Mar 2009
Location: Tokyo, Japan
Posts: 34
Rep Power: 10 
Hello,
I want to simulate a flow around a square prism exposed with a roughwall turbulent boundary layer. For saving a calculation time, I want to use the loglaw wall function with a roughness length instead of putting appropriate rougness blocks on the ground exactly. Loglaw wall function with a roughness length: Uw/U*=ln(hw/z0)/kappa + A where, z0: roughness length Uw: velocity near the ground U*: friction velocity hw: height from the ground kappa, A: parameters This is a my question. [Q] How can I add a new wall function like this? Thanks, Masashi IMANO 

May 3, 2005, 06:14 
At the moment, wall functions

#2 
Senior Member
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 14 
At the moment, wall functions are hardwired into the RANS turbulence models. To add a new wall function, you would have to copy an existing turbulence model and insert your new wall function where appropriate.
Example: kEpsilon model src/turbulenceModels/incompressible/kEpsilon/kEpsilin.C line 88 = # include "wallViscosityI.H" The "wallViscosityI.H" can be found here: src/turbulenceModels/incompressible/wallFunc So copy "wallViscosityI.H" to "roughWallViscosityI.H", modify it as required and include it in a copy of the turbulence model you wish to use. If you are feeling a bit adventurous, making the wall function selectable via a dictionary entry in the turbulenceProperties file would be more elegant. 

May 3, 2005, 06:15 
Are you running LES or RANS?

#3 
Senior Member
Join Date: Mar 2009
Posts: 854
Rep Power: 15 
Are you running LES or RANS?
Currently LES wallfunctions are runtime selectable and it is easy to add new types but RANS wallfunctions are not. I have thought about trying to make RANS wallfunctions runtime selectable but have not yet come up with an elegant solution. If you would like to change the current RANS implementation you will find them in OpenFOAM1.1.1/src/turbulenceModels/compressible/wallFunc for incompressible flow and in OpenFOAM1.1/src/turbulenceModels/compressible/wallFunc for compressible flow. 

May 4, 2005, 03:18 
Sorry, I forgot to mention abo

#4 
Member
Masashi IMANO
Join Date: Mar 2009
Location: Tokyo, Japan
Posts: 34
Rep Power: 10 
Sorry, I forgot to mention about my calculation setup's detail.
1. I'm running highRe RANS. 2. I need to apply the rough wall function only to a ground and other walls should be calculated with normal slip wall function. So I would like to change wall functions whether a wall is a ground or not. Since I'm beginner about both OpenFOAM and C++ language;;, I would like to copy and modify the wall function sources directly, but I still need to switch wall functions with using information of the wall. [Q] How can I switch wall functions according to wall's information(name?) in RANS wall function sources? Thanks for your advice, Masashi IMANO 

May 4, 2005, 03:36 
You could add a test for the p

#5 
Senior Member
Join Date: Mar 2009
Posts: 854
Rep Power: 15 
You could add a test for the patch name to the code in
OpenFOAM1.1.1/src/turbulenceModels/compressible/wallFunc for incompressible flow and in OpenFOAM1.1/src/turbulenceModels/compressible/wallFunc for compressible flow and use your rough wall function on some wall patches and the original form on the rest. 

May 4, 2005, 03:46 
Thanks. I will add a switch to

#6 
Member
Masashi IMANO
Join Date: Mar 2009
Location: Tokyo, Japan
Posts: 34
Rep Power: 10 
Thanks. I will add a switch to the code you advised.
BTW how can I obtain OpenFOAM1.1.1? I could not find out the new release. Thanks in advance, Masashi IMANO. 

May 4, 2005, 04:06 
OpenFOAM1.1.1 is not quite re

#7 
Senior Member
Join Date: Mar 2009
Posts: 854
Rep Power: 15 
OpenFOAM1.1.1 is not quite ready for release yet, in fact it will go out as OpenFOAM1.2 as it includes a substantial number of developments. OpenCFD will release it as soon as possible.


January 22, 2006, 12:39 
Hi,
I´m also trying to implem

#8 
Member
David Segersson
Join Date: Mar 2009
Posts: 39
Rep Power: 10 
Hi,
I´m also trying to implement rough wall functions (with nonuniform roughness...). Is it necessary to make changes anywhere else in the code, besides in the turbulence model, to include roughness effects (e.g. in the velocity b.c.)? Masashi, have you made any progress in your implementation? In that case, it would probably help me a lot if you could post your code here or in the Wiki. Regards David 

January 23, 2006, 00:18 
Hi, David!
I actually imple

#9 
Member
Masashi IMANO
Join Date: Mar 2009
Location: Tokyo, Japan
Posts: 34
Rep Power: 10 
Hi, David!
I actually implemented rough wall functions, but my implementation couldn't handle nonuniform roughness and was very adhoc like this: src/turbulenceModels/incompressible/wallFunc/wallViscosityI.H: if (yPlus > yPlusLam_) { if ((curPatch.name().count('~'))==2) { nutw[facei] = nuw[facei] *(yPlus*kappa_.value()/(log(y_[patchi][facei]/z0_.value()))  1.0); } else if ((curPatch.name().count('^'))==2) { nutw[facei] = nuw[facei] *(1.0/alpha_.value()  1.0); } else { nutw[facei] = nuw[facei] *(yPlus*kappa_.value()/log(E_.value()*yPlus)  1); } } So I'm afraid my code would not help you... Masashi, 

February 27, 2006, 16:52 
Thanks Masashi,
I'm not famil

#10 
Member
David Segersson
Join Date: Mar 2009
Posts: 39
Rep Power: 10 
Thanks Masashi,
I'm not familiar with the "wall viscosity" concept. Could you explain how you go from your wallfunction for velocity to your implementation in wallViscosityI.H? Also, since your formulation of a rough wallfunction differ from the one used in other codes e.g. Fluent, which uses Ks "sand grain roughness" to describe the roughness length, it would be interesting to know if you have evaluated the results from your wallfunction somehow. Regards David 

February 27, 2006, 23:29 
Dear David,
Actually I impl

#11 
Member
Masashi IMANO
Join Date: Mar 2009
Location: Tokyo, Japan
Posts: 34
Rep Power: 10 
Dear David,
Actually I implemented the loglaw wall function with roughness length, but there was little difference between a calculation result with the implemented roughness wall and that with the original smooth wall. As I had no time for finding out the reason at that time, I switched the wall function from the roughness type to the original one. So there is no evaluation about my implementation to show here... Since my mother tongue is not English , it's difficult to explain the "wall viscosity" concept here. So please consult guide books about the numerical calculation of turbulent flow. Regards, Masashi 

February 28, 2006, 07:57 
Wall viscosity is a pretty str

#12 
Senior Member
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 14 
Wall viscosity is a pretty straightforward concept. Really it is just a "trick" to specify the wall shear stress via turbulent viscosity and the noslip velocity boundary conditions.
So tau_w = nut_w * dU/dy where tau_w can be found from some wall function and dU/dy is the wall normal derivative of velocity. See wallFunctions/wallViscosityI.H for details. 

December 13, 2007, 11:00 
Hi all.
I'm solving two phase

#13 
New Member
Hyunchang Lee
Join Date: Mar 2009
Location: Daejeon, Korea
Posts: 11
Rep Power: 10 
Hi all.
I'm solving two phase flow with twoPhaseEulerFoam and I want to implement new drag model. So according to your suggestions, I think it will be better to change the code which exists already(acutally it is schillerNeumann.C) rather than make new code for the drag model. I'm solving new fields, say moments and with those moments, got average diameter fields, let say, volScalarField D10. I want to use this D10 instead phasea_.d() in below code. How can I implement this diameter? I'm not used to C++, so any suggestion and help will be appreciated. Thanks in advance. have fun!! // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // Foam::tmp<foam::volscalarfield> Foam::SchillerNaumann::K ( const volScalarField& Ur ) const { volScalarField Re = max(Ur*phasea_.d()/phaseb_.nu(), scalar(1.0e3)); volScalarField Cds = 24.0*(scalar(1) + 0.15*pow(Re, 0.687))/Re; forAll(Re, celli) { if(Re[celli] > 1000.0) { Cds[celli] = 0.44; } } return 0.75*Cds*phaseb_.rho()*Ur/phasea_.d(); } 

January 17, 2011, 06:19 
roughness

#14 
Member

Hi all of foamers, i hope that you are well
i compiled the new solver with roughness( i modified simpleFoam & i used OF 1.5dev), but my question is how to change the related case to read this coeffs (Ks , Cs)? how to define the BC for this Coeffs? best regards 

September 17, 2015, 08:53 
how to make the new wall function

#15 
Member
Xinguang Wang
Join Date: Feb 2015
Posts: 42
Rep Power: 4 
hi
I find a guide on how to implement a turbulence model in openfoam: http://www.tfd.chalmers.se/~hani/kur...lenceModel.pdf However, I need to implement a new wall function, can I just follow the guide and make the new wall function? Thanks a lot. Jason 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Bug in wall function  rolando  OpenFOAM Bugs  7  June 8, 2007 04:51 
wall function for low Re  M. Essuri  FLUENT  2  December 18, 2006 04:11 
wall function  Alex  CFX  9  May 19, 2005 10:05 
Does RSM use wall function?  Sam  Main CFD Forum  4  March 3, 2005 00:58 
Wall function  MinHua Wang  CFX  4  July 5, 2002 12:13 