From f3d0db18bb3720ea1fcc4bae64a2b02e0d1065ee Mon Sep 17 00:00:00 2001 From: Kutalmis Bercin Date: Fri, 16 Jul 2021 16:04:03 +0100 Subject: [PATCH] ENH: yPlus: add a flag to enable/disable wall-function predictions --- src/functionObjects/field/yPlus/yPlus.C | 21 +++++++++++++++------ src/functionObjects/field/yPlus/yPlus.H | 15 ++++++++++++++- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/functionObjects/field/yPlus/yPlus.C b/src/functionObjects/field/yPlus/yPlus.C index 8fc394738e..32a0e3f951 100644 --- a/src/functionObjects/field/yPlus/yPlus.C +++ b/src/functionObjects/field/yPlus/yPlus.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2016 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -70,7 +70,8 @@ Foam::functionObjects::yPlus::yPlus ) : fvMeshFunctionObject(name, runTime, dict), - writeFile(obr_, name, typeName, dict) + writeFile(obr_, name, typeName, dict), + useWallFunction_(true) { read(dict); @@ -101,10 +102,14 @@ Foam::functionObjects::yPlus::yPlus bool Foam::functionObjects::yPlus::read(const dictionary& dict) { - fvMeshFunctionObject::read(dict); - writeFile::read(dict); + if (fvMeshFunctionObject::read(dict) && writeFile::read(dict)) + { + useWallFunction_ = dict.getOrDefault("useWallFunction", true); - return true; + return true; + } + + return false; } @@ -139,7 +144,11 @@ bool Foam::functionObjects::yPlus::execute() { const fvPatch& patch = patches[patchi]; - if (isA(nutBf[patchi])) + if + ( + isA(nutBf[patchi]) + && useWallFunction_ + ) { const nutWallFunctionFvPatchScalarField& nutPf = dynamic_cast diff --git a/src/functionObjects/field/yPlus/yPlus.H b/src/functionObjects/field/yPlus/yPlus.H index 6614ef33ff..1e70952e53 100644 --- a/src/functionObjects/field/yPlus/yPlus.H +++ b/src/functionObjects/field/yPlus/yPlus.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2016 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -50,6 +50,9 @@ Usage type yPlus; libs (fieldFunctionObjects); + // Optional entries + useWallFunction true; + // Optional (inherited) entries ... } @@ -60,6 +63,10 @@ Usage Property | Description | Type | Req'd | Dflt type | Type name: yPlus | word | yes | - libs | Library name: fieldFunctionObjects | word | yes | - + useWallFunction | Flag to use the local expressions of the selected nut wall function to compute yPlus, otherwise directly compute yPlus from flow field | bool | no | true \endtable The inherited entries are elaborated in: @@ -106,6 +113,12 @@ class yPlus public fvMeshFunctionObject, public writeFile { + // Private Data + + //- Flag to use the wall function expressions to compute yPlus + bool useWallFunction_; + + // Private Member Functions //- File header information