From de21a6bc0e5bdae2a4c70ed7bbd4349269e1842e Mon Sep 17 00:00:00 2001 From: Kutalmis Bercin Date: Mon, 4 Jul 2022 13:34:13 +0100 Subject: [PATCH] BUG: setTurbulenceFields: update processor boundaries (fixes #2527) --- .../setTurbulenceFields/setTurbulenceFields.C | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/applications/utilities/preProcessing/setTurbulenceFields/setTurbulenceFields.C b/applications/utilities/preProcessing/setTurbulenceFields/setTurbulenceFields.C index 6e69f83457..c5351daf5d 100644 --- a/applications/utilities/preProcessing/setTurbulenceFields/setTurbulenceFields.C +++ b/applications/utilities/preProcessing/setTurbulenceFields/setTurbulenceFields.C @@ -109,6 +109,7 @@ Note #include "singlePhaseTransportModel.H" #include "turbulentTransportModel.H" #include "turbulentFluidThermoModel.H" +#include "processorFvPatchField.H" #include "wallFvPatch.H" #include "fixedValueFvPatchFields.H" @@ -122,6 +123,40 @@ void InfoField(const word& fldName) } +template +void correctProcessorPatches +( + GeometricField& vf +) +{ + if (!Pstream::parRun()) + { + return; + } + + // Not possible to use correctBoundaryConditions on fields as they may + // use local info as opposed to the constraint values employed here, + // but still need to update processor patches + auto& bf = vf.boundaryFieldRef(); + + forAll(bf, patchi) + { + if (isA>(bf[patchi])) + { + bf[patchi].initEvaluate(); + } + } + + forAll(bf, patchi) + { + if (isA>(bf[patchi])) + { + bf[patchi].evaluate(); + } + } +} + + IOobject createIOobject ( const fvMesh& mesh, @@ -447,22 +482,26 @@ int main(int argc, char *argv[]) // (M:Eq. 9) const dimensionedScalar maxU(dimVelocity, SMALL); U *= min(scalar(1), fRei*uTau/max(mag(U), maxU)); + correctProcessorPatches(U); } if (tepsilon.valid()) { tepsilon.ref() = epsilon; + correctProcessorPatches(tepsilon.ref()); } if (tk.valid()) { tk.ref() = k; + correctProcessorPatches(tk.ref()); } if (tomega.valid()) { const dimensionedScalar k0(sqr(dimLength/dimTime), SMALL); tomega.ref() = Cmu*epsilon/(k + k0); + correctProcessorPatches(tomega.ref()); } if (tR.valid()) @@ -475,6 +514,7 @@ int main(int argc, char *argv[]) { R[celli] = Rdiag[celli]; } + correctProcessorPatches(R); }