CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   KEpsilon model k_oldTime not working (

harly December 9, 2008 21:06

Hi, I try to modify the kEp

I try to modify the kEpsilon model and I wanted to access k_.oldTime() - the application compiled and ran - but the value k_.oldTime() was always the current k_ value.

k_ is defined as:

in OpenFOAM-1.5/src/turbulenceModels/RAS/incompressible/kEpsilon/kEpsilon.C

you can try

Info << "k_.oldTime()" << endl;
Info << "k_" << endl;

to see what I mean.
hope you have an idea ...


hjasak December 10, 2008 04:21

Which solver are you using - i
Which solver are you using - is it simpleFoam by any chance ;)

Have a look at system/fvSchemes and tell me what differencing scheme is used ok k (is it steadyState by any chance)?

The code MUST be correct on this if you are time-stepping; otherwise all my calculations would be wrong.


harly December 10, 2008 14:13

Hi, you are right I forgot

you are right I forgot about the turbulent kinetic energy equation: there is an ddt(k_) - so it should work(means the code stores the previous k_ somewhere).

But where is the problem then? - because k_ is calculated it changes every timestep - but when I try to access k_.oldtime() directly from the kEpsilon subroutine (I am not using the build in ddt function - not because I don't want to because I don"t know how to specify my variable to accomplish that) I get the value of the current k back.

The same thing !works! for U_ so I really think it is something about variable definition or I am missing an include because evidently in the ddt subroutine k_.oldTime() is returning a value.

I am using turbFoam and a "CrankNicholson 0.5" ddt scheme.

hope you got some ideas


All times are GMT -4. The time now is 16:17.