CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   KOmega Turbulence model from wwwopenFOAMWikinet (

philippose March 4, 2007 15:08

Hello, Yet another blue Sun

Yet another blue Sunday to everyone!

I had been thinking about integrating the k-omega turbulence models available in the OpenFOAM Wiki into my version of openFOAM for a long time, and today I decided to take the jump.....

Well...the fact that I am writing this would make it clear that I hit bottom faster than I expected :-)!

Anyway... I downloaded the files, and extracted them into the turbulence models directory of the OpenFOAM source, and modified "files" in "Make" to include the k-Omega models.

I replaced the "turbulenceModel.C" and .H with "turbulenceModelOmega.C" and .H, and also the file "laminar.C" and .H with "laminarOmega.C" and .H

The compilation went through very smoothly.... ending up with a successful library of turbulence models (I "added" on the k-Omega models along with the existing turbulence models, rather than replacing the entire set with only the k-Omega models)

However, it seems that the files available at the wiki are not really geared towards co-existing with the other turbulence models....

When I tried running turbFoam with the kEpsilon model after recompiling the turbulence model with kOmega included, it gave me an error and quit.

On looking into the file "turbulenceModelOmega.C", I found that occurances of "epsilon" had been replaced with "omega".... which means the k-Epsilon model wouldnt work (I think).

Has anyone successfully integrated the k-Omega turbulence models into an existing openFOAM installation such that all the other models work too? And if so, could I get some pointers?

Have a nice day!


panara March 5, 2007 04:56

Hi Philippose, (Philippose
Hi Philippose,

(Philippose is your name or surname? =) )

just follow the tread

I followed as well the good suggestions of Bernhard Gschaider and I have now two libraries for k-omega and k-omega compressible turbulence models that work perfectly together with the old k-epsilon models,

I will upload them in the wiki as soon as I find some time..


philippose March 5, 2007 07:08

Hi Daniele, Thanks for the
Hi Daniele,
Thanks for the response, and a good day to you :-)!

Last night after posting the message, I tried making a second library... following the suggestions of Bernhard Gschaider... and it works fine now :-)! (Though, I havent tried the k-omega models yet)

Now that I have the system up and running... here come the questions regarding the turbulence model itself...

Could you give me a brief overview of the situations in which one would use the BSL, SST and SSTsas variants of the k-Omega turbulence model?

If I am not mistaken, the SST and SSTsas models do not use wall functions right? Is there anything special I need to specify...? Or can I still use the "wall" boundary condition for a wall?

And as for starting values of omega... is there a manner in which I could calculate a realistic starting value like in the case of the k-epsilon models (using the equations for k and epsilon with expected maximum velocities i.e.)?

Hmmm... well.. thats all I can think of at the moment :-)!

Have a nice day!

(Philippose is my first name.. so your usage was right :-)!)


philippose March 5, 2007 14:51

Hello, Just a status update
Just a status update.... As I mentioned before, I had compiled the k-Omega turbulence models into a separate library as suggested by Bernhard Gschaider.

Some time back I recompiled one of the solvers (a variant of simpleFoam) after including the k-Omega library into the "options" file.

Things are working fine, and I was able to select the k-Omega turbulence model... the simulation is currently running, but intermediate results are looking good :-)! So far.. converging very comfortably... shall get back regarding accuracy (compared to experiments).

The k-Epsilon model gave me around 7% error on the flow compared to measurements... hoping to get something better with the k-Omega!

I would still like you to give me an insight into the other k-Omega model types (BSL, SST and SSTsas) :-)!

Have a nice day!


panara March 6, 2007 06:01

Hi Philippose, I suggest y
Hi Philippose,

I suggest you to read the articles I used as reference for the model implementation (see the Wiki)

in short, the k-omega BSL is a mix of k-omega near the wall and k-epsilon outside the near wall region.
This is done because it is easier to give freestream condition in terms of epsilon rather than omega.

at the wall you have to specify omega using the relation


where Dy1 is the distance from the wall at the first grid point. Dy1 should be in the laminar sublayer.

In the freestream remember that omega is
equal to epsilon/k.

The k-Omega SST is the same as the BSL but it satisfy also the Bradshaw assumption that the shear stress in a boundary layer is proportional to the turbulent kinetic energy. (see the article for details)

The k-Omega SST sas is very different. In stable flow it behaves exactly as the k-Omega SST but in 3D flows with instabilities it behaves like an LES computation. When instabilities appear the model tends to decrease the turbulent viscosity up to the LES like value. The result is analogous to a LES computation. (see articles for details)

Hope that this helps you,

have fun,

philippose March 6, 2007 14:04

Hi again, Thanks for the cl
Hi again,
Thanks for the clean and precise descriptions of the k-Omega Variants.

I have been running some simulations using the k-Omega and k-Omega SST on models I have already run using the k-Epsilon model, and also have measurements for.... the results have not been looking too good.

Basically, the simulations are all steady state, run using simpleFoam. I first started with the k-Omega Turbulence Model, and then tried the k-Omega SST... Here is the process I followed:

I renamed the original "epsilon" file present in the "0" time folder to "omega", changed the name of the volScalarField to "omega" and the units to [0 0 -1 0 0 0 0] as I had seen in the test case you had provided.

The rest of the data (including the initial value of the internal field and the inlet, and all the boundary conditions) were left as it was.

I assume that the solver takes these values as initial values only, and in case the values are bad, it takes longer to converge.

Here is the "omega" file:

dimensions [0 0 -1 0 0 0 0];

internalField uniform 5000;

type zeroGradient;

type fixedValue;
value uniform 5000;

type zeroGradient;

type zeroGradient;


For completion, here is my "boundary" file of the mesh (the mesh was also exactly the same as the one in the k-Epsilon run):

type wall;
physicalType wallFunctions;
nFaces 37358;
startFace 278856;

type patch;
physicalType pressureInlet;
nFaces 212;
startFace 316214;

type patch;
physicalType pressureOutlet;
nFaces 48;
startFace 316426;

type patch;
physicalType pressureOutlet;
nFaces 94;
startFace 316474;

I left the "k" file exactly as it was in the k-Epsilon case.

Further, I changed the files "fvSolution" and "fvSchemes"... replacing occurances of "epsilon" with "omega" so that the solvers and the schemes work with k-Omega.

The convergence values, relaxation factors (for simpleFoam) and the kinematic viscosity (nu) were left as it was in the k-epsilon case.

The Kinematic viscosity is 1.76e-05 m^2/s

Using this configuration, I ran the simulation, and ended up with a total flow through the inlet and outlet patches to be around 10 times smaller than the expected values (k-Epsilon and measurements).

The pressure field looks good, but the velocities are much lower than they are supposed to be.

The k-Omega SST case also came up with a similar difference in the flow.

Could it be that I am doing something wrong? Do I need to change any boundary conditions when I switch to the k-Omega Turbulence Model? Or is the turbulence model very sensitive to the initial conditions that are given?

I was looking through the source code of the k-Omega Turbulence Model and comparing it with the k-Epsilon model, and noticed that though there are the following header files in the directory:


These files are never called within the k-Omega source code. Does this mean that the k-Omega does not use wall functions?

The mesh I use is a 100% tetrahedral mesh generated by NetGen (a free tetrahedral mesh generator). These meshes have worked very well so far with the k-Epsilon turbulence model.

Could there be some bug in the source code of the Turbulence Models?

I am hoping its only some simple error... because I have heard and read a lot about the k-Omega Turbulence Models, and have been wanting to try them out in an attempt to increase the accuracy of my simulations.

Have a nice day!


rolando April 27, 2007 06:17

Hello Daniele, you´re trying
Hello Daniele,
you´re trying two different things above.
In your first attempt you try to set values at the boundary faces.
In your second attempt you try to set the values in the wall nearest cells. (For that you are using y-values at the wall, which have to be zero => division by zero).

What do you precisely want to do?
Setting values at the wall faces or in the wall cells?

Can you term a reference for the wall omega?


panara April 27, 2007 06:30

Hi Rolando, I want to set t
Hi Rolando,

I want to set the value at the face that is the same of setting a fixedValue boundary condition with a constant value of omega=omega_wall

omega_wall = 60/beta*nu/sqr(dy)

where dy is the wall nearest cell center.

as it is described in Menter, Two-Equation Eddy-Viscosity Turbulence Models for Engineering Applications, AIAA Journal Vol.32, No8,August 1994.

Thanks for your feedback,do you have any ideas?


rolando April 27, 2007 06:36

Try something like the followi
Try something like the following, it should only set the values at the boundaries and use the wall nearest cell values for the calculation:

const fvPatchList& patches = mesh_.boundary();

forAll(patches, patchI)
const fvPatch& curPatch = patches[patchI];

if (isType<wallfvpatch>(curPatch))
* nuw.boundaryField()[patchI].patchInternalField()
/ sqr(y.boundaryField()[patchI].patchInternalField())
/ 0.075;


panara April 27, 2007 10:33

Thanks Rolando, it seems to
Thanks Rolando,

it seems to work very well =)

Thank you,


qtian August 6, 2007 09:30

Dear all, I am starting to
Dear all,

I am starting to use K-Omega model for my simulation and have a few questions regarding the boundary setting and wall function. As Daniele Panara suggested, we need to specify a fix value of omega at the wall. The problem I had is if I tried to used a fixed value at the wall, I got a error message like this:

--> FOAM FATAL ERROR : fixedValue is the wrong omega patchField type for wall-functions on patch bottomWall
should be zeroGradient

From function wall-function evaluation
in file kOmegaSST/checkkOmegaPatchFieldTypes.H at line 13.

Then I went to check the file kOmegaSST/checkkOmegaPatchFieldTypes.H, and found something like this in the file:
if (!isType<zerogradientfvpatchscalarfield>(k_.bounda ryField()[patchi]))
FatalErrorIn("wall-function evaluation")
<< k_.boundaryField()[patchi].type()
<< " is the wrong k patchField type for wall-functions on patch "
<< << nl
<< " should be zeroGradient"
<< exit(FatalError);

if (!isType<zerogradientfvpatchscalarfield>( undaryField()[patchi]))
FatalErrorIn("wall-function evaluation")
<< omega_.boundaryField()[patchi].type()
<< " is the wrong omega patchField type for wall-functions on patch "
<< << nl
<< " should be zeroGradient"
<< exit(FatalError);

I got quite confused. Does this mean I have to set "zero gradient" NOT "fixed value" at the wall for omega? Does the SST model in 1.4 version use wall function or not? BTW, I defined my "bottomWALL" patch as "wall" not "wall function" in the polyMesh/boundary file. Thanks for your help.

Best regards


make August 6, 2007 10:39

Hi Quinn, I'm also using kO
Hi Quinn,

I'm also using kOmegaSST.

The kOmegaSST model delivered together with OpenFOAM 1.4 uses wall functions. Have a look in kOmegaSST.C:

# include "kOmegaWallFunctionsI.H"
# include "kOmegaWallViscosityI.H"

So you have to defin omega and k as zeroGradient at the wall patches. I haven't experienced any difficulties so far using this BCs. Hope I'm not mistaken. Seems that there exists another version of kOmega without wall function.

qtian August 6, 2007 10:57

Matthias, Thank you so much

Thank you so much for your reply. Can you please answer one more question for me, how can I define the boundary condition for omega at inlet? I read Menter's 1994 paper. At the wall omega_wall=60/0.075*nu/(dy)^2 and free stream omega = U/L or epsilon/k. I have a non uniform k and velocity profile at inlet. I had no experience to define non uniform omega. Can you please share some of your experience. Thanks


make August 6, 2007 11:57

Hi Quinn, you don't have to
Hi Quinn,

you don't have to set omega at the wall only at the inlet. There I use the relation omega = epsilon/k as you mentioned. I use uniform boundary conditions for omega, so I don't have experiences with nonuniform conditions for omega. How do you define your nonuniform inlet velocity? I guess you can do it with omega in the same way. Knowing your degree of turbulence and the integral length scale you can calculate k and epsilon and then omega by epsilon/k.
So your omega is a function of these three values U, Degree of Turbulence and integral length scale.

qtian August 6, 2007 12:38

Matthias, Thanks for the gr

Thanks for the great answer. For the velocity and tke, I had LDV data and just did interpolation at inlet for the nonuniform boundary. I was mistaken that epsilon/k is only valid at the freestream. I realized this is a universal relationship, which we can find in Pope's turbulence book. Thanks for pointing out this. Thanks again for your help.

ivan_cozza January 25, 2009 07:16

Hi Foamers! I'm wondering if
Hi Foamers!
I'm wondering if the kOmegaSST model without wallfunctions present on the wiki is available also for 1.5 version. If not, there's someone that could give me some guidelines to modify it?

roth March 23, 2009 14:03

freestream omega
I see a few posts suggesting that omega = epsilon / k is a good initialization for the freestream. However, when I examine the code (kOmegaSST.H), the calculation for epsilon is

epsilon = betaStar * k * omega

where betaStar is typically Cmu i.e. 9/100. So shouldn't a better estimate of omega be

omega = 100/9 * epsilon / k ?


lakeat May 6, 2009 10:09

Also note on CFD-Online WIKI,
\epsilon = C_\mu^\frac{3}{4} \, \frac{k^\frac{3}{2}}{l}
\omega = C_\mu^{-\frac{1}{4}} \, \frac{\sqrt{k}}{l}
I dont see \omega = \frac{\epsilon}{k}
Am I missing sth??

lakeat May 6, 2009 10:11

Hi Quinn,
Can you email me a copy of that paper (Menter 1994)? It's not available for my university. Much appreciated.

maruthamuthu_venkatraman July 1, 2009 08:18

Could anyone give some step by step illustration of implimenting these low reynolds number K omega models in OpenFoam 1.5 as referred in link below:

I tried to extract the contents and complied them by typing " wmake libso " in the terminal from incompresible directory.

I got an error

kOmega/kOmega.C:111: error: no matching function for call to ‘Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::IOobject, Foam::tmp<Foam::GeometricField<Foam::SymmTensor<do uble>, Foam::fvPatchField, Foam::volMesh> >, Foam::wordList)’ ...................

Let me know the right way of implimenting the same..


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