CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Adding a Turbulence Model (http://www.cfd-online.com/Forums/openfoam-solving/59325-adding-turbulence-model.html)

doug June 21, 2007 16:34

I'm trying to implement a new
 
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

alberto June 21, 2007 16:55

Hello Doug, you don't need to
 
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

doug June 21, 2007 17:14

Alberto- Thanks a ton! It w
 
Alberto-

Thanks a ton! It worked perfectly.

-Doug

msha November 10, 2007 05:16

ALBERTO I need more dtails
 
ALBERTO

I need more dtails about the steps

(I mean)HOW to add a new model in details

neeraj September 25, 2012 07:23

Problem with Wmake Libso
 
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 September 28, 2012 04:14

please help..!
 
anyone here ready to help me... please... im stuck with my project..!! :(

Bernhard September 28, 2012 05:45

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.

neeraj October 1, 2012 09:12

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?

Bernhard October 1, 2012 09:26

What is the code that gives you this error?

neeraj October 2, 2012 06:41

1 Attachment(s)
Plz find the attached folder for mykEpsilon solver.

Bernhard October 2, 2012 06:55

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.


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