# SMALL, GREAT and ROOTVSMALL - what is that?

 Register Blogs Members List Search Today's Posts Mark Forums Read

 July 18, 2013, 17:18 SMALL, GREAT and ROOTVSMALL - what is that? #1 New Member   Thomas F. Join Date: Jun 2013 Location: Graz, Austria Posts: 14 Rep Power: 4 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

 July 18, 2013, 17:31 #2 Senior Member   Lieven Join Date: Dec 2011 Location: Mol, Belgium Posts: 295 Rep Power: 13 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 apple-tree, songwukong and babala like this.

 July 18, 2013, 17:47 #3 Senior Member   Laurence R. McGlashan Join Date: Mar 2009 Posts: 370 Rep Power: 14 Slight correction; the values depend on whether openfoam is compiled in single or double precision. __________________ Laurence R. McGlashan :: Website

 July 18, 2013, 17:55 #4 Senior Member   Lieven Join Date: Dec 2011 Location: Mol, Belgium Posts: 295 Rep Power: 13 How indeed, my apologies for this laxity. The values mentioned above are for a double precision compilation. Cheers L

 July 19, 2013, 04:47 #5 New Member   Thomas F. Join Date: Jun 2013 Location: Graz, Austria Posts: 14 Rep Power: 4 Thanks for the quick reply - it all makes sense now!

 July 19, 2013, 04:48 #6 Senior Member   Laurence R. McGlashan Join Date: Mar 2009 Posts: 370 Rep Power: 14 Correction; the values above are for single precision. __________________ Laurence R. McGlashan :: Website

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

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