Compare commits

..

1 Commits

14 changed files with 200 additions and 300 deletions

View File

@ -1,2 +1,2 @@
api=2312
patch=240625
patch=240220

View File

@ -310,7 +310,13 @@ void Foam::GAMGSolver::gatherMatrices
const auto& boundaryMap = agglomeration_.boundaryMap(destLevel);
PstreamBuffers pBufs(comm);
// Use PstreamBuffers
PstreamBuffers pBufs
(
UPstream::commsTypes::nonBlocking,
UPstream::msgType(),
comm
);
// Send to master
if (!UPstream::master(comm))
@ -335,7 +341,6 @@ void Foam::GAMGSolver::gatherMatrices
validCoeffs.set(intI);
}
}
// Only preserved interfaces need to be sent across
bitSet validInterface(interfaces.size());
forAll(interfaces, intI)
@ -349,8 +354,7 @@ void Foam::GAMGSolver::gatherMatrices
UOPstream toMaster(UPstream::masterNo(), pBufs);
toMaster
<< mat
toMaster<< mat
<< token::SPACE << validCoeffs
<< token::SPACE << validInterface;
@ -384,10 +388,10 @@ void Foam::GAMGSolver::gatherMatrices
lduInterfacePtrsList destInterfaces = destMesh.interfaces();
// Master.
otherMats.resize(nProcs-1);
otherBouCoeffs.resize(nProcs-1);
otherIntCoeffs.resize(nProcs-1);
otherInterfaces.resize(nProcs-1);
otherMats.setSize(nProcs-1);
otherBouCoeffs.setSize(nProcs-1);
otherIntCoeffs.setSize(nProcs-1);
otherInterfaces.setSize(nProcs-1);
for (const int proci : UPstream::subProcs(comm))
{
@ -397,7 +401,7 @@ void Foam::GAMGSolver::gatherMatrices
otherMats.set(otherI, new lduMatrix(destMesh, fromProc));
// Receive bit-sets of valid interfaceCoeffs/interfaces
// Receive bitSet of/valid interfaceCoeffs/interfaces
const bitSet validCoeffs(fromProc);
const bitSet validInterface(fromProc);

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2024 OpenCFD Ltd.
Copyright (C) 2017-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -136,8 +136,7 @@ std::string Foam::fileFormats::NASCore::nextNasField
(
const std::string& str,
std::string::size_type& pos,
const std::string::size_type width,
const bool free_format
std::string::size_type len
)
{
const auto beg = pos;
@ -145,23 +144,15 @@ std::string Foam::fileFormats::NASCore::nextNasField
if (end == std::string::npos)
{
if (free_format)
{
// Nothing left
pos = str.size();
return str.substr(beg);
}
// Fixed format - continue after field width
pos = beg + width;
return str.substr(beg, width);
pos = beg + len; // Continue after field width
}
else
{
// Free format - continue after comma
pos = end + 1;
return str.substr(beg, (end - beg));
len = (end - beg); // Efffective width
pos = end + 1; // Continue after comma
}
return str.substr(beg, len);
}
@ -258,8 +249,8 @@ void Foam::fileFormats::NASCore::writeCoord
// 2 ID : point ID - requires starting index of 1
// 3 CP : coordinate system ID (blank)
// 4 X1 : point x coordinate
// 5 X2 : point y coordinate
// 6 X3 : point z coordinate
// 5 X2 : point x coordinate
// 6 X3 : point x coordinate
// 7 CD : coordinate system for displacements (blank)
// 8 PS : single point constraints (blank)
// 9 SEID : super-element ID

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2024 OpenCFD Ltd.
Copyright (C) 2017-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -47,6 +47,7 @@ SourceFiles
namespace Foam
{
namespace fileFormats
{
@ -78,18 +79,18 @@ public:
//- Output load format
enum loadFormat
{
PLOAD2, //!< Face load (eg, pressure)
PLOAD4 //!< Vertex load
PLOAD2,
PLOAD4
};
//- Selection names for the NASTRAN load formats
//- Selection names for the NASTRAN file field formats
static const Enum<loadFormat> loadFormatNames;
// Constructors
//- Default construct
NASCore() noexcept = default;
NASCore() = default;
// Public Static Member Functions
@ -97,20 +98,18 @@ public:
//- Extract numbers from things like "-2.358-8" (same as "-2.358e-8")
static scalar readNasScalar(const std::string& str);
//- A std::string::substr() variant to handle fixed-format and
//- free-format NASTRAN.
// Returns the substr until the next comma (if found)
// or the given fixed width
//- A string::substr() to handle fixed-format and free-format NASTRAN.
// Returns the substr to the next comma (if found) or the given length
//
// \param str The string to extract from
// \param pos On input, the position of the first character of the
// substring. On output, advances to the next position to use.
// \param len The fixed-format length to use if a comma is not found.
static std::string nextNasField
(
//! The string to extract from
const std::string& str,
//! [in,out] The parse position within \p str
std::string::size_type& pos,
//! The fixed-format width to use (if comma is not found)
const std::string::size_type width,
//! The input is known to be free-format
const bool free_format = false
std::string::size_type len
);

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2024 OpenCFD Ltd.
Copyright (C) 2016-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -61,36 +61,6 @@ static bool startsWithSolid(const char header[STLHeaderSize])
}
// Check if file size appears to be reasonable for an STL binary file.
// Compare file size with that expected from number of tris
// If this is not sensible, it may be an ASCII file
//
// sizeof(STLtriangle) = 50 bytes [int16 + 4 * (3 float)]
inline static bool checkBinaryFileSize
(
const int64_t nTris,
const Foam::fileName& file
)
{
// When checking the content size, account for the header size (80),
// but ignore the nTris information (int32_t) to give some rounding
const int64_t contentSize =
(
int64_t(Foam::fileSize(file))
- int64_t(STLHeaderSize)
);
return
(
(contentSize >= 0)
&& (nTris >= contentSize/50)
&& (nTris <= contentSize/25)
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::fileFormats::STLCore::isBinaryName
@ -147,31 +117,31 @@ int Foam::fileFormats::STLCore::detectBinaryHeader
// Read the number of triangles in the STL file
// (note: read as signed int so we can check whether >2^31).
//
// With nTris == 2^31, file size is 107.37 GB !
//
// However, the limit is more likely caused by the number of points
// that can be stored (label-size=32) when flattened for merging.
// So more like 715.8M triangles (~35.8 GB)
// (note: read as signed so we can check whether >2^31)
int32_t nTris;
is.read(reinterpret_cast<char*>(&nTris), sizeof(int32_t));
bool ok = (is && nTris >= 0);
// Check that stream is OK and number of triangles is positive,
// if not this may be an ASCII file
if (ok && unCompressed)
bool bad = (!is || nTris < 0);
if (!bad && unCompressed)
{
ok = checkBinaryFileSize(nTris, filename);
// Compare file size with that expected from number of tris
// If this is not sensible, it may be an ASCII file
const off_t dataFileSize = Foam::fileSize(filename);
bad =
(
nTris < int(dataFileSize - STLHeaderSize)/50
|| nTris > int(dataFileSize - STLHeaderSize)/25
);
}
//if (ok)
//{
// InfoErr<< "stlb : " << nTris << " triangles" << nl;
//}
// Return number of triangles if it appears to be BINARY and good.
return (ok ? nTris : 0);
return (bad ? 0 : nTris);
}
@ -219,27 +189,31 @@ Foam::fileFormats::STLCore::readBinaryHeader
<< exit(FatalError);
}
// Read the number of triangles in the STL file
// (note: read as signed int so we can check whether >2^31).
//
// With nTris == 2^31, file size is 107.37 GB !
//
// However, the limit is more likely caused by the number of points
// that can be stored (label-size=32) when flattened for merging.
// So more like 715.8M triangles (~35.8 GB)
// Read the number of triangles in the STl file
// (note: read as int so we can check whether >2^31)
int32_t nTris;
is.read(reinterpret_cast<char*>(&nTris), sizeof(int32_t));
bool ok = (is && nTris >= 0);
// Check that stream is OK and number of triangles is positive,
// if not this maybe an ASCII file
if (ok && unCompressed)
bool bad = (!is || nTris < 0);
if (!bad && unCompressed)
{
ok = checkBinaryFileSize(nTris, filename);
// Compare file size with that expected from number of tris
// If this is not sensible, it may be an ASCII file
const off_t dataFileSize = Foam::fileSize(filename);
bad =
(
nTris < int(dataFileSize - STLHeaderSize)/50
|| nTris > int(dataFileSize - STLHeaderSize)/25
);
}
if (!ok)
if (bad)
{
FatalErrorInFunction
<< "problem reading number of triangles, perhaps file is not binary"

View File

@ -43,7 +43,7 @@ Type Foam::functionObjects::extractEulerianParticles::faceValue
{
label patchi = patchIDs_[localFacei];
label pFacei = patchFaceIDs_[localFacei];
if (patchi != -1)
if (patchi != 0)
{
return field.boundaryField()[patchi][pFacei];
}

View File

@ -302,7 +302,7 @@ void Foam::ThermoSurfaceFilm<CloudType>::cacheFilmFields
TFilmPatch_ = film.Tf().primitiveField();
// Direct copy (one-to-one mapping)
CpFilmPatch_ = film.Cp().primitiveField();
TFilmPatch_ = film.Cp().primitiveField();
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021-2024 OpenCFD Ltd.
Copyright (C) 2021-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -70,7 +70,7 @@ static tmp<vectorField> getBoundedColours
const scalar boundMax
)
{
const scalar boundDelta = (boundMax - boundMin + ROOTVSMALL);
const label boundDelta = (boundMax - boundMin + ROOTVSMALL);
auto tresult = tmp<vectorField>::New(field.size());
auto& result = tresult.ref();
@ -167,7 +167,7 @@ Foam::scalarMinMax Foam::coordSetWriters::gltfWriter::getFieldLimits
{
const dictionary fieldDict = fieldInfoDict_.subOrEmptyDict(fieldName);
scalarMinMax limits(-GREAT, GREAT);
scalarMinMax limits;
fieldDict.readIfPresent("min", limits.min());
fieldDict.readIfPresent("max", limits.max());
@ -191,7 +191,7 @@ Foam::coordSetWriters::gltfWriter::getAlphaField
{
// Not specified
}
else if (!eptr->stream().peek().isWord())
else if (!eptr->stream().peek().isString())
{
// Value specified

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021-2024 OpenCFD Ltd.
Copyright (C) 2021-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -45,27 +45,24 @@ Description
\verbatim
formatOptions
{
gltf
// Apply colours flag (yes | no ) [optional]
colours yes;
// List of options per field
fieldInfo
{
// Apply colours flag (yes | no ) [optional]
colour yes;
// List of options per field
fieldInfo
p
{
p
{
// Colour map [optional]
colourMap <colourMap>;
// Colour map [optional]
colourMap <colourMap>;
// Colour map minimum and maximum limits [optional]
// Uses field min and max if not specified
min 0;
max 1;
// Colour map minimum and maximum limits [optional]
// Uses field min and max if not specified
min 0;
max 1;
// Alpha channel [optional] (<scalar>)
alpha 0.5;
}
// Alpha channel [optional] (<scalar>)
alpha 0.5;
}
}
}
@ -76,38 +73,35 @@ Description
\verbatim
formatOptions
{
gltf
// Apply colours flag (yes | no) [optional]
colours yes;
// Animate tracks (yes | no) [optional]
animate yes;
// Animation properties [optional]
animationInfo
{
// Apply colours flag (yes | no) [optional]
colour yes;
// Colour map [optional]
colourMap <colourMap>;
// Animate tracks (yes | no) [optional]
animate yes;
// Colour [optional] (<vector> | uniform | field)
colour (1 0 0); // RGB in range [0-1]
// Animation properties [optional]
animationInfo
{
// Colour map [optional]
colourMap <colourMap>;
//colour uniform;
//colourValue (1 0 0); // RGB in range [0-1]
// Colour [optional] (<vector> | uniform | field)
colour (1 0 0); // RGB in range [0-1]
//colour field;
//colourField d;
//colour uniform;
//colourValue (1 0 0); // RGB in range [0-1]
// Colour map minimum and maximum limits [optional]
// Note: for colour = field option
// Uses field min and max if not specified
min 0;
max 1;
//colour field;
//colourField d;
// Colour map minimum and maximum limits [optional]
// Note: for colour = field option
// Uses field min and max if not specified
min 0;
max 1;
// Alpha channel [optional] (<scalar>)
alpha 0.5;
}
// Alpha channel [optional] (<scalar>)
alpha 0.5;
}
}
\endverbatim

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2017-2024 OpenCFD Ltd.
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -62,17 +62,13 @@ bool Foam::fileFormats::NASedgeFormat::read
while (is.good())
{
string::size_type linei = 0; // parsing position within current line
string line;
is.getLine(line);
if (line.empty())
if (line.empty() || line[0] == '$')
{
continue; // Ignore empty
}
else if (line[0] == '$')
{
// Ignore comment
continue;
continue; // Skip empty or comment
}
// Check if character 72 is continuation
@ -98,69 +94,41 @@ bool Foam::fileFormats::NASedgeFormat::read
}
// Parsing position within current line
std::string::size_type linei = 0;
// Is free format if line contains a comma
const bool freeFormat = line.contains(',');
// First word (column 0-8)
const word cmd(word::validate(nextNasField(line, linei, 8)));
if (cmd == "CBEAM" || cmd == "CROD")
{
// Fixed format:
// 8-16 : element id
// 16-24 : group id
// 24-32 : vertex
// 32-40 : vertex
// discard elementId (8-16)
(void) nextNasField(line, linei, 8); // 8-16
// discard groupId (16-24)
(void) nextNasField(line, linei, 8); // 16-24
// discard elementId
(void) nextNasField(line, linei, 8, freeFormat);
// discard groupId
(void) nextNasField(line, linei, 8, freeFormat);
label a = readLabel(nextNasField(line, linei, 8)); // 24-32
label b = readLabel(nextNasField(line, linei, 8)); // 32-40
label a = readLabel(nextNasField(line, linei, 8, freeFormat));
label b = readLabel(nextNasField(line, linei, 8, freeFormat));
dynEdges.emplace_back(a,b);
dynEdges.append(edge(a,b));
}
else if (cmd == "PLOTEL")
{
// Fixed format:
// 8-16 : element id
// 16-24 : vertex
// 24-32 : vertex
// 32-40 : vertex
// discard elementId (8-16)
(void) nextNasField(line, linei, 8, freeFormat);
(void) nextNasField(line, linei, 8); // 8-16
label a = readLabel(nextNasField(line, linei, 8, freeFormat));
label b = readLabel(nextNasField(line, linei, 8, freeFormat));
label a = readLabel(nextNasField(line, linei, 8)); // 16-24
label b = readLabel(nextNasField(line, linei, 8)); // 24-32
dynEdges.emplace_back(a,b);
dynEdges.append(edge(a,b));
}
else if (cmd == "GRID")
{
// Fixed (short) format:
// 8-16 : point id
// 16-24 : coordinate system (unsupported)
// 24-32 : point x coordinate
// 32-40 : point y coordinate
// 40-48 : point z coordinate
// 48-56 : displacement coordinate system (optional, unsupported)
// 56-64 : single point constraints (optional, unsupported)
// 64-70 : super-element id (optional, unsupported)
label index = readLabel(nextNasField(line, linei, 8)); // 8-16
(void) nextNasField(line, linei, 8); // 16-24
scalar x = readNasScalar(nextNasField(line, linei, 8)); // 24-32
scalar y = readNasScalar(nextNasField(line, linei, 8)); // 32-40
scalar z = readNasScalar(nextNasField(line, linei, 8)); // 40-48
label index = readLabel(nextNasField(line, linei, 8, freeFormat));
(void) nextNasField(line, linei, 8, freeFormat);
scalar x = readNasScalar(nextNasField(line, linei, 8, freeFormat));
scalar y = readNasScalar(nextNasField(line, linei, 8, freeFormat));
scalar z = readNasScalar(nextNasField(line, linei, 8, freeFormat));
pointId.push_back(index);
dynPoints.emplace_back(x, y, z);
pointId.append(index);
dynPoints.append(point(x, y, z));
}
else if (cmd == "GRID*")
{
@ -170,8 +138,6 @@ bool Foam::fileFormats::NASedgeFormat::read
// GRID* 126 0 -5.55999875E+02 -5.68730474E+02
// * 2.14897901E+02
// Cannot be long format and free format at the same time!
label index = readLabel(nextNasField(line, linei, 16)); // 8-24
(void) nextNasField(line, linei, 16); // 24-40
scalar x = readNasScalar(nextNasField(line, linei, 16)); // 40-56
@ -191,8 +157,8 @@ bool Foam::fileFormats::NASedgeFormat::read
(void) nextNasField(line, linei, 8); // 0-8
scalar z = readNasScalar(nextNasField(line, linei, 16)); // 8-16
pointId.push_back(index);
dynPoints.emplace_back(x, y, z);
pointId.append(index);
dynPoints.append(point(x, y, z));
}
}

View File

@ -420,21 +420,19 @@ void Foam::incompressibleAdjointSolver::accumulateBCSensitivityIntegrand
fvPatchVectorField& Uab = UaBoundary[patchI];
if (isA<adjointVectorBoundaryCondition>(Uab))
{
tmp<tensorField> dxdbMult =
refCast<adjointVectorBoundaryCondition>(Uab).dxdbMult();
if (dxdbMult)
{
const fvPatch& patch = mesh_.boundary()[patchI];
tmp<vectorField> tnf = patch.nf();
const scalarField& magSf = patch.magSf();
const fvPatch& patch = mesh_.boundary()[patchI];
tmp<vectorField> tnf = patch.nf();
const scalarField& magSf = patch.magSf();
tmp<vectorField> DvDbMult =
nuEffBoundary[patchI]
*(Uab.snGrad() + (gradUabf[patchI] & tnf))
// - (nf*pa.boundaryField()[patchI])
+ adjointTurbulence().adjointMomentumBCSource()[patchI];
bcDxDbMult()[patchI] += (DvDbMult & dxdbMult())*magSf*dt;
}
tmp<vectorField> DvDbMult =
nuEffBoundary[patchI]*(Uab.snGrad() + (gradUabf[patchI] & tnf))
// - (nf*pa.boundaryField()[patchI])
+ adjointTurbulence().adjointMomentumBCSource()[patchI];
bcDxDbMult()[patchI] +=
(
DvDbMult
& refCast<adjointVectorBoundaryCondition>(Uab).dxdbMult()
)*magSf*dt;
}
}
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2017-2024 OpenCFD Ltd.
Copyright (C) 2017-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -183,6 +183,8 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
while (is.good())
{
// Parsing position within current line
std::string::size_type linei = 0;
is.getLine(line);
if (NASCore::debug > 1) Info<< "Process: " << line << nl;
@ -317,30 +319,16 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
}
}
// Parsing position within current line
std::string::size_type linei = 0;
// Is free format if line contains a comma
const bool freeFormat = line.contains(',');
// First word (column 0-8)
const word cmd(word::validate(nextNasField(line, linei, 8)));
if (cmd == "CTRIA3")
{
// Fixed format:
// 8-16 : element id
// 16-24 : group id
// 24-32 : vertex
// 32-40 : vertex
// 40-48 : vertex
label elemId = readLabel(nextNasField(line, linei, 8, freeFormat));
label groupId = readLabel(nextNasField(line, linei, 8, freeFormat));
const auto a = readLabel(nextNasField(line, linei, 8, freeFormat));
const auto b = readLabel(nextNasField(line, linei, 8, freeFormat));
const auto c = readLabel(nextNasField(line, linei, 8, freeFormat));
label elemId = readLabel(nextNasField(line, linei, 8)); // 8-16
label groupId = readLabel(nextNasField(line, linei, 8)); // 16-24
const auto a = readLabel(nextNasField(line, linei, 8)); // 24-32
const auto b = readLabel(nextNasField(line, linei, 8)); // 32-40
const auto c = readLabel(nextNasField(line, linei, 8)); // 40-48
// Convert groupId into zoneId
const auto iterZone = zoneLookup.cfind(groupId);
@ -369,20 +357,12 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
}
else if (cmd == "CQUAD4")
{
// Fixed format:
// 8-16 : element id
// 16-24 : group id
// 24-32 : vertex
// 32-40 : vertex
// 40-48 : vertex
// 48-56 : vertex
label elemId = readLabel(nextNasField(line, linei, 8, freeFormat));
label groupId = readLabel(nextNasField(line, linei, 8, freeFormat));
const auto a = readLabel(nextNasField(line, linei, 8, freeFormat));
const auto b = readLabel(nextNasField(line, linei, 8, freeFormat));
const auto c = readLabel(nextNasField(line, linei, 8, freeFormat));
const auto d = readLabel(nextNasField(line, linei, 8, freeFormat));
label elemId = readLabel(nextNasField(line, linei, 8)); // 8-16
label groupId = readLabel(nextNasField(line, linei, 8)); // 16-24
const auto a = readLabel(nextNasField(line, linei, 8)); // 24-32
const auto b = readLabel(nextNasField(line, linei, 8)); // 32-40
const auto c = readLabel(nextNasField(line, linei, 8)); // 40-48
const auto d = readLabel(nextNasField(line, linei, 8)); // 48-56
// Convert groupId into zoneId
const auto iterZone = zoneLookup.cfind(groupId);
@ -426,21 +406,11 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
}
else if (cmd == "GRID")
{
// Fixed (short) format:
// 8-16 : point id
// 16-24 : coordinate system (not supported)
// 24-32 : point x coordinate
// 32-40 : point y coordinate
// 40-48 : point z coordinate
// 48-56 : displacement coordinate system (optional, unsupported)
// 56-64 : single point constraints (optional, unsupported)
// 64-70 : super-element id (optional, unsupported)
label index = readLabel(nextNasField(line, linei, 8, freeFormat));
(void) nextNasField(line, linei, 8, freeFormat);
scalar x = readNasScalar(nextNasField(line, linei, 8, freeFormat));
scalar y = readNasScalar(nextNasField(line, linei, 8, freeFormat));
scalar z = readNasScalar(nextNasField(line, linei, 8, freeFormat));
label index = readLabel(nextNasField(line, linei, 8)); // 8-16
(void) nextNasField(line, linei, 8); // 16-24
scalar x = readNasScalar(nextNasField(line, linei, 8)); // 24-32
scalar y = readNasScalar(nextNasField(line, linei, 8)); // 32-40
scalar z = readNasScalar(nextNasField(line, linei, 8)); // 40-48
pointId.push_back(index);
dynPoints.emplace_back(x, y, z);
@ -453,8 +423,6 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
// GRID* 126 0 -5.55999875E+02 -5.68730474E+02
// * 2.14897901E+02
// Cannot be long format and free format at the same time!
label index = readLabel(nextNasField(line, linei, 16)); // 8-24
(void) nextNasField(line, linei, 16); // 24-40
scalar x = readNasScalar(nextNasField(line, linei, 16)); // 40-56
@ -484,10 +452,7 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
// have the 'weird' format where the immediately preceeding
// comment contains the information.
// Fixed format:
// 8-16 : pshell id
label groupId = readLabel(nextNasField(line, linei, 8, freeFormat));
label groupId = readLabel(nextNasField(line, linei, 8)); // 8-16
if (lastComment.size() > 1 && !nameLookup.contains(groupId))
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2015-2024 OpenCFD Ltd.
Copyright (C) 2015-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -307,10 +307,16 @@ void Foam::surfaceWriters::nastranWriter::writeGeometry
Foam::surfaceWriters::nastranWriter::nastranWriter()
:
surfaceWriter(),
writeFormat_(fieldFormat::FREE),
writeFormat_(fieldFormat::SHORT),
fieldMap_(),
commonGeometry_(false),
separator_(",") // FREE format
{}
separator_()
{
// if (writeFormat_ == fieldFormat::FREE)
// {
// separator_ = ",";
// }
}
Foam::surfaceWriters::nastranWriter::nastranWriter
@ -325,10 +331,12 @@ Foam::surfaceWriters::nastranWriter::nastranWriter
(
"format",
options,
fieldFormat::FREE
fieldFormat::LONG
)
),
commonGeometry_(options.getOrDefault("commonGeometry", false))
fieldMap_(),
commonGeometry_(options.getOrDefault("commonGeometry", false)),
separator_()
{
if (writeFormat_ == fieldFormat::FREE)
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2015-2024 OpenCFD Ltd.
Copyright (C) 2015-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -33,13 +33,13 @@ Description
The formatOptions for nastran:
\table
Property | Description | Reqd | Default
format | Nastran format (short/long/free) | no | free
fields | Field pairs for PLOAD2/PLOAD4 | yes |
format | Nastran format (short/long/free) | no | long
scale | Output geometry scaling | no | 1
transform | Output coordinate transform | no |
fieldLevel | Subtract field level before scaling | no | empty dict
fieldScale | Output field scaling | no | empty dict
commonGeometry | use separate geometry files | no | false
fields | Field pairs for PLOAD2/PLOAD4 | yes |
\endtable
For example,
@ -48,6 +48,13 @@ Description
{
nastran
{
// OpenFOAM field name to NASTRAN load types
fields
(
(pMean PLOAD2)
(p PLOAD4)
);
format free; // format type
scale 1000; // [m] -> [mm]
@ -55,13 +62,6 @@ Description
{
"p.*" 0.01; // [Pa] -> [mbar]
}
// OpenFOAM field name to NASTRAN load types
fields
(
(pMean PLOAD2)
(p PLOAD4)
);
}
}
\endverbatim
@ -93,6 +93,7 @@ Description
Note
Output variable scaling does not apply to integer types such as Ids.
Field pairs default to PLOAD2 for scalars and PLOAD4 for vectors etc.
SourceFiles
nastranSurfaceWriter.C
@ -220,10 +221,10 @@ public:
// Constructors
//- Default construct. Default FREE format
//- Default construct. Default SHORT format
nastranWriter();
//- Construct with some output options. Default FREE format
//- Construct with some output options. Default LONG format
explicit nastranWriter(const dictionary& options);
//- Construct from components