Compare commits

...

23 Commits

Author SHA1 Message Date
5aadc3a03d CONFIG: bump patch level (240625) 2024-06-26 12:19:02 +02:00
956fb4ca3a BUG: Nastran reading of free format truncates last field (fixes #3189)
- the old logic relied on the presence/absence of a comma to decide
  whether to parse as fixed or free format. This logic is faulty when
  handling the final (trailing) entry and will generally lead to the
  last field being truncated when read in.
  Now the caller decides on fixed vs free.

FIX: inconsistent Nastran surface output format

- use FREE format by default. Previously had an odd mix of SHORT
  format when created without options and LONG format (as default)
  when created with format options.
2024-06-26 12:19:02 +02:00
905d63357c BUG: STL: cannot handle files > 2Gb. Fixes #3171 2024-05-22 13:21:02 +01:00
0177b762c0 BUG: SlicedGeometricField, slices into field instead of shallow copy (#3080)
- regression introduced by e98acdc4fc

  Affected versions: (v2206, v2212, v2306, v2312)
2024-01-19 18:22:37 +01:00
308615e63a COMP: g++11: suppress optimisation. See #3024 2024-01-19 18:20:07 +01:00
2999c15f77 BUG: ThermoSurfaceFilm: reintroduce energy to film sources (fixes #2996) 2023-10-11 11:27:48 +01:00
3d8a1c7f63 BUG: snappyHexMesh: correct oppositeness checking. Fixes #2971 2023-09-07 15:08:39 +01:00
bf14272826 BUG: mapFields: incorrect patches. Fixes #2944. 2023-08-30 16:35:51 +02:00
095c9bc45b BUG: expressions rand() ignores objectRegistry timeIndex (fixes #2923) 2023-06-26 17:53:31 +02:00
20c7f0970d BUG: UPstream::shutdown misbehaves with external initialisation (fixes #2808)
- freeCommmunicatorComponents needs an additional bounds check.
  When MPI is initialized outside of OpenFOAM, there are no
  UPstream communicator equivalents
2023-06-20 09:16:12 +02:00
fd1661ae15 TUT: scalarTransport: avoid excessive number of output directories (fixes #2806) 2023-06-19 09:08:27 +01:00
70874860b9 CONFIG: bump patch level for maintenance-v2212 2023-06-14 14:57:29 +02:00
113fe48d0e ENH: faceAreaWeightAMI - report centre of problenm face. Fixes #2730 2023-05-30 18:00:21 +01:00
d94744e9f7 BUG: parcel injection models - corrected volume calculations. Fixes #2708 2023-05-30 12:07:33 +01:00
dcf005508b BUG: ReversibleReaction::kr - replaced 1e-6 by VSMALL. Fixes #2704 2023-05-30 11:53:47 +01:00
868d6dd778 BUG: VTK write pointSet fails in parallel (fixes #2773)
- de-referenced autoPtr with () instead of ref() will fail on
  non-master ranks.
2023-05-05 15:17:31 +02:00
f8e05934f1 BUG: incorrect dictionary contruction of alphatPhaseChange mDotL 2023-04-03 17:35:07 +02:00
ed89d97627 BUG: LES: enable sigma model for compressible flows (fixes #2727) 2023-03-24 08:23:51 +00:00
5614a571f2 COMP: code adjustments for gcc-13 (#2714) 2023-02-28 11:49:58 +01:00
4136b686ba BUG: infinite template recursion in boundaryData readField 2023-02-28 10:02:15 +01:00
c9081d5daf BUG: globalIndex gather/scatter fails with multi-world (fixes #2706)
- was using UPstream::procIDs(), which returns the sub-ranks with
  respect to the parent communicator. This is normally just an
  identity list (single-world) but with multi-world the indexing
  is incorrect.  Use UPstream::allProcs() instead.
2023-02-20 16:15:44 +01:00
a597c044c7 BUG: inconsistent faceArea on processor boundaries (fixes #2683)
- was missing evaluateCoupled on the initial faceAreaNormals field
  (related to #2507)

ENH: simplify/consistent geometry updating
2023-02-15 17:22:12 +01:00
d8c6b6b811 CONFIG: disable reporting of ensight type checks (unless in debug)
- avoids flooding the log file with warnings when reading in data
  sets that were not generated with OpenFOAM utilities
2023-02-15 14:07:25 +01:00
39 changed files with 385 additions and 153 deletions

View File

@ -1,2 +1,2 @@
api=2212 api=2212
patch=230110 patch=240625

View File

@ -18,6 +18,8 @@ Description
type scalarTransport; type scalarTransport;
libs ("libsolverFunctionObjects.so"); libs ("libsolverFunctionObjects.so");
writeControl writeTime;
field s; field s;
schemesField s; schemesField s;
D 1e-09; D 1e-09;

View File

@ -174,7 +174,7 @@ Foam::tokenList Foam::functionEntries::evalEntry::evaluate
result.writeField(toks); result.writeField(toks);
} }
return std::move(toks); return tokenList(std::move(toks.tokens()));
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019-2021 OpenCFD Ltd. Copyright (C) 2019-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -41,9 +41,11 @@ void Foam::expressions::exprDriver::fill_random
{ {
if (seed <= 0) if (seed <= 0)
{ {
if (timeStatePtr_) const TimeState* ts = this->timeState();
if (ts)
{ {
seed = (timeStatePtr_->timeIndex() - seed); seed = (ts->timeIndex() - seed);
} }
else else
{ {

View File

@ -152,10 +152,11 @@ slicedBoundaryField
new SlicedPatchField<Type> new SlicedPatchField<Type>
( (
mesh.boundary()[patchi], mesh.boundary()[patchi],
DimensionedField<Type, GeoMesh>::null(), DimensionedField<Type, GeoMesh>::null()
bField[patchi]
) )
); );
bf[patchi].UList<Type>::shallowCopy(bField[patchi]);
} }
} }

View File

@ -201,7 +201,8 @@ inline Foam::Matrix<Form, Type>::Matrix
) )
: :
mRows_(Mb.m()), mRows_(Mb.m()),
nCols_(Mb.n()) nCols_(Mb.n()),
v_(nullptr)
{ {
doAlloc(); doAlloc();
@ -223,7 +224,8 @@ inline Foam::Matrix<Form, Type>::Matrix
) )
: :
mRows_(Mb.m()), mRows_(Mb.m()),
nCols_(Mb.n()) nCols_(Mb.n()),
v_(nullptr)
{ {
doAlloc(); doAlloc();

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018-2022 OpenCFD Ltd. Copyright (C) 2018-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -489,12 +489,12 @@ public:
//- Collect indirect data in processor order on master //- Collect indirect data in processor order on master
// Handles contiguous/non-contiguous data, skips empty fields. // Handles contiguous/non-contiguous data, skips empty fields.
template<class Type, class Addr> template<class ProcIDsContainer, class Type, class Addr>
static void gather static void gather
( (
const labelUList& offsets, //!< offsets (master only) const labelUList& offsets, //!< offsets (master only)
const label comm, //!< communicator const label comm, //!< communicator
const UList<int>& procIDs, const ProcIDsContainer& procIDs,
const IndirectListBase<Type, Addr>& fld, const IndirectListBase<Type, Addr>& fld,
List<Type>& allFld, //! output field (master only) List<Type>& allFld, //! output field (master only)
const int tag = UPstream::msgType(), const int tag = UPstream::msgType(),

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2017 OpenFOAM Foundation Copyright (C) 2013-2017 OpenFOAM Foundation
Copyright (C) 2019-2022 OpenCFD Ltd. Copyright (C) 2019-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -248,12 +248,12 @@ void Foam::globalIndex::gather
} }
template<class Type, class Addr> template<class ProcIDsContainer, class Type, class Addr>
void Foam::globalIndex::gather void Foam::globalIndex::gather
( (
const labelUList& off, // needed on master only const labelUList& off, // needed on master only
const label comm, const label comm,
const UList<int>& procIDs, const ProcIDsContainer& procIDs,
const IndirectListBase<Type, Addr>& fld, const IndirectListBase<Type, Addr>& fld,
List<Type>& allFld, List<Type>& allFld,
const int tag, const int tag,
@ -368,7 +368,7 @@ void Foam::globalIndex::gather
( (
offsets_, // needed on master only offsets_, // needed on master only
comm, comm,
UPstream::procID(comm), UPstream::allProcs(comm), // All communicator ranks
sendData, sendData,
allData, allData,
tag, tag,
@ -404,7 +404,7 @@ void Foam::globalIndex::gather
( (
offsets_, // needed on master only offsets_, // needed on master only
comm, comm,
UPstream::procID(comm), UPstream::allProcs(comm), // All communicator ranks
sendData, sendData,
allData, allData,
tag, tag,
@ -622,7 +622,7 @@ void Foam::globalIndex::mpiGather
( (
offsets_, // needed on master only offsets_, // needed on master only
comm, comm,
UPstream::procID(comm), UPstream::allProcs(comm), // All communicator ranks
sendData, sendData,
allData, allData,
tag, tag,
@ -967,7 +967,7 @@ void Foam::globalIndex::scatter
( (
offsets_, // needed on master only offsets_, // needed on master only
comm, comm,
UPstream::procID(comm), UPstream::allProcs(comm), // All communicator ranks
allData, allData,
localData, localData,
tag, tag,

View File

@ -409,6 +409,10 @@ inline Foam::Tensor<Cmpt> Foam::Tensor<Cmpt>::T() const
template<class Cmpt> template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Foam::Tensor<Cmpt> inline Foam::Tensor<Cmpt>
Foam::Tensor<Cmpt>::inner(const Tensor<Cmpt>& t2) const Foam::Tensor<Cmpt>::inner(const Tensor<Cmpt>& t2) const
{ {
@ -432,6 +436,10 @@ Foam::Tensor<Cmpt>::inner(const Tensor<Cmpt>& t2) const
template<class Cmpt> template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Foam::Tensor<Cmpt> inline Foam::Tensor<Cmpt>
Foam::Tensor<Cmpt>::schur(const Tensor<Cmpt>& t2) const Foam::Tensor<Cmpt>::schur(const Tensor<Cmpt>& t2) const
{ {
@ -867,6 +875,10 @@ operator&(const Tensor<Cmpt>& t1, const Tensor<Cmpt>& t2)
//- Inner-product of a SphericalTensor and a Tensor //- Inner-product of a SphericalTensor and a Tensor
template<class Cmpt> template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Tensor<Cmpt> inline Tensor<Cmpt>
operator&(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2) operator&(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
{ {
@ -881,6 +893,10 @@ operator&(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
//- Inner-product of a Tensor and a SphericalTensor //- Inner-product of a Tensor and a SphericalTensor
template<class Cmpt> template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Tensor<Cmpt> inline Tensor<Cmpt>
operator&(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2) operator&(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
{ {
@ -895,6 +911,10 @@ operator&(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
//- Inner-product of a SymmTensor and a Tensor //- Inner-product of a SymmTensor and a Tensor
template<class Cmpt> template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Tensor<Cmpt> inline Tensor<Cmpt>
operator&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2) operator&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
{ {
@ -917,6 +937,10 @@ operator&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
//- Inner-product of a Tensor and a SymmTensor //- Inner-product of a Tensor and a SymmTensor
template<class Cmpt> template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Tensor<Cmpt> inline Tensor<Cmpt>
operator&(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2) operator&(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2)
{ {
@ -957,6 +981,10 @@ operator&(const Tensor<Cmpt>& t, const Vector<Cmpt>& v)
//- Inner-product of a Vector and a Tensor //- Inner-product of a Vector and a Tensor
template<class Cmpt> template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Vector<Cmpt> inline Vector<Cmpt>
operator&(const Vector<Cmpt>& v, const Tensor<Cmpt>& t) operator&(const Vector<Cmpt>& v, const Tensor<Cmpt>& t)
{ {

View File

@ -29,6 +29,7 @@ License
#include "word.H" #include "word.H"
#include "debug.H" #include "debug.H"
#include <cctype> #include <cctype>
#include <cstdint>
#include <sstream> #include <sstream>
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -641,7 +641,16 @@ void Foam::UPstream::freePstreamCommunicator(const label communicator)
} }
// Not touching the first two communicators (SELF, WORLD) // Not touching the first two communicators (SELF, WORLD)
if (communicator > 1) // or anything out-of bounds.
//
// No UPstream communicator indices when MPI is initialized outside
// of OpenFOAM - thus needs a bounds check too!
if
(
communicator > 1
&& (communicator < PstreamGlobals::MPICommunicators_.size())
)
{ {
if (MPI_COMM_NULL != PstreamGlobals::MPICommunicators_[communicator]) if (MPI_COMM_NULL != PstreamGlobals::MPICommunicators_[communicator])
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd. Copyright (C) 2022-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -131,6 +131,9 @@ makeLESModel(dynamicKEqn);
#include "dynamicLagrangian.H" #include "dynamicLagrangian.H"
makeLESModel(dynamicLagrangian); makeLESModel(dynamicLagrangian);
#include "sigma.H"
makeLESModel(sigma);
#include "SpalartAllmarasDES.H" #include "SpalartAllmarasDES.H"
makeLESModel(SpalartAllmarasDES); makeLESModel(SpalartAllmarasDES);

View File

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

View File

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

View File

@ -135,8 +135,9 @@ int Foam::fileFormats::STLCore::detectBinaryHeader
bad = bad =
( (
nTris < int(dataFileSize - STLHeaderSize)/50 dataFileSize < STLHeaderSize
|| nTris > int(dataFileSize - STLHeaderSize)/25 || nTris < (dataFileSize - STLHeaderSize)/50
|| nTris > (dataFileSize - STLHeaderSize)/25
); );
} }
@ -208,8 +209,9 @@ Foam::fileFormats::STLCore::readBinaryHeader
bad = bad =
( (
nTris < int(dataFileSize - STLHeaderSize)/50 dataFileSize < STLHeaderSize
|| nTris > int(dataFileSize - STLHeaderSize)/25 || nTris < (dataFileSize - STLHeaderSize)/50
|| nTris > (dataFileSize - STLHeaderSize)/25
); );
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2018-2022 OpenCFD Ltd. Copyright (C) 2018-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -180,12 +180,26 @@ Foam::faBoundaryMesh::faBoundaryMesh
void Foam::faBoundaryMesh::calcGeometry() void Foam::faBoundaryMesh::calcGeometry()
{ {
// processorFaPatch geometry triggers calculation of pointNormals. // processor initGeometry send/recv the following:
// - edgeCentres() : faMesh::edgeCentres()
// - edgeLengths() : faMesh::Le()
// - edgeFaceCentres() : faMesh::areaCentres()
//
// faMesh::Le() has its own point-to-point communication (OK) but
// triggers either/or edgeAreaNormals(), pointAreaNormals()
// with their own communication that can block.
// This uses parallel comms and hence will not be trigggered // This uses parallel comms and hence will not be trigggered
// on processors that do not have a processorFaPatch so instead // on processors that do not have a processorFaPatch so instead
// force construction. // force construction.
(void)mesh_.edgeAreaNormals();
(void)mesh_.pointAreaNormals(); (void)mesh_.pointAreaNormals();
(void)mesh_.areaCentres();
(void)mesh_.faceAreaNormals();
PstreamBuffers pBufs(Pstream::defaultCommsType); PstreamBuffers pBufs(Pstream::defaultCommsType);
if if
@ -773,12 +787,15 @@ bool Foam::faBoundaryMesh::checkDefinition(const bool report) const
void Foam::faBoundaryMesh::movePoints(const pointField& p) void Foam::faBoundaryMesh::movePoints(const pointField& p)
{ {
// processorFaPatch geometry triggers calculation of pointNormals. // See comments in calcGeometry()
// This uses parallel comms and hence will not be trigggered
// on processors that do not have a processorFaPatch so instead (void)mesh_.edgeAreaNormals();
// force construction.
(void)mesh_.pointAreaNormals(); (void)mesh_.pointAreaNormals();
(void)mesh_.areaCentres();
(void)mesh_.faceAreaNormals();
PstreamBuffers pBufs(Pstream::defaultCommsType); PstreamBuffers pBufs(Pstream::defaultCommsType);
if if

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2020-2022 OpenCFD Ltd. Copyright (C) 2020-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -277,6 +277,27 @@ void Foam::faMesh::clearOut() const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
void Foam::faMesh::syncGeom()
{
if (UPstream::parRun())
{
// areaCentres()
if (faceCentresPtr_)
{
faceCentresPtr_->boundaryFieldRef()
.evaluateCoupled<processorFaPatch>();
}
// faceAreaNormals()
if (faceAreaNormalsPtr_)
{
faceAreaNormalsPtr_->boundaryFieldRef()
.evaluateCoupled<processorFaPatch>();
}
}
}
bool Foam::faMesh::init(const bool doInit) bool Foam::faMesh::init(const bool doInit)
{ {
if (doInit) if (doInit)
@ -296,18 +317,7 @@ bool Foam::faMesh::init(const bool doInit)
// Calculate the geometry for the patches (transformation tensors etc.) // Calculate the geometry for the patches (transformation tensors etc.)
boundary_.calcGeometry(); boundary_.calcGeometry();
// Ensure processor/processor information is properly synchronised syncGeom();
if (Pstream::parRun())
{
const_cast<areaVectorField&>(areaCentres()).boundaryFieldRef()
.evaluateCoupled<processorFaPatch>();
// This roughly corresponds to what OpenFOAM-v2112 (and earlier) had,
// but should nominally be unnecessary.
//
/// const_cast<areaVectorField&>(faceAreaNormals()).boundaryFieldRef()
/// .evaluateCoupled<processorFaPatch>();
}
return false; return false;
} }
@ -989,7 +999,6 @@ bool Foam::faMesh::movePoints()
clearGeomNotAreas(); clearGeomNotAreas();
// To satisfy the motion interface for MeshObject, const cast is needed
if (patchPtr_) if (patchPtr_)
{ {
patchPtr_->movePoints(newPoints); patchPtr_->movePoints(newPoints);
@ -1003,6 +1012,8 @@ bool Foam::faMesh::movePoints()
// Note: Fluxes were dummy? // Note: Fluxes were dummy?
syncGeom();
return true; return true;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2021-2022 OpenCFD Ltd. Copyright (C) 2021-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -617,6 +617,10 @@ public:
//- Initialise non-demand-driven data etc //- Initialise non-demand-driven data etc
bool init(const bool doInit); bool init(const bool doInit);
//- Processor/processor synchronisation for geometry fields.
// Largely internal use only (slightly hacky).
void syncGeom();
// Database // Database

View File

@ -898,6 +898,12 @@ void Foam::faMesh::calcFaceCentres() const
} }
} }
} }
// Parallel consistency, exchange on processor patches
if (UPstream::parRun())
{
centres.boundaryFieldRef().evaluateCoupled<processorFaPatch>();
}
} }
@ -1110,6 +1116,12 @@ void Foam::faMesh::calcFaceAreaNormals() const
= edgeNormalsBoundary[patchi]; = edgeNormalsBoundary[patchi];
} }
} }
// Parallel consistency, exchange on processor patches
if (UPstream::parRun())
{
faceNormals.boundaryFieldRef().evaluateCoupled<processorFaPatch>();
}
} }

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-2022 OpenCFD Ltd. Copyright (C) 2015-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -61,6 +61,8 @@ void Foam::faMeshTools::forceDemandDriven(faMesh& mesh)
(void)mesh.pointAreaNormals(); (void)mesh.pointAreaNormals();
(void)mesh.faceCurvatures(); (void)mesh.faceCurvatures();
(void)mesh.edgeTransformTensors(); (void)mesh.edgeTransformTensors();
mesh.syncGeom();
} }

View File

@ -179,7 +179,7 @@ void Foam::InjectedParticleDistributionInjection<CloudType>::initialise()
sumPow3 += pow3(diameters[particlei]); sumPow3 += pow3(diameters[particlei]);
} }
const scalar volume = sumPow3*mathematical::pi/16.0; const scalar volume = sumPow3*mathematical::pi/6.0;
sumVolume += volume; sumVolume += volume;
volumeFlowRate_[injectori] = volume/dTime; volumeFlowRate_[injectori] = volume/dTime;

View File

@ -119,7 +119,7 @@ void Foam::InjectedParticleInjection<CloudType>::initialise()
scalar sumVolume = 0; scalar sumVolume = 0;
forAll(volume, i) forAll(volume, i)
{ {
scalar vol = pow3(diameter_[i])*mathematical::pi/16.0; scalar vol = pow3(diameter_[i])*mathematical::pi/6.0;
volume[i] = vol; volume[i] = vol;
sumVolume += vol; sumVolume += vol;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019-2022 OpenCFD Ltd. Copyright (C) 2019-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -62,6 +62,53 @@ Foam::ThermoSurfaceFilm<CloudType>::ThermoSurfaceFilm
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
template<class filmType>
void Foam::ThermoSurfaceFilm<CloudType>::absorbInteraction
(
filmType& film,
const parcelType& p,
const polyPatch& pp,
const label facei,
const scalar mass,
bool& keepParticle
)
{
DebugInfo<< "Parcel " << p.origId() << " absorbInteraction" << endl;
// Patch face normal
const vector& nf = pp.faceNormals()[facei];
// Patch velocity
const vector& Up = this->owner().U().boundaryField()[pp.index()][facei];
// Relative parcel velocity
const vector Urel(p.U() - Up);
// Parcel normal velocity
const vector Un(nf*(Urel & nf));
// Parcel tangential velocity
const vector Ut(Urel - Un);
film.addSources
(
pp.index(),
facei,
mass, // mass
mass*Ut, // tangential momentum
mass*mag(Un), // impingement pressure
mass*p.hs() // energy
);
this->nParcelsTransferred()++;
this->totalMassTransferred() += mass;
keepParticle = false;
}
template<class CloudType> template<class CloudType>
bool Foam::ThermoSurfaceFilm<CloudType>::transferParcel bool Foam::ThermoSurfaceFilm<CloudType>::transferParcel
( (

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd. Copyright (C) 2021-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -143,6 +143,21 @@ public:
// Member Functions // Member Functions
// Interaction models
//- Absorb parcel into film
template<class filmType>
void absorbInteraction
(
filmType&,
const parcelType& p,
const polyPatch& pp,
const label facei,
const scalar mass,
bool& keepParticle
);
// Evaluation // Evaluation
//- Transfer parcel from cloud to surface film //- Transfer parcel from cloud to surface film

View File

@ -1368,6 +1368,7 @@ Foam::label Foam::snappyRefineDriver::refinementInterfaceRefine
( (
face2i != facei face2i != facei
&& surfaceIndex[face2i] != -1 && surfaceIndex[face2i] != -1
&& cutter.faceLevel(face2i) > cLevel
) )
{ {
// Get outwards pointing normal // Get outwards pointing normal

View File

@ -269,7 +269,8 @@ bool Foam::faceAreaWeightAMI::setNextFaces
return false; return false;
} }
const labelList& srcNbrFaces = this->srcPatch().faceFaces()[srcFacei]; const auto& srcPatch = this->srcPatch();
const labelList& srcNbrFaces = srcPatch.faceFaces()[srcFacei];
// Initialise tgtFacei // Initialise tgtFacei
tgtFacei = -1; tgtFacei = -1;
@ -360,6 +361,7 @@ bool Foam::faceAreaWeightAMI::setNextFaces
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Unable to set target face for source face " << srcFacei << "Unable to set target face for source face " << srcFacei
<< " with centre: " << srcPatch.faceCentres()[srcFacei]
<< abort(FatalError); << abort(FatalError);
} }

View File

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

View File

@ -155,7 +155,7 @@ bool Foam::vtk::writePointSet
if (parallel) if (parallel)
{ {
vtk::writeListParallel(format(), mesh.points(), pointLabels); vtk::writeListParallel(format.ref(), mesh.points(), pointLabels);
} }
else else
{ {

View File

@ -1949,7 +1949,7 @@ Foam::distributedTriSurfaceMesh::independentlyDistributedBbs
// //globalBorderTris.gather // //globalBorderTris.gather
// //( // //(
// // UPstream::worldComm, // // UPstream::worldComm,
// // UPstream::procID(Pstream::worldComm), // // UPstream::allProcs(UPstream::worldComm),
// // globalBorderCentres // // globalBorderCentres
// //); // //);
// pointField globalBorderCentres(allCentres); // pointField globalBorderCentres(allCentres);
@ -1996,7 +1996,7 @@ Foam::distributedTriSurfaceMesh::independentlyDistributedBbs
// //globalBorderTris.scatter // //globalBorderTris.scatter
// //( // //(
// // UPstream::worldComm, // // UPstream::worldComm,
// // UPstream::procID(Pstream::worldComm), // // UPstream::allProcs(UPstream::worldComm),
// // isMasterPoint // // isMasterPoint
// //); // //);
// //boolList isMasterBorder(s.size(), false); // //boolList isMasterBorder(s.size(), false);
@ -2094,7 +2094,7 @@ Foam::distributedTriSurfaceMesh::independentlyDistributedBbs
globalTris().gather globalTris().gather
( (
UPstream::worldComm, UPstream::worldComm,
UPstream::procID(Pstream::worldComm), UPstream::allProcs(UPstream::worldComm),
allCentres allCentres
); );
} }
@ -2144,7 +2144,7 @@ Foam::distributedTriSurfaceMesh::independentlyDistributedBbs
globalTris().scatter globalTris().scatter
( (
UPstream::worldComm, UPstream::worldComm,
UPstream::procID(Pstream::worldComm), UPstream::allProcs(UPstream::worldComm),
allDistribution, allDistribution,
distribution distribution
); );

View File

@ -75,7 +75,7 @@ alphatPhaseChangeWallFunctionFvPatchScalarField
if (dict.found("mDotL")) if (dict.found("mDotL"))
{ {
dmdt_ = scalarField("mDotL", dict, p.size()); mDotL_ = scalarField("mDotL", dict, p.size());
} }
} }

View File

@ -834,15 +834,15 @@ Foam::meshToMesh::mapTgtToSrc
label srcPatchi = srcPatchID_[i]; label srcPatchi = srcPatchID_[i];
label tgtPatchi = tgtPatchID_[i]; label tgtPatchi = tgtPatchID_[i];
if (!srcPatchFields.set(tgtPatchi)) if (!srcPatchFields.set(srcPatchi))
{ {
srcPatchFields.set srcPatchFields.set
( (
srcPatchi, srcPatchi,
fvPatchField<Type>::New fvPatchField<Type>::New
( (
tgtBfld[srcPatchi], tgtBfld[tgtPatchi],
srcMesh.boundary()[tgtPatchi], srcMesh.boundary()[srcPatchi],
DimensionedField<Type, volMesh>::null(), DimensionedField<Type, volMesh>::null(),
directFvPatchFieldMapper directFvPatchFieldMapper
( (

View File

@ -88,7 +88,7 @@ Foam::boundaryDataSurfaceReader::readField
{ {
refPtr<Time> timePtr(Time::New(argList::envGlobalPath())); refPtr<Time> timePtr(Time::New(argList::envGlobalPath()));
return readField<Type>(baseDir, timeDir, fieldName, avg); return readField<Type>(*timePtr, baseDir, timeDir, fieldName, avg);
} }

View File

@ -82,7 +82,7 @@ Foam::tmp<Foam::Field<Type>> Foam::ensightSurfaceReader::readField
} }
// Check that data type is as expected // Check that data type is as expected
// (assumes OpenFOAM generated the data set) // (assuming OpenFOAM generated the data set)
string primitiveType; string primitiveType;
is.read(primitiveType); is.read(primitiveType);
@ -90,7 +90,8 @@ Foam::tmp<Foam::Field<Type>> Foam::ensightSurfaceReader::readField
if if
( (
primitiveType != ensightPTraits<Type>::typeName debug
&& primitiveType != ensightPTraits<Type>::typeName
&& primitiveType != pTraits<Type>::typeName && primitiveType != pTraits<Type>::typeName
) )
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2017-2022 OpenCFD Ltd. Copyright (C) 2017-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -149,7 +149,6 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
string line; string line;
while (is.good()) while (is.good())
{ {
string::size_type linei = 0; // Parsing position within current line
is.getLine(line); is.getLine(line);
// ANSA extension // ANSA extension
@ -223,16 +222,30 @@ 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) // First word (column 0-8)
const word cmd(word::validate(nextNasField(line, linei, 8))); const word cmd(word::validate(nextNasField(line, linei, 8)));
if (cmd == "CTRIA3") if (cmd == "CTRIA3")
{ {
label elemId = readLabel(nextNasField(line, linei, 8)); // 8-16 // Fixed format:
label groupId = readLabel(nextNasField(line, linei, 8)); // 16-24 // 8-16 : element id
const auto a = readLabel(nextNasField(line, linei, 8)); // 24-32 // 16-24 : group id
const auto b = readLabel(nextNasField(line, linei, 8)); // 32-40 // 24-32 : vertex
const auto c = readLabel(nextNasField(line, linei, 8)); // 40-48 // 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));
// Convert groupId into zoneId // Convert groupId into zoneId
const auto iterZone = zoneLookup.cfind(groupId); const auto iterZone = zoneLookup.cfind(groupId);
@ -261,12 +274,20 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
} }
else if (cmd == "CQUAD4") else if (cmd == "CQUAD4")
{ {
label elemId = readLabel(nextNasField(line, linei, 8)); // 8-16 // Fixed format:
label groupId = readLabel(nextNasField(line, linei, 8)); // 16-24 // 8-16 : element id
const auto a = readLabel(nextNasField(line, linei, 8)); // 24-32 // 16-24 : group id
const auto b = readLabel(nextNasField(line, linei, 8)); // 32-40 // 24-32 : vertex
const auto c = readLabel(nextNasField(line, linei, 8)); // 40-48 // 32-40 : vertex
const auto d = readLabel(nextNasField(line, linei, 8)); // 48-56 // 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));
// Convert groupId into zoneId // Convert groupId into zoneId
const auto iterZone = zoneLookup.cfind(groupId); const auto iterZone = zoneLookup.cfind(groupId);
@ -310,11 +331,21 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
} }
else if (cmd == "GRID") else if (cmd == "GRID")
{ {
label index = readLabel(nextNasField(line, linei, 8)); // 8-16 // Fixed (short) format:
(void) nextNasField(line, linei, 8); // 16-24 // 8-16 : point id
scalar x = readNasScalar(nextNasField(line, linei, 8)); // 24-32 // 16-24 : coordinate system (not supported)
scalar y = readNasScalar(nextNasField(line, linei, 8)); // 32-40 // 24-32 : point x coordinate
scalar z = readNasScalar(nextNasField(line, linei, 8)); // 40-48 // 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));
pointId.append(index); pointId.append(index);
dynPoints.append(point(x, y, z)); dynPoints.append(point(x, y, z));
@ -327,6 +358,8 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
// GRID* 126 0 -5.55999875E+02 -5.68730474E+02 // GRID* 126 0 -5.55999875E+02 -5.68730474E+02
// * 2.14897901E+02 // * 2.14897901E+02
// Cannot be long format and free format at the same time!
label index = readLabel(nextNasField(line, linei, 16)); // 8-24 label index = readLabel(nextNasField(line, linei, 16)); // 8-24
(void) nextNasField(line, linei, 16); // 24-40 (void) nextNasField(line, linei, 16); // 24-40
scalar x = readNasScalar(nextNasField(line, linei, 16)); // 40-56 scalar x = readNasScalar(nextNasField(line, linei, 16)); // 40-56

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

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

View File

@ -128,7 +128,7 @@ Foam::scalar Foam::ReversibleReaction
const scalarField& c const scalarField& c
) const ) const
{ {
return kfwd/max(this->Kc(p, T), 1e-6); return kfwd/max(this->Kc(p, T), VSMALL);
} }

View File

@ -7,7 +7,7 @@ tracer0
log off; log off;
resetOnStartUp false; resetOnStartUp false;
// writeControl writeTime; writeControl writeTime;
// writeInterval 1; // writeInterval 1;
field tracer0; field tracer0;
D 0.001; D 0.001;

View File

@ -61,6 +61,8 @@ functions
fvOptions fvOptions
{ {
} }
writeControl writeTime;
} }
fileUpdate fileUpdate