diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C index a14329a0be..cf683535d0 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C @@ -671,7 +671,7 @@ int main(int argc, char *argv[]) { for ( - const word& opt + const char * const opt : { "cellSet", "cellZone", "faceSet", "pointSet" } ) { diff --git a/applications/utilities/preProcessing/setFields/setFields.C b/applications/utilities/preProcessing/setFields/setFields.C index ea4ab60d77..0af8c05ec0 100644 --- a/applications/utilities/preProcessing/setFields/setFields.C +++ b/applications/utilities/preProcessing/setFields/setFields.C @@ -92,7 +92,7 @@ bool setCellFieldType fieldType field(fieldHeader, mesh, false); - const Type& value = pTraits(fieldValueStream); + const Type value = pTraits(fieldValueStream); if (selectedCells.size() == field.size()) { @@ -244,7 +244,7 @@ bool setFaceFieldType fieldType field(fieldHeader, mesh); - const Type& value = pTraits(fieldValueStream); + const Type value = pTraits(fieldValueStream); // Create flat list of selected faces and their value. Field allBoundaryValues(mesh.nBoundaryFaces()); diff --git a/etc/config.csh/setup b/etc/config.csh/setup index 4b0a9a18ea..47cd76a91a 100644 --- a/etc/config.csh/setup +++ b/etc/config.csh/setup @@ -5,7 +5,7 @@ # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------ -# Copyright (C) 2018-2021 OpenCFD Ltd. +# Copyright (C) 2018-2022 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -210,8 +210,8 @@ endif # Remove duplicates from environment paths -_foamClean PATH "$foamOldDirs" -_foamClean MANPATH "$foamOldDirs" +_foamClean PATH +_foamClean MANPATH _foamClean -lib # Add trailing ':' for system manpages diff --git a/src/OpenFOAM/primitives/functions/Math/erfInv.C b/src/OpenFOAM/primitives/functions/Math/erfInv.C index 1c5b01497c..8d7fb042e3 100644 --- a/src/OpenFOAM/primitives/functions/Math/erfInv.C +++ b/src/OpenFOAM/primitives/functions/Math/erfInv.C @@ -28,6 +28,8 @@ License #include "MathFunctions.H" #include "mathematicalConstants.H" #include "error.H" +#include +#include // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/functions/Math/incGamma.C b/src/OpenFOAM/primitives/functions/Math/incGamma.C index 22f97c4b6b..5b78d62981 100644 --- a/src/OpenFOAM/primitives/functions/Math/incGamma.C +++ b/src/OpenFOAM/primitives/functions/Math/incGamma.C @@ -36,6 +36,7 @@ Description #include "mathematicalConstants.H" #include "error.H" #include +#include // * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/functions/Math/invIncGamma.C b/src/OpenFOAM/primitives/functions/Math/invIncGamma.C index 58897f62d2..26e262be4a 100644 --- a/src/OpenFOAM/primitives/functions/Math/invIncGamma.C +++ b/src/OpenFOAM/primitives/functions/Math/invIncGamma.C @@ -35,6 +35,8 @@ Description #include "MathFunctions.H" #include "mathematicalConstants.H" #include "error.H" +#include +#include using namespace Foam::constant::mathematical; diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/totalFlowRateAdvectiveDiffusive/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/totalFlowRateAdvectiveDiffusive/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C index 5d9dc3e293..6c28ad6cc9 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/totalFlowRateAdvectiveDiffusive/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/totalFlowRateAdvectiveDiffusive/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018-2020 OpenCFD Ltd. + Copyright (C) 2018-2020,2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -135,7 +135,7 @@ void Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::autoMap const fvPatchFieldMapper& m ) { - scalarField::autoMap(m); + mixedFvPatchField::autoMap(m); } diff --git a/src/TurbulenceModels/turbulenceModels/RAS/RNGkEpsilon/RNGkEpsilon.C b/src/TurbulenceModels/turbulenceModels/RAS/RNGkEpsilon/RNGkEpsilon.C index d497853fc8..bfe502275b 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/RNGkEpsilon/RNGkEpsilon.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/RNGkEpsilon/RNGkEpsilon.C @@ -264,6 +264,7 @@ void RNGkEpsilon::correct() tmp tgradU = fvc::grad(U); const volScalarField::Internal GbyNu ( + this->type() + ":GbyNu", tgradU().v() && dev(twoSymm(tgradU().v())) ); tgradU.clear(); diff --git a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C index 79677beea9..3eb02aa929 100644 --- a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C +++ b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C @@ -115,10 +115,10 @@ atmBoundaryLayer::atmBoundaryLayer(const atmBoundaryLayer& abl) ppMin_(abl.ppMin_), time_(abl.time_), patch_(abl.patch_), - flowDir_(abl.flowDir_), - zDir_(abl.zDir_), - Uref_(abl.Uref_), - Zref_(abl.Zref_), + flowDir_(abl.flowDir_.clone()), + zDir_(abl.zDir_.clone()), + Uref_(abl.Uref_.clone()), + Zref_(abl.Zref_.clone()), z0_(abl.z0_.clone(patch_)), d_(abl.d_.clone(patch_)) {} @@ -274,10 +274,22 @@ void atmBoundaryLayer::write(Ostream& os) const os.writeEntry("Cmu", Cmu_); os.writeEntry("C1", C1_); os.writeEntry("C2", C2_); - flowDir_->writeData(os); - zDir_->writeData(os); - Uref_->writeData(os); - Zref_->writeData(os); + if (flowDir_) + { + flowDir_->writeData(os); + } + if (zDir_) + { + zDir_->writeData(os); + } + if (Uref_) + { + Uref_->writeData(os); + } + if (Zref_) + { + Zref_->writeData(os); + } if (z0_) { z0_->writeData(os) ; diff --git a/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmAlphatkWallFunction/atmAlphatkWallFunctionFvPatchScalarField.C b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmAlphatkWallFunction/atmAlphatkWallFunctionFvPatchScalarField.C index a7c69bc99d..da7b552fa0 100644 --- a/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmAlphatkWallFunction/atmAlphatkWallFunctionFvPatchScalarField.C +++ b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmAlphatkWallFunction/atmAlphatkWallFunctionFvPatchScalarField.C @@ -166,7 +166,7 @@ atmAlphatkWallFunctionFvPatchScalarField fixedValueFvPatchScalarField(wfpsf), Cmu_(wfpsf.Cmu_), kappa_(wfpsf.kappa_), - Pr_(wfpsf.Pr_), + Pr_(wfpsf.Pr_.clone()), Prt_(wfpsf.Prt_.clone(this->patch().patch())), z0_(wfpsf.z0_.clone(this->patch().patch())) { @@ -184,7 +184,7 @@ atmAlphatkWallFunctionFvPatchScalarField fixedValueFvPatchScalarField(wfpsf, iF), Cmu_(wfpsf.Cmu_), kappa_(wfpsf.kappa_), - Pr_(wfpsf.Pr_), + Pr_(wfpsf.Pr_.clone()), Prt_(wfpsf.Prt_.clone(this->patch().patch())), z0_(wfpsf.z0_.clone(this->patch().patch())) { diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDigitalFilterInlet/turbulentDigitalFilterInletFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDigitalFilterInlet/turbulentDigitalFilterInletFvPatchVectorField.C index 6ad03839f7..180451f164 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDigitalFilterInlet/turbulentDigitalFilterInletFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDigitalFilterInlet/turbulentDigitalFilterInletFvPatchVectorField.C @@ -161,38 +161,38 @@ Foam::turbulentDigitalFilterInletFvPatchVectorField::indexPairs() void Foam::turbulentDigitalFilterInletFvPatchVectorField::checkR() const { - const vectorField& faceCentres = this->patch().patch().faceCentres(); + label badFacei = -1; forAll(R_, facei) { if (R_[facei].xx() <= 0) { + badFacei = facei; FatalErrorInFunction << "Reynolds stress tensor component Rxx cannot be negative" - << " or zero, where Rxx = " << R_[facei].xx() - << " at the face centre = " << faceCentres[facei] - << exit(FatalError); + << " or zero, where Rxx = " << R_[facei].xx(); + break; } if (R_[facei].yy() < 0 || R_[facei].zz() < 0) { + badFacei = facei; FatalErrorInFunction << "Reynolds stress tensor components Ryy or Rzz cannot be" << " negative where Ryy = " << R_[facei].yy() - << ", and Rzz = " << R_[facei].zz() - << " at the face centre = " << faceCentres[facei] - << exit(FatalError); + << ", and Rzz = " << R_[facei].zz(); + break; } const scalar x0 = R_[facei].xx()*R_[facei].yy() - sqr(R_[facei].xy()); if (x0 <= 0) { + badFacei = facei; FatalErrorInFunction << "Reynolds stress tensor component group, Rxx*Ryy - Rxy^2" - << " cannot be negative or zero" - << " at the face centre = " << faceCentres[facei] - << exit(FatalError); + << " cannot be negative or zero"; + break; } 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) { + badFacei = facei; FatalErrorInFunction << "Reynolds stress tensor component group, " << "Rzz - Rxz^2/Rxx - (Ryz - Rxy*Rxz/(Rxx*(Rxx*Ryy - Rxy^2)))^2" - << " cannot be negative at the face centre = " - << faceCentres[facei] - << exit(FatalError); + << " cannot be negative"; + break; } } + if (badFacei >= 0) + { + FatalError + << " at the face centre = " + << this->patch().patch().faceCentres()[badFacei] + << exit(FatalError); + } + Info<< " # Reynolds stress tensor on patch is consistent #" << endl; } diff --git a/src/functionObjects/field/nearWallFields/nearWallFields.C b/src/functionObjects/field/nearWallFields/nearWallFields.C index c0dd3f14eb..5f42d0ab6e 100644 --- a/src/functionObjects/field/nearWallFields/nearWallFields.C +++ b/src/functionObjects/field/nearWallFields/nearWallFields.C @@ -79,7 +79,7 @@ void Foam::functionObjects::nearWallFields::calcAddressing() const vectorField nf(patch.nf()); const vectorField faceCellCentres(patch.patch().faceCellCentres()); const labelUList& faceCells = patch.patch().faceCells(); - const vectorField::subField& faceCentres = patch.patch().faceCentres(); + const vectorField::subField faceCentres = patch.patch().faceCentres(); forAll(patch, patchFacei) { diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C index 7d230ab7bf..b1402155bc 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -159,7 +159,7 @@ Foam::scalar Foam::ManualInjection::timeEnd() const { // Injection is instantaneous - but allow for a finite interval to // avoid numerical issues when interval is zero - return ROOTVSMALL; + return this->SOI_ + SMALL; } diff --git a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C index 04d38b25c0..0968e7a077 100644 --- a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C +++ b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C @@ -294,6 +294,7 @@ void Foam::SprayParcel::calcBreakup // Add child parcel as copy of parent SprayParcel* child = new SprayParcel(*this); child->origId() = this->getNewParticleID(); + child->origProc() = Pstream::myProcNo(); child->d() = dChild; child->d0() = dChild; const scalar massChild = child->mass(); diff --git a/src/mesh/snappyHexMesh/meshRefinement/weightedPosition.H b/src/mesh/snappyHexMesh/meshRefinement/weightedPosition.H index 0594b1f9a3..a56fe80d25 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/weightedPosition.H +++ b/src/mesh/snappyHexMesh/meshRefinement/weightedPosition.H @@ -37,7 +37,7 @@ Description Typical use might be to e.g. average face centres to points on a patch const labelListList& pointFaces = pp.pointFaces(); - const pointField& faceCentres = pp.faceCentres(); + const vectorField::subField faceCentres = pp.faceCentres(); Field avgBoundary(pointFaces.size()); diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.C b/src/thermophysicalModels/basic/basicThermo/basicThermo.C index b2204d0d42..0c19e0b837 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.C +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.C @@ -436,7 +436,15 @@ Foam::autoPtr Foam::basicThermo::New Foam::basicThermo::~basicThermo() { - db().checkOut("p"); + if (pOwner_) + { + db().checkOut(p_.name()); + } + + if (TOwner_) + { + db().checkOut(T_.name()); + } } diff --git a/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceReflecting/faceReflecting.C b/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceReflecting/faceReflecting.C index b7a7e98014..db623f1d84 100644 --- a/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceReflecting/faceReflecting.C +++ b/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceReflecting/faceReflecting.C @@ -136,7 +136,7 @@ void Foam::faceReflecting::initialise(const dictionary& coeffs) forAll(patches, patchI) { const polyPatch& pp = patches[patchI]; - const pointField& cf = pp.faceCentres(); + const vectorField::subField cf = pp.faceCentres(); if (!pp.coupled() && !isA(pp)) { diff --git a/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceShading/faceShading.C b/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceShading/faceShading.C index 2ce4008006..675a1b6de9 100644 --- a/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceShading/faceShading.C +++ b/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceShading/faceShading.C @@ -155,7 +155,7 @@ void Foam::faceShading::calculate() forAll(patches, patchI) { const polyPatch& pp = patches[patchI]; - const pointField& cf = pp.faceCentres(); + const vectorField::subField cf = pp.faceCentres(); if (!pp.coupled() && !isA(pp)) {