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

This commit is contained in:
Mark Olesen
2020-01-31 16:53:36 +01:00
14 changed files with 138 additions and 131 deletions

View File

@ -1,2 +1,2 @@
api=2001 api=2001
patch=0 patch=200129

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2018 Bernhard Gschaider <bgschaid@hfd-research.com> Copyright (C) 2012-2018 Bernhard Gschaider <bgschaid@hfd-research.com>
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -203,7 +203,7 @@ Foam::expressions::exprResultGlobals::get
{ {
WarningInFunction WarningInFunction
<< "No scope " << scopeName << " for " << name << nl << "No scope " << scopeName << " for " << name << nl
<< "Known global scopes: " << variables_.sortToc() << nl; << "Known global scopes: " << variables_.sortedToc() << nl;
} }
#endif #endif
} }

View File

@ -97,13 +97,6 @@ public:
vectorTensorTransform& vectorTensorTransform&
operator=(const vectorTensorTransform&) = default; operator=(const vectorTensorTransform&) = default;
//- Move construct
vectorTensorTransform(vectorTensorTransform&&) = default;
//- Move assignment
vectorTensorTransform&
operator=(vectorTensorTransform&&) = default;
// Constructors // Constructors

View File

@ -138,12 +138,6 @@ public:
//- Copy assignment //- Copy assignment
quaternion& operator=(const quaternion&) = default; quaternion& operator=(const quaternion&) = default;
//- Move construct
quaternion(quaternion&&) = default;
//- Move assignment
quaternion& operator=(quaternion&&) = default;
// Constructors // Constructors

View File

@ -96,12 +96,6 @@ public:
//- Copy assignment //- Copy assignment
septernion& operator=(const septernion&) = default; septernion& operator=(const septernion&) = default;
//- Move construct
septernion(septernion&&) = default;
//- Move assignment
septernion& operator=(septernion&&) = default;
// Constructors // Constructors

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -120,9 +120,18 @@ kEpsilonPhitF<BasicTurbulenceModel>::kEpsilonPhitF
propertiesName propertiesName
), ),
includeNu_
(
Switch::getOrAddToDict
(
"includeNu",
this->coeffDict_,
true
)
),
Cmu_ Cmu_
( (
dimensioned<scalar>::getOrAddToDict dimensionedScalar::getOrAddToDict
( (
"Cmu", "Cmu",
this->coeffDict_, this->coeffDict_,
@ -131,7 +140,7 @@ kEpsilonPhitF<BasicTurbulenceModel>::kEpsilonPhitF
), ),
Ceps1a_ Ceps1a_
( (
dimensioned<scalar>::getOrAddToDict dimensionedScalar::getOrAddToDict
( (
"Ceps1a", "Ceps1a",
this->coeffDict_, this->coeffDict_,
@ -140,7 +149,7 @@ kEpsilonPhitF<BasicTurbulenceModel>::kEpsilonPhitF
), ),
Ceps1b_ Ceps1b_
( (
dimensioned<scalar>::getOrAddToDict dimensionedScalar::getOrAddToDict
( (
"Ceps1b", "Ceps1b",
this->coeffDict_, this->coeffDict_,
@ -149,7 +158,7 @@ kEpsilonPhitF<BasicTurbulenceModel>::kEpsilonPhitF
), ),
Ceps1c_ Ceps1c_
( (
dimensioned<scalar>::getOrAddToDict dimensionedScalar::getOrAddToDict
( (
"Ceps1c", "Ceps1c",
this->coeffDict_, this->coeffDict_,
@ -158,7 +167,7 @@ kEpsilonPhitF<BasicTurbulenceModel>::kEpsilonPhitF
), ),
Ceps2_ Ceps2_
( (
dimensioned<scalar>::getOrAddToDict dimensionedScalar::getOrAddToDict
( (
"Ceps2", "Ceps2",
this->coeffDict_, this->coeffDict_,
@ -167,7 +176,7 @@ kEpsilonPhitF<BasicTurbulenceModel>::kEpsilonPhitF
), ),
Cf1_ Cf1_
( (
dimensioned<scalar>::getOrAddToDict dimensionedScalar::getOrAddToDict
( (
"Cf1", "Cf1",
this->coeffDict_, this->coeffDict_,
@ -176,7 +185,7 @@ kEpsilonPhitF<BasicTurbulenceModel>::kEpsilonPhitF
), ),
Cf2_ Cf2_
( (
dimensioned<scalar>::getOrAddToDict dimensionedScalar::getOrAddToDict
( (
"Cf2", "Cf2",
this->coeffDict_, this->coeffDict_,
@ -185,7 +194,7 @@ kEpsilonPhitF<BasicTurbulenceModel>::kEpsilonPhitF
), ),
CL_ CL_
( (
dimensioned<scalar>::getOrAddToDict dimensionedScalar::getOrAddToDict
( (
"CL", "CL",
this->coeffDict_, this->coeffDict_,
@ -194,7 +203,7 @@ kEpsilonPhitF<BasicTurbulenceModel>::kEpsilonPhitF
), ),
Ceta_ Ceta_
( (
dimensioned<scalar>::getOrAddToDict dimensionedScalar::getOrAddToDict
( (
"Ceta", "Ceta",
this->coeffDict_, this->coeffDict_,
@ -203,7 +212,7 @@ kEpsilonPhitF<BasicTurbulenceModel>::kEpsilonPhitF
), ),
CT_ CT_
( (
dimensioned<scalar>::getOrAddToDict dimensionedScalar::getOrAddToDict
( (
"CT", "CT",
this->coeffDict_, this->coeffDict_,
@ -212,7 +221,7 @@ kEpsilonPhitF<BasicTurbulenceModel>::kEpsilonPhitF
), ),
sigmaK_ sigmaK_
( (
dimensioned<scalar>::getOrAddToDict dimensionedScalar::getOrAddToDict
( (
"sigmaK", "sigmaK",
this->coeffDict_, this->coeffDict_,
@ -221,7 +230,7 @@ kEpsilonPhitF<BasicTurbulenceModel>::kEpsilonPhitF
), ),
sigmaEps_ sigmaEps_
( (
dimensioned<scalar>::getOrAddToDict dimensionedScalar::getOrAddToDict
( (
"sigmaEps", "sigmaEps",
this->coeffDict_, this->coeffDict_,
@ -230,7 +239,7 @@ kEpsilonPhitF<BasicTurbulenceModel>::kEpsilonPhitF
), ),
sigmaPhit_ sigmaPhit_
( (
dimensioned<scalar>::getOrAddToDict dimensionedScalar::getOrAddToDict
( (
"sigmaPhit", "sigmaPhit",
this->coeffDict_, this->coeffDict_,
@ -340,6 +349,7 @@ bool kEpsilonPhitF<BasicTurbulenceModel>::read()
{ {
if (eddyViscosity<RASModel<BasicTurbulenceModel>>::read()) if (eddyViscosity<RASModel<BasicTurbulenceModel>>::read())
{ {
includeNu_.readIfPresent("includeNu", this->coeffDict());
Cmu_.readIfPresent(this->coeffDict()); Cmu_.readIfPresent(this->coeffDict());
Ceps1a_.readIfPresent(this->coeffDict()); Ceps1a_.readIfPresent(this->coeffDict());
Ceps1b_.readIfPresent(this->coeffDict()); Ceps1b_.readIfPresent(this->coeffDict());

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -34,11 +34,15 @@ Description
compressible flows. compressible flows.
The model is a three-transport-equation linear-eddy-viscosity turbulence The model is a three-transport-equation linear-eddy-viscosity turbulence
closure model alongside an elliptic relaxation equation: closure model alongside an elliptic relaxation equation.
- Turbulent kinetic energy, \c k,
- Turbulent kinetic energy dissipation rate, \c epsilon, \heading Input fields
- Normalised wall-normal fluctuating velocity scale, \c phit, \plaintable
- Elliptic relaxation factor, \c f. 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: Reference:
\verbatim \verbatim
@ -53,19 +57,20 @@ Description
\verbatim \verbatim
kEpsilonPhitFCoeffs kEpsilonPhitFCoeffs
{ {
Cmu 0.22, // Turbulent viscosity constant includeNu true; // include nu in (LUU: Eq. 17), see Notes
Ceps1a 1.4, // Model constant for epsilon Cmu 0.22; // Turbulent viscosity constant
Ceps1b 1.0, // Model constant for epsilon Ceps1a 1.4; // Model constant for epsilon
Ceps1c 0.05, // Model constant for epsilon Ceps1b 1.0; // Model constant for epsilon
Ceps2 1.9, // Model constant for epsilon Ceps1c 0.05; // Model constant for epsilon
Cf1 1.4, // Model constant for f Ceps2 1.9; // Model constant for epsilon
Cf2 0.3, // Model constant for f Cf1 1.4; // Model constant for f
CL 0.25, // Model constant for L Cf2 0.3; // Model constant for f
Ceta 110.0, // Model constant for L CL 0.25; // Model constant for L
CT 6.0, // Model constant for T Ceta 110.0; // Model constant for L
sigmaK 1.0, // Turbulent Prandtl number for k CT 6.0; // Model constant for T
sigmaEps 1.3, // Turbulent Prandtl number for epsilon sigmaK 1.0; // Turbulent Prandtl number for k
sigmaPhit 1.0, // Turbulent Prandtl number for phit = sigmaK sigmaEps 1.3; // Turbulent Prandtl number for epsilon
sigmaPhit 1.0; // Turbulent Prandtl number for phit = sigmaK
} }
\endverbatim \endverbatim
@ -74,6 +79,14 @@ Note
However, the name 'phi' preexisted in OpenFOAM; therefore, this name was However, the name 'phi' preexisted in OpenFOAM; therefore, this name was
replaced by 'phit' herein. 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 SourceFiles
kEpsilonPhitF.C kEpsilonPhitF.C
@ -117,6 +130,8 @@ protected:
// Protected Data // Protected Data
Switch includeNu_;
// Model coefficients // Model coefficients
dimensionedScalar Cmu_; dimensionedScalar Cmu_;
@ -208,7 +223,7 @@ public:
//- Re-read model coefficients if they have changed //- Re-read model coefficients if they have changed
virtual bool read(); virtual bool read();
//- Return the effective diffusivity for k //- Return the effective diffusivity for k (LUU:Eq. 3)
tmp<volScalarField> DkEff() const tmp<volScalarField> DkEff() const
{ {
return tmp<volScalarField> 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 tmp<volScalarField> DepsilonEff() const
{ {
return tmp<volScalarField> 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 tmp<volScalarField> DphitEff() const
{ {
return tmp<volScalarField> auto tfld =
( tmp<volScalarField>::New("DphitEff", this->nut_/sigmaPhit_);
new volScalarField
( if (includeNu_)
"DphitEff", {
this->nut_/sigmaPhit_ + this->nu() tfld.ref() += this->nu();
) }
);
return tfld;
} }
//- Return the turbulent kinetic energy field //- Return the turbulent kinetic energy field

View File

@ -166,19 +166,15 @@ Foam::Ostream& Foam::ensightFile::write
Foam::Ostream& Foam::ensightFile::write(const char* value) Foam::Ostream& Foam::ensightFile::write(const char* value)
{ {
// Parentheses around strncpy to silence the GCC -Wstringop-truncation // Output 80 chars, but allocate for trailing nul character
// warning, which is spurious here. // to avoid -Wstringop-truncation warnings/errors.
// 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.
char buf[80]; char buf[80+1];
(strncpy(buf, value, 80)); // max 80 chars or padded with nul if smaller strncpy(buf, value, 80); // max 80 chars or padded with nul if smaller
if (format() == IOstream::BINARY) if (format() == IOstream::BINARY)
{ {
write(buf, sizeof(buf)); write(buf, 80);
} }
else else
{ {

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -96,11 +96,11 @@ Foam::turbulentDigitalFilterInletFvPatchVectorField::patchIndexPairs()
const vector nf(computePatchNormal()); const vector nf(computePatchNormal());
// Find the second local coordinate direction // Find the second local coordinate direction
direction minCmpt = -1; direction minCmpt = 0;
scalar minMag = VGREAT; scalar minMag = mag(nf[minCmpt]);
for (direction cmpt = 0; cmpt < pTraits<vector>::nComponents; ++cmpt) for (direction cmpt = 1; cmpt < pTraits<vector>::nComponents; ++cmpt)
{ {
scalar s = mag(nf[cmpt]); const scalar s = mag(nf[cmpt]);
if (s < minMag) if (s < minMag)
{ {
minMag = s; minMag = s;
@ -110,7 +110,7 @@ Foam::turbulentDigitalFilterInletFvPatchVectorField::patchIndexPairs()
// Create the second local coordinate direction // Create the second local coordinate direction
vector e2(Zero); vector e2(Zero);
e2[minCmpt] = 1.0; e2[minCmpt] = 1;
// Remove normal component // Remove normal component
e2 -= (nf&e2)*nf; e2 -= (nf&e2)*nf;
@ -147,17 +147,14 @@ Foam::turbulentDigitalFilterInletFvPatchVectorField::patchIndexPairs()
// Compute virtual-actual patch index pairs // Compute virtual-actual patch index pairs
List<Pair<label>> indexPairs(this->size(), Pair<label>(Zero, Zero)); List<Pair<label>> indexPairs(this->size(), Pair<label>(Zero, Zero));
// Virtual turbulence plane indices
label j = 0;
label k = 0;
forAll(*this, facei) forAll(*this, facei)
{ {
const scalar& centre0 = localPos[facei][0]; const scalar& centre0 = localPos[facei][0];
const scalar& centre1 = localPos[facei][1]; const scalar& centre1 = localPos[facei][1];
j = label((centre0 - localMinPt[0])*invDelta_[0]); // Virtual turbulence plane indices
k = label((centre1 - localMinPt[1])*invDelta_[1]); 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); indexPairs[facei] = Pair<label>(facei, k*n[0] + j);
} }

View File

@ -162,7 +162,7 @@ public:
//- Destructor //- Destructor
~weightedFlux(); virtual ~weightedFlux();
// Member Functions // Member Functions

View File

@ -622,7 +622,7 @@ scalar reactingOneDim::solidRegionDiffNo() const
DiNum = max(KrhoCpbyDelta.primitiveField())*time().deltaTValue(); DiNum = max(KrhoCpbyDelta.primitiveField())*time().deltaTValue();
} }
return DiNum; return returnReduce(DiNum, maxOp<scalar>());
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2015-2019 OpenCFD Ltd. Copyright (C) 2015-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -129,8 +129,8 @@ void Foam::surfaceWriters::nastranWriter::writeFace
Ostream& os, Ostream& os,
const word& faceType, const word& faceType,
const labelUList& facePts, const labelUList& facePts,
const label nFace, const label elemId,
const label PID const label propId
) const ) const
{ {
// Only valid surface elements are CTRIA3 and CQUAD4 // 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 // For CTRIA3 elements, cols 7 onwards are not used
writeKeyword(os, faceType) << separator_; writeKeyword(os, faceType) << separator_;
os.setf(std::ios_base::right); os.setf(std::ios_base::right);
writeValue(os, nFace) << separator_; writeValue(os, elemId) << separator_;
writeValue(os, PID); writeValue(os, propId);
switch (writeFormat_) switch (writeFormat_)
{ {
@ -204,7 +204,7 @@ void Foam::surfaceWriters::nastranWriter::writeGeometry
( (
Ostream& os, Ostream& os,
const meshedSurf& surf, const meshedSurf& surf,
List<DynamicList<face>>& decomposedFaces List<faceList>& decomposedFaces
) const ) const
{ {
const pointField& points = surf.points(); const pointField& points = surf.points();
@ -222,42 +222,46 @@ void Foam::surfaceWriters::nastranWriter::writeGeometry
writeCoord(os, points[pointi], pointi); writeCoord(os, points[pointi], pointi);
} }
// Write faces // Write faces, with on-the-fly decomposition (triangulation)
decomposedFaces.clear(); decomposedFaces.clear();
decomposedFaces.setSize(faces.size()); decomposedFaces.resize(faces.size());
os << "$" << nl os << "$" << nl
<< "$ Faces" << nl << "$ Faces" << nl
<< "$" << nl; << "$" << nl;
label nFace = 0; // the element-id label elemId = 0; // The element-id
forAll(faces, facei) forAll(faces, facei)
{ {
const face& f = faces[facei]; const face& f = faces[facei];
faceList& decomp = decomposedFaces[facei];
// 1-offset for PID // 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) if (f.size() == 3)
{ {
writeFace(os, "CTRIA3", f, ++nFace, PID); writeFace(os, "CTRIA3", f, ++elemId, propId);
decomposedFaces[facei].append(f); decomp.resize(1);
decomp[0] = f;
} }
else if (f.size() == 4) else if (f.size() == 4)
{ {
writeFace(os, "CQUAD4", f, ++nFace, PID); writeFace(os, "CQUAD4", f, ++elemId, propId);
decomposedFaces[facei].append(f); decomp.resize(1);
decomp[0] = f;
} }
else else
{ {
// Decompose poly face into tris // Decompose poly face into tris
label nTri = 0; decomp.resize(f.nTriangles());
faceList triFaces;
f.triangles(points, nTri, triFaces);
forAll(triFaces, trii) label nTri = 0;
f.triangles(points, nTri, decomp);
for (const face& f2 : decomp)
{ {
writeFace(os, "CTRIA3", triFaces[trii], ++nFace, PID); writeFace(os, "CTRIA3", f2, ++elemId, propId);
decomposedFaces[facei].append(triFaces[trii]);
} }
} }
} }
@ -275,7 +279,7 @@ Foam::Ostream& Foam::surfaceWriters::nastranWriter::writeFooter
labelList pidsUsed = labelHashSet(surf.zoneIds()).sortedToc(); labelList pidsUsed = labelHashSet(surf.zoneIds()).sortedToc();
if (pidsUsed.empty()) if (pidsUsed.empty())
{ {
pidsUsed.setSize(1, Zero); // fallback pidsUsed.resize(1, Zero); // fallback
} }
for (auto pid : pidsUsed) for (auto pid : pidsUsed)
@ -431,7 +435,7 @@ Foam::fileName Foam::surfaceWriters::nastranWriter::write()
<< "$" << nl << "$" << nl
<< "BEGIN BULK" << nl; << "BEGIN BULK" << nl;
List<DynamicList<face>> decomposedFaces; List<faceList> decomposedFaces;
writeGeometry(os, surf, decomposedFaces); writeGeometry(os, surf, decomposedFaces);
writeFooter(os, surf) writeFooter(os, surf)

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2015-2019 OpenCFD Ltd. Copyright (C) 2015-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -151,8 +151,8 @@ private:
Ostream& os, Ostream& os,
const word& faceType, const word& faceType,
const labelUList& facePts, const labelUList& facePts,
const label EID, //!< 1-based Element Id const label elemId, //!< 1-based Element Id
const label PID //!< 1-based Property Id const label propId //!< 1-based Property Id
) const; ) const;
//- Main driver to write the surface mesh geometry //- Main driver to write the surface mesh geometry
@ -160,7 +160,7 @@ private:
( (
Ostream& os, Ostream& os,
const meshedSurf& surf, const meshedSurf& surf,
List<DynamicList<face>>& decomposedFaces List<faceList>& decomposedFaces
) const; ) const;
//- Write the formatted keyword to the output stream //- Write the formatted keyword to the output stream
@ -184,7 +184,7 @@ private:
Ostream& os, Ostream& os,
const loadFormat format, const loadFormat format,
const Type& value, const Type& value,
const label EID //!< 1-based Element Id const label elemId //!< 1-based Element Id
) const; ) const;
@ -199,16 +199,16 @@ private:
public: public:
//- Runtime type information //- Declare type-name, virtual type (with debug switch)
TypeNameNoDebug("nastran"); TypeNameNoDebug("nastran");
// Constructors // Constructors
//- Construct null //- Default construct. Default SHORT format
nastranWriter(); nastranWriter();
//- Construct with some output options //- Construct with some output options. Default LONG format
explicit nastranWriter(const dictionary& options); explicit nastranWriter(const dictionary& options);
//- Construct from components //- Construct from components

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2015-2019 OpenCFD Ltd. Copyright (C) 2015-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -70,7 +70,7 @@ Foam::Ostream& Foam::surfaceWriters::nastranWriter::writeFaceValue
Ostream& os, Ostream& os,
const loadFormat format, const loadFormat format,
const Type& value, const Type& value,
const label EID const label elemId
) const ) const
{ {
// Fixed short/long formats supporting PLOAD2 and PLOAD4: // Fixed short/long formats supporting PLOAD2 and PLOAD4:
@ -87,7 +87,7 @@ Foam::Ostream& Foam::surfaceWriters::nastranWriter::writeFaceValue
// 3 EID : element ID // 3 EID : element ID
// 4 onwards : load values // 4 onwards : load values
label SID = 1; const label setId = 1;
Type scaledValue = scale_*value; Type scaledValue = scale_*value;
@ -98,7 +98,7 @@ Foam::Ostream& Foam::surfaceWriters::nastranWriter::writeFaceValue
// Write load set ID // Write load set ID
os.setf(std::ios_base::right); os.setf(std::ios_base::right);
writeValue(os, SID) << separator_; writeValue(os, setId) << separator_;
switch (format) switch (format)
{ {
@ -119,13 +119,13 @@ Foam::Ostream& Foam::surfaceWriters::nastranWriter::writeFaceValue
writeValue(os, scalar(0)) << separator_; writeValue(os, scalar(0)) << separator_;
} }
writeValue(os, EID); writeValue(os, elemId);
break; break;
} }
case loadFormat::PLOAD4 : case loadFormat::PLOAD4 :
{ {
writeValue(os, EID); writeValue(os, elemId);
for (direction d = 0; d < pTraits<Type>::nComponents; ++d) for (direction d = 0; d < pTraits<Type>::nComponents; ++d)
{ {
@ -197,7 +197,7 @@ Foam::fileName Foam::surfaceWriters::nastranWriter::writeTemplate
mkDir(outputFile.path()); mkDir(outputFile.path());
} }
const scalar timeValue = 0.0; const scalar timeValue(0);
OFstream os(outputFile); OFstream os(outputFile);
fileFormats::NASCore::setPrecision(os, writeFormat_); fileFormats::NASCore::setPrecision(os, writeFormat_);
@ -214,7 +214,7 @@ Foam::fileName Foam::surfaceWriters::nastranWriter::writeTemplate
<< "$" << nl << "$" << nl
<< "BEGIN BULK" << nl; << "BEGIN BULK" << nl;
List<DynamicList<face>> decomposedFaces; List<faceList> decomposedFaces;
writeGeometry(os, surf, decomposedFaces); writeGeometry(os, surf, decomposedFaces);
os << "$" << nl os << "$" << nl
@ -225,7 +225,7 @@ Foam::fileName Foam::surfaceWriters::nastranWriter::writeTemplate
if (this->isPointData()) if (this->isPointData())
{ {
for (const DynamicList<face>& dFaces : decomposedFaces) for (const faceList& dFaces : decomposedFaces)
{ {
for (const face& f : dFaces) for (const face& f : dFaces)
{ {
@ -243,12 +243,15 @@ Foam::fileName Foam::surfaceWriters::nastranWriter::writeTemplate
} }
else else
{ {
for (const DynamicList<face>& dFaces : decomposedFaces) auto valIter = values.cbegin();
for (const faceList& dFaces : decomposedFaces)
{ {
forAll(dFaces, facei) forAll(dFaces, facei)
{ {
writeFaceValue(os, format, values[facei], ++elemId); writeFaceValue(os, format, *valIter, ++elemId);
} }
++valIter;
} }
} }