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