Skip to content
Snippets Groups Projects
Commit 55f61a00 authored by Kutalmış Berçin's avatar Kutalmış Berçin
Browse files

ENH: turbulenceFields: enable custom prefix for output fields

parent 8f16527a
Branches
Tags
No related merge requests found
......@@ -94,7 +94,7 @@ void Foam::functionObjects::turbulenceFields::initialise()
{
for (const word& f : fieldSet_)
{
const word scopedName(modelName_ + ':' + f);
const word scopedName(prefix_ + f);
if (obr_.found(scopedName))
{
......@@ -141,6 +141,7 @@ Foam::functionObjects::turbulenceFields::turbulenceFields
:
fvMeshFunctionObject(name, runTime, dict),
initialised_(false),
prefix_(dict.getOrDefault<word>("prefix", "turbulenceProperties:")),
fieldSet_()
{
read(dict);
......@@ -153,6 +154,8 @@ bool Foam::functionObjects::turbulenceFields::read(const dictionary& dict)
{
if (fvMeshFunctionObject::read(dict))
{
dict.readIfPresent("prefix", prefix_);
if (dict.found("field"))
{
fieldSet_.insert(dict.get<word>("field"));
......@@ -168,7 +171,7 @@ bool Foam::functionObjects::turbulenceFields::read(const dictionary& dict)
Info<< "storing fields:" << nl;
for (const word& f : fieldSet_)
{
Info<< " " << modelName_ << ':' << f << nl;
Info<< " " << prefix_ << f << nl;
}
Info<< endl;
}
......@@ -348,7 +351,7 @@ bool Foam::functionObjects::turbulenceFields::write()
{
for (const word& f : fieldSet_)
{
const word scopedName(modelName_ + ':' + f);
const word scopedName(prefix_ + f);
writeObject(scopedName);
}
......
......@@ -35,13 +35,6 @@ Description
output during calculations, and stores/writes them on the mesh database
for further manipulation.
Fields are stored as copies of the original, with the prefix
"turbulenceModel:", e.g.:
\verbatim
turbulenceModel:R
\endverbatim
Operands:
\table
Operand | Type | Location
......@@ -79,6 +72,9 @@ Usage
// Option-2
field R;
// Optional entries (runtime modifiable)
prefix <word>;
// Inherited entries
...
}
......@@ -91,6 +87,7 @@ Usage
libs | Library name: fieldFunctionObjects | word | yes | -
fields | Names of fields to store (see below) | wordList | yes | -
field | Name of a field to store (see below) | word | yes | -
prefix | Name of output-field prefix | word | no | turbulenceProperties:
\endtable
where \c fields can include:
......@@ -213,6 +210,9 @@ protected:
//- Flag to track initialisation
bool initialised_;
//- Name of output-field prefix
word prefix_;
//- Fields to load
wordHashSet fieldSet_;
......
......@@ -39,7 +39,7 @@ void Foam::functionObjects::turbulenceFields::processField
{
typedef GeometricField<Type, fvPatchField, volMesh> FieldType;
const word scopedName(modelName_ + ':' + fieldName);
const word scopedName(prefix_ + fieldName);
FieldType* fldPtr = obr_.getObjectPtr<FieldType>(scopedName);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment