From f815a12bba89ee24a472b5abfa2771ad2ecc658e Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 2 Sep 2021 15:25:51 +0200 Subject: [PATCH 01/13] BUG: error with empty distributed roots specification (fixes #2196) - previously used the size of distributed roots to transmit if the case was running in distributed mode, but this behaves rather poorly with bad input. Specifically, the following questionable setup: distributed true; roots ( /*none*/ ); Now transmit the ParRunControl distributed() value instead, and also emit a gentle warning for the user: WARNING: running distributed but did not specify roots! --- src/OpenFOAM/global/argList/argList.C | 47 ++++++++++++++++++++------- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index f4b26f38f8..d8334d3dd6 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.C @@ -1203,7 +1203,13 @@ void Foam::argList::parse { source = "-roots"; parRunControl_.distributed(true); - if (roots.size() != 1) + if (roots.empty()) + { + FatalErrorInFunction + << "The -roots option must contain values" + << exit(FatalError); + } + if (roots.size() > 1) { dictNProcs = roots.size()+1; } @@ -1211,17 +1217,27 @@ void Foam::argList::parse else if (options_.found("hostRoots")) { source = "-hostRoots"; - roots.resize(Pstream::nProcs()-1, fileName::null); + parRunControl_.distributed(true); + ITstream is(this->lookup("hostRoots")); List> hostRoots(is); checkITstream(is, "hostRoots"); + if (hostRoots.empty()) + { + FatalErrorInFunction + << "The -hostRoots option must contain values" + << exit(FatalError); + } + + // Match machine names to roots + roots.resize(Pstream::nProcs()-1, fileName::null); for (const auto& hostRoot : hostRoots) { labelList matched ( - findStrings(hostRoot.first(), hostMachine) + findMatchingStrings(hostRoot.first(), hostMachine) ); for (const label matchi : matched) { @@ -1251,7 +1267,7 @@ void Foam::argList::parse } } - if (roots.size() != 1) + if (roots.size() > 1) { dictNProcs = roots.size()+1; } @@ -1288,6 +1304,13 @@ void Foam::argList::parse nDomainsMandatory = true; parRunControl_.distributed(true); decompDict.readEntry("roots", roots); + + if (roots.empty()) + { + DetailInfo + << "WARNING: running distributed" + << " but did not specify roots!" << nl; + } } // Get numberOfSubdomains if it exists. @@ -1306,7 +1329,7 @@ void Foam::argList::parse { // Optional if using default location DetailInfo - << "Warning: running without decomposeParDict " + << "WARNING: running without decomposeParDict " << this->relativePath(source) << nl; } else @@ -1391,8 +1414,8 @@ void Foam::argList::parse { options_.set("case", roots[subproci-1]/globalCase_); - OPstream toSubproc(Pstream::commsTypes::scheduled, subproci); - toSubproc << args_ << options_ << roots.size(); + OPstream toProc(Pstream::commsTypes::scheduled, subproci); + toProc << args_ << options_ << parRunControl_.distributed(); } options_.erase("case"); @@ -1439,24 +1462,24 @@ void Foam::argList::parse // Distribute the master's argument list (unaltered) for (const int subproci : Pstream::subProcs()) { - OPstream toSubproc(Pstream::commsTypes::scheduled, subproci); - toSubproc << args_ << options_ << roots.size(); + OPstream toProc(Pstream::commsTypes::scheduled, subproci); + toProc << args_ << options_ << parRunControl_.distributed(); } } } else { // Collect the master's argument list - label nroots; + bool isDistributed; IPstream fromMaster ( Pstream::commsTypes::scheduled, Pstream::masterNo() ); - fromMaster >> args_ >> options_ >> nroots; + fromMaster >> args_ >> options_ >> isDistributed; - parRunControl_.distributed(nroots); + parRunControl_.distributed(isDistributed); // Establish rootPath_/globalCase_/case_ for sub-process setCasePaths(); From 14aeaf8dabfaf46e146a56a0e72beffeb401a5be Mon Sep 17 00:00:00 2001 From: Andrew Heather <> Date: Mon, 20 Dec 2021 13:05:41 +0000 Subject: [PATCH 02/13] RELEASE: Updated version to v2112 --- etc/bashrc | 2 +- etc/cshrc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/bashrc b/etc/bashrc index 0634bee9f5..1b24ab2b2b 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -55,7 +55,7 @@ # [WM_PROJECT_VERSION] - A human-readable version name # A development version is often named 'com' - as in www.openfoam.com -export WM_PROJECT_VERSION=com +export WM_PROJECT_VERSION=v2112 #------------------------------------------------------------------------------ # Configuration environment variables. diff --git a/etc/cshrc b/etc/cshrc index ae50d92ba9..0a6b09abf8 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -55,7 +55,7 @@ # [WM_PROJECT_VERSION] - A human-readable version name # A development version is often named 'com' - as in www.openfoam.com -setenv WM_PROJECT_VERSION com +setenv WM_PROJECT_VERSION v2112 #------------------------------------------------------------------------------ # Configuration environment variables. From 48562b86491aea3201f156e027ac5ba10dc39e1a Mon Sep 17 00:00:00 2001 From: Kutalmis Bercin Date: Tue, 4 Jan 2022 09:51:43 +0000 Subject: [PATCH 03/13] BUG: KinematicReynoldsNumber: enable cloud function object (fixes #2317) TUT: hopperEmptying: add an example for KinematicReynoldsNumber DOC: ThermoReynoldsNumber/KinematicReynoldsNumber: correct the usage examples --- .../include/makeParcelCloudFunctionObjects.H | 3 ++- .../KinematicReynoldsNumber.H | 8 ++++---- .../ThermoReynoldsNumber/ThermoReynoldsNumber.H | 14 +++++++------- .../constant/kinematicCloudProperties | 7 ++++++- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.H b/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.H index 45310e16d2..e11442604b 100644 --- a/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.H +++ b/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.H @@ -62,7 +62,8 @@ License makeCloudFunctionObjectType(PatchPostProcessing, CloudType); \ makeCloudFunctionObjectType(PatchParticleHistogram, CloudType); \ makeCloudFunctionObjectType(RemoveParcels, CloudType); \ - makeCloudFunctionObjectType(VoidFraction, CloudType); + makeCloudFunctionObjectType(VoidFraction, CloudType); \ + makeCloudFunctionObjectType(KinematicReynoldsNumber, CloudType); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/KinematicReynoldsNumber/KinematicReynoldsNumber.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/KinematicReynoldsNumber/KinematicReynoldsNumber.H index 9db624cd42..0694f77f78 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/KinematicReynoldsNumber/KinematicReynoldsNumber.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/KinematicReynoldsNumber/KinematicReynoldsNumber.H @@ -51,7 +51,7 @@ Description Operand | Type | Location input | - | - output file | - | - - output field | scalarField | \/lagrangian/\/kinematicRe + output field | scalarField | \/lagrangian/\/Re \endtable Usage @@ -62,15 +62,15 @@ Usage KinematicReynoldsNumber1 { // Mandatory entries - type KinematicReynoldsNumber; + type ReynoldsNumber; } } \endverbatim where the entries mean: \table - Property | Description | Type | Reqd | Deflt - type | Type name: KinematicReynoldsNumber | word | yes | - + Property | Description | Type | Reqd | Deflt + type | Type name: ReynoldsNumber | word | yes | - \endtable See also diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ThermoReynoldsNumber/ThermoReynoldsNumber.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ThermoReynoldsNumber/ThermoReynoldsNumber.H index b7a922104b..72ca5fbd6e 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ThermoReynoldsNumber/ThermoReynoldsNumber.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ThermoReynoldsNumber/ThermoReynoldsNumber.H @@ -51,7 +51,7 @@ Description Operand | Type | Location input | - | - output file | - | - - output field | scalarField | \/lagrangian/\/thermoRe + output field | scalarField | \/lagrangian/\/Re \endtable Usage @@ -62,22 +62,22 @@ Usage ThermoReynoldsNumber1 { // Mandatory entries - type ThermoReynoldsNumber; + type ReynoldsNumber; } } \endverbatim where the entries mean: \table - Property | Description | Type | Reqd | Deflt - type | Type name: ThermoReynoldsNumber | word | yes | - + Property | Description | Type | Reqd | Deflt + type | Type name: ReynoldsNumber | word | yes | - \endtable Note - Normalisation factors \c rhoc and \c muc are based on temperature - dependent values calculated inside the film surrounding the particle - rather than freestream values; therefore, \c ThermoReynoldsNumber should not - be expected to operate with kinematic (non-thermo) applications. + dependent values calculated inside the film surrounding the particle + rather than freestream values; therefore, the thermo \c ReynoldsNumber + should not be expected to operate with kinematic (non-thermo) applications. See also - Foam::KinematicReynoldsNumber diff --git a/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/hopperEmptying/constant/kinematicCloudProperties b/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/hopperEmptying/constant/kinematicCloudProperties index 66016fb9bb..41a26a317b 100644 --- a/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/hopperEmptying/constant/kinematicCloudProperties +++ b/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/hopperEmptying/constant/kinematicCloudProperties @@ -121,7 +121,12 @@ subModels cloudFunctions -{} +{ + ReynoldsNumber1 + { + type ReynoldsNumber; + } +} // ************************************************************************* // From 91b5525749f5c5edd4c609a88774c4679deea702 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 10 Jan 2022 09:36:50 +0100 Subject: [PATCH 04/13] CONFIG: incorrect lib-name handling (fixes #2322) --- etc/config.sh/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/config.sh/functions b/etc/config.sh/functions index d3765d29ac..2707f3a54c 100644 --- a/etc/config.sh/functions +++ b/etc/config.sh/functions @@ -149,7 +149,7 @@ then then case "$foamVar_end" in (/*) # Absolute path - _foamAddLib "foamVar_end" + _foamAddLib "$foamVar_end" ;; (*) # Relative to prefix _foamAddLib "$foamVar_prefix/$foamVar_end" From d44c8318f095d9fbfbe7268a8197bfa46b1c1f59 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 11 Jan 2022 11:32:03 +0100 Subject: [PATCH 05/13] COMP: use automatic cleanup for run-time compat table (fixes #2314) - occurs with newer gcc on ubuntu impish (gcc-11.2.0), but may perhaps actually be related to `-flto=auto` or to the destruction order of the static variables (race condition?). Leaving the compat table around for automatic cleanup does not impact on other lookups (which are nullptr checked anyhow). --- .../construction/runTimeSelectionTables.H | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/OpenFOAM/db/runTimeSelection/construction/runTimeSelectionTables.H b/src/OpenFOAM/db/runTimeSelection/construction/runTimeSelectionTables.H index d5fd13438d..bf734f4673 100644 --- a/src/OpenFOAM/db/runTimeSelection/construction/runTimeSelectionTables.H +++ b/src/OpenFOAM/db/runTimeSelection/construction/runTimeSelectionTables.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019-2021 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -37,8 +37,8 @@ Description #include "token.H" -#ifndef runTimeSelectionTables_H -#define runTimeSelectionTables_H +#ifndef Foam_runTimeSelectionTables_H +#define Foam_runTimeSelectionTables_H #include // For std::unique_ptr #include // For std::pair @@ -89,6 +89,7 @@ Description // Not used directly: storage and helper methods for runtime tables +// - uses automatic cleanup for compat table (issue #2314) #define defineRunTimeSelectionTableBase(baseType,prefix,Tspecialize) \ \ /* Define table singleton (storage) */ \ @@ -124,8 +125,6 @@ Description { \ delete prefix##TablePtr_; \ prefix##TablePtr_ = nullptr; \ - prefix##CompatTablePtr_.reset(nullptr); \ - constructed = false; \ } \ } \ \ From 19398ded1c56dc4f95013755821ddf9092f80549 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 17 Jan 2022 09:51:52 +0100 Subject: [PATCH 06/13] CONFIG: align adios2 settings with shipped ThirdParty version (#2353) --- etc/config.csh/adios2 | 4 ++-- etc/config.sh/adios2 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/etc/config.csh/adios2 b/etc/config.csh/adios2 index 668eb3bf6d..a2459b02c1 100644 --- a/etc/config.csh/adios2 +++ b/etc/config.csh/adios2 @@ -5,7 +5,7 @@ # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------ -# Copyright (C) 2017-2020 OpenCFD Ltd. +# Copyright (C) 2017-2022 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -20,7 +20,7 @@ #------------------------------------------------------------------------------ # USER EDITABLE PART: Changes made here may be lost with the next upgrade -set adios2_version=ADIOS2-2.6.0 +set adios2_version=ADIOS2-2.7.1 setenv ADIOS2_ARCH_PATH "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$adios2_version" # END OF (NORMAL) USER EDITABLE PART diff --git a/etc/config.sh/adios2 b/etc/config.sh/adios2 index 4d2fd7e32c..7be5374b0c 100644 --- a/etc/config.sh/adios2 +++ b/etc/config.sh/adios2 @@ -5,7 +5,7 @@ # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------ -# Copyright (C) 2017-2020 OpenCFD Ltd. +# Copyright (C) 2017-2022 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -21,7 +21,7 @@ #------------------------------------------------------------------------------ # USER EDITABLE PART: Changes made here may be lost with the next upgrade -adios2_version=ADIOS2-2.6.0 +adios2_version=ADIOS2-2.7.1 export ADIOS2_ARCH_PATH="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$adios2_version" # END OF (NORMAL) USER EDITABLE PART From 3a6c0d7fb0b9f7b60ff5f1d992baa22c8adc5189 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 11 Feb 2022 14:23:33 +0100 Subject: [PATCH 07/13] BUG: sample/store surface field triggers dimension check (fixes #2361) - when used for example with wallShearStress, the stress field is initially created as incompressible but later updated with the correct compressible/incompressible dimensions. If this field is sampled as a surface and stored on the registry the dimensions should be reset() and not '=' assigned, since that causes a dimension check which will obviously fail. --- src/surfMesh/polySurface/polySurfaceTemplates.C | 6 +++--- src/surfMesh/surfMesh/surfMeshTemplates.C | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/surfMesh/polySurface/polySurfaceTemplates.C b/src/surfMesh/polySurface/polySurfaceTemplates.C index 4d697eb039..39464f6eb9 100644 --- a/src/surfMesh/polySurface/polySurfaceTemplates.C +++ b/src/surfMesh/polySurface/polySurfaceTemplates.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -107,7 +107,7 @@ void Foam::polySurface::storeField if (dimfield) { - dimfield->dimensions() = dims; + dimfield->dimensions().reset(dims); // Dimensions may have changed dimfield->field() = values; } else @@ -148,7 +148,7 @@ void Foam::polySurface::storeField if (dimfield) { - dimfield->dimensions() = dims; + dimfield->dimensions().reset(dims); // Dimensions may have changed dimfield->field() = std::move(values); } else diff --git a/src/surfMesh/surfMesh/surfMeshTemplates.C b/src/surfMesh/surfMesh/surfMeshTemplates.C index cf14e9d744..e777844f6d 100644 --- a/src/surfMesh/surfMesh/surfMeshTemplates.C +++ b/src/surfMesh/surfMesh/surfMeshTemplates.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -45,7 +45,7 @@ void Foam::surfMesh::storeField if (dimfield) { - dimfield->dimensions() = dims; + dimfield->dimensions().reset(dims); // Dimensions may have changed dimfield->field() = values; } else @@ -85,7 +85,7 @@ void Foam::surfMesh::storeField if (dimfield) { - dimfield->dimensions() = dims; + dimfield->dimensions().reset(dims); // Dimensions may have changed dimfield->field() = std::move(values); } else From 34a3e0abe3589104a37997fbda4064c59785f4f2 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 11 Feb 2022 18:38:11 +0000 Subject: [PATCH 08/13] BUG: cyclicAMI: optional settings not written. Fixes #2363 --- .../advancingFrontAMI/advancingFrontAMI.C | 14 +++++++++++++- .../advancingFrontAMI/advancingFrontAMI.H | 6 ++++++ .../faceAreaWeightAMI2D/faceAreaWeightAMI2D.C | 3 ++- .../nearestFaceAMI/nearestFaceAMI.C | 9 ++++++++- .../nearestFaceAMI/nearestFaceAMI.H | 3 +++ 5 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.C b/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.C index 7c03cbed1c..01f83db8c0 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2016 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2020,2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -476,4 +476,16 @@ bool Foam::advancingFrontAMI::calculate } +void Foam::advancingFrontAMI::write(Ostream& os) const +{ + AMIInterpolation::write(os); + os.writeEntryIfDifferent + ( + "triMode", + faceAreaIntersect::triangulationModeNames_[faceAreaIntersect::tmMesh], + faceAreaIntersect::triangulationModeNames_[triMode_] + ); +} + + // ************************************************************************* // diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.H b/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.H index 07e08b68d8..9ba117ecd3 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.H @@ -252,6 +252,12 @@ public: //- Labels of faces that are not overlapped by any target faces // Note: this should be empty for correct functioning inline const labelList& srcNonOverlap() const; + + + // I-O + + //- Write + virtual void write(Ostream& os) const; }; diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/faceAreaWeightAMI2D/faceAreaWeightAMI2D.C b/src/meshTools/AMIInterpolation/AMIInterpolation/faceAreaWeightAMI2D/faceAreaWeightAMI2D.C index c8270c6d31..bec5662ac9 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/faceAreaWeightAMI2D/faceAreaWeightAMI2D.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/faceAreaWeightAMI2D/faceAreaWeightAMI2D.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020,2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -520,6 +520,7 @@ bool Foam::faceAreaWeightAMI2D::calculate void Foam::faceAreaWeightAMI2D::write(Ostream& os) const { advancingFrontAMI::write(os); + os.writeEntryIfDifferent("Cbb", 0.1, Cbb_); } diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/nearestFaceAMI/nearestFaceAMI.C b/src/meshTools/AMIInterpolation/AMIInterpolation/nearestFaceAMI/nearestFaceAMI.C index aaebecbc95..5708ef55db 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/nearestFaceAMI/nearestFaceAMI.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/nearestFaceAMI/nearestFaceAMI.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020,2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -405,4 +405,11 @@ bool Foam::nearestFaceAMI::calculate } +void Foam::nearestFaceAMI::write(Ostream& os) const +{ + AMIInterpolation::write(os); + os.writeEntryIfDifferent("maxDistance2", GREAT, maxDistance2_); +} + + // ************************************************************************* // diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/nearestFaceAMI/nearestFaceAMI.H b/src/meshTools/AMIInterpolation/AMIInterpolation/nearestFaceAMI/nearestFaceAMI.H index 85938ecf4d..ea958b9a12 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/nearestFaceAMI/nearestFaceAMI.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/nearestFaceAMI/nearestFaceAMI.H @@ -155,6 +155,9 @@ public: const primitivePatch& tgtPatch, const autoPtr& surfPtr = nullptr ); + + //- Write + virtual void write(Ostream& os) const; }; From 3d842aac936592549c8f59aacbd39fb03c7e8597 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 16 Feb 2022 09:59:03 +0000 Subject: [PATCH 09/13] BUG: decomposeParDict: operate with masterUncollated. Fixes #2368. --- src/OpenFOAM/global/argList/argList.C | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index 204e95e9cf..3fdedbb473 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2015-2021 OpenCFD Ltd. + Copyright (C) 2015-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -1355,7 +1355,9 @@ void Foam::argList::parse // Disable any parallel comms happening inside the fileHandler // since we are on master. This can happen e.g. inside - // the masterUncollated/collated handler. + // the masterUncollated/collated handler. Note that we + // also have to protect the actual dictionary parsing since + // it might trigger file access (e.g. #include, #codeStream) const bool oldParRun = Pstream::parRun(false); autoPtr dictStream @@ -1363,8 +1365,6 @@ void Foam::argList::parse fileHandler().NewIFstream(source) ); - Pstream::parRun(oldParRun); // Restore parallel state - if (dictStream && dictStream->good()) { dictionary decompDict(*dictStream); @@ -1413,6 +1413,8 @@ void Foam::argList::parse } } + Pstream::parRun(oldParRun); // Restore parallel state + if (Pstream::nProcs() == 1) { Warning From cc65f5f0f0660034c76179622d72c849958373bd Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 18 Feb 2022 10:38:04 +0100 Subject: [PATCH 10/13] TUT: coded functionObject called on execute instead of write - generated too much output that also missed topology changes, which prevents proper post-processing --- .../pimpleFoam/RAS/rotatingFanInRoom/system/relVelocity | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tutorials/incompressible/pimpleFoam/RAS/rotatingFanInRoom/system/relVelocity b/tutorials/incompressible/pimpleFoam/RAS/rotatingFanInRoom/system/relVelocity index 5d0eb1e1e6..32fcce76f4 100644 --- a/tutorials/incompressible/pimpleFoam/RAS/rotatingFanInRoom/system/relVelocity +++ b/tutorials/incompressible/pimpleFoam/RAS/rotatingFanInRoom/system/relVelocity @@ -14,6 +14,8 @@ relVelocity name relVelocity; libs ( utilityFunctionObjects ); + writeControl writeTime; + coeffs { // User input (duplicate of constant/dynamicMeshDict) @@ -72,7 +74,7 @@ relVelocity } #}; - codeExecute // codeWrite + codeWrite #{ const dictionary& context = this->codeContext(); From 3d7e99b7a75579b5259ceae388ccaa56587b90f9 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 23 Feb 2022 12:18:53 +0100 Subject: [PATCH 11/13] BUG: timeActivatedFileUpdate file check on non-master (fixes #2377) ENH: report relative paths for output for easier reading --- .../timeActivatedFileUpdate.C | 40 ++++++++++++------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/src/functionObjects/utilities/timeActivatedFileUpdate/timeActivatedFileUpdate.C b/src/functionObjects/utilities/timeActivatedFileUpdate/timeActivatedFileUpdate.C index e776c32805..b2941a218f 100644 --- a/src/functionObjects/utilities/timeActivatedFileUpdate/timeActivatedFileUpdate.C +++ b/src/functionObjects/utilities/timeActivatedFileUpdate/timeActivatedFileUpdate.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2015-2019 OpenCFD Ltd. + Copyright (C) 2015-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -67,15 +67,20 @@ void Foam::functionObjects::timeActivatedFileUpdate::updateFile() if (i > lastIndex_) { - Log << nl << type() << ": copying file" << nl << timeVsFile_[i].second() - << nl << "to:" << nl << fileToUpdate_ << nl << endl; + const fileName& srcFile = timeVsFile_[i].second(); + + // Report case-relative path for information + Log << nl << type() << ": copying file" << nl + << "from: " << time_.relativePath(srcFile, true) << nl + << "to : " << time_.relativePath(fileToUpdate_, true) << nl + << endl; if (Pstream::master() || time_.distributed()) { // Slaves do not copy if running non-distributed - fileName destFile(fileToUpdate_ + Foam::name(pid())); - cp(timeVsFile_[i].second(), destFile); - mv(destFile, fileToUpdate_); + fileName tmpFile(fileToUpdate_ + Foam::name(pid())); + Foam::cp(srcFile, tmpFile); + Foam::mv(tmpFile, fileToUpdate_); } lastIndex_ = i; modified_ = true; @@ -122,16 +127,23 @@ bool Foam::functionObjects::timeActivatedFileUpdate::read forAll(timeVsFile_, i) { - timeVsFile_[i].second() = timeVsFile_[i].second().expand(); - if (!isFile(timeVsFile_[i].second())) - { - FatalErrorInFunction - << "File: " << timeVsFile_[i].second() << " not found" - << nl << exit(FatalError); - } + timeVsFile_[i].second().expand(); + const fileName& srcFile = timeVsFile_[i].second(); + // Report case-relative path for information Info<< " " << timeVsFile_[i].first() << tab - << timeVsFile_[i].second() << endl; + << time_.relativePath(srcFile, true) << endl; + + if (Pstream::master() || time_.distributed()) + { + if (!Foam::isFile(srcFile)) + { + // Report full path on error + FatalErrorInFunction + << "File not found: " << srcFile << endl + << exit(FatalError); + } + } } // Copy starting files From 942c354b59175483bb0fd6e1913a869e49990138 Mon Sep 17 00:00:00 2001 From: Andrew Heather <> Date: Fri, 25 Feb 2022 13:01:04 +0000 Subject: [PATCH 12/13] BUG: atmTurbulentHeatFluxTemperature BC - added missing clone() calls for Function1. See #2370 --- .../atmTurbulentHeatFluxTemperatureFvPatchScalarField.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/atmosphericModels/derivedFvPatchFields/atmTurbulentHeatFluxTemperature/atmTurbulentHeatFluxTemperatureFvPatchScalarField.C b/src/atmosphericModels/derivedFvPatchFields/atmTurbulentHeatFluxTemperature/atmTurbulentHeatFluxTemperatureFvPatchScalarField.C index 6d0649285d..19424001cc 100644 --- a/src/atmosphericModels/derivedFvPatchFields/atmTurbulentHeatFluxTemperature/atmTurbulentHeatFluxTemperatureFvPatchScalarField.C +++ b/src/atmosphericModels/derivedFvPatchFields/atmTurbulentHeatFluxTemperature/atmTurbulentHeatFluxTemperatureFvPatchScalarField.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. @@ -131,7 +131,7 @@ atmTurbulentHeatFluxTemperatureFvPatchScalarField fixedGradientFvPatchScalarField(atmpsf), heatSource_(atmpsf.heatSource_), alphaEffName_(atmpsf.alphaEffName_), - Cp0_(atmpsf.Cp0_), + Cp0_(atmpsf.Cp0_.clone()), q_(atmpsf.q_.clone(this->patch().patch())) {} @@ -146,7 +146,7 @@ atmTurbulentHeatFluxTemperatureFvPatchScalarField fixedGradientFvPatchScalarField(atmpsf, iF), heatSource_(atmpsf.heatSource_), alphaEffName_(atmpsf.alphaEffName_), - Cp0_(atmpsf.Cp0_), + Cp0_(atmpsf.Cp0_.clone()), q_(atmpsf.q_.clone(this->patch().patch())) {} From 80318542e11340abb7e26c2b73860ae1673af02d Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 1 Mar 2022 11:00:00 +0100 Subject: [PATCH 13/13] CONFIG: bump patch level --- META-INFO/api-info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/META-INFO/api-info b/META-INFO/api-info index 87aba82fd9..e29cea3e5c 100644 --- a/META-INFO/api-info +++ b/META-INFO/api-info @@ -1,2 +1,2 @@ api=2112 -patch=0 +patch=220310