CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Implementation of turbulence model (http://www.cfd-online.com/Forums/openfoam-programming-development/114952-implementation-turbulence-model.html)

idefix March 20, 2013 11:08

Implementation of turbulence model
 
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

Lieven March 20, 2013 11:19

Hi Idefix,

You were a bit too enthusiastic with copying everything :D
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

idefix March 26, 2013 05:39

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 March 26, 2013 11:01

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

Lieven March 26, 2013 11:04

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

idefix March 27, 2013 02:22

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


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