From b9d6a84314b9e0579e79fadc316e531eee1a7c18 Mon Sep 17 00:00:00 2001 From: Andrew Heather <> Date: Thu, 24 Mar 2022 09:17:00 +0000 Subject: [PATCH 01/10] BUG: Ensure T can be checked-out on destruction of thermo. See #1619 --- .../basic/basicThermo/basicThermo.C | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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()); + } } From cae9b6b868caf099eaa6bba59f976912ddfb4778 Mon Sep 17 00:00:00 2001 From: Andrew Heather <> Date: Thu, 24 Mar 2022 14:27:08 +0000 Subject: [PATCH 02/10] BUG: Added missing GbyNu name - see #2409 --- .../turbulenceModels/RAS/RNGkEpsilon/RNGkEpsilon.C | 1 + 1 file changed, 1 insertion(+) 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(); From 0e5dfb1f6437926ffb270428c81950da3acf5105 Mon Sep 17 00:00:00 2001 From: Kutalmis Bercin Date: Tue, 29 Mar 2022 13:16:14 +0100 Subject: [PATCH 03/10] BUG: atmosphericModels: add missing clone functions (fixes #2428) --- .../atmBoundaryLayer/atmBoundaryLayer.C | 30 +++++++++++++------ ...atmAlphatkWallFunctionFvPatchScalarField.C | 21 +++++++++---- 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C index 5c5d0b5acb..3c77cefdb6 100644 --- a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C +++ b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2014-2016 OpenFOAM Foundation - Copyright (C) 2018-2021 OpenCFD Ltd. + Copyright (C) 2018-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -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 0f0be2ac92..32f69fb255 100644 --- a/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmAlphatkWallFunction/atmAlphatkWallFunctionFvPatchScalarField.C +++ b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmAlphatkWallFunction/atmAlphatkWallFunctionFvPatchScalarField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2020 ENERCON GmbH - Copyright (C) 2020-2021 OpenCFD Ltd. + Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -145,7 +145,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())) { @@ -163,7 +163,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())) { @@ -289,9 +289,18 @@ void atmAlphatkWallFunctionFvPatchScalarField::write(Ostream& os) const fvPatchField::write(os); os.writeEntry("Cmu", Cmu_); os.writeEntry("kappa", kappa_); - Pr_->writeData(os); - Prt_->writeData(os); - z0_->writeData(os); + if (Pr_) + { + Pr_->writeData(os); + } + if (Prt_) + { + Prt_->writeData(os); + } + if (z0_) + { + z0_->writeData(os); + } writeEntry("value", os); } From 579883354a7dc8790ea7e10cc09ec40360ee67be Mon Sep 17 00:00:00 2001 From: Andrew Heather <> Date: Fri, 29 Apr 2022 22:11:21 +0100 Subject: [PATCH 04/10] BUG: ManualInjection - corrected for non-zero SOI. See #2096 --- .../InjectionModel/ManualInjection/ManualInjection.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; } From de1aa8059349b97e1ddd5f777aba159d54406ca8 Mon Sep 17 00:00:00 2001 From: Andrew Heather <> Date: Fri, 6 May 2022 10:54:39 +0100 Subject: [PATCH 05/10] BUG: SprayParcel - set the child origProc. Fixed #1857 --- src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C | 1 + 1 file changed, 1 insertion(+) 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(); From 2c7621116ea0b73085492b246eeae6cc09d020bd Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 22 Apr 2022 19:56:48 +0200 Subject: [PATCH 06/10] COMP: missing linkage to regionFaModels (fixes #2449) - needed for the lld linker (eg, AMD aocc compiler) --- applications/solvers/multiphase/MPPICInterFoam/Make/options | 2 +- .../utilities/mesh/manipulation/createPatch/Make/options | 1 + .../utilities/mesh/manipulation/mergeMeshes/Make/options | 1 + applications/utilities/mesh/manipulation/splitMesh/Make/options | 1 + src/dynamicMesh/Make/options | 2 ++ src/renumber/renumberMethods/Make/options | 1 + src/thermophysicalModels/solidThermo/Make/options | 1 + 7 files changed, 8 insertions(+), 1 deletion(-) diff --git a/applications/solvers/multiphase/MPPICInterFoam/Make/options b/applications/solvers/multiphase/MPPICInterFoam/Make/options index 078ccece86..07e2081503 100644 --- a/applications/solvers/multiphase/MPPICInterFoam/Make/options +++ b/applications/solvers/multiphase/MPPICInterFoam/Make/options @@ -39,6 +39,6 @@ EXE_LIBS = \ -lturbulenceModels \ -lsampling \ -lregionModels \ + -lregionFaModels \ -lsurfaceFilmModels \ -lcompressibleTwoPhaseMixtureTurbulenceModels - diff --git a/applications/utilities/mesh/manipulation/createPatch/Make/options b/applications/utilities/mesh/manipulation/createPatch/Make/options index be41010b2c..3d643bd0fb 100644 --- a/applications/utilities/mesh/manipulation/createPatch/Make/options +++ b/applications/utilities/mesh/manipulation/createPatch/Make/options @@ -5,6 +5,7 @@ EXE_INC = \ -I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude \ EXE_LIBS = \ + -lfiniteVolume \ -lmeshTools \ -ldynamicMesh \ -lreconstruct diff --git a/applications/utilities/mesh/manipulation/mergeMeshes/Make/options b/applications/utilities/mesh/manipulation/mergeMeshes/Make/options index 228b724626..5c88275eed 100644 --- a/applications/utilities/mesh/manipulation/mergeMeshes/Make/options +++ b/applications/utilities/mesh/manipulation/mergeMeshes/Make/options @@ -5,6 +5,7 @@ EXE_INC = \ -I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude EXE_LIBS = \ + -lfiniteVolume \ -lmeshTools \ -ldynamicMesh \ -lreconstruct diff --git a/applications/utilities/mesh/manipulation/splitMesh/Make/options b/applications/utilities/mesh/manipulation/splitMesh/Make/options index 228b724626..5c88275eed 100644 --- a/applications/utilities/mesh/manipulation/splitMesh/Make/options +++ b/applications/utilities/mesh/manipulation/splitMesh/Make/options @@ -5,6 +5,7 @@ EXE_INC = \ -I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude EXE_LIBS = \ + -lfiniteVolume \ -lmeshTools \ -ldynamicMesh \ -lreconstruct diff --git a/src/dynamicMesh/Make/options b/src/dynamicMesh/Make/options index 040f0b7fd1..72c56c61b7 100644 --- a/src/dynamicMesh/Make/options +++ b/src/dynamicMesh/Make/options @@ -1,11 +1,13 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/surfMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/mesh/extrudeModel/lnInclude LIB_LIBS = \ -lfiniteVolume \ + -lfileFormats \ -lsurfMesh \ -lmeshTools \ -lextrudeModel diff --git a/src/renumber/renumberMethods/Make/options b/src/renumber/renumberMethods/Make/options index dcfea82205..461e29ebda 100644 --- a/src/renumber/renumberMethods/Make/options +++ b/src/renumber/renumberMethods/Make/options @@ -5,6 +5,7 @@ EXE_INC = \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude LIB_LIBS = \ + -lfiniteVolume \ -lmeshTools \ -ldynamicMesh \ -ldecompositionMethods diff --git a/src/thermophysicalModels/solidThermo/Make/options b/src/thermophysicalModels/solidThermo/Make/options index 2bc4cf5f36..8c1e915218 100644 --- a/src/thermophysicalModels/solidThermo/Make/options +++ b/src/thermophysicalModels/solidThermo/Make/options @@ -14,4 +14,5 @@ LIB_LIBS = \ -lsolidSpecie \ -lfluidThermophysicalModels \ -lreactionThermophysicalModels \ + -lthermophysicalProperties \ -lcompressibleTransportModels From f8dc1929415eb4f9b850269bca1e77e7eb5240d0 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Sat, 7 May 2022 15:53:55 +0200 Subject: [PATCH 07/10] CONFIG: sourcing etc/cshrc twice unset the environment (fixes #2458) --- etc/config.csh/setup | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 From 6f4196ae62761d825143baac01691ed4c4469284 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 18 May 2022 12:19:33 +0100 Subject: [PATCH 08/10] BUG: totalFlowRateAdvectiveDiffusive: missing autoMap. Fixes #2475 --- .../totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); } From 91198eaf6a0c11b57446374d97a079ca95cf1412 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 3 Jun 2022 08:52:58 +0200 Subject: [PATCH 09/10] COMP: gcc-12 buffer check bypasses xsputn (#2481, #2496) - add overflow() method to the SHA1 streambuf. Previously could rely on xsputn for adding to sha1 content, but streams now check pptr() first to test for the buffering range and thus overflow() is needed. --- src/OpenFOAM/db/IOstreams/hashes/OSHA1stream.H | 13 ++++++++++--- src/OpenFOAM/primitives/hashes/SHA1/SHA1.H | 9 ++++++--- src/OpenFOAM/primitives/hashes/SHA1/SHA1I.H | 8 +++++++- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/OpenFOAM/db/IOstreams/hashes/OSHA1stream.H b/src/OpenFOAM/db/IOstreams/hashes/OSHA1stream.H index 763745aa25..28c84a64b3 100644 --- a/src/OpenFOAM/db/IOstreams/hashes/OSHA1stream.H +++ b/src/OpenFOAM/db/IOstreams/hashes/OSHA1stream.H @@ -32,8 +32,8 @@ Description \*---------------------------------------------------------------------------*/ -#ifndef OSHA1stream_H -#define OSHA1stream_H +#ifndef Foam_OSHA1stream_H +#define Foam_OSHA1stream_H #include "OSstream.H" #include "SHA1.H" @@ -63,10 +63,17 @@ class osha1stream protected: + //- Handle overflow + virtual int overflow(int c = EOF) + { + if (c != EOF) sha1_.append(c); + return c; + } + //- Put sequence of characters virtual std::streamsize xsputn(const char* s, std::streamsize n) { - sha1_.append(s, n); + if (n) sha1_.append(s, n); return n; } diff --git a/src/OpenFOAM/primitives/hashes/SHA1/SHA1.H b/src/OpenFOAM/primitives/hashes/SHA1/SHA1.H index 9d9e617a48..54a506034e 100644 --- a/src/OpenFOAM/primitives/hashes/SHA1/SHA1.H +++ b/src/OpenFOAM/primitives/hashes/SHA1/SHA1.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -42,8 +42,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef SHA1_H -#define SHA1_H +#ifndef Foam_SHA1_H +#define Foam_SHA1_H #include #include @@ -113,6 +113,9 @@ public: //- Reset the hashed data before appending more void clear() noexcept; + //- Append single character + inline void append(char c); + //- Append data for processing inline SHA1& append(const char* str); diff --git a/src/OpenFOAM/primitives/hashes/SHA1/SHA1I.H b/src/OpenFOAM/primitives/hashes/SHA1/SHA1I.H index b04b3b6161..beaa3e40f1 100644 --- a/src/OpenFOAM/primitives/hashes/SHA1/SHA1I.H +++ b/src/OpenFOAM/primitives/hashes/SHA1/SHA1I.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011 OpenFOAM Foundation - Copyright (C) 2019-2021 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -52,6 +52,12 @@ inline Foam::SHA1::SHA1(const std::string& str) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +inline void Foam::SHA1::append(char c) +{ + processBytes(&c, 1); +} + + inline Foam::SHA1& Foam::SHA1::append(const char* data, size_t len) { processBytes(data, len); From 40cadfd2f23854a1cc419ef0270d0a529fd68b6d Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 3 Jun 2022 10:04:38 +0200 Subject: [PATCH 10/10] COMP: references to temporaries COMP: include --- .../dataConversion/foamToVTK/foamToVTK.C | 2 +- .../preProcessing/setFields/setFields.C | 4 +-- .../primitives/functions/Math/erfInv.C | 2 ++ .../primitives/functions/Math/incGamma.C | 1 + .../primitives/functions/Math/invIncGamma.C | 2 ++ ...lentDigitalFilterInletFvPatchVectorField.C | 34 ++++++++++++------- .../field/nearWallFields/nearWallFields.C | 2 +- .../meshRefinement/weightedPosition.H | 2 +- .../solarLoad/faceReflecting/faceReflecting.C | 2 +- .../solarLoad/faceShading/faceShading.C | 2 +- 10 files changed, 33 insertions(+), 20 deletions(-) diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C index f2e447b5bb..5e769fa830 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C @@ -591,7 +591,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 14f3a5acf7..a57514f9d6 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/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/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 27a8e0da6a..302fcc9204 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/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/radiation/radiationModels/solarLoad/faceReflecting/faceReflecting.C b/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceReflecting/faceReflecting.C index b301f66041..28d1ed4da8 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)) {