CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Created a bounded and modified version of kEpsilon.C

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 26, 2016, 05:19
Default Created a bounded and modified version of kEpsilon.C
  #1
Member
 
Sebastian W.
Join Date: Nov 2012
Location: Saxony, Germany
Posts: 43
Rep Power: 13
nero235 is on a distinguished road
Send a message via ICQ to nero235
Hello,

I've created a modified version of the kEpsilon model for the openFOAM version 2.2.0. It can be found here: https://github.com/11101011/modKEpsilon

The models and my modification is based on this paper here: http://www.icmc.usp.br/~gustavo.busc...ew01_ijcfd.pdf

The initial reason for this modification were many tests I've run with the standard OF model and I had always problems with floating point exceptions based on divisions by zero and also negative turbulence values. OpenFOAM uses a scheme in its standard kEpsilon model which bounds negative or values smaller than 1E-15. The problem is that this number generates also floating point exceptions, when for example initializing a case with k and epsilon values of this magnitude. Someone can overwrite this bounding minimum by putting the following definitions in the RASProperties dictionary:

Code:
kMin         1e-5;
epsilonMin   1e-5;
This will mean that k, epsilon < kMin, epsilonMin will get bounded to this value.

Code:
const scalar minVsf = min(vsf).value();
    
if (minVsf < lowerBound.value())
{
vsf.internalField() = max
(
   max
   (
         vsf.internalField(),
         fvc::average(max(vsf, lowerBound))().internalField()
       * pos(-vsf.internalField())
    ),
    lowerBound.value()
);

vsf.boundaryField() = max(vsf.boundaryField(), lowerBound.value());
}
...

return vsf;
In this code, the lowerBound can be the unchanged (standard) value of 1e-15 or any other value, which can be defined by kMin, epsilonMin. The bounding itself of k and epsilon was not the solution, proposed in the paper above. It was more the bounding of nut > 0, the reaction coefficients and the source fluxes to positive values.

Regards, Sebastian
nero235 is offline   Reply With Quote

Old   February 26, 2016, 14:28
Default
  #2
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Dear Sebastian,

you also checked out the
Code:
limitedLimitedLinear 1 1e-8 1e4
scheme? This scheme should bound your variables between 1e-8 and 1e4.

Quote:
The problem is that this number generates also floating point exceptions, when for example initializing a case with k and epsilon values of this magnitude.
In a programming point of few, you should not get a floating point exception if you divide by 1e-15. Question: If you know that "maybe" your small values of k and epsilon will start the floating-point exception, why didn 't you use other values in your files k and epsilon?


Finally thanks for sharing.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   February 29, 2016, 03:14
Default
  #3
Member
 
Sebastian W.
Join Date: Nov 2012
Location: Saxony, Germany
Posts: 43
Rep Power: 13
nero235 is on a distinguished road
Send a message via ICQ to nero235
Hello Tobi,

Quote:
you also checked out the
Code:
limitedLimitedLinear 1 1e-8 1e4
scheme? This scheme should bound your variables between 1e-8 and 1e4.
I haven't tested this scheme but pretty much every other, including cellMDLimited grad schemes. At some point during my tests didn't believe anymore that I could bound the epsilon & k values in this way.

Quote:
In a programming point of few, you should not get a floating point exception if you divide by 1e-15. Question: If you know that "maybe" your small values of k and epsilon will start the floating-point exception, why didn 't you use other values in your files k and epsilon?
I have found the lower bounding limit by modifying the bound.C. Then I used this value in my k & epsilon initial conditions to find out if value is the problem or something else. In my other test cases I always used 1E-1 as initial conditions for k, epsilon.

If you have some time, I would be glad if you could run some tests with the model.

Regards, Sebastian
nero235 is offline   Reply With Quote

Old   March 1, 2016, 08:32
Default
  #4
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hey Sebastian,

I really would Check it but i have to much stuff to Do.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



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