functionObjects::turbulenceFields: Added phase support
e.g. when used with multiphaseEulerFoam: multiphaseEulerFoam -postProcess -func "turbulenceFields(omega,phase=air)"
This commit is contained in:
@ -101,7 +101,8 @@ Foam::functionObjects::turbulenceFields::turbulenceFields
|
||||
)
|
||||
:
|
||||
fvMeshFunctionObject(name, runTime, dict),
|
||||
fieldSet_()
|
||||
fieldSet_(),
|
||||
phaseName_(dict.lookupOrDefault<word>("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<Switch>("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<thermophysicalTransportModel>(modelName()))
|
||||
const word modelName
|
||||
(
|
||||
IOobject::groupName(momentumTransportModel::typeName, phaseName_)
|
||||
);
|
||||
|
||||
if (obr_.foundObject<thermophysicalTransportModel>(modelName))
|
||||
{
|
||||
const thermophysicalTransportModel& ttm =
|
||||
obr_.lookupObject<thermophysicalTransportModel>
|
||||
@ -226,10 +227,10 @@ bool Foam::functionObjects::turbulenceFields::execute()
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (obr_.foundObject<compressibleMomentumTransportModel>(modelName()))
|
||||
else if (obr_.foundObject<compressibleMomentumTransportModel>(modelName))
|
||||
{
|
||||
const compressibleMomentumTransportModel& model =
|
||||
obr_.lookupObject<compressibleMomentumTransportModel>(modelName());
|
||||
obr_.lookupObject<compressibleMomentumTransportModel>(modelName);
|
||||
|
||||
forAllConstIter(wordHashSet, fieldSet_, iter)
|
||||
{
|
||||
@ -281,13 +282,13 @@ bool Foam::functionObjects::turbulenceFields::execute()
|
||||
}
|
||||
else if
|
||||
(
|
||||
obr_.foundObject<incompressible::momentumTransportModel>(modelName())
|
||||
obr_.foundObject<incompressible::momentumTransportModel>(modelName)
|
||||
)
|
||||
{
|
||||
const incompressible::momentumTransportModel& model =
|
||||
obr_.lookupObject<incompressible::momentumTransportModel>
|
||||
(
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -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<class Type>
|
||||
|
||||
@ -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<Type, fvPatchField, volMesh> FieldType;
|
||||
|
||||
const word scopedName = prefix_ + fieldName;
|
||||
const word scopedName
|
||||
(
|
||||
IOobject::groupName(prefix_ + fieldName, phaseName_)
|
||||
);
|
||||
|
||||
if (obr_.foundObject<FieldType>(scopedName))
|
||||
{
|
||||
@ -89,7 +92,7 @@ Foam::functionObjects::turbulenceFields::omega
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"omega",
|
||||
IOobject::groupName("omega", phaseName_),
|
||||
k.mesh().time().timeName(),
|
||||
k.mesh(),
|
||||
IOobject::NO_READ,
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user