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

Implementation of turbulence model

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 20, 2013, 11:08
Default Implementation of turbulence model
  #1
Member
 
Join Date: Aug 2011
Posts: 74
Rep Power: 5
idefix is on a distinguished road
Hello

I am trying to implement a new turbulence model, but it does not work.

Here are the steps I did:

user:~/OpenFOAM> mkdir OpenFOAM-2.1.1-user
user:~/OpenFOAM> cd OpenFOAM-2.1.1
user:~/OpenFOAM/OpenFOAM-2.1.1> cp -r --parents src/turbulenceModels/incompressible/RAS/kEpsilon ../OpenFOAM-2.1.1-user
user:~/OpenFOAM/OpenFOAM-2.1.1> cd ../OpenFOAM-2.1.1-user/src/turbulenceModels/incompressible/RAS
user:~/OpenFOAM/OpenFOAM-2.1.1-user/src/turbulenceModels/incompressible/RAS> mv kEpsilon/ VOFkEpsilon
user:~/OpenFOAM/OpenFOAM-2.1.1-user/src/turbulenceModels/incompressible/RAS> cd VOFkEpsilon/
user:~/OpenFOAM/OpenFOAM-2.1.1-user/src/turbulenceModels/incompressible/RAS/VOFkEpsilon> mv kEpsilon.H VOFkEpsilon.H
user:~/OpenFOAM/OpenFOAM-2.1.1-user/src/turbulenceModels/incompressible/RAS/VOFkEpsilon> mv kEpsilon.C VOFkEpsilon.C
user:~/OpenFOAM/OpenFOAM-2.1.1-user/src/turbulenceModels/incompressible/RAS/VOFkEpsilon> sed s/kEpsilon/VOFkEpsilon/g VOFkEpsilon.C > temp
user:~/OpenFOAM/OpenFOAM-2.1.1-user/src/turbulenceModels/incompressible/RAS/VOFkEpsilon> mv temp VOFkEpsilon.C
user:~/OpenFOAM/OpenFOAM-2.1.1-user/src/turbulenceModels/incompressible/RAS/VOFkEpsilon> sed s/kEpsilon/VOFkEpsilon/g VOFkEpsilon.H > temp
user:~/OpenFOAM/OpenFOAM-2.1.1-user/src/turbulenceModels/incompressible/RAS/VOFkEpsilon> mv temp VOFkEpsilon.H
user:~/OpenFOAM/OpenFOAM-2.1.1-user/src/turbulenceModels/incompressible/RAS/VOFkEpsilon> ll
kEpsilon.dep
VOFkEpsilon.C
VOFkEpsilon.H

user:~/OpenFOAM/OpenFOAM-2.1.1-user/src/turbulenceModels/incompressible/RAS/VOFkEpsilon> cp -r $FOAM_SRC/turbulenceModels/incompressible/RAS/Make .
user:~/OpenFOAM/OpenFOAM-2.1.1-user/src/turbulenceModels/incompressible/RAS/VOFkEpsilon> ll
Make
VOFkEpsilon.C
VOFkEpsilon.H
user:~/OpenFOAM/OpenFOAM-2.1.1-user/src/turbulenceModels/incompressible/RAS/VOFkEpsilon> vi Make/files
In line 20 add: VOFkEpsilon/VOFkEpsilon.C
Finish with :wq
user:~/OpenFOAM/OpenFOAM-2.1.1-user/src/turbulenceModels/incompressible/RAS/VOFkEpsilon> vi Make/options
I added -I$(LIB_SRC)/turbulenceModels/RAS/incompressible/lnInclude
The final file looks like
EXE_INC = \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/turbulenceModels/incompressible/RAS/lnInclude
LIB_LIBS = \
-lincompressibleTurbulenceModel \
-lfiniteVolume \
-lmeshTools

Finish with :wq
user:~/OpenFOAM/OpenFOAM-2.1.1-user/src/turbulenceModels/incompressible/RAS/VOFkEpsilon> vi VOFkEpsilon.C
In line 57 ad: Info << "my VOFkepsilon model" << endl;
Finish with :wq
user:~/OpenFOAM/OpenFOAM-2.1.1-user/src/turbulenceModels/incompressible/RAS/VOFkEpsilon> wmake libso
wmakeLnInclude: linking include files to ./lnInclude
make: *** No rule to make target »RASModel/RASModel.dep«,
needed by »Make/linux64GccDPOpt/dependencies« Stop.

Can anyone help me what I am doing wrong?

Thanks a lot
idefix is offline   Reply With Quote

Old   March 20, 2013, 11:19
Default
  #2
Senior Member
 
Lieven
Join Date: Dec 2011
Location: Mol, Belgium
Posts: 295
Rep Power: 13
Lieven will become famous soon enough
Hi Idefix,

You were a bit too enthusiastic with copying everything
Remove the Make/files you copied and replace it by a new Make/files file with the (only!) following lines:

Code:
VOFkEpsilon.C

LIB = $(FOAM_USER_LIBBIN)/libextendedRASModels
where libextendedRASModels is the name of the library you are creating

In the case where you want to use the turbulence model, you should add
Code:
libs
(
    "libOpenFOAM.so"
    "libextendenRASModels.so"
);
at the bottom of the system/controlDict.

If something goes wrong, feel free to let us know.

Cheers,

L
Lieven is offline   Reply With Quote

Old   March 26, 2013, 05:39
Default
  #3
Member
 
Join Date: Aug 2011
Posts: 74
Rep Power: 5
idefix is on a distinguished road
Thanks for your help.

Everything is working now

If anyone has the same problem, here is the last step you have to do to finish the implementation:

Go to constant/RASProperties
Add: RASModel VOFkEpsilon;

Cheers
idefix is offline   Reply With Quote

Old   March 26, 2013, 11:01
Default
  #4
Member
 
Join Date: Aug 2011
Posts: 74
Rep Power: 5
idefix is on a distinguished road
Hello,

now I´ve got the next problem

I want to implement a term which uses alpha1

but what ever I did, I always get the massage:
alpha1 was not declared in this scope

What did I forget to add?

Thanks for your help
idefix is offline   Reply With Quote

Old   March 26, 2013, 11:04
Default
  #5
Senior Member
 
Lieven
Join Date: Dec 2011
Location: Mol, Belgium
Posts: 295
Rep Power: 13
Lieven will become famous soon enough
Hi Idefix,

You really should define the problem a bit better if you want us to be able to help us...

What does this alpha1 represent. Is it a const parameter of the turbulence model? Is it a volScalarField? Does it only show up in the turbulence model equations?

Cheers,

Lieven
Lieven is offline   Reply With Quote

Old   March 27, 2013, 02:22
Default
  #6
Member
 
Join Date: Aug 2011
Posts: 74
Rep Power: 5
idefix is on a distinguished road
oh sorry, I forget

alpha1 is defined in the User´s Guide:
http://www.openfoam.org/docs/user/damBreak.php (chapter 2.3.3)

alpha1 is the phase fraction and is used in the VOF-model. I refer to the solver interFoam.

alpha1 = 1: the phase is liquid
alpha1 = 0: the phase is gaseous
0 < alpha1 < 1: there is the interface between two phases in this cell

alpha1 is a volScalarField

Do you understand this explanation? If it´s not the case, please ask. I´ll try to explain it in more detail.

Thanks again

Cheers

Last edited by idefix; March 27, 2013 at 05:31.
idefix is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Centrifugal Pump and Turbulence Model Michiel CFX 12 January 25, 2010 04:20
turbulence model equation Andy Chen FLOW-3D 4 January 1, 2010 22:45
SA Turbulence model implementation ganesh Main CFD Forum 0 March 6, 2006 13:23
k-w Turbulence model implementation suneesh Main CFD Forum 4 November 23, 2005 18:35
A reference on implementation of Spalart-Alam. Turbulence Model? Mohammad Kermani Main CFD Forum 2 December 26, 1999 03:56


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