Commit 9c85d40c authored by Mark Olesen's avatar Mark Olesen
Browse files

Merge remote-tracking branch 'origin/master' into develop

parents d18a5be8 d3bcc71b
api=2001
patch=0
patch=200129
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2018 Bernhard Gschaider <bgschaid@hfd-research.com>
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -203,7 +203,7 @@ Foam::expressions::exprResultGlobals::get
{
WarningInFunction
<< "No scope " << scopeName << " for " << name << nl
<< "Known global scopes: " << variables_.sortToc() << nl;
<< "Known global scopes: " << variables_.sortedToc() << nl;
}
#endif
}
......
......@@ -97,13 +97,6 @@ public:
vectorTensorTransform&
operator=(const vectorTensorTransform&) = default;
//- Move construct
vectorTensorTransform(vectorTensorTransform&&) = default;
//- Move assignment
vectorTensorTransform&
operator=(vectorTensorTransform&&) = default;
// Constructors
......
......@@ -138,12 +138,6 @@ public:
//- Copy assignment
quaternion& operator=(const quaternion&) = default;
//- Move construct
quaternion(quaternion&&) = default;
//- Move assignment
quaternion& operator=(quaternion&&) = default;
// Constructors
......
......@@ -96,12 +96,6 @@ public:
//- Copy assignment
septernion& operator=(const septernion&) = default;
//- Move construct
septernion(septernion&&) = default;
//- Move assignment
septernion& operator=(septernion&&) = default;
// Constructors
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -120,9 +120,18 @@ kEpsilonPhitF<BasicTurbulenceModel>::kEpsilonPhitF
propertiesName
),
includeNu_
(
Switch::getOrAddToDict
(
"includeNu",
this->coeffDict_,
true
)
),
Cmu_
(
dimensioned<scalar>::getOrAddToDict
dimensionedScalar::getOrAddToDict
(
"Cmu",
this->coeffDict_,
......@@ -131,7 +140,7 @@ kEpsilonPhitF<BasicTurbulenceModel>::kEpsilonPhitF
),
Ceps1a_
(
dimensioned<scalar>::getOrAddToDict
dimensionedScalar::getOrAddToDict
(
"Ceps1a",
this->coeffDict_,
......@@ -140,7 +149,7 @@ kEpsilonPhitF<BasicTurbulenceModel>::kEpsilonPhitF
),
Ceps1b_
(
dimensioned<scalar>::getOrAddToDict
dimensionedScalar::getOrAddToDict
(
"Ceps1b",
this->coeffDict_,
......@@ -149,7 +158,7 @@ kEpsilonPhitF<BasicTurbulenceModel>::kEpsilonPhitF
),
Ceps1c_
(
dimensioned<scalar>::getOrAddToDict
dimensionedScalar::getOrAddToDict
(
"Ceps1c",
this->coeffDict_,
......@@ -158,7 +167,7 @@ kEpsilonPhitF<BasicTurbulenceModel>::kEpsilonPhitF
),
Ceps2_
(
dimensioned<scalar>::getOrAddToDict
dimensionedScalar::getOrAddToDict
(
"Ceps2",
this->coeffDict_,
......@@ -167,7 +176,7 @@ kEpsilonPhitF<BasicTurbulenceModel>::kEpsilonPhitF
),
Cf1_
(
dimensioned<scalar>::getOrAddToDict
dimensionedScalar::getOrAddToDict
(
"Cf1",
this->coeffDict_,
......@@ -176,7 +185,7 @@ kEpsilonPhitF<BasicTurbulenceModel>::kEpsilonPhitF
),
Cf2_
(
dimensioned<scalar>::getOrAddToDict
dimensionedScalar::getOrAddToDict
(
"Cf2",
this->coeffDict_,
......@@ -185,7 +194,7 @@ kEpsilonPhitF<BasicTurbulenceModel>::kEpsilonPhitF
),
CL_
(
dimensioned<scalar>::getOrAddToDict
dimensionedScalar::getOrAddToDict
(
"CL",
this->coeffDict_,
......@@ -194,7 +203,7 @@ kEpsilonPhitF<BasicTurbulenceModel>::kEpsilonPhitF
),
Ceta_
(
dimensioned<scalar>::getOrAddToDict
dimensionedScalar::getOrAddToDict
(
"Ceta",
this->coeffDict_,
......@@ -203,7 +212,7 @@ kEpsilonPhitF<BasicTurbulenceModel>::kEpsilonPhitF
),
CT_
(
dimensioned<scalar>::getOrAddToDict
dimensionedScalar::getOrAddToDict
(
"CT",
this->coeffDict_,
......@@ -212,7 +221,7 @@ kEpsilonPhitF<BasicTurbulenceModel>::kEpsilonPhitF
),
sigmaK_
(
dimensioned<scalar>::getOrAddToDict
dimensionedScalar::getOrAddToDict
(
"sigmaK",
this->coeffDict_,
......@@ -221,7 +230,7 @@ kEpsilonPhitF<BasicTurbulenceModel>::kEpsilonPhitF
),
sigmaEps_
(
dimensioned<scalar>::getOrAddToDict
dimensionedScalar::getOrAddToDict
(
"sigmaEps",
this->coeffDict_,
......@@ -230,7 +239,7 @@ kEpsilonPhitF<BasicTurbulenceModel>::kEpsilonPhitF
),
sigmaPhit_
(
dimensioned<scalar>::getOrAddToDict
dimensionedScalar::getOrAddToDict
(
"sigmaPhit",
this->coeffDict_,
......@@ -340,6 +349,7 @@ bool kEpsilonPhitF<BasicTurbulenceModel>::read()
{
if (eddyViscosity<RASModel<BasicTurbulenceModel>>::read())
{
includeNu_.readIfPresent("includeNu", this->coeffDict());
Cmu_.readIfPresent(this->coeffDict());
Ceps1a_.readIfPresent(this->coeffDict());
Ceps1b_.readIfPresent(this->coeffDict());
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -34,11 +34,15 @@ Description
compressible flows.
The model is a three-transport-equation linear-eddy-viscosity turbulence
closure model alongside an elliptic relaxation equation:
- Turbulent kinetic energy, \c k,
- Turbulent kinetic energy dissipation rate, \c epsilon,
- Normalised wall-normal fluctuating velocity scale, \c phit,
- Elliptic relaxation factor, \c f.
closure model alongside an elliptic relaxation equation.
\heading Input fields
\plaintable
k | Turbulent kinetic energy [m2/s2]
epsilon | Turbulent kinetic energy dissipation rate [m2/s3]
phit | Normalised wall-normal fluctuating velocity scale [-]
f | Elliptic relaxation factor [1/s]
\endplaintable
Reference:
\verbatim
......@@ -53,19 +57,20 @@ Description
\verbatim
kEpsilonPhitFCoeffs
{
Cmu 0.22, // Turbulent viscosity constant
Ceps1a 1.4, // Model constant for epsilon
Ceps1b 1.0, // Model constant for epsilon
Ceps1c 0.05, // Model constant for epsilon
Ceps2 1.9, // Model constant for epsilon
Cf1 1.4, // Model constant for f
Cf2 0.3, // Model constant for f
CL 0.25, // Model constant for L
Ceta 110.0, // Model constant for L
CT 6.0, // Model constant for T
sigmaK 1.0, // Turbulent Prandtl number for k
sigmaEps 1.3, // Turbulent Prandtl number for epsilon
sigmaPhit 1.0, // Turbulent Prandtl number for phit = sigmaK
includeNu true; // include nu in (LUU: Eq. 17), see Notes
Cmu 0.22; // Turbulent viscosity constant
Ceps1a 1.4; // Model constant for epsilon
Ceps1b 1.0; // Model constant for epsilon
Ceps1c 0.05; // Model constant for epsilon
Ceps2 1.9; // Model constant for epsilon
Cf1 1.4; // Model constant for f
Cf2 0.3; // Model constant for f
CL 0.25; // Model constant for L
Ceta 110.0; // Model constant for L
CT 6.0; // Model constant for T
sigmaK 1.0; // Turbulent Prandtl number for k
sigmaEps 1.3; // Turbulent Prandtl number for epsilon
sigmaPhit 1.0; // Turbulent Prandtl number for phit = sigmaK
}
\endverbatim
......@@ -74,6 +79,14 @@ Note
However, the name 'phi' preexisted in OpenFOAM; therefore, this name was
replaced by 'phit' herein.
Including \c nu in \c DphitEff even though it is not present in (LUU:Eq. 17)
provided higher level of resemblance to benchmarks for the tests considered,
particularly for the peak skin friction (yet, pressure-related predictions
were unaffected). Users can switch off \c nu in \c DphitEff by using
\c includeNu entry in \c kEpsilonPhitFCoeffs as shown above in order to
follow the reference paper thereat. \c includeNu is left \c true by default.
See GitLab issue #1560.
SourceFiles
kEpsilonPhitF.C
......@@ -117,6 +130,8 @@ protected:
// Protected Data
Switch includeNu_;
// Model coefficients
dimensionedScalar Cmu_;
......@@ -208,7 +223,7 @@ public:
//- Re-read model coefficients if they have changed
virtual bool read();
//- Return the effective diffusivity for k
//- Return the effective diffusivity for k (LUU:Eq. 3)
tmp<volScalarField> DkEff() const
{
return tmp<volScalarField>
......@@ -221,7 +236,7 @@ public:
);
}
//- Return the effective diffusivity for epsilon
//- Return the effective diffusivity for epsilon (LUU:Eq. 4)
tmp<volScalarField> DepsilonEff() const
{
return tmp<volScalarField>
......@@ -234,17 +249,18 @@ public:
);
}
//- Return the effective diffusivity for phit
//- Return the effective diffusivity for phit (LUU:Eq. 17)
tmp<volScalarField> DphitEff() const
{
return tmp<volScalarField>
(
new volScalarField
(
"DphitEff",
this->nut_/sigmaPhit_ + this->nu()
)
);
auto tfld =
tmp<volScalarField>::New("DphitEff", this->nut_/sigmaPhit_);
if (includeNu_)
{
tfld.ref() += this->nu();
}
return tfld;
}
//- Return the turbulent kinetic energy field
......
......@@ -166,19 +166,15 @@ Foam::Ostream& Foam::ensightFile::write
Foam::Ostream& Foam::ensightFile::write(const char* value)
{
// Parentheses around strncpy to silence the GCC -Wstringop-truncation
// warning, which is spurious here.
// The max-size and buffer-size *are* identical, which means the buffer
// may not have a nul terminator. However, this is properly handled in
// the subsequent binary write and the ASCII write explicitly adds
// a nul terminator.
// Output 80 chars, but allocate for trailing nul character
// to avoid -Wstringop-truncation warnings/errors.
char buf[80];
(strncpy(buf, value, 80)); // max 80 chars or padded with nul if smaller
char buf[80+1];
strncpy(buf, value, 80); // max 80 chars or padded with nul if smaller
if (format() == IOstream::BINARY)
{
write(buf, sizeof(buf));
write(buf, 80);
}
else
{
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -96,11 +96,11 @@ Foam::turbulentDigitalFilterInletFvPatchVectorField::patchIndexPairs()
const vector nf(computePatchNormal());
// Find the second local coordinate direction
direction minCmpt = -1;
scalar minMag = VGREAT;
for (direction cmpt = 0; cmpt < pTraits<vector>::nComponents; ++cmpt)
direction minCmpt = 0;
scalar minMag = mag(nf[minCmpt]);
for (direction cmpt = 1; cmpt < pTraits<vector>::nComponents; ++cmpt)
{
scalar s = mag(nf[cmpt]);
const scalar s = mag(nf[cmpt]);
if (s < minMag)
{
minMag = s;
......@@ -110,7 +110,7 @@ Foam::turbulentDigitalFilterInletFvPatchVectorField::patchIndexPairs()
// Create the second local coordinate direction
vector e2(Zero);
e2[minCmpt] = 1.0;
e2[minCmpt] = 1;
// Remove normal component
e2 -= (nf&e2)*nf;
......@@ -147,17 +147,14 @@ Foam::turbulentDigitalFilterInletFvPatchVectorField::patchIndexPairs()
// Compute virtual-actual patch index pairs
List<Pair<label>> indexPairs(this->size(), Pair<label>(Zero, Zero));
// Virtual turbulence plane indices
label j = 0;
label k = 0;
forAll(*this, facei)
{
const scalar& centre0 = localPos[facei][0];
const scalar& centre1 = localPos[facei][1];
j = label((centre0 - localMinPt[0])*invDelta_[0]);
k = label((centre1 - localMinPt[1])*invDelta_[1]);
// Virtual turbulence plane indices
const label j = label((centre0 - localMinPt[0])*invDelta_[0]);
const label k = label((centre1 - localMinPt[1])*invDelta_[1]);
indexPairs[facei] = Pair<label>(facei, k*n[0] + j);
}
......
......@@ -162,7 +162,7 @@ public:
//- Destructor
~weightedFlux();
virtual ~weightedFlux();
// Member Functions
......
......@@ -622,7 +622,7 @@ scalar reactingOneDim::solidRegionDiffNo() const
DiNum = max(KrhoCpbyDelta.primitiveField())*time().deltaTValue();
}
return DiNum;
return returnReduce(DiNum, maxOp<scalar>());
}
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2015-2019 OpenCFD Ltd.
Copyright (C) 2015-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -129,8 +129,8 @@ void Foam::surfaceWriters::nastranWriter::writeFace
Ostream& os,
const word& faceType,
const labelUList& facePts,
const label nFace,
const label PID
const label elemId,
const label propId
) const
{
// Only valid surface elements are CTRIA3 and CQUAD4
......@@ -147,12 +147,12 @@ void Foam::surfaceWriters::nastranWriter::writeFace
// For CTRIA3 elements, cols 7 onwards are not used
writeKeyword(os, faceType) << separator_;
writeKeyword(os, faceType) << separator_;
os.setf(std::ios_base::right);
writeValue(os, nFace) << separator_;
writeValue(os, PID);
writeValue(os, elemId) << separator_;
writeValue(os, propId);
switch (writeFormat_)
{
......@@ -204,7 +204,7 @@ void Foam::surfaceWriters::nastranWriter::writeGeometry
(
Ostream& os,
const meshedSurf& surf,
List<DynamicList<face>>& decomposedFaces
List<faceList>& decomposedFaces
) const
{
const pointField& points = surf.points();
......@@ -222,42 +222,46 @@ void Foam::surfaceWriters::nastranWriter::writeGeometry
writeCoord(os, points[pointi], pointi);
}
// Write faces
// Write faces, with on-the-fly decomposition (triangulation)
decomposedFaces.clear();
decomposedFaces.setSize(faces.size());
decomposedFaces.resize(faces.size());
os << "$" << nl
<< "$ Faces" << nl
<< "$" << nl;
label nFace = 0; // the element-id
label elemId = 0; // The element-id
forAll(faces, facei)
{
const face& f = faces[facei];
faceList& decomp = decomposedFaces[facei];
// 1-offset for PID
const label PID = 1 + (facei < zones.size() ? zones[facei] : 0);
const label propId = 1 + (facei < zones.size() ? zones[facei] : 0);
if (f.size() == 3)
{
writeFace(os, "CTRIA3", f, ++nFace, PID);
decomposedFaces[facei].append(f);
writeFace(os, "CTRIA3", f, ++elemId, propId);
decomp.resize(1);
decomp[0] = f;
}
else if (f.size() == 4)
{
writeFace(os, "CQUAD4", f, ++nFace, PID);
decomposedFaces[facei].append(f);
writeFace(os, "CQUAD4", f, ++elemId, propId);
decomp.resize(1);
decomp[0] = f;
}
else
{
// Decompose poly face into tris
decomp.resize(f.nTriangles());
label nTri = 0;
faceList triFaces;
f.triangles(points, nTri, triFaces);
f.triangles(points, nTri, decomp);
forAll(triFaces, trii)
for (const face& f2 : decomp)
{
writeFace(os, "CTRIA3", triFaces[trii], ++nFace, PID);
decomposedFaces[facei].append(triFaces[trii]);
writeFace(os, "CTRIA3", f2, ++elemId, propId);
}
}
}
......@@ -275,7 +279,7 @@ Foam::Ostream& Foam::surfaceWriters::nastranWriter::writeFooter
labelList pidsUsed = labelHashSet(surf.zoneIds()).sortedToc();
if (pidsUsed.empty())
{
pidsUsed.setSize(1, Zero); // fallback
pidsUsed.resize(1, Zero); // fallback
}
for (auto pid : pidsUsed)
......@@ -431,7 +435,7 @@ Foam::fileName Foam::surfaceWriters::nastranWriter::write()
<< "$" << nl
<< "BEGIN BULK" << nl;
List<DynamicList<face>> decomposedFaces;
List<faceList> decomposedFaces;
writeGeometry(os, surf, decomposedFaces);
writeFooter(os, surf)
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2015-2019 OpenCFD Ltd.
Copyright (C) 2015-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -151,8 +151,8 @@ private:
Ostream& os,
const word& faceType,
const labelUList& facePts,
const label EID, //!< 1-based Element Id
const label PID //!< 1-based Property Id
const label elemId, //!< 1-based Element Id
const label propId //!< 1-based Property Id
) const;
//- Main driver to write the surface mesh geometry
......@@ -160,7 +160,7 @@ private:
(
Ostream& os,
const meshedSurf& surf,
List<DynamicList<face>>& decomposedFaces
List<faceList>& decomposedFaces
) const;
//- Write the formatted keyword to the output stream
......@@ -184,7 +184,7 @@ private:
Ostream& os,
const loadFormat format,
const Type& value,
const label EID //!< 1-based Element Id
const label elemId //!< 1-based Element Id
) const;
......@@ -199,16 +199,16 @@ private:
public:
//- Runtime type information
//- Declare type-name, virtual type (with debug switch)
TypeNameNoDebug("nastran");
// Constructors
//- Construct null
//- Default construct. Default SHORT format
nastranWriter();