diff --git a/src/functionObjects/field/turbulenceFields/turbulenceFields.C b/src/functionObjects/field/turbulenceFields/turbulenceFields.C index 7a4617b1d1..eb0bbfff50 100644 --- a/src/functionObjects/field/turbulenceFields/turbulenceFields.C +++ b/src/functionObjects/field/turbulenceFields/turbulenceFields.C @@ -101,7 +101,8 @@ Foam::functionObjects::turbulenceFields::turbulenceFields ) : fvMeshFunctionObject(name, runTime, dict), - fieldSet_() + fieldSet_(), + phaseName_(dict.lookupOrDefault("phase", word::null)) { read(dict); } @@ -115,12 +116,6 @@ Foam::functionObjects::turbulenceFields::~turbulenceFields() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -const Foam::word& Foam::functionObjects::turbulenceFields::modelName() -{ - return Foam::momentumTransportModel::typeName; -} - - bool Foam::functionObjects::turbulenceFields::read(const dictionary& dict) { if (dict.found("field")) @@ -134,7 +129,7 @@ bool Foam::functionObjects::turbulenceFields::read(const dictionary& dict) if (dict.lookupOrDefault("prefix", false)) { - prefix_ = modelName() + ':'; + prefix_ = momentumTransportModel::typeName + ':'; } else { @@ -147,7 +142,8 @@ bool Foam::functionObjects::turbulenceFields::read(const dictionary& dict) Info<< "storing fields:" << nl; forAllConstIter(wordHashSet, fieldSet_, iter) { - Info<< " " << prefix_ + iter.key() << nl; + Info<< " " + << IOobject::groupName(prefix_ + iter.key(), phaseName_) << nl; } Info<< endl; } @@ -162,7 +158,12 @@ bool Foam::functionObjects::turbulenceFields::read(const dictionary& dict) bool Foam::functionObjects::turbulenceFields::execute() { - if (obr_.foundObject(modelName())) + const word modelName + ( + IOobject::groupName(momentumTransportModel::typeName, phaseName_) + ); + + if (obr_.foundObject(modelName)) { const thermophysicalTransportModel& ttm = obr_.lookupObject @@ -226,10 +227,10 @@ bool Foam::functionObjects::turbulenceFields::execute() } } } - else if (obr_.foundObject(modelName())) + else if (obr_.foundObject(modelName)) { const compressibleMomentumTransportModel& model = - obr_.lookupObject(modelName()); + obr_.lookupObject(modelName); forAllConstIter(wordHashSet, fieldSet_, iter) { @@ -281,13 +282,13 @@ bool Foam::functionObjects::turbulenceFields::execute() } else if ( - obr_.foundObject(modelName()) + obr_.foundObject(modelName) ) { const incompressible::momentumTransportModel& model = obr_.lookupObject ( - modelName() + modelName ); forAllConstIter(wordHashSet, fieldSet_, iter) @@ -353,7 +354,10 @@ bool Foam::functionObjects::turbulenceFields::write() { forAllConstIter(wordHashSet, fieldSet_, iter) { - const word fieldName = prefix_ + iter.key(); + const word fieldName + ( + IOobject::groupName(prefix_ + iter.key(), phaseName_) + ); writeObject(fieldName); } diff --git a/src/functionObjects/field/turbulenceFields/turbulenceFields.H b/src/functionObjects/field/turbulenceFields/turbulenceFields.H index 9a150f99d1..e3f17302e2 100644 --- a/src/functionObjects/field/turbulenceFields/turbulenceFields.H +++ b/src/functionObjects/field/turbulenceFields/turbulenceFields.H @@ -55,6 +55,7 @@ Usage type | Type name: processorField | yes | fields | Fields to store (see below) | yes | prefix | If true prefix fields | no | no + phase | phase name | no | \endtable Where \c fields can include: @@ -144,10 +145,13 @@ protected: // Defaults to null word prefix_; + //- Optional phase name + word phaseName_; + // Protected Member Functions - static const word& modelName(); + word modelName(); //- Process the turbulence field template diff --git a/src/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C b/src/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C index 30357d89a7..bd54ab7bd0 100644 --- a/src/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C +++ b/src/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,7 +36,10 @@ void Foam::functionObjects::turbulenceFields::processField { typedef GeometricField FieldType; - const word scopedName = prefix_ + fieldName; + const word scopedName + ( + IOobject::groupName(prefix_ + fieldName, phaseName_) + ); if (obr_.foundObject(scopedName)) { @@ -89,7 +92,7 @@ Foam::functionObjects::turbulenceFields::omega ( IOobject ( - "omega", + IOobject::groupName("omega", phaseName_), k.mesh().time().timeName(), k.mesh(), IOobject::NO_READ, diff --git a/src/functionObjects/field/yPlus/yPlus.H b/src/functionObjects/field/yPlus/yPlus.H index 3df859bc8d..ed796be765 100644 --- a/src/functionObjects/field/yPlus/yPlus.H +++ b/src/functionObjects/field/yPlus/yPlus.H @@ -42,7 +42,7 @@ Usage \table Property | Description | Required | Default value type | type name: yPlus | yes | - phase | phase name | no | none + phase | phase name | no | \endtable Note