diff --git a/src/functionObjects/field/yPlus/yPlus.C b/src/functionObjects/field/yPlus/yPlus.C index 0fda54e1d8..3eede62949 100644 --- a/src/functionObjects/field/yPlus/yPlus.C +++ b/src/functionObjects/field/yPlus/yPlus.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -71,7 +71,7 @@ Foam::tmp Foam::functionObjects::yPlus::calcYPlus ( volScalarField::New ( - type(), + IOobject::groupName(type(), phaseName_), mesh_, dimensionedScalar(dimless, 0) ) @@ -133,11 +133,12 @@ Foam::functionObjects::yPlus::yPlus : fvMeshFunctionObject(name, runTime, dict), logFiles(obr_, name), - writeLocalObjects(obr_, log) + writeLocalObjects(obr_, log), + phaseName_(dict.lookupOrDefault("phase", word::null)) { read(dict); - resetName(typeName); - resetLocalObjectName(typeName); + resetName(IOobject::groupName(typeName, phaseName_)); + resetLocalObjectName(IOobject::groupName(typeName, phaseName_)); } @@ -160,14 +161,17 @@ bool Foam::functionObjects::yPlus::read(const dictionary& dict) bool Foam::functionObjects::yPlus::execute() { - if (mesh_.foundObject(turbulenceModel::propertiesName)) + if (mesh_.foundObject + ( + IOobject::groupName(turbulenceModel::propertiesName, phaseName_)) + ) { const turbulenceModel& model = mesh_.lookupObject ( - turbulenceModel::propertiesName + IOobject::groupName(turbulenceModel::propertiesName, phaseName_) ); - word name(type()); + word name(IOobject::groupName(type(), phaseName_)); return store(name, calcYPlus(model)); } @@ -191,7 +195,10 @@ bool Foam::functionObjects::yPlus::write() logFiles::write(); const volScalarField& yPlus = - mesh_.lookupObject(type()); + mesh_.lookupObject + ( + IOobject::groupName(type(), phaseName_) + ); const volScalarField::Boundary& yPlusBf = yPlus.boundaryField(); const fvPatchList& patches = mesh_.boundary(); diff --git a/src/functionObjects/field/yPlus/yPlus.H b/src/functionObjects/field/yPlus/yPlus.H index dfdd7c26e1..1b62c97716 100644 --- a/src/functionObjects/field/yPlus/yPlus.H +++ b/src/functionObjects/field/yPlus/yPlus.H @@ -26,7 +26,7 @@ Class Description Evaluates and outputs turbulence y+ for models. Values written to - time directories as field 'yPlus'. + time directories as field 'yPlus' or 'yPlus.phase'. Example of function object specification: \verbatim @@ -42,6 +42,7 @@ Usage \table Property | Description | Required | Default value type | type name: yPlus | yes | + phase | phase name | no | none \endtable Note @@ -89,6 +90,16 @@ class yPlus public logFiles, public writeLocalObjects { +protected: + + // Protected data + + //- Optional phase name [K] + word phaseName_; + + +private: + // Private Member Functions //- File header information