OpenFOAM: Replaced hard-coded scalar limits with C++11 numeric_limits
This change simplifies maintenance and improved portability
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -113,7 +113,7 @@ public:
|
|||||||
{
|
{
|
||||||
forAll(sf, i)
|
forAll(sf, i)
|
||||||
{
|
{
|
||||||
if (mag(sf[i]) >= scalar(floatScalarVSMALL))
|
if (mag(sf[i]) >= scalar(floatScalarVSmall))
|
||||||
{
|
{
|
||||||
str_ << setw(12) << sf[i] << nl;
|
str_ << setw(12) << sf[i] << nl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -33,10 +33,10 @@ namespace Foam
|
|||||||
const char* const pTraits<Scalar>::typeName = "scalar";
|
const char* const pTraits<Scalar>::typeName = "scalar";
|
||||||
const Scalar pTraits<Scalar>::zero = 0.0;
|
const Scalar pTraits<Scalar>::zero = 0.0;
|
||||||
const Scalar pTraits<Scalar>::one = 1.0;
|
const Scalar pTraits<Scalar>::one = 1.0;
|
||||||
const Scalar pTraits<Scalar>::min = -ScalarVGREAT;
|
const Scalar pTraits<Scalar>::min = -ScalarVGreat;
|
||||||
const Scalar pTraits<Scalar>::max = ScalarVGREAT;
|
const Scalar pTraits<Scalar>::max = ScalarVGreat;
|
||||||
const Scalar pTraits<Scalar>::rootMin = -ScalarROOTVGREAT;
|
const Scalar pTraits<Scalar>::rootMin = -ScalarRootVGreat;
|
||||||
const Scalar pTraits<Scalar>::rootMax = ScalarROOTVGREAT;
|
const Scalar pTraits<Scalar>::rootMax = ScalarRootVGreat;
|
||||||
|
|
||||||
const char* const pTraits<Scalar>::componentNames[] = { "" };
|
const char* const pTraits<Scalar>::componentNames[] = { "" };
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -208,13 +208,13 @@ inline Scalar negPart(const Scalar s)
|
|||||||
|
|
||||||
inline bool equal(const Scalar& s1, const Scalar& s2)
|
inline bool equal(const Scalar& s1, const Scalar& s2)
|
||||||
{
|
{
|
||||||
return mag(s1 - s2) <= ScalarVSMALL;
|
return mag(s1 - s2) <= ScalarVSmall;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool notEqual(const Scalar s1, const Scalar s2)
|
inline bool notEqual(const Scalar s1, const Scalar s2)
|
||||||
{
|
{
|
||||||
return mag(s1 - s2) > ScalarVSMALL;
|
return mag(s1 - s2) > ScalarVSmall;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -343,7 +343,7 @@ inline Scalar sqrtSumSqr(const Scalar a, const Scalar b)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return magb < ScalarVSMALL ? 0.0 : magb*sqrt(1.0 + sqr(maga/magb));
|
return magb < ScalarVSmall ? 0.0 : magb*sqrt(1.0 + sqr(maga/magb));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -31,17 +31,17 @@ License
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#define Scalar doubleScalar
|
#define Scalar doubleScalar
|
||||||
#define ScalarVGREAT doubleScalarVGREAT
|
#define ScalarVGreat doubleScalarVGreat
|
||||||
#define ScalarVSMALL doubleScalarVSMALL
|
#define ScalarVSmall doubleScalarVSmall
|
||||||
#define ScalarROOTVGREAT doubleScalarROOTVGREAT
|
#define ScalarRootVGreat doubleScalarRootVGreat
|
||||||
#define ScalarROOTVSMALL doubleScalarROOTVSMALL
|
#define ScalarRootVSmall doubleScalarRootVSmall
|
||||||
#define readScalar readDoubleScalar
|
#define readScalar readDoubleScalar
|
||||||
#include "Scalar.C"
|
#include "Scalar.C"
|
||||||
#undef Scalar
|
#undef Scalar
|
||||||
#undef ScalarVGREAT
|
#undef ScalarVGreat
|
||||||
#undef ScalarVSMALL
|
#undef ScalarVSmall
|
||||||
#undef ScalarROOTVGREAT
|
#undef ScalarRootVGreat
|
||||||
#undef ScalarROOTVSMALL
|
#undef ScalarRootVSmall
|
||||||
#undef readScalar
|
#undef readScalar
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -39,6 +39,9 @@ SourceFiles
|
|||||||
#include "direction.H"
|
#include "direction.H"
|
||||||
#include "word.H"
|
#include "word.H"
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
|
using std::numeric_limits;
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -49,15 +52,17 @@ namespace Foam
|
|||||||
typedef double doubleScalar;
|
typedef double doubleScalar;
|
||||||
|
|
||||||
// Largest and smallest scalar values allowed in certain parts of the code.
|
// Largest and smallest scalar values allowed in certain parts of the code.
|
||||||
// (15 is the number of significant figures in an
|
static const doubleScalar doubleScalarVGreat = numeric_limits<double>::max();
|
||||||
// IEEE double precision number. See limits.h or float.h)
|
static const doubleScalar doubleScalarVSmall = numeric_limits<double>::min();
|
||||||
static const doubleScalar doubleScalarGREAT = 1.0e+15;
|
|
||||||
static const doubleScalar doubleScalarVGREAT = 1.0e+300;
|
static const doubleScalar doubleScalarSmall = numeric_limits<double>::epsilon();
|
||||||
static const doubleScalar doubleScalarROOTVGREAT = 1.0e+150;
|
static const doubleScalar doubleScalarGreat = 1.0/doubleScalarSmall;
|
||||||
static const doubleScalar doubleScalarSMALL = 1.0e-15;
|
|
||||||
static const doubleScalar doubleScalarROOTSMALL = 3.0e-8;
|
static const doubleScalar doubleScalarRootVGreat = ::sqrt(doubleScalarVGreat);
|
||||||
static const doubleScalar doubleScalarVSMALL = 1.0e-300;
|
static const doubleScalar doubleScalarRootVSmall = ::sqrt(doubleScalarVSmall);
|
||||||
static const doubleScalar doubleScalarROOTVSMALL = 1.0e-150;
|
|
||||||
|
static const doubleScalar doubleScalarRootGreat = ::sqrt(doubleScalarGreat);
|
||||||
|
static const doubleScalar doubleScalarRootSmall = ::sqrt(doubleScalarSmall);
|
||||||
|
|
||||||
//- Read whole of buf as a scalar. Return true if succesful.
|
//- Read whole of buf as a scalar. Return true if succesful.
|
||||||
inline bool readScalar(const char* buf, doubleScalar& s)
|
inline bool readScalar(const char* buf, doubleScalar& s)
|
||||||
@ -69,10 +74,10 @@ inline bool readScalar(const char* buf, doubleScalar& s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define Scalar doubleScalar
|
#define Scalar doubleScalar
|
||||||
#define ScalarVGREAT doubleScalarVGREAT
|
#define ScalarVGreat doubleScalarVGreat
|
||||||
#define ScalarVSMALL doubleScalarVSMALL
|
#define ScalarVSmall doubleScalarVSmall
|
||||||
#define ScalarROOTVGREAT doubleScalarROOTVGREAT
|
#define ScalarRootVGreat doubleScalarRootVGreat
|
||||||
#define ScalarROOTVSMALL doubleScalarROOTVSMALL
|
#define ScalarRootVSmall doubleScalarRootVSmall
|
||||||
#define readScalar readDoubleScalar
|
#define readScalar readDoubleScalar
|
||||||
|
|
||||||
inline Scalar mag(const Scalar s)
|
inline Scalar mag(const Scalar s)
|
||||||
@ -122,10 +127,10 @@ inline Scalar yn(const int n, const Scalar s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#undef Scalar
|
#undef Scalar
|
||||||
#undef ScalarVGREAT
|
#undef ScalarVGreat
|
||||||
#undef ScalarVSMALL
|
#undef ScalarVSmall
|
||||||
#undef ScalarROOTVGREAT
|
#undef ScalarRootVGreat
|
||||||
#undef ScalarROOTVSMALL
|
#undef ScalarRootVSmall
|
||||||
#undef readScalar
|
#undef readScalar
|
||||||
#undef transFunc
|
#undef transFunc
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -31,17 +31,17 @@ License
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#define Scalar floatScalar
|
#define Scalar floatScalar
|
||||||
#define ScalarVGREAT floatScalarVGREAT
|
#define ScalarVGreat floatScalarVGreat
|
||||||
#define ScalarVSMALL floatScalarVSMALL
|
#define ScalarVSmall floatScalarVSmall
|
||||||
#define ScalarROOTVGREAT floatScalarROOTVGREAT
|
#define ScalarRootVGreat floatScalarRootVGreat
|
||||||
#define ScalarROOTVSMALL floatScalarROOTVSMALL
|
#define ScalarRootVSmall floatScalarRootVSmall
|
||||||
#define readScalar readFloatScalar
|
#define readScalar readFloatScalar
|
||||||
#include "Scalar.C"
|
#include "Scalar.C"
|
||||||
#undef Scalar
|
#undef Scalar
|
||||||
#undef ScalarVSMALL
|
#undef ScalarVSmall
|
||||||
#undef ScalarVSMALL
|
#undef ScalarVSmall
|
||||||
#undef ScalarROOTVGREAT
|
#undef ScalarRootVGreat
|
||||||
#undef ScalarROOTVSMALL
|
#undef ScalarRootVSmall
|
||||||
#undef readScalar
|
#undef readScalar
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -39,6 +39,9 @@ SourceFiles
|
|||||||
#include "direction.H"
|
#include "direction.H"
|
||||||
#include "word.H"
|
#include "word.H"
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
|
using std::numeric_limits;
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -49,15 +52,17 @@ namespace Foam
|
|||||||
typedef float floatScalar;
|
typedef float floatScalar;
|
||||||
|
|
||||||
// Largest and smallest scalar values allowed in certain parts of the code
|
// Largest and smallest scalar values allowed in certain parts of the code
|
||||||
// (6 is the number of significant figures in an
|
static const floatScalar floatScalarVGreat = numeric_limits<float>::max();
|
||||||
// IEEE single precision number. See limits.h or float.h)
|
static const floatScalar floatScalarVSmall = numeric_limits<float>::min();
|
||||||
static const floatScalar floatScalarGREAT = 1.0e+6;
|
|
||||||
static const floatScalar floatScalarVGREAT = 1.0e+37;
|
static const floatScalar floatScalarSmall = numeric_limits<float>::epsilon();
|
||||||
static const floatScalar floatScalarROOTVGREAT = 1.0e+18;
|
static const floatScalar floatScalarGreat = 1.0/floatScalarSmall;
|
||||||
static const floatScalar floatScalarSMALL = 1.0e-6;
|
|
||||||
static const floatScalar floatScalarROOTSMALL = 1.0e-3;
|
static const floatScalar floatScalarRootVGreat = ::sqrt(floatScalarVGreat);
|
||||||
static const floatScalar floatScalarVSMALL = 1.0e-37;
|
static const floatScalar floatScalarRootVSmall = ::sqrt(floatScalarVSmall);
|
||||||
static const floatScalar floatScalarROOTVSMALL = 1.0e-18;
|
|
||||||
|
static const floatScalar floatScalarRootGreat = ::sqrt(floatScalarGreat);
|
||||||
|
static const floatScalar floatScalarRootSmall = ::sqrt(floatScalarSmall);
|
||||||
|
|
||||||
//- Read whole of buf as a scalar. Return true if succesful.
|
//- Read whole of buf as a scalar. Return true if succesful.
|
||||||
inline bool readScalar(const char* buf, floatScalar& s)
|
inline bool readScalar(const char* buf, floatScalar& s)
|
||||||
@ -69,10 +74,10 @@ inline bool readScalar(const char* buf, floatScalar& s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define Scalar floatScalar
|
#define Scalar floatScalar
|
||||||
#define ScalarVGREAT floatScalarVGREAT
|
#define ScalarVGreat floatScalarVGreat
|
||||||
#define ScalarVSMALL floatScalarVSMALL
|
#define ScalarVSmall floatScalarVSmall
|
||||||
#define ScalarROOTVGREAT floatScalarROOTVGREAT
|
#define ScalarRootVGreat floatScalarRootVGreat
|
||||||
#define ScalarROOTVSMALL floatScalarROOTVSMALL
|
#define ScalarRootVSmall floatScalarRootVSmall
|
||||||
#define readScalar readFloatScalar
|
#define readScalar readFloatScalar
|
||||||
|
|
||||||
inline Scalar mag(const Scalar s)
|
inline Scalar mag(const Scalar s)
|
||||||
@ -122,10 +127,10 @@ inline Scalar yn(const int n, const Scalar s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#undef Scalar
|
#undef Scalar
|
||||||
#undef ScalarVGREAT
|
#undef ScalarVGreat
|
||||||
#undef ScalarVSMALL
|
#undef ScalarVSmall
|
||||||
#undef ScalarROOTVGREAT
|
#undef ScalarRootVGreat
|
||||||
#undef ScalarROOTVSMALL
|
#undef ScalarRootVSmall
|
||||||
#undef readScalar
|
#undef readScalar
|
||||||
#undef transFunc
|
#undef transFunc
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -49,13 +49,14 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
typedef floatScalar scalar;
|
typedef floatScalar scalar;
|
||||||
|
|
||||||
static const scalar GREAT = floatScalarGREAT;
|
static const scalar great = floatScalarGreat;
|
||||||
static const scalar VGREAT = floatScalarVGREAT;
|
static const scalar rootGreat = floatScalarRootGreat;
|
||||||
static const scalar ROOTVGREAT = floatScalarROOTVGREAT;
|
static const scalar vGreat = floatScalarVGreat;
|
||||||
static const scalar SMALL = floatScalarSMALL;
|
static const scalar rootVGreat = floatScalarRootVGreat;
|
||||||
static const scalar ROOTSMALL = floatScalarROOTSMALL;
|
static const scalar small = floatScalarSmall;
|
||||||
static const scalar VSMALL = floatScalarVSMALL;
|
static const scalar rootSmall = floatScalarRootSmall;
|
||||||
static const scalar ROOTVSMALL = floatScalarROOTVSMALL;
|
static const scalar vSmall = floatScalarVSmall;
|
||||||
|
static const scalar rootVSmall = floatScalarRootVSmall;
|
||||||
|
|
||||||
scalar readScalar(Istream& is);
|
scalar readScalar(Istream& is);
|
||||||
}
|
}
|
||||||
@ -68,19 +69,33 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
typedef doubleScalar scalar;
|
typedef doubleScalar scalar;
|
||||||
|
|
||||||
static const scalar GREAT = doubleScalarGREAT;
|
static const scalar great = doubleScalarGreat;
|
||||||
static const scalar VGREAT = doubleScalarVGREAT;
|
static const scalar rootGreat = doubleScalarRootGreat;
|
||||||
static const scalar ROOTVGREAT = doubleScalarROOTVGREAT;
|
static const scalar vGreat = doubleScalarVGreat;
|
||||||
static const scalar SMALL = doubleScalarSMALL;
|
static const scalar rootVGreat = doubleScalarRootVGreat;
|
||||||
static const scalar ROOTSMALL = doubleScalarROOTSMALL;
|
static const scalar small = doubleScalarSmall;
|
||||||
static const scalar VSMALL = doubleScalarVSMALL;
|
static const scalar rootSmall = doubleScalarRootSmall;
|
||||||
static const scalar ROOTVSMALL = doubleScalarROOTVSMALL;
|
static const scalar vSmall = doubleScalarVSmall;
|
||||||
|
static const scalar rootVSmall = doubleScalarRootVSmall;
|
||||||
|
|
||||||
scalar readScalar(Istream& is);
|
scalar readScalar(Istream& is);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//- Deprecated limit constant for backward-compatibility
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
static const scalar GREAT = great;
|
||||||
|
static const scalar ROOTGREAT = rootGreat;
|
||||||
|
static const scalar VGREAT = vGreat;
|
||||||
|
static const scalar ROOTVGREAT = rootVGreat;
|
||||||
|
static const scalar SMALL = small;
|
||||||
|
static const scalar ROOTSMALL = rootSmall;
|
||||||
|
static const scalar VSMALL = vSmall;
|
||||||
|
static const scalar ROOTVSMALL = rootVSmall;
|
||||||
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
// Additional transcendental functions
|
// Additional transcendental functions
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -53,25 +53,25 @@ const Foam::floatTensor Foam::floatTensor::vsType::one
|
|||||||
template<>
|
template<>
|
||||||
const Foam::floatTensor Foam::floatTensor::vsType::max
|
const Foam::floatTensor Foam::floatTensor::vsType::max
|
||||||
(
|
(
|
||||||
floatTensor::uniform(floatScalarVGREAT)
|
floatTensor::uniform(floatScalarVGreat)
|
||||||
);
|
);
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
const Foam::floatTensor Foam::floatTensor::vsType::min
|
const Foam::floatTensor Foam::floatTensor::vsType::min
|
||||||
(
|
(
|
||||||
floatTensor::uniform(-floatScalarVGREAT)
|
floatTensor::uniform(-floatScalarVGreat)
|
||||||
);
|
);
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
const Foam::floatTensor Foam::floatTensor::vsType::rootMax
|
const Foam::floatTensor Foam::floatTensor::vsType::rootMax
|
||||||
(
|
(
|
||||||
floatTensor::uniform(floatScalarROOTVGREAT)
|
floatTensor::uniform(floatScalarRootVGreat)
|
||||||
);
|
);
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
const Foam::floatTensor Foam::floatTensor::vsType::rootMin
|
const Foam::floatTensor Foam::floatTensor::vsType::rootMin
|
||||||
(
|
(
|
||||||
floatTensor::uniform(-floatScalarROOTVGREAT)
|
floatTensor::uniform(-floatScalarRootVGreat)
|
||||||
);
|
);
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -54,25 +54,25 @@ const Foam::floatVector Foam::floatVector::vsType::one
|
|||||||
template<>
|
template<>
|
||||||
const Foam::floatVector Foam::floatVector::vsType::max
|
const Foam::floatVector Foam::floatVector::vsType::max
|
||||||
(
|
(
|
||||||
floatVector::uniform(floatScalarVGREAT)
|
floatVector::uniform(floatScalarVGreat)
|
||||||
);
|
);
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
const Foam::floatVector Foam::floatVector::vsType::min
|
const Foam::floatVector Foam::floatVector::vsType::min
|
||||||
(
|
(
|
||||||
floatVector::uniform(-floatScalarVGREAT)
|
floatVector::uniform(-floatScalarVGreat)
|
||||||
);
|
);
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
const Foam::floatVector Foam::floatVector::vsType::rootMax
|
const Foam::floatVector Foam::floatVector::vsType::rootMax
|
||||||
(
|
(
|
||||||
floatVector::uniform(floatScalarROOTVGREAT)
|
floatVector::uniform(floatScalarRootVGreat)
|
||||||
);
|
);
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
const Foam::floatVector Foam::floatVector::vsType::rootMin
|
const Foam::floatVector Foam::floatVector::vsType::rootMin
|
||||||
(
|
(
|
||||||
floatVector::uniform(-floatScalarROOTVGREAT)
|
floatVector::uniform(-floatScalarRootVGreat)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -132,9 +132,18 @@ void Foam::triad::orthogonalize()
|
|||||||
{
|
{
|
||||||
for (int i=0; i<2; i++)
|
for (int i=0; i<2; i++)
|
||||||
{
|
{
|
||||||
scalar o01 = mag(operator[](0) & operator[](1));
|
const scalar o01
|
||||||
scalar o02 = mag(operator[](0) & operator[](2));
|
(
|
||||||
scalar o12 = mag(operator[](1) & operator[](2));
|
(set(0) && set(1)) ? mag(operator[](0) & operator[](1)) : VGREAT
|
||||||
|
);
|
||||||
|
const scalar o02
|
||||||
|
(
|
||||||
|
(set(0) && set(2)) ? mag(operator[](0) & operator[](2)) : VGREAT
|
||||||
|
);
|
||||||
|
const scalar o12
|
||||||
|
(
|
||||||
|
(set(1) && set(2)) ? mag(operator[](1) & operator[](2)) : VGREAT
|
||||||
|
);
|
||||||
|
|
||||||
if (o01 < o02 && o01 < o12)
|
if (o01 < o02 && o01 < o12)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -30,7 +30,7 @@ License
|
|||||||
|
|
||||||
bool Foam::ensightFile::allowUndef_ = false;
|
bool Foam::ensightFile::allowUndef_ = false;
|
||||||
|
|
||||||
Foam::scalar Foam::ensightFile::undefValue_ = Foam::floatScalarVGREAT;
|
Foam::scalar Foam::ensightFile::undefValue_ = Foam::floatScalarVGreat;
|
||||||
|
|
||||||
// default is width 8
|
// default is width 8
|
||||||
Foam::string Foam::ensightFile::mask_ = "********";
|
Foam::string Foam::ensightFile::mask_ = "********";
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -125,7 +125,7 @@ void Foam::ensightSetWriter<Type>::write
|
|||||||
forAll(points, pointi)
|
forAll(points, pointi)
|
||||||
{
|
{
|
||||||
const scalar comp = points[pointi][cmpt];
|
const scalar comp = points[pointi][cmpt];
|
||||||
if (mag(comp) >= scalar(floatScalarVSMALL))
|
if (mag(comp) >= scalar(floatScalarVSmall))
|
||||||
{
|
{
|
||||||
os << setw(12) << comp << nl;
|
os << setw(12) << comp << nl;
|
||||||
}
|
}
|
||||||
@ -160,7 +160,7 @@ void Foam::ensightSetWriter<Type>::write
|
|||||||
const scalarField fld(valueSets[setI]->component(cmpt));
|
const scalarField fld(valueSets[setI]->component(cmpt));
|
||||||
forAll(fld, i)
|
forAll(fld, i)
|
||||||
{
|
{
|
||||||
if (mag(fld[i]) >= scalar(floatScalarVSMALL))
|
if (mag(fld[i]) >= scalar(floatScalarVSmall))
|
||||||
{
|
{
|
||||||
os << setw(12) << fld[i] << nl;
|
os << setw(12) << fld[i] << nl;
|
||||||
}
|
}
|
||||||
@ -243,7 +243,7 @@ void Foam::ensightSetWriter<Type>::write
|
|||||||
forAll(points, pointi)
|
forAll(points, pointi)
|
||||||
{
|
{
|
||||||
const scalar comp = points[pointi][cmpt];
|
const scalar comp = points[pointi][cmpt];
|
||||||
if (mag(comp) >= scalar(floatScalarVSMALL))
|
if (mag(comp) >= scalar(floatScalarVSmall))
|
||||||
{
|
{
|
||||||
os << setw(12) << comp << nl;
|
os << setw(12) << comp << nl;
|
||||||
}
|
}
|
||||||
@ -296,7 +296,7 @@ void Foam::ensightSetWriter<Type>::write
|
|||||||
const scalarField fld(fieldVals[trackI].component(cmpt));
|
const scalarField fld(fieldVals[trackI].component(cmpt));
|
||||||
forAll(fld, i)
|
forAll(fld, i)
|
||||||
{
|
{
|
||||||
if (mag(fld[i]) >= scalar(floatScalarVSMALL))
|
if (mag(fld[i]) >= scalar(floatScalarVSmall))
|
||||||
{
|
{
|
||||||
os << setw(12) << fld[i] << nl;
|
os << setw(12) << fld[i] << nl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -55,7 +55,7 @@ void Foam::DSMCCloud<ParcelType>::buildConstProps()
|
|||||||
const dictionary& molDict(moleculeProperties.subDict(id));
|
const dictionary& molDict(moleculeProperties.subDict(id));
|
||||||
|
|
||||||
constProps_[i] =
|
constProps_[i] =
|
||||||
typename ParcelType::constantProperties::constantProperties(molDict);
|
typename ParcelType::constantProperties(molDict);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1034,11 +1034,11 @@ Foam::scalar Foam::DSMCCloud<ParcelType>::equipartitionInternalEnergy
|
|||||||
{
|
{
|
||||||
scalar Ei = 0.0;
|
scalar Ei = 0.0;
|
||||||
|
|
||||||
if (iDof < SMALL)
|
if (iDof == 0)
|
||||||
{
|
{
|
||||||
return Ei;
|
return Ei;
|
||||||
}
|
}
|
||||||
else if (iDof < 2.0 + SMALL && iDof > 2.0 - SMALL)
|
else if (iDof == 2)
|
||||||
{
|
{
|
||||||
// Special case for iDof = 2, i.e. diatomics;
|
// Special case for iDof = 2, i.e. diatomics;
|
||||||
Ei = -log(rndGen_.scalar01())*physicoChemical::k.value()*temperature;
|
Ei = -log(rndGen_.scalar01())*physicoChemical::k.value()*temperature;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2017-2018 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -475,12 +475,14 @@ Foam::scalar Foam::sweptFaceAreaWeightAMI<SourcePatch, TargetPatch>::interArea
|
|||||||
srcNrm[i+1],
|
srcNrm[i+1],
|
||||||
tgtTri
|
tgtTri
|
||||||
);
|
);
|
||||||
|
|
||||||
cutTriList<8> cutTrisTmp;
|
cutTriList<8> cutTrisTmp;
|
||||||
for (label i = 0; i < cutTris.size(); ++ i)
|
|
||||||
|
for (label j = 0; j < cutTris.size(); ++j)
|
||||||
{
|
{
|
||||||
triCut
|
triCut
|
||||||
(
|
(
|
||||||
cutTris[i],
|
cutTris[j],
|
||||||
cutPlane,
|
cutPlane,
|
||||||
cut::noOp(),
|
cut::noOp(),
|
||||||
cut::appendOp<cutTriList<8>>(cutTrisTmp)
|
cut::appendOp<cutTriList<8>>(cutTrisTmp)
|
||||||
|
|||||||
Reference in New Issue
Block a user