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

This commit is contained in:
Mark Olesen 2022-06-03 14:11:00 +02:00
commit 264c09c365
18 changed files with 73 additions and 38 deletions

View File

@ -671,7 +671,7 @@ int main(int argc, char *argv[])
{ {
for for
( (
const word& opt const char * const opt
: { "cellSet", "cellZone", "faceSet", "pointSet" } : { "cellSet", "cellZone", "faceSet", "pointSet" }
) )
{ {

View File

@ -92,7 +92,7 @@ bool setCellFieldType
fieldType field(fieldHeader, mesh, false); fieldType field(fieldHeader, mesh, false);
const Type& value = pTraits<Type>(fieldValueStream); const Type value = pTraits<Type>(fieldValueStream);
if (selectedCells.size() == field.size()) if (selectedCells.size() == field.size())
{ {
@ -244,7 +244,7 @@ bool setFaceFieldType
fieldType field(fieldHeader, mesh); fieldType field(fieldHeader, mesh);
const Type& value = pTraits<Type>(fieldValueStream); const Type value = pTraits<Type>(fieldValueStream);
// Create flat list of selected faces and their value. // Create flat list of selected faces and their value.
Field<Type> allBoundaryValues(mesh.nBoundaryFaces()); Field<Type> allBoundaryValues(mesh.nBoundaryFaces());

View File

@ -5,7 +5,7 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2018-2021 OpenCFD Ltd. # Copyright (C) 2018-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -210,8 +210,8 @@ endif
# Remove duplicates from environment paths # Remove duplicates from environment paths
_foamClean PATH "$foamOldDirs" _foamClean PATH
_foamClean MANPATH "$foamOldDirs" _foamClean MANPATH
_foamClean -lib _foamClean -lib
# Add trailing ':' for system manpages # Add trailing ':' for system manpages

View File

@ -28,6 +28,8 @@ License
#include "MathFunctions.H" #include "MathFunctions.H"
#include "mathematicalConstants.H" #include "mathematicalConstants.H"
#include "error.H" #include "error.H"
#include <cmath>
#include <limits>
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * * //

View File

@ -36,6 +36,7 @@ Description
#include "mathematicalConstants.H" #include "mathematicalConstants.H"
#include "error.H" #include "error.H"
#include <cmath> #include <cmath>
#include <limits>
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //

View File

@ -35,6 +35,8 @@ Description
#include "MathFunctions.H" #include "MathFunctions.H"
#include "mathematicalConstants.H" #include "mathematicalConstants.H"
#include "error.H" #include "error.H"
#include <cmath>
#include <limits>
using namespace Foam::constant::mathematical; using namespace Foam::constant::mathematical;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2020 OpenCFD Ltd. Copyright (C) 2018-2020,2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -135,7 +135,7 @@ void Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::autoMap
const fvPatchFieldMapper& m const fvPatchFieldMapper& m
) )
{ {
scalarField::autoMap(m); mixedFvPatchField<scalar>::autoMap(m);
} }

View File

@ -264,6 +264,7 @@ void RNGkEpsilon<BasicTurbulenceModel>::correct()
tmp<volTensorField> tgradU = fvc::grad(U); tmp<volTensorField> tgradU = fvc::grad(U);
const volScalarField::Internal GbyNu const volScalarField::Internal GbyNu
( (
this->type() + ":GbyNu",
tgradU().v() && dev(twoSymm(tgradU().v())) tgradU().v() && dev(twoSymm(tgradU().v()))
); );
tgradU.clear(); tgradU.clear();

View File

@ -115,10 +115,10 @@ atmBoundaryLayer::atmBoundaryLayer(const atmBoundaryLayer& abl)
ppMin_(abl.ppMin_), ppMin_(abl.ppMin_),
time_(abl.time_), time_(abl.time_),
patch_(abl.patch_), patch_(abl.patch_),
flowDir_(abl.flowDir_), flowDir_(abl.flowDir_.clone()),
zDir_(abl.zDir_), zDir_(abl.zDir_.clone()),
Uref_(abl.Uref_), Uref_(abl.Uref_.clone()),
Zref_(abl.Zref_), Zref_(abl.Zref_.clone()),
z0_(abl.z0_.clone(patch_)), z0_(abl.z0_.clone(patch_)),
d_(abl.d_.clone(patch_)) d_(abl.d_.clone(patch_))
{} {}
@ -274,10 +274,22 @@ void atmBoundaryLayer::write(Ostream& os) const
os.writeEntry("Cmu", Cmu_); os.writeEntry("Cmu", Cmu_);
os.writeEntry("C1", C1_); os.writeEntry("C1", C1_);
os.writeEntry("C2", C2_); os.writeEntry("C2", C2_);
flowDir_->writeData(os); if (flowDir_)
zDir_->writeData(os); {
Uref_->writeData(os); flowDir_->writeData(os);
Zref_->writeData(os); }
if (zDir_)
{
zDir_->writeData(os);
}
if (Uref_)
{
Uref_->writeData(os);
}
if (Zref_)
{
Zref_->writeData(os);
}
if (z0_) if (z0_)
{ {
z0_->writeData(os) ; z0_->writeData(os) ;

View File

@ -166,7 +166,7 @@ atmAlphatkWallFunctionFvPatchScalarField
fixedValueFvPatchScalarField(wfpsf), fixedValueFvPatchScalarField(wfpsf),
Cmu_(wfpsf.Cmu_), Cmu_(wfpsf.Cmu_),
kappa_(wfpsf.kappa_), kappa_(wfpsf.kappa_),
Pr_(wfpsf.Pr_), Pr_(wfpsf.Pr_.clone()),
Prt_(wfpsf.Prt_.clone(this->patch().patch())), Prt_(wfpsf.Prt_.clone(this->patch().patch())),
z0_(wfpsf.z0_.clone(this->patch().patch())) z0_(wfpsf.z0_.clone(this->patch().patch()))
{ {
@ -184,7 +184,7 @@ atmAlphatkWallFunctionFvPatchScalarField
fixedValueFvPatchScalarField(wfpsf, iF), fixedValueFvPatchScalarField(wfpsf, iF),
Cmu_(wfpsf.Cmu_), Cmu_(wfpsf.Cmu_),
kappa_(wfpsf.kappa_), kappa_(wfpsf.kappa_),
Pr_(wfpsf.Pr_), Pr_(wfpsf.Pr_.clone()),
Prt_(wfpsf.Prt_.clone(this->patch().patch())), Prt_(wfpsf.Prt_.clone(this->patch().patch())),
z0_(wfpsf.z0_.clone(this->patch().patch())) z0_(wfpsf.z0_.clone(this->patch().patch()))
{ {

View File

@ -161,38 +161,38 @@ Foam::turbulentDigitalFilterInletFvPatchVectorField::indexPairs()
void Foam::turbulentDigitalFilterInletFvPatchVectorField::checkR() const void Foam::turbulentDigitalFilterInletFvPatchVectorField::checkR() const
{ {
const vectorField& faceCentres = this->patch().patch().faceCentres(); label badFacei = -1;
forAll(R_, facei) forAll(R_, facei)
{ {
if (R_[facei].xx() <= 0) if (R_[facei].xx() <= 0)
{ {
badFacei = facei;
FatalErrorInFunction FatalErrorInFunction
<< "Reynolds stress tensor component Rxx cannot be negative" << "Reynolds stress tensor component Rxx cannot be negative"
<< " or zero, where Rxx = " << R_[facei].xx() << " or zero, where Rxx = " << R_[facei].xx();
<< " at the face centre = " << faceCentres[facei] break;
<< exit(FatalError);
} }
if (R_[facei].yy() < 0 || R_[facei].zz() < 0) if (R_[facei].yy() < 0 || R_[facei].zz() < 0)
{ {
badFacei = facei;
FatalErrorInFunction FatalErrorInFunction
<< "Reynolds stress tensor components Ryy or Rzz cannot be" << "Reynolds stress tensor components Ryy or Rzz cannot be"
<< " negative where Ryy = " << R_[facei].yy() << " negative where Ryy = " << R_[facei].yy()
<< ", and Rzz = " << R_[facei].zz() << ", and Rzz = " << R_[facei].zz();
<< " at the face centre = " << faceCentres[facei] break;
<< exit(FatalError);
} }
const scalar x0 = R_[facei].xx()*R_[facei].yy() - sqr(R_[facei].xy()); const scalar x0 = R_[facei].xx()*R_[facei].yy() - sqr(R_[facei].xy());
if (x0 <= 0) if (x0 <= 0)
{ {
badFacei = facei;
FatalErrorInFunction FatalErrorInFunction
<< "Reynolds stress tensor component group, Rxx*Ryy - Rxy^2" << "Reynolds stress tensor component group, Rxx*Ryy - Rxy^2"
<< " cannot be negative or zero" << " cannot be negative or zero";
<< " at the face centre = " << faceCentres[facei] break;
<< exit(FatalError);
} }
const scalar x1 = R_[facei].zz() - sqr(R_[facei].xz())/R_[facei].xx(); const scalar x1 = R_[facei].zz() - sqr(R_[facei].xz())/R_[facei].xx();
@ -202,15 +202,23 @@ void Foam::turbulentDigitalFilterInletFvPatchVectorField::checkR() const
if (x3 < 0) if (x3 < 0)
{ {
badFacei = facei;
FatalErrorInFunction FatalErrorInFunction
<< "Reynolds stress tensor component group, " << "Reynolds stress tensor component group, "
<< "Rzz - Rxz^2/Rxx - (Ryz - Rxy*Rxz/(Rxx*(Rxx*Ryy - Rxy^2)))^2" << "Rzz - Rxz^2/Rxx - (Ryz - Rxy*Rxz/(Rxx*(Rxx*Ryy - Rxy^2)))^2"
<< " cannot be negative at the face centre = " << " cannot be negative";
<< faceCentres[facei] break;
<< exit(FatalError);
} }
} }
if (badFacei >= 0)
{
FatalError
<< " at the face centre = "
<< this->patch().patch().faceCentres()[badFacei]
<< exit(FatalError);
}
Info<< " # Reynolds stress tensor on patch is consistent #" << endl; Info<< " # Reynolds stress tensor on patch is consistent #" << endl;
} }

View File

@ -79,7 +79,7 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
const vectorField nf(patch.nf()); const vectorField nf(patch.nf());
const vectorField faceCellCentres(patch.patch().faceCellCentres()); const vectorField faceCellCentres(patch.patch().faceCellCentres());
const labelUList& faceCells = patch.patch().faceCells(); const labelUList& faceCells = patch.patch().faceCells();
const vectorField::subField& faceCentres = patch.patch().faceCentres(); const vectorField::subField faceCentres = patch.patch().faceCentres();
forAll(patch, patchFacei) forAll(patch, patchFacei)
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2020 OpenCFD Ltd. Copyright (C) 2015-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -159,7 +159,7 @@ Foam::scalar Foam::ManualInjection<CloudType>::timeEnd() const
{ {
// Injection is instantaneous - but allow for a finite interval to // Injection is instantaneous - but allow for a finite interval to
// avoid numerical issues when interval is zero // avoid numerical issues when interval is zero
return ROOTVSMALL; return this->SOI_ + SMALL;
} }

View File

@ -294,6 +294,7 @@ void Foam::SprayParcel<ParcelType>::calcBreakup
// Add child parcel as copy of parent // Add child parcel as copy of parent
SprayParcel<ParcelType>* child = new SprayParcel<ParcelType>(*this); SprayParcel<ParcelType>* child = new SprayParcel<ParcelType>(*this);
child->origId() = this->getNewParticleID(); child->origId() = this->getNewParticleID();
child->origProc() = Pstream::myProcNo();
child->d() = dChild; child->d() = dChild;
child->d0() = dChild; child->d0() = dChild;
const scalar massChild = child->mass(); const scalar massChild = child->mass();

View File

@ -37,7 +37,7 @@ Description
Typical use might be to e.g. average face centres to points on a patch Typical use might be to e.g. average face centres to points on a patch
const labelListList& pointFaces = pp.pointFaces(); const labelListList& pointFaces = pp.pointFaces();
const pointField& faceCentres = pp.faceCentres(); const vectorField::subField faceCentres = pp.faceCentres();
Field<weightedPosition> avgBoundary(pointFaces.size()); Field<weightedPosition> avgBoundary(pointFaces.size());

View File

@ -436,7 +436,15 @@ Foam::autoPtr<Foam::basicThermo> Foam::basicThermo::New
Foam::basicThermo::~basicThermo() Foam::basicThermo::~basicThermo()
{ {
db().checkOut("p"); if (pOwner_)
{
db().checkOut(p_.name());
}
if (TOwner_)
{
db().checkOut(T_.name());
}
} }

View File

@ -136,7 +136,7 @@ void Foam::faceReflecting::initialise(const dictionary& coeffs)
forAll(patches, patchI) forAll(patches, patchI)
{ {
const polyPatch& pp = patches[patchI]; const polyPatch& pp = patches[patchI];
const pointField& cf = pp.faceCentres(); const vectorField::subField cf = pp.faceCentres();
if (!pp.coupled() && !isA<cyclicAMIPolyPatch>(pp)) if (!pp.coupled() && !isA<cyclicAMIPolyPatch>(pp))
{ {

View File

@ -155,7 +155,7 @@ void Foam::faceShading::calculate()
forAll(patches, patchI) forAll(patches, patchI)
{ {
const polyPatch& pp = patches[patchI]; const polyPatch& pp = patches[patchI];
const pointField& cf = pp.faceCentres(); const vectorField::subField cf = pp.faceCentres();
if (!pp.coupled() && !isA<cyclicAMIPolyPatch>(pp)) if (!pp.coupled() && !isA<cyclicAMIPolyPatch>(pp))
{ {