CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Turbulence models implementation (

vinz November 2, 2006 04:49

Hi everybody, Since I can't
Hi everybody,

Since I can't obtain expected results with the turbulence models presents in OpenFOAM. I would like to implement two other models, k-omega and SST.
Did someone allready tried this in the past?

Best regards,


vinz November 6, 2006 03:44

Hi everibody, I did the imp
Hi everibody,

I did the implementation of the k-omega turbulence model, and I recompiled the turbuelence models. However, when opening FoamX I don't see my model. Should I recompile the whole code? Or is there any manipulation to do to see a model in FoamX.
Thanks in advance.


dmoroian November 6, 2006 04:19

You don't need to recompile Fo
You don't need to recompile FoamX, just add the proper configuration files. Though, why bother, when you could do what FoamX does directly?


jbrunel November 6, 2006 04:38

Hi Vincent, Just a question :
Hi Vincent,
Just a question : do you intend that model to be part of the public released openfoam distribution.
As there was some interest already expressed within this forum, I suppose that this model is of interest for many other users. (I was planning to do this in the mid term anyway)

And a more general question, this time for anybody : what is the process to follow to have any kind of model being incorporated within the openfoam public release? (the link related to this question in the faq of openCFD website doesn't work)


Jonathan BRUNEL

vinz November 6, 2006 04:58

Hi Jonathan and Dragos, Ok
Hi Jonathan and Dragos,

Ok for the configuration file, I just found it.
Concerning the k-omega model. Before putting it in the public release, I have to test it. But if it works, I would be pleased to see it in the next version of OpenFOAM. I'm also planing to add other models, like SST, if the k-omega implementation works fine.

vinz November 6, 2006 12:02

After the implementation of k-
After the implementation of k-omega model in the source. I tried to run simpleFoam from FoamX (but also using a command line). I end up with the following error:

Foam::error::printStack(Foam:: Ostream&)
Foam::sigSegv:: sigSegvHandler(int)
std::basic_ostream<char,> >& std::operator<<>, std::allocator<char> >(std::basic_ostream<char,> >&, std::basic_string<char,>, std::allocator<char> > const&)
Foam:: OSstream::write(Foam::word const&)
Foam::operator<<(Foam:: Ostream&, Foam::word const&)
simpleFoam [0x805ebf4]
simpleFoam [0x806b2a1]
simpleFoam [0x8056f4d]

Does anyone have any idea of where it can come from?



mattijs November 7, 2006 04:32

Hi Jonathan, if you want to
Hi Jonathan,

if you want to make your code publicly available I guess the best thing is to put it on a central place in the OpenFOAM Wiki (


you could compile your code with -DFULLDEBUG -g -O0 and do a traceback in the debugger.

vinz November 7, 2006 04:46

Hi Mattijs, Should I compil
Hi Mattijs,

Should I compile the turbulence model using:
Allwmake -DFULLDEBUG -g -O0
or should I recompile simpleFoam?
SOrry if my question is stupid, I'm a beginer i the domain.


jbrunel November 7, 2006 05:11

Thank you Mattijs for your ans
Thank you Mattijs for your answer!

mattijs November 7, 2006 13:22

>or should I recompile simpleF
>or should I recompile simpleFoam?

Your traceback shows it is trying to print something ('<<') from simpleFoam so I'd compile that with above debugging. Search this forum for Make/options.

jbrunel November 10, 2006 06:43

Hi Vincent, any success?
Hi Vincent,
any success?

vinz November 10, 2006 07:02

Hi Jonhatan, Unfortunately,
Hi Jonhatan,

Unfortunately, I didn't succes but I'm still working on it. I conduct different things at the same time, so it takes a while to have results. But I don't give up, I let you know as soon as I have interesting results.


panara December 2, 2006 14:31

Dear All, I wrote the k-Ome
Dear All,

I wrote the k-Omega, k-Omega BSL and k-Omega SST turbulence models.

I tested them in a simple channel configuration and they seem to have resonable results.

I post them in the discussion group hoping that you can test them and contribute to their development.. kOmegaTutorials.tar.gz kOmegaTurbulenceModels.tar.gz



egp December 2, 2006 14:39

Hi Daniele, Awesome! I'm a
Hi Daniele,

Awesome! I'm a big fan of k-omega and will test today. By the way, are the designed to also work with wall functions, or are they for sub-layer resolution only?


panara December 2, 2006 15:04

no it works without wall funct
no it works without wall functions you have to specify omega at the boundary equal to 10*6*nu/(beta deltay^2)

I forgot to attach also the turbFoam with a pressure source term to be used with the test cases turbFoamPsource.tar.gz

hani December 6, 2006 03:41

Great Daniele, that is what Op
Great Daniele, that is what OpenSource is all about - sharing and helping eachother. I'm eager to examine your k-omega turbulence models.

I have downloaded your files but when running I ran into some problems, which you might be able to explain to me:

1: The k and omega value at <fixedwalls> had to be rewritten as
type fixedValue;
value uniform 1e-10;
i.e. including 'uniform'

2: I get a Floating exception when the solver reaches the k-equation in tutorial ChannelOmega:
Time = 0.0001
Courant Number mean: 0.0036 max: 0.1
BICCG: Solving for Ux, Initial residual = 1, Final residual = 1.47436e-07, No Iterations 3
BICCG: Solving for Uy, Initial residual = 1, Final residual = 3.0616e-06, No Iterations 2
ICCG: Solving for p, Initial residual = 1, Final residual = 8.87922e-07, No Iterations 16
time step continuity errors : sum local = 1.00885e-12, global = 4.13544e-14, cumulative = 4.13544e-14
ICCG: Solving for p, Initial residual = 0.330426, Final residual = 2.9432e-07,No Iterations 16
time step continuity errors : sum local = 9.1028e-13, global = 1.17317e-13, cumulative = 1.58671e-13
Floating exception

Was your development made in 1.3 or any other version? I managed to compile it for 1.3 (Hrvs development version) without modifications.

I guess that this tutorial runs perfectly for you?
Do you have any ideas what might cause the problem?


vinz December 6, 2006 04:01

Hi, And thanks Daniele sinc

And thanks Daniele since you did what I didn't manage to do.
For me, the tutorial case is running perfectly (at least ChannelOmega, I didn't try the others yet). However, since I want to do the computaion on a flat plat, the first modification that I tried was to separate the <fixedwalls> into two seperated walls (top and down). Strangely, just making this modification, it doesn't work any more (for me). It blows up after two or three time step.Notice thta I kept all the original boundary conditions. (I just separated the one for <fixedwalls> into two similar bc for top and down)
Does somebody have an idea of what could be the problem?
Anyway, this turbulence model will certainly be very helpfull, thanks again.



hani December 6, 2006 06:59

I was using setenv FOAM_SIGFP
I was using
setenv FOAM_SIGFPE 1 #Halts on Nan/Floating Point Exceptions

I.e. there is a problem somewhere with floating point exceptions.

Without this environment variable everything seems to work fine.

Is there a way to name the library to something else than I want to be able to use the original library in other runs without having to modify LD_LIBRARY_PATH all the time.


hani December 6, 2006 08:47

Maybe you already have a nice
Maybe you already have a nice way of doing turbulence model development, but here's an example of how you can do it without affecting executables linking with the original

Make a src directory in your $WM_PROJECT_USER_DIR
Put Daniele's turbulenceModels directory in that src directory (the turbulenceModels directory should have the same structure as that in the OpenFOAM src directory)

Modify the following files according to:
LIB = $(FOAM_USER_LIBBIN)/libincompressibleTurbulenceModelsOmega
(gives your new library a different name than the original one)

-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(WM_PROJECT_USER_DIR)/src/turbulenceModels \

-lincompressibleTurbulenceModelsOmega \
-lincompressibleTransportModels \
-lfiniteVolume \

There might be a nicer way to do this, but at least this seems to work.


panara December 7, 2006 15:56

Sorry for the late reply, I
Sorry for the late reply,

I made the models with OF 1.3.

The floating point exception could come from some division with zero.. try to initialize the field with small value of k and omega and see if you have the same problem... It could be that I have forgotten somewhere to prevent division with zero..

for the error of vincent.. I have no idea why you get this error, can you post the BC you are using?

Hakan, thanks for the tipp about the linking, I was wondering how to overcome the same problem but I didn't have much time to look at the problem more in details..

I will try your way..


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