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

SMALL, GREAT and ROOTVSMALL - what is that?

Register Blogs Community New Posts Updated Threads Search

Like Tree47Likes
  • 31 Post By Lieven
  • 1 Post By l_r_mcglashan
  • 1 Post By Lieven
  • 10 Post By ndev
  • 4 Post By evamaria

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 18, 2013, 17:18
Default SMALL, GREAT and ROOTVSMALL - what is that?
  #1
New Member
 
Thomas F.
Join Date: Jun 2013
Location: Graz, Austria
Posts: 14
Rep Power: 12
Dommy is on a distinguished road
Dear Foamers!

I'm working on Euler/Lagrange validation cases at the moment.
While looking into Disoersion Models I discoverd something in the Code - SMALL, GREAT and ROOTVSMALL.

Some examples (from /openfoam211/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/GradientDispersionRAS/GradientDispersionRAS.C)

Code:
 
scalar sigma = sqrt(2.0*k/3.0);
vector dir = -gradk/(mag(gradk) + SMALL);
Code:
 else
    {
        tTurb = GREAT;
        UTurb = vector::zero;
    }
Code:
const scalar epsilon =
        this->epsilonPtr_->internalField()[cellI] + ROOTVSMALL;
    const vector& gradk = this->gradkPtr_->internalField()[cellI];
In order to completly understand what I'm doing I need to know what this model is doing. Thanks a lot in advance!

Best,
Thomas
Dommy is offline   Reply With Quote

Old   July 18, 2013, 17:31
Default
  #2
Senior Member
 
Lieven
Join Date: Dec 2011
Location: Leuven, Belgium
Posts: 299
Rep Power: 22
Lieven will become famous soon enough
Hi Thomas,

SMALL, VSMALL, LARGE, ... are simply constants defined in src/OpenFOAM/primitives/Scalar/scalar/scalar.H and src/OpenFOAM/primitives/Scalar/floatScalar/floatScalar.H

In summary:
Code:
GREAT = 1.0e+6;
VGREAT = 1.0e+37;
ROOTVGREAT = 1.0e+18;
SMALL = 1.0e-6;
VSMALL = 1.0e-37;
ROOTVSMALL = 1.0e-18;
When you have something like 1/(x+SMALL) in the code, the SMALL simply prevents an floating point error from occurring when x = 0.

Cheers,

Lieven
Lieven is offline   Reply With Quote

Old   July 18, 2013, 17:47
Default
  #3
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
Slight correction; the values depend on whether openfoam is compiled in single or double precision.
vivek05 likes this.
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   July 18, 2013, 17:55
Default
  #4
Senior Member
 
Lieven
Join Date: Dec 2011
Location: Leuven, Belgium
Posts: 299
Rep Power: 22
Lieven will become famous soon enough
How indeed, my apologies for this laxity. The values mentioned above are for a double precision compilation.

Cheers

L
vivek05 likes this.
Lieven is offline   Reply With Quote

Old   July 19, 2013, 04:47
Default
  #5
New Member
 
Thomas F.
Join Date: Jun 2013
Location: Graz, Austria
Posts: 14
Rep Power: 12
Dommy is on a distinguished road
Thanks for the quick reply - it all makes sense now!
Dommy is offline   Reply With Quote

Old   July 19, 2013, 04:48
Default
  #6
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
Correction; the values above are for single precision.
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   March 22, 2017, 19:53
Default Double Precision Values
  #7
New Member
 
Nate
Join Date: Oct 2013
Location: Amherst, MA
Posts: 13
Rep Power: 12
ndev is on a distinguished road
I know this is old, but sometimes these posts get a lot of traffic. Just to eliminate any confusion, the double precision values are:

static const doubleScalar doubleScalarGREAT = 1.0e+15;
static const doubleScalar doubleScalarVGREAT = 1.0e+300;

static const doubleScalar doubleScalarROOTVGREAT = 1.0e+150;

static const doubleScalar doubleScalarSMALL = 1.0e-15;
static const doubleScalar doubleScalarVSMALL = 1.0e-300;
static const doubleScalar doubleScalarROOTVSMALL = 1.0e-150;
xpqiu, serles, mrishi and 7 others like this.
ndev is offline   Reply With Quote

Old   February 20, 2020, 09:12
Default
  #8
New Member
 
Join Date: May 2018
Location: Vienna, Austria
Posts: 14
Rep Power: 7
evamaria is on a distinguished road
Be aware that the hard-coded scalar limits have been replaced: https://github.com/OpenFOAM/OpenFOAM...9d7f1ee5912713
evamaria 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 19:27.