From a4d235af6b327e9133c3d80ce71862906158db54 Mon Sep 17 00:00:00 2001 From: Kutalmis Bercin Date: Wed, 2 Nov 2022 14:55:38 +0000 Subject: [PATCH] BUG: porousBafflePressure: read fixedJump entries - apply under-relaxation (fixes #2626) --- .../porousBafflePressureFvPatchField.C | 27 ++++++++++++++----- .../porousBafflePressureFvPatchField.H | 3 ++- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C index f249e419bc..b045715f87 100644 --- a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C +++ b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -53,10 +53,11 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField ( const fvPatch& p, const DimensionedField& iF, - const dictionary& dict + const dictionary& dict, + const bool valueRequired ) : - fixedJumpFvPatchField(p, iF), + fixedJumpFvPatchField(p, iF, dict, false), phiName_(dict.getOrDefault("phi", "phi")), rhoName_(dict.getOrDefault("rho", "rho")), D_(Function1::New("D", dict, &db())), @@ -64,10 +65,20 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField length_(dict.get("length")), uniformJump_(dict.getOrDefault("uniformJump", false)) { - fvPatchField::operator= - ( - Field("value", dict, p.size()) - ); + if (valueRequired) + { + if (dict.found("value")) + { + fvPatchField::operator= + ( + Field("value", dict, p.size()) + ); + } + else + { + this->evaluate(Pstream::commsTypes::blocking); + } + } } @@ -178,6 +189,8 @@ void Foam::porousBafflePressureFvPatchField::updateCoeffs() ); } + this->relax(); + if (debug) { scalar avePressureJump = gAverage(jump()); diff --git a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.H b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.H index f7fd802fc6..0fb4f64e3f 100644 --- a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.H +++ b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.H @@ -162,7 +162,8 @@ public: ( const fvPatch&, const DimensionedField&, - const dictionary& + const dictionary&, + const bool valueRequired = true ); //- Construct by mapping given porousBafflePressureFvPatchField