CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   non-constant blending function (

sven82 December 8, 2009 11:06

non-constant blending function
Dear Foamers,

for my Simulation I will calculate a non-constant blending factor between upwind and CDS. The definition of this factor contains turbulence parameters like epsilon.

And this is my problem, where can I implemented the code part

1. in the solver.C, but how its possible to use the turbulence describe parameters in e.g. simpleFoam.C :confused:

2. calculate the blending factor in my turbulence modell.C e.g kEpsilon in a return function, but there is the problem how its possible to link this return function to my solver.C :confused:

Thanks, for any help and I'm really hope anybody got a idea for me

Thanks a lot!

eugene December 9, 2009 07:45

Hi Sven,

Your best course of action is the following.

1. Use the localBlended scheme for convections, e.g.

div(phi,U) Gauss localBlended linear upwind;

2. Define a surfaceScalarField called UBlendingFactor in you top level code. If this field is 1 it will use linear (CD), if this field is 0, the localBlended scheme will use the upwind. You can blend any two schemes this way. The name of the blending field is important and should be <field>BlendingFactor. The localBlended scheme will search the database for this field to use as its blending indicator.

3. To do this in you turbulence model is a bit more tricky. I strongly suggest you try to do it in the top level code. You can access most of the turbulence fields via lookups:


or via calls to the turbulence model base class:


To perform this stuff in the turbulence model is possible. The UBlendingFactor field has to be defined before U is solved for the first time. You could do it by adding the following type of code to your turbulence model constructor:

autoPtr<surfaceScalarField> UBlendingFactor (constructor stuff);


This will switch the ownership of the BlendingFactor object to the central database, from which you can access the object via a lookup:

mesh.lookupObject<surfaceScalarField>("UBlendingFa ctor");

Hope this helps.

sven82 December 12, 2009 07:34

thanks eugene,

" turbulence->epsilon()()
turbulence->k()() "

this is the correct link for me,


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