|
[Sponsors] |
![]() |
![]() |
#1 |
New Member
David Egede Fich
Join Date: Mar 2009
Location: Aalborg, Denmark
Posts: 1
Rep Power: 0 ![]() |
Hi.
I have recently started modelling in OpenFOAM and I need to run a kEpsilon model on a duct with surface roughness on the bottom wall. Is there any way to do this in OpenFOAM? I fear that I have to write the C++ code on my own which would probably take more time than I have. Sincerely David Fich |
|
![]() |
![]() |
![]() |
![]() |
#2 |
New Member
Andrea M.A. Barbera
Join Date: Mar 2009
Location: Turin, Italy
Posts: 7
Rep Power: 17 ![]() |
Hi,
I have a similar problem and I have discovered that a way to consider roughness is perhaps already implemented. Unfortunately I'm not able to apply it. In the folder ~/OpenFOAM/OpenFOAM-1.5/src/turbulenceModels/RAS/compressible/wallFunctions/mutW allFunctions/mutStandardRoughWallFunction a BC which allows to consider roughness is implemented, but, sincerely, I do not understand how to apply it (to K or Epsilon, perhaps?) and what is the meaning of the two constants "roughnessConstant" and "roughnessFudgeFactor". Can someone please illustrate how to apply this BC? Regards Andrea |
|
![]() |
![]() |
![]() |
![]() |
#3 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,901
Rep Power: 37 ![]() ![]() |
Hi Andrea and David
A lot of discussions about roughnesses and turbulencemodels can be found here: http://www.cfd-online.com/OpenFOAM_D...es/1/5791.html Please note that it contains some of my own work, and that it has not been validated. Just implemented directly out of the textbook. Best regards
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request. |
|
![]() |
![]() |
![]() |
![]() |
#4 |
Super Moderator
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 29 ![]() ![]() |
I have added surface roughness according to the fluent manual.
found for instance here http://web.njit.edu/topics/Prog_Lang_Docs/html/FLUENT/fluent/fluent5/ug/html/nod e195.htm What I did was to add Ks_ ( dimensioned<scalar>::lookupOrAddToDict ( "Ks", subDict("wallFunctionCoeffs"), 0.0 ) ), Cs_ ( dimensioned<scalar>::lookupOrAddToDict ( "Cs", subDict("wallFunctionCoeffs"), 0.0 ) ), to RASModel.H and the corresponding stuff in RASModel.C and in wallViscosityI.H i modified the for-loop to forAll(curPatch, facei) { label faceCelli = curPatch.faceCells()[facei]; scalar uStar = Cmu25*sqrt(k_[faceCelli]); scalar yPlus = y_[patchi][facei]*uStar/nuw[facei]; scalar KsPlus = Ks_.value()*uStar/nuw[facei]; // hydrodynamically smooth scalar logDB = 1.0; if (KsPlus > 2.25) { // fully rough if (KsPlus > 90.0) { logDB = 1.0 + Cs_.value()*KsPlus; } else // transitional { scalar n = ::sin(0.4258*(log(KsPlus) - 0.811)) scalar a = (KsPlus - 2.25)/87.75 + Cs_.value()*KsPlus; logDB = ::pow(a, n); } } if (yPlus > yPlusLam_) { nutw[facei] = nuw[facei] *(yPlus*kappa_.value()/log(E_.value()*yPlus/logDB) - 1); } else { nutw[facei] = 0.0; } } using the facts that log(A)-log(B) = log(A/B) log(A)*n = log(A^n) you essentially just need to divide the wall constant E with the variable logDB. Normally setting the constants to zero would revert to the normal smooth approach, but not here and that is easily fixed also. But is there anything else I need to modify that I have missed or is this all I have to do? N |
|
![]() |
![]() |
![]() |
![]() |
#5 |
Senior Member
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23 ![]() |
Dear Niklas,
thanks for your contribution, the piece of code you pasted above is exactly what I need! I have a couple of questions for you: 1) What do you mean when you said: "you essentially just need to divide the wall constant E with the variable logDB"? Do you mean I need to do some extra calculation in order to define properly E in the RASProperty file? Or can I set E arbitrairly, i.e. to zero? 2) Is this piece of code tested for OF 1.5? I think so, but I just want to be sure... Thanks! Mad |
|
![]() |
![]() |
![]() |
![]() |
#6 |
Super Moderator
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 29 ![]() ![]() |
||
![]() |
![]() |
![]() |
![]() |
#7 |
Senior Member
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23 ![]() |
Hi Niklas,
one more basic question... Since I do not want to change OF original files, I want to copy the turbFoam solver, rename it and change references to the new IncompressibleWallRoughness RANS, that I will copy as well. Thus, I followed the user guide: 1) take $WM_PROJECT_DIR/applications/solvers/incompressible/turbFoam and copy it to $WM_PROJECT_USER_DIR/applications/solvers/myFoam 2) change filename turbFoam.C to myFoam.C 3) change /Make/files to match my application name 4) change EXE = $(FOAM_APPBIN)/turbFoam to EXE = $(FOAM_USER_APPBIN)/myFoam 5) wclean and wmake libso No error displayed during the compilation. However, when I want to use myFoam as a solver, I get bash: myFoam: command not found. It seems that my solver is not defined. I am sure I am missing something, but I do not know what!!! Could you help me? Thanks a lot! Mad |
|
![]() |
![]() |
![]() |
![]() |
#8 |
Senior Member
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23 ![]() |
I got it! I missed this: rm -rf linuxGccDP0pt after point 4)! ;O)
|
|
![]() |
![]() |
![]() |
![]() |
#9 |
Super Moderator
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 29 ![]() ![]() |
by not specifying the Ks and Cs values, the original way of doing things will be used. (or by setting Ks to zero).
no need to copy turbFoam, nothing will change there. |
|
![]() |
![]() |
![]() |
![]() |
#10 |
New Member
Join Date: Mar 2009
Posts: 20
Rep Power: 17 ![]() |
Hi all!
I am interested in applying a variable roughness along a surface (wall). Does anyone know whether it is possible or not using OpenFoam? Every post I read and code i see, roughness was considered constant ... Thanks in advance, X |
|
![]() |
![]() |
![]() |
![]() |
#11 |
Super Moderator
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 29 ![]() ![]() |
When you say variable, is it a function variable, or do you have different walls with different constants?
|
|
![]() |
![]() |
![]() |
![]() |
#12 |
New Member
Join Date: Mar 2009
Posts: 20
Rep Power: 17 ![]() |
||
![]() |
![]() |
![]() |
![]() |
#13 |
Super Moderator
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 29 ![]() ![]() |
||
![]() |
![]() |
![]() |
![]() |
#14 |
New Member
Join Date: Mar 2009
Posts: 20
Rep Power: 17 ![]() |
Hi Niklas,
Before starting with variable roughness I finally decided to implement first a simple constant roughness. I found your piece of code and I add it and had a little problem. It is quite strange because although Cs_ and Ks_ are declared in Rasmodel.c and set up in Rasmodel .h I get an error saying : .../wallFunction/wallViscosityI.H : error :'Cs_' was not declared in the scope. .../wallFunction/wallViscosityI.H : error :'Ks_' was not declared in the scope. And its strange because the definition of kappa as well as E is the same as Cs and Ks and everything it is ok with them. so Do you know why it can be? Thank you. |
|
![]() |
![]() |
![]() |
![]() |
#15 |
New Member
Qi Ying
Join Date: Mar 2009
Posts: 6
Rep Power: 17 ![]() |
Hi All,
I am a new user of OF and I justed added Niklas's roughness wall code mentioned in this thread. I would like to write a postprocessing code that saves the KsPlus values just like the yPlusRAS utility. I know KsPlus=uStar*Ks/nuw but how can I access uStar, Ks and nuw in the program. I am trying to modify the yPlusRAS code but don't know how to get these variables. Any help is appreciated. Thanks, Qi |
|
![]() |
![]() |
![]() |
![]() |
#16 |
New Member
Nestor Rueda
Join Date: Mar 2009
Posts: 9
Rep Power: 17 ![]() |
hi Niklas
maybe i'm forgetting something but I modified all the files mentioned in the wiki and recompiled again, but I do not get any change in my results when I change the values of Cs, Ks. could you tell me what I'm forgetting? I'm usign k-e, simplefoam. I would expect to see a pressure drop with the increase of Ks. Regards Nestor |
|
![]() |
![]() |
![]() |
![]() |
#17 |
New Member
Peter Skrifvars
Join Date: Oct 2009
Posts: 3
Rep Power: 16 ![]() |
Hi,
I did the changes (OF1.5) described in the Wiki page (or I thought I did) and I get the following error: LHS and RHS of + have different dimensions dimensions : [0 2 -3 0 0 0 0] + [0 2 -2 0 0 0 0] |
|
![]() |
![]() |
![]() |
![]() |
#18 |
Senior Member
Join Date: Jan 2010
Location: Stuttgart
Posts: 150
Rep Power: 16 ![]() |
I am working with OF 1.6. I would like to know, where I should define the variables Ks and Cs when i am using roughWallfunctions. Must this be done in the RasProperties file or some where else. What I have to write to force Ks and Cs?
Regards Chrisi |
|
![]() |
![]() |
![]() |
![]() |
#19 |
New Member
Burak
Join Date: Nov 2012
Posts: 14
Rep Power: 13 ![]() |
Hello Maybe it's a long history but I couldn't find the answer
I have terrain map I want to add roughness lenght to z0.I am trying to convert the simpleFOAM case for wind turbine siting;There the z0 roughness height is defined in ABLconditions as a single value.I would like to include a matrix to define the roughness on the ground patch. At least I would like to create a patch saying "the points inside the patch should have z0=0.1 instead of z0=0.05"so being able to manually include the variable roughness crudely. Is this possible? Here Mr. Hanael compiled a code that implements Mr.Tapia's Master Thesis as basis. https://github.com/hananel/roughnessToFoam However I don't have wasp *.map file, only coordinates and roughness values and I don't quite get the idea to implement a OpenFOAM source code. How does for example internalField nonuniform List<Vector> work out?How can I call the <Vector> part from another file.I guess my solution lies there. Many thanks Regards Burak |
|
![]() |
![]() |
![]() |
![]() |
#20 | |
Senior Member
|
Quote:
Have you found any solutions to this? Before reading your post, I was dividing my ground surface into multiple surfaces using my CAD program, and then in the next step, I defined each of those surfaces as separate wall boundary conditions, and at last in openFOAM while assigning boundary conditions, I set different z0 values for each of those surfaces. I mean something like this: ground_rough { type nutkAtmRoughWallFunction; value uniform 0; z0 $z0_rough; } ground_smooth { type nutkAtmRoughWallFunction; value uniform 0; z0 $z0_smooth; } But, I think this is wrong. because I see some discontinuities between borders of these surfaces. Now that I have read your post, I think it is a great idea to use nonuniform List<Vector> to define various z0 values to a surface and not by dividing it into multiple surfaces. but right now I have no idea how to define z0 value for each surface cells. Do you have anything in mind to share with me? Thank you, Warmest wishes, Mojtaba
__________________
Learn OpenFOAM in Persian SFO (StarCCM+ FLUENT OpenFOAM) Project Team Member Complex Heat & Flow Simulation Research Group If you can't explain it simply, you don't understand it well enough. "Richard Feynman" |
||
![]() |
![]() |
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Surface roughness | Rajesh | CFX | 1 | February 10, 2008 16:36 |
surface roughness in HTC | Trang | CFX | 0 | August 4, 2007 03:51 |
CCM+ Surface Roughness | AJ | Siemens | 3 | March 8, 2006 18:14 |
surface roughness | sankar | Siemens | 1 | November 8, 2004 10:36 |
Surface roughness | Peter | Main CFD Forum | 9 | July 19, 2001 11:29 |