diff --git a/src/functionObjects/field/turbulenceFields/turbulenceFields.C b/src/functionObjects/field/turbulenceFields/turbulenceFields.C index 66cbd24413..51811391db 100644 --- a/src/functionObjects/field/turbulenceFields/turbulenceFields.C +++ b/src/functionObjects/field/turbulenceFields/turbulenceFields.C @@ -133,13 +133,22 @@ bool Foam::functionObjects::turbulenceFields::read(const dictionary& dict) fieldSet_.insert(wordList(dict.lookup("fields"))); } + if (dict.lookupOrDefault("prefix", false)) + { + prefix_ = modelName() + ':'; + } + else + { + prefix_ = word::null; + } + Info<< type() << " " << name() << ": "; if (fieldSet_.size()) { Info<< "storing fields:" << nl; forAllConstIter(wordHashSet, fieldSet_, iter) { - Info<< " " << modelName() << ':' << iter.key() << nl; + Info<< " " << prefix_ + iter.key() << nl; } Info<< endl; } @@ -338,7 +347,7 @@ bool Foam::functionObjects::turbulenceFields::write() { forAllConstIter(wordHashSet, fieldSet_, iter) { - const word fieldName = modelName() + ':' + iter.key(); + const word fieldName = prefix_ + iter.key(); writeObject(fieldName); } diff --git a/src/functionObjects/field/turbulenceFields/turbulenceFields.H b/src/functionObjects/field/turbulenceFields/turbulenceFields.H index 9732691be7..4c10cb7240 100644 --- a/src/functionObjects/field/turbulenceFields/turbulenceFields.H +++ b/src/functionObjects/field/turbulenceFields/turbulenceFields.H @@ -52,8 +52,9 @@ Description Usage \table Property | Description | Required | Default value - type | type name: processorField | yes | - fields | fields to store (see below) | yes | + type | Type name: processorField | yes | + fields | Fields to store (see below) | yes | + prefix | If true prefix fields | no | no \endtable Where \c fields can include: @@ -140,6 +141,10 @@ protected: //- Fields to load wordHashSet fieldSet_; + //- Optional field prefix to avoid name clashes + // Defaults to null + word prefix_; + // Protected Member Functions diff --git a/src/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C b/src/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C index 735c1bc04e..dd5f1da65b 100644 --- a/src/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C +++ b/src/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C @@ -36,7 +36,7 @@ void Foam::functionObjects::turbulenceFields::processField { typedef GeometricField FieldType; - const word scopedName = modelName() + ':' + fieldName; + const word scopedName = prefix_ + fieldName; if (obr_.foundObject(scopedName)) {