diff --git a/src/functionObjects/field/turbulenceFields/turbulenceFields.C b/src/functionObjects/field/turbulenceFields/turbulenceFields.C index c445161ddbf835d57192403c47b46da9293fbc48..894f8adf8f82b70aa55f29ff2321bc87ba71a277 100644 --- a/src/functionObjects/field/turbulenceFields/turbulenceFields.C +++ b/src/functionObjects/field/turbulenceFields/turbulenceFields.C @@ -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); } diff --git a/src/functionObjects/field/turbulenceFields/turbulenceFields.H b/src/functionObjects/field/turbulenceFields/turbulenceFields.H index 01b6d0fd1c2240439dd7a4d918ef584a28c84763..05ed772e4769ee4020c9c2241bc33841a19d362c 100644 --- a/src/functionObjects/field/turbulenceFields/turbulenceFields.H +++ b/src/functionObjects/field/turbulenceFields/turbulenceFields.H @@ -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 @@ -85,6 +78,9 @@ Usage // Option-2 field R; + // Optional entries (runtime modifiable) + prefix <word>; + // Inherited entries ... } @@ -97,6 +93,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: @@ -214,6 +211,9 @@ protected: //- Flag to track initialisation bool initialised_; + //- Name of output-field prefix + word prefix_; + //- Fields to load wordHashSet fieldSet_; diff --git a/src/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C b/src/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C index eff64c673ce3485a74895fc86d26e08e686dbad5..a5452640d571a657cfe7ccbae2c4f978869e336c 100644 --- a/src/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C +++ b/src/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C @@ -40,7 +40,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);