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

Adding a Turbulence Model

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By doug

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 21, 2007, 16:34
Default I'm trying to implement a new
  #1
Member
 
Doug Hunsaker
Join Date: Mar 2009
Location: Logan, UT
Posts: 63
Rep Power: 17
doug is on a distinguished road
I'm trying to implement a new turbulence model. I've read through many of the other posts about implementing the k-omega model from the wiki into 1.3:
http://www.cfd-online.com/OpenFOAM_D...tml?1168380100

In 1.4, this model comes built-in, so I'd like to jump straight to implementing my own model. I've created a directory user/src/turbulenceModels/incompressible into which I copied the following directories from the OF/src/turbulenceModels/incompressible folder: laminar, lnInclude, Make, turbulenceModel, and wallFunctions. I then added my own directory called myKEpsilon which is basically a copy of the original kEpsilon src files renamed (just to learn how to link this turbulence model into the code).

I then changed the Make/files file to:
turbulenceModel/turbulenceModel.C
turbulenceModel/newTurbulenceModel.C
laminar/laminar.C
myKEpsilon/myKEpsilon.C

wallFunctions/nutWallFunction/nutWallFunction/nutWallFunctionFvPatchScalarField. C
wallFunctions/nutWallFunction/nutStandardWallFunction/nutStandardWallFunctionFvP atchScalarField.C
wallFunctions/nutWallFunction/nutStandardRoughWallFunction/nutStandardRoughWallF unctionFvPatchScalarField.C

LIB = $(FOAM_USER_LIBBIN)/libincompressibleTurbulenceModels


Then I tried to compile by using the ./Allwmake in the user/src/turbulenceModels directory and got the following error:
doug@dell:~/OpenFOAM/doug-1.4/src/turbulenceModels> ./Allwmake
Making dependency list for source file myKEpsilon/myKEpsilon.C
SOURCE=myKEpsilon/myKEpsilon.C ; g++ -m32 -Dlinux -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -I/home/doug/OpenFOAM/OpenFOAM-1.4/src/finiteVolume/lnInclude -I/home/doug/OpenFOAM/OpenFOAM-1.4/src/meshTools/lnInclude -I/home/doug/OpenFOAM/OpenFOAM-1.4/src/transportModels -IlnInclude -I. -I/home/doug/OpenFOAM/OpenFOAM-1.4/src/OpenFOAM/lnInclude -fPIC -pthread -c $SOURCE -o Make/linuxGcc4DPOpt/myKEpsilon.o
myKEpsilon/myKEpsilon.C: In constructor 'Foam::turbulenceModels::myKEpsilon::myKEpsilon(co nst Foam::volVectorField&, const Foam::surfaceScalarField&, Foam::transportModel&)':
myKEpsilon/myKEpsilon.C:52: error: 'Foam::IOobject' is an ambiguous base of 'Foam::fvMesh'
myKEpsilon/myKEpsilon.C: In member function 'virtual bool Foam::turbulenceModels::myKEpsilon::read()':
myKEpsilon/myKEpsilon.C:97: error: 'turublenceModel' has not been declared
myKEpsilon/myKEpsilon.C: In member function 'virtual void Foam::turbulenceModels::myKEpsilon::correct()':
myKEpsilon/myKEpsilon.C:135: error: 'sp' is not a member of 'Foam::fvm'
myKEpsilon/myKEpsilon.C:153: error: 'class Foam::volScalarField' has no member named 'k_'
make: *** [Make/linuxGcc4DPOpt/myKEpsilon.o] Error 1


Any ideas? It seems to me that implementing a new turbulence model should be quite common, and therefore well documented somewhere. However, I haven't found much help on the wiki or the discussion board. Any guidance to better documentation would also be appreciated.

Thanks.

-doug
kiddmax likes this.
doug is offline   Reply With Quote

Old   June 21, 2007, 16:55
Default Hello Doug, you don't need to
  #2
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Hello Doug,
you don't need to change all those files to implement a new turbulence model in OpenFOAM. You just need to:

- Look for the model closest to the one you want to add. For example, for an incompressible k-eps model, consider the files in incompressible/kEpsilon.

- Copy the kEpsilon directory and rename it.

- Modify the class name (files, code).

- Modify the code according to the two-equation model you want.

- Create make rules (look at the content of the Make directory).

This is everything for the equations part.

For the wall-functions, the procedure is the same, but take the content of the wallFunctions directory.

With kind regards,
Alberto
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   June 21, 2007, 17:14
Default Alberto- Thanks a ton! It w
  #3
Member
 
Doug Hunsaker
Join Date: Mar 2009
Location: Logan, UT
Posts: 63
Rep Power: 17
doug is on a distinguished road
Alberto-

Thanks a ton! It worked perfectly.

-Doug
doug is offline   Reply With Quote

Old   November 10, 2007, 05:16
Default ALBERTO I need more dtails
  #4
Member
 
Mojtaba Shahmohammadian
Join Date: Mar 2009
Posts: 73
Rep Power: 17
msha is on a distinguished road
ALBERTO

I need more dtails about the steps

(I mean)HOW to add a new model in details
msha is offline   Reply With Quote

Old   September 25, 2012, 07:23
Default Problem with Wmake Libso
  #5
New Member
 
neeraj's Avatar
 
OpenFoam
Join Date: Jul 2012
Posts: 24
Rep Power: 13
neeraj is on a distinguished road
I am trying to implement the myKepsilon turbulence model to run the pitzDaily tutorial in OF 2.1.1

1) I followed all the step by step instruction given in the Wiki SIG without any changes. Wmake libso gave me following output:

http@http-OptiPlex-990:~/OpenFOAM/http-2.1.1/mykEpsilon$ wmake libso
wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file mykEpsilon.C
could not open file RASModel.H for source file mykEpsilon.C
could not open file backwardsCompatibilityWallFunctions.H for source file mykEpsilon.C
SOURCE=mykEpsilon.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam211/src/finiteVolume/lnInclude -I/opt/openfoam211/src/meshTools/lnInclude -I/opt/openfoam211/src/turbulenceModels -I/opt/openfoam211/src/transportModels -I/opt/openfoam211/src/turbulenceModels/incompressible/lnInclude -IlnInclude -I. -I/opt/openfoam211/src/OpenFOAM/lnInclude -I/opt/openfoam211/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/mykEpsilon.o
In file included from mykEpsilon.C:26:0:
mykEpsilon.H:49:22: fatal error: RASModel.H: No such file or directory
compilation terminated.
make: *** [Make/linux64GccDPOpt/mykEpsilon.o] Error 1

Please give me a solution...!

2)Also in the next step we need to add libs ("libmyTurbulenceModels.so"); to the controldict file of system folder. Can i add it anywhere or specifically inside any loop?
neeraj is offline   Reply With Quote

Old   September 28, 2012, 04:14
Default please help..!
  #6
New Member
 
neeraj's Avatar
 
OpenFoam
Join Date: Jul 2012
Posts: 24
Rep Power: 13
neeraj is on a distinguished road
anyone here ready to help me... please... im stuck with my project..!!
neeraj is offline   Reply With Quote

Old   September 28, 2012, 05:45
Default
  #7
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 21
Bernhard is on a distinguished road
1)
The error message reads RASModel.H cannot be found. This is probably due to the fact that the reference in Make/options is not correct. Probably you should as this line -I$(LIB_SRC)/turbulenceModels/incompressible/RAS/lnInclude

2) It doesn't really matter where you put it.
Bernhard is offline   Reply With Quote

Old   October 1, 2012, 09:12
Default
  #8
New Member
 
neeraj's Avatar
 
OpenFoam
Join Date: Jul 2012
Posts: 24
Rep Power: 13
neeraj is on a distinguished road
Thank you Bernhard..! :-)

mykEpsilon.C:46:1: error: ‘Info’ does not name a type


Now i got this error by trying to add an "info" statement into mykEpsilon.C file as explained in this tutorial.



i am using OF 2.1.1. Can you help me to resolve this problem?
neeraj is offline   Reply With Quote

Old   October 1, 2012, 09:26
Default
  #9
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 21
Bernhard is on a distinguished road
What is the code that gives you this error?
Bernhard is offline   Reply With Quote

Old   October 2, 2012, 06:41
Default
  #10
New Member
 
neeraj's Avatar
 
OpenFoam
Join Date: Jul 2012
Posts: 24
Rep Power: 13
neeraj is on a distinguished road
Plz find the attached folder for mykEpsilon solver.
Attached Files
File Type: zip mykEpsilon.zip (13.3 KB, 80 views)
neeraj is offline   Reply With Quote

Old   October 2, 2012, 06:55
Default
  #11
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 21
Bernhard is on a distinguished road
You're using this info statement on an unusual location, which is probably the reason that it doesn't work. I assume that it gives no difficulties if you put it inside the constructor.
Bernhard is offline   Reply With Quote

Old   May 21, 2018, 13:54
Default PANS turbulence model+ simpleFoam
  #12
New Member
 
Amir-hossein Mokhtari
Join Date: Mar 2015
Posts: 13
Rep Power: 11
kolahefereshte is on a distinguished road
Hi my friends
I do not know what changes should be made fvSchemes and fvSolution or eAnywhere else for use PANS turbulence model.


help me.



tanx
sajjad alimardani.
kolahefereshte is offline   Reply With Quote

Reply


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
turbulence model elkan FLUENT 3 June 13, 2007 03:42
V2F turbulence model Luke CFX 2 May 19, 2007 07:38
changing model constants in k-e turbulence model Sunil CFX 3 October 3, 2006 12:12
HELP! TURBULENCE k-e OR k-omega TURBULENCE MODEL? Mirek Kabacinski FLUENT 5 August 24, 2003 22:31
adding turbulence models to CFX Steve Collie CFX 0 January 30, 2001 16:32


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