mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge remote-tracking branch 'origin/master' into develop
This commit is contained in:
@ -49,7 +49,7 @@
|
||||
|
||||
<!--
|
||||
Providing details of your set-up can help us identify any issues, e.g.
|
||||
OpenFOAM version : v1806|v1812|v1906 etc
|
||||
OpenFOAM version : v1806|v1812|v1906|v1912|v2006|v2012|v2106 etc
|
||||
Operating system : ubuntu|openSUSE|centos etc
|
||||
Hardware info : any info that may help?
|
||||
Compiler : gcc|intel|clang etc
|
||||
|
||||
@ -1,3 +1,10 @@
|
||||
## Getting the code
|
||||
|
||||
Links to all code packs are available on https://dl.openfoam.com. For OpenFOAM-v2106:
|
||||
|
||||
- Source: https://dl.openfoam.com/source/v2106/OpenFOAM-v2106.tgz
|
||||
- ThirdParty: https://dl.openfoam.com/source/v2106/ThirdParty-v2106.tgz
|
||||
|
||||
## OpenFOAM® Quick Build Guide
|
||||
|
||||
Prior to building, ensure that the [system requirements][link openfoam-require]
|
||||
|
||||
@ -52,8 +52,12 @@ Description
|
||||
typedef autoPtr<baseType> (*argNames##ConstructorPtr)argList; \
|
||||
\
|
||||
/* Construct from argList function table type */ \
|
||||
typedef HashTable<argNames##ConstructorPtr, word> \
|
||||
argNames##ConstructorTable; \
|
||||
typedef HashTable \
|
||||
< \
|
||||
argNames##ConstructorPtr, \
|
||||
::Foam::word, \
|
||||
::Foam::string::hasher \
|
||||
> argNames##ConstructorTable; \
|
||||
\
|
||||
/* Construct from argList function pointer table pointer */ \
|
||||
static argNames##ConstructorTable* argNames##ConstructorTablePtr_; \
|
||||
@ -77,7 +81,7 @@ Description
|
||||
\
|
||||
explicit add##argNames##ConstructorToTable \
|
||||
( \
|
||||
const word& lookup = baseType##Type::typeName \
|
||||
const ::Foam::word& lookup = baseType##Type::typeName \
|
||||
) \
|
||||
{ \
|
||||
construct##argNames##ConstructorTables(); \
|
||||
@ -109,7 +113,7 @@ Description
|
||||
{ \
|
||||
public: \
|
||||
\
|
||||
const word name; /* Lookup name for later removal */ \
|
||||
const ::Foam::word name; /* Lookup name for later removal */ \
|
||||
\
|
||||
static autoPtr<baseType> New argList \
|
||||
{ \
|
||||
@ -118,7 +122,7 @@ Description
|
||||
\
|
||||
explicit addRemovable##argNames##ConstructorToTable \
|
||||
( \
|
||||
const word& lookup = baseType##Type::typeName \
|
||||
const ::Foam::word& lookup = baseType##Type::typeName \
|
||||
) \
|
||||
: \
|
||||
name(lookup) \
|
||||
@ -152,8 +156,12 @@ Description
|
||||
typedef autoPtr<baseType> (*argNames##ConstructorPtr)argList; \
|
||||
\
|
||||
/* Construct from argList function table type */ \
|
||||
typedef HashTable<argNames##ConstructorPtr, word> \
|
||||
argNames##ConstructorTable; \
|
||||
typedef HashTable \
|
||||
< \
|
||||
argNames##ConstructorPtr, \
|
||||
::Foam::word, \
|
||||
::Foam::string::hasher \
|
||||
> argNames##ConstructorTable; \
|
||||
\
|
||||
/* Construct from argList function pointer table pointer */ \
|
||||
static argNames##ConstructorTable* argNames##ConstructorTablePtr_; \
|
||||
@ -177,7 +185,7 @@ Description
|
||||
\
|
||||
explicit add##argNames##ConstructorToTable \
|
||||
( \
|
||||
const word& lookup = baseType##Type::typeName \
|
||||
const ::Foam::word& lookup = baseType##Type::typeName \
|
||||
) \
|
||||
{ \
|
||||
construct##argNames##ConstructorTables(); \
|
||||
@ -215,7 +223,7 @@ Description
|
||||
{ \
|
||||
public: \
|
||||
\
|
||||
const word name; /* Lookup name for later removal */ \
|
||||
const ::Foam::word name; /* Lookup name for later removal */ \
|
||||
\
|
||||
static autoPtr<baseType> New##baseType argList \
|
||||
{ \
|
||||
@ -224,7 +232,7 @@ Description
|
||||
\
|
||||
explicit addRemovable##argNames##ConstructorToTable \
|
||||
( \
|
||||
const word& lookup = baseType##Type::typeName \
|
||||
const ::Foam::word& lookup = baseType##Type::typeName \
|
||||
) \
|
||||
: \
|
||||
name(lookup) \
|
||||
|
||||
@ -46,8 +46,12 @@ Description
|
||||
typedef returnType (*memberFunction##argNames##MemberFunctionPtr)argList; \
|
||||
\
|
||||
/* Construct from argList function table type */ \
|
||||
typedef HashTable<memberFunction##argNames##MemberFunctionPtr, word> \
|
||||
memberFunction##argNames##MemberFunctionTable; \
|
||||
typedef HashTable \
|
||||
< \
|
||||
memberFunction##argNames##MemberFunctionPtr, \
|
||||
::Foam::word, \
|
||||
::Foam::string::hasher \
|
||||
> memberFunction##argNames##MemberFunctionTable; \
|
||||
\
|
||||
/* Construct from argList function pointer table pointer */ \
|
||||
static memberFunction##argNames##MemberFunctionTable* \
|
||||
@ -61,7 +65,7 @@ Description
|
||||
\
|
||||
explicit add##memberFunction##argNames##MemberFunctionToTable \
|
||||
( \
|
||||
const word& lookup = baseType##Type::typeName \
|
||||
const ::Foam::word& lookup = baseType##Type::typeName \
|
||||
) \
|
||||
{ \
|
||||
construct##memberFunction##argNames##MemberFunctionTables(); \
|
||||
|
||||
@ -48,15 +48,16 @@ Foam::Istream& Foam::operator>>(Istream& is, word& val)
|
||||
{
|
||||
val = tok.wordToken();
|
||||
}
|
||||
else if (tok.isQuotedString())
|
||||
else if (tok.isQuotedString() || tok.isVariable())
|
||||
{
|
||||
// Try a bit harder and convert string to word
|
||||
val = tok.stringToken();
|
||||
const auto oldLen = val.length();
|
||||
string::stripInvalid<word>(val);
|
||||
// Try a bit harder, convert some string types to word
|
||||
// - accept "quoted" or $tag, but not verbatim/expression
|
||||
|
||||
const auto& str = tok.stringToken();
|
||||
val = word::validate(str);
|
||||
|
||||
// Flag empty strings and bad chars as an error
|
||||
if (val.empty() || val.length() != oldLen)
|
||||
if (val.empty() || val.length() != str.length())
|
||||
{
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "Empty word or non-word characters "
|
||||
|
||||
@ -213,11 +213,11 @@ bool Foam::functionObjects::Curle::execute()
|
||||
|
||||
forAll(observerPositions_, pointi)
|
||||
{
|
||||
const vectorField r(Cfp - observerPositions_[pointi]);
|
||||
const vectorField r(observerPositions_[pointi] - Cfp);
|
||||
const scalarField invMagR(1/(mag(r) + ROOTVSMALL));
|
||||
|
||||
pDash[pointi] +=
|
||||
sum((pp*sqr(invMagR) + invMagR/c0_*dpdtp)*(Sfp & r));
|
||||
sum((pp*sqr(invMagR) + invMagR/c0_*dpdtp)*(Sfp & (r*invMagR)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -419,8 +419,6 @@ void Foam::ParticleCollector<CloudType>::write()
|
||||
massTotal_[facei] += mass_[facei];
|
||||
}
|
||||
|
||||
const label proci = Pstream::myProcNo();
|
||||
|
||||
Info<< type() << " output:" << nl;
|
||||
|
||||
Field<scalar> faceMassTotal(mass_.size(), Zero);
|
||||
@ -434,15 +432,11 @@ void Foam::ParticleCollector<CloudType>::write()
|
||||
scalar sumAverageMFR = 0.0;
|
||||
forAll(faces_, facei)
|
||||
{
|
||||
scalarList allProcMass(Pstream::nProcs());
|
||||
allProcMass[proci] = massTotal_[facei];
|
||||
Pstream::gatherList(allProcMass);
|
||||
faceMassTotal[facei] += sum(allProcMass);
|
||||
faceMassTotal[facei] +=
|
||||
returnReduce(massTotal_[facei], sumOp<scalar>());
|
||||
|
||||
scalarList allProcMassFlowRate(Pstream::nProcs());
|
||||
allProcMassFlowRate[proci] = massFlowRate_[facei];
|
||||
Pstream::gatherList(allProcMassFlowRate);
|
||||
faceMassFlowRate[facei] += sum(allProcMassFlowRate);
|
||||
faceMassFlowRate[facei] +=
|
||||
returnReduce(massFlowRate_[facei], sumOp<scalar>());
|
||||
|
||||
sumTotalMass += faceMassTotal[facei];
|
||||
sumAverageMFR += faceMassFlowRate[facei];
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -108,6 +108,57 @@ Foam::surfaceWriters::boundaryDataWriter::boundaryDataWriter
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::surfaceWriters::boundaryDataWriter::serialWriteGeometry
|
||||
(
|
||||
const regIOobject& iopts,
|
||||
const meshedSurf& surf
|
||||
)
|
||||
{
|
||||
const pointField& points = surf.points();
|
||||
const faceList& faces = surf.faces();
|
||||
|
||||
if (verbose_)
|
||||
{
|
||||
if (this->isPointData())
|
||||
{
|
||||
Info<< "Writing points: " << iopts.objectPath() << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Writing face centres: " << iopts.objectPath() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Like regIOobject::writeObject without instance() adaptation
|
||||
// since this would write to e.g. 0/ instead of postProcessing/
|
||||
|
||||
OFstream osGeom(iopts.objectPath(), streamOpt_);
|
||||
|
||||
if (header_)
|
||||
{
|
||||
iopts.writeHeader(osGeom);
|
||||
}
|
||||
|
||||
if (this->isPointData())
|
||||
{
|
||||
// Just like writeData, but without copying beforehand
|
||||
osGeom << points;
|
||||
}
|
||||
else
|
||||
{
|
||||
primitivePatch pp(SubList<face>(faces), points);
|
||||
|
||||
// Just like writeData, but without copying beforehand
|
||||
osGeom << pp.faceCentres();
|
||||
}
|
||||
|
||||
if (header_)
|
||||
{
|
||||
iopts.writeEndDivider(osGeom);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName Foam::surfaceWriters::boundaryDataWriter::write()
|
||||
{
|
||||
checkOpen();
|
||||
@ -129,6 +180,7 @@ Foam::fileName Foam::surfaceWriters::boundaryDataWriter::write()
|
||||
mkDir(surfaceDir);
|
||||
}
|
||||
|
||||
// Write sample locations
|
||||
pointIOField iopts
|
||||
(
|
||||
IOobject
|
||||
@ -140,30 +192,9 @@ Foam::fileName Foam::surfaceWriters::boundaryDataWriter::write()
|
||||
false
|
||||
)
|
||||
);
|
||||
iopts.note() = (this->isPointData() ? "point data" : "face data");
|
||||
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< "Writing points: " << iopts.objectPath() << endl;
|
||||
}
|
||||
|
||||
|
||||
// Like regIOobject::writeObject without instance() adaptation
|
||||
// since this would write to e.g. 0/ instead of postProcessing/
|
||||
|
||||
OFstream osGeom(iopts.objectPath(), streamOpt_);
|
||||
|
||||
if (header_)
|
||||
{
|
||||
iopts.writeHeader(osGeom);
|
||||
}
|
||||
|
||||
// Just like writeData, but without copying beforehand
|
||||
osGeom << surf.points();
|
||||
|
||||
if (header_)
|
||||
{
|
||||
iopts.writeEndDivider(osGeom);
|
||||
}
|
||||
serialWriteGeometry(iopts, surf);
|
||||
}
|
||||
|
||||
wroteGeom_ = true;
|
||||
@ -212,67 +243,29 @@ Foam::fileName Foam::surfaceWriters::boundaryDataWriter::writeTemplate
|
||||
|
||||
if (Pstream::master() || !parallel_)
|
||||
{
|
||||
const pointField& points = surf.points();
|
||||
const faceList& faces = surf.faces();
|
||||
|
||||
if (!isDir(outputFile.path()))
|
||||
{
|
||||
mkDir(outputFile.path());
|
||||
}
|
||||
|
||||
pointIOField iopts
|
||||
(
|
||||
IOobject
|
||||
// Write sample locations
|
||||
{
|
||||
pointIOField iopts
|
||||
(
|
||||
surfaceDir/"points",
|
||||
*dummyTimePtr,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
);
|
||||
IOobject
|
||||
(
|
||||
surfaceDir/"points",
|
||||
*dummyTimePtr,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
);
|
||||
iopts.note() = (this->isPointData() ? "point data" : "face data");
|
||||
|
||||
if (verbose_)
|
||||
{
|
||||
if (this->isPointData())
|
||||
{
|
||||
Info<< "Writing points: " << iopts.objectPath() << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Writing face centres: " << iopts.objectPath() << endl;
|
||||
}
|
||||
serialWriteGeometry(iopts, surf);
|
||||
}
|
||||
|
||||
// Like regIOobject::writeObject without instance() adaptation
|
||||
// since this would write to e.g. 0/ instead of postProcessing/
|
||||
|
||||
OFstream osGeom(iopts.objectPath(), streamOpt_);
|
||||
|
||||
if (header_)
|
||||
{
|
||||
iopts.writeHeader(osGeom);
|
||||
}
|
||||
|
||||
if (this->isPointData())
|
||||
{
|
||||
// Just like writeData, but without copying beforehand
|
||||
osGeom << points;
|
||||
}
|
||||
else
|
||||
{
|
||||
primitivePatch pp(SubList<face>(faces), points);
|
||||
|
||||
// Just like writeData, but without copying beforehand
|
||||
osGeom << pp.faceCentres();
|
||||
}
|
||||
|
||||
if (header_)
|
||||
{
|
||||
iopts.writeEndDivider(osGeom);
|
||||
}
|
||||
|
||||
|
||||
// Write field
|
||||
{
|
||||
IOField<Type> iofld
|
||||
@ -286,6 +279,7 @@ Foam::fileName Foam::surfaceWriters::boundaryDataWriter::writeTemplate
|
||||
false
|
||||
)
|
||||
);
|
||||
iofld.note() = (this->isPointData() ? "point data" : "face data");
|
||||
|
||||
OFstream osField(iofld.objectPath(), streamOpt_);
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -134,6 +134,10 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward Declarations
|
||||
class regIOobject;
|
||||
|
||||
namespace surfaceWriters
|
||||
{
|
||||
|
||||
@ -159,6 +163,9 @@ class boundaryDataWriter
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Write serial surface geometry to "points" file.
|
||||
void serialWriteGeometry(const regIOobject&, const meshedSurf& surf);
|
||||
|
||||
//- Templated write field operation
|
||||
template<class Type>
|
||||
fileName writeTemplate
|
||||
|
||||
Reference in New Issue
Block a user