From f71c2c3b608f13b42117ce03c79941ad022aba4f Mon Sep 17 00:00:00 2001
From: andy <andy>
Date: Mon, 5 Mar 2012 15:04:33 +0000
Subject: [PATCH] ENH: Added new turbulenceFields function object - to obtain
 fields, e.g. R, devReff, devRhoReff etc

---
 .../functionObjects/field/Make/files          |   3 +
 .../functionObjects/field/Make/options        |  11 +-
 .../turbulenceFields/IOturbulenceFields.H     |  49 ++++
 .../field/turbulenceFields/postProcessingDict |  34 +++
 .../field/turbulenceFields/turbulenceFields.C | 267 ++++++++++++++++++
 .../field/turbulenceFields/turbulenceFields.H | 192 +++++++++++++
 .../turbulenceFieldsFunctionObject.C          |  42 +++
 .../turbulenceFieldsFunctionObject.H          |  54 ++++
 .../turbulenceFieldsTemplates.C               |  51 ++++
 9 files changed, 701 insertions(+), 2 deletions(-)
 create mode 100644 src/postProcessing/functionObjects/field/turbulenceFields/IOturbulenceFields.H
 create mode 100644 src/postProcessing/functionObjects/field/turbulenceFields/postProcessingDict
 create mode 100644 src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFields.C
 create mode 100644 src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFields.H
 create mode 100644 src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFieldsFunctionObject.C
 create mode 100644 src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFieldsFunctionObject.H
 create mode 100644 src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C

diff --git a/src/postProcessing/functionObjects/field/Make/files b/src/postProcessing/functionObjects/field/Make/files
index ab0c44e69d1..e351784bdcb 100644
--- a/src/postProcessing/functionObjects/field/Make/files
+++ b/src/postProcessing/functionObjects/field/Make/files
@@ -29,6 +29,9 @@ streamLine/streamLineParticle.C
 streamLine/streamLineParticleCloud.C
 streamLine/streamLineFunctionObject.C
 
+turbulenceFields/turbulenceFields.C
+turbulenceFields/turbulenceFieldsFunctionObject.C
+
 wallBoundedStreamLine/wallBoundedStreamLine.C
 wallBoundedStreamLine/wallBoundedStreamLineFunctionObject.C
 wallBoundedStreamLine/wallBoundedStreamLineParticle.C
diff --git a/src/postProcessing/functionObjects/field/Make/options b/src/postProcessing/functionObjects/field/Make/options
index 1e254fd4bb4..d7c5f944c60 100644
--- a/src/postProcessing/functionObjects/field/Make/options
+++ b/src/postProcessing/functionObjects/field/Make/options
@@ -2,10 +2,17 @@ EXE_INC = \
     -I$(LIB_SRC)/finiteVolume/lnInclude \
     -I$(LIB_SRC)/meshTools/lnInclude \
     -I$(LIB_SRC)/lagrangian/basic/lnInclude \
-    -I$(LIB_SRC)/sampling/lnInclude
+    -I$(LIB_SRC)/sampling/lnInclude \
+    -I$(LIB_SRC)/transportModels \
+    -I$(LIB_SRC)/turbulenceModels \
+    -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude
 
 LIB_LIBS = \
     -lfiniteVolume \
     -lmeshTools \
     -llagrangian \
-    -lsampling
+    -lsampling \
+    -lincompressibleTransportModels \
+    -lcompressibleTurbulenceModel \
+    -lincompressibleTurbulenceModel
+
diff --git a/src/postProcessing/functionObjects/field/turbulenceFields/IOturbulenceFields.H b/src/postProcessing/functionObjects/field/turbulenceFields/IOturbulenceFields.H
new file mode 100644
index 00000000000..3ac6a32e54f
--- /dev/null
+++ b/src/postProcessing/functionObjects/field/turbulenceFields/IOturbulenceFields.H
@@ -0,0 +1,49 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Typedef
+    Foam::IOturbulenceFields
+
+Description
+    Instance of the generic IOOutputFilter for turbulenceFields.
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef IOturbulenceFields_H
+#define IOturbulenceFields_H
+
+#include "turbulenceFields.H"
+#include "IOOutputFilter.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    typedef IOOutputFilter<turbulenceFields> IOturbulenceFields;
+}
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/postProcessing/functionObjects/field/turbulenceFields/postProcessingDict b/src/postProcessing/functionObjects/field/turbulenceFields/postProcessingDict
new file mode 100644
index 00000000000..6d4b0409fa5
--- /dev/null
+++ b/src/postProcessing/functionObjects/field/turbulenceFields/postProcessingDict
@@ -0,0 +1,34 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  dev                                   |
+|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    object      postProcessingDict;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+functions
+{
+    turbulenceFields1
+    {
+        type            turbulenceFields;
+        functionObjectLibs ("libfieldFunctionObjects.so");
+        enabled         true;
+        outputControl   timeStep;
+        outputInterval  1;
+
+        fields
+        (
+            R 
+        );
+    }
+}
+
+// ************************************************************************* //
diff --git a/src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFields.C b/src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFields.C
new file mode 100644
index 00000000000..ab21ab2242c
--- /dev/null
+++ b/src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFields.C
@@ -0,0 +1,267 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "turbulenceFields.H"
+#include "dictionary.H"
+#include "compressible/turbulenceModel/turbulenceModel.H"
+#include "incompressible/turbulenceModel/turbulenceModel.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    defineTypeNameAndDebug(Foam::turbulenceFields, 0);
+
+    template<>
+    const char* NamedEnum<turbulenceFields::compressibleField, 6>::names[] =
+    {
+        "R",
+        "devRhoReff",
+        "mut",
+        "muEff",
+        "alphat",
+        "alphaEff"
+    };
+    const NamedEnum<turbulenceFields::compressibleField, 6>
+        turbulenceFields::compressibleFieldNames_;
+
+    template<>
+    const char* NamedEnum<turbulenceFields::incompressibleField, 4>::names[] =
+    {
+        "R",
+        "devReff",
+        "nut",
+        "nuEff"
+    };
+    const NamedEnum<turbulenceFields::incompressibleField, 4>
+        turbulenceFields::incompressibleFieldNames_;
+
+    const word turbulenceFields::modelName = "turbulenceModel";
+}
+
+
+// * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * * //
+
+bool Foam::turbulenceFields::compressible()
+{
+    if (obr_.foundObject<compressible::turbulenceModel>(modelName))
+    {
+        return true;
+    }
+    else if (obr_.foundObject<incompressible::turbulenceModel>(modelName))
+    {
+        return false;
+    }
+    else
+    {
+        WarningIn("Foam::word& Foam::turbulenceFields::compressible() const")
+            << "Turbulence model not found in database, deactivating";
+        active_ = false;
+    }
+
+    return false;
+}
+
+
+Foam::IOobject Foam::turbulenceFields::io(const word& fieldName) const
+{
+    return
+        IOobject
+        (
+            fieldName,
+            obr_.time().timeName(),
+            obr_,
+            IOobject::READ_IF_PRESENT,
+            IOobject::NO_WRITE
+        );
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::turbulenceFields::turbulenceFields
+(
+    const word& name,
+    const objectRegistry& obr,
+    const dictionary& dict,
+    const bool loadFromFiles
+)
+:
+    name_(name),
+    obr_(obr),
+    active_(true),
+    fieldSet_()
+{
+    // Check if the available mesh is an fvMesh otherise deactivate
+    if (!isA<fvMesh>(obr_))
+    {
+        active_ = false;
+        WarningIn
+        (
+            "turbulenceFields::turbulenceFields"
+            "("
+                "const word&, "
+                "const objectRegistry&, "
+                "const dictionary&, "
+                "const bool"
+            ")"
+        )   << "No fvMesh available, deactivating."
+            << endl;
+    }
+
+    read(dict);
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Foam::turbulenceFields::~turbulenceFields()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+void Foam::turbulenceFields::read(const dictionary& dict)
+{
+    if (active_)
+    {
+        dict.lookup("fields") >> fieldSet_;
+
+        execute();
+    }
+}
+
+
+void Foam::turbulenceFields::execute()
+{
+    bool comp = compressible();
+
+    if (!active_)
+    {
+        return;
+    }
+
+    if (comp)
+    {
+        const compressible::turbulenceModel& model =
+            obr_.lookupObject<compressible::turbulenceModel>(modelName);
+
+        forAll(fieldSet_, fieldI)
+        {
+            const word& f = fieldSet_[fieldI];
+            switch (compressibleFieldNames_[f])
+            {
+                case cfR:
+                {
+                    processField<symmTensor>(f, model.R());
+                    break;
+                }
+                case cfDevRhoReff:
+                {
+                    processField<symmTensor>(f, model.devRhoReff());
+                    break;
+                }
+                case cfMut:
+                {
+                    processField<scalar>(f, model.mut());
+                    break;
+                }
+                case cfMuEff:
+                {
+                    processField<scalar>(f, model.muEff());
+                    break;
+                }
+                case cfAlphat:
+                {
+                    processField<scalar>(f, model.alphat());
+                    break;
+                }
+                case cfAlphaEff:
+                {
+                    processField<scalar>(f, model.alphaEff());
+                    break;
+                }
+                default:
+                {
+                    FatalErrorIn("void Foam::turbulenceFields::execute()")
+                        << "Invalid field selection" << abort(FatalError);
+                }
+            }
+        }
+    }
+    else
+    {
+        const incompressible::turbulenceModel& model =
+            obr_.lookupObject<incompressible::turbulenceModel>(modelName);
+
+        forAll(fieldSet_, fieldI)
+        {
+            const word& f = fieldSet_[fieldI];
+            switch (incompressibleFieldNames_[f])
+            {
+                case ifR:
+                {
+                    processField<symmTensor>(f, model.R());
+                    break;
+                }
+                case ifDevReff:
+                {
+                    processField<symmTensor>(f, model.devReff());
+                    break;
+                }
+                case ifNut:
+                {
+                    processField<scalar>(f, model.nut());
+                    break;
+                }
+                case ifNuEff:
+                {
+                    processField<scalar>(f, model.nuEff());
+                    break;
+                }
+                default:
+                {
+                    FatalErrorIn("void Foam::turbulenceFields::execute()")
+                        << "Invalid field selection" << abort(FatalError);
+                }
+            }
+        }
+    }
+}
+
+
+void Foam::turbulenceFields::end()
+{
+    // Do nothing
+}
+
+
+void Foam::turbulenceFields::write()
+{
+    // Do nothing
+}
+
+
+// ************************************************************************* //
diff --git a/src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFields.H b/src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFields.H
new file mode 100644
index 00000000000..1d33b657922
--- /dev/null
+++ b/src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFields.H
@@ -0,0 +1,192 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Class
+    Foam::turbulenceFields
+
+Description
+    Stores turbulence fields on the mesh database for further manipulation.
+
+SourceFiles
+    turbulenceFields.C
+    IOturbulenceFields.H
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef turbulenceFields_H
+#define turbulenceFields_H
+
+#include "wordList.H"
+#include "IOobject.H"
+#include "NamedEnum.H"
+#include "pointField.H"
+#include "volFieldsFwd.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// Forward declaration of classes
+class objectRegistry;
+class dictionary;
+class mapPolyMesh;
+
+/*---------------------------------------------------------------------------*\
+                       Class turbulenceFields Declaration
+\*---------------------------------------------------------------------------*/
+
+class turbulenceFields
+{
+public:
+
+    enum compressibleField
+    {
+        cfR,
+        cfDevRhoReff,
+        cfMut,
+        cfMuEff,
+        cfAlphat,
+        cfAlphaEff
+    };
+    static const NamedEnum<compressibleField, 6> compressibleFieldNames_;
+
+    enum incompressibleField
+    {
+        ifR,
+        ifDevReff,
+        ifNut,
+        ifNuEff
+    };
+    static const NamedEnum<incompressibleField, 4> incompressibleFieldNames_;
+
+    static const word modelName;
+
+
+protected:
+
+    // Protected data
+
+        //- Name of this set of turbulenceFields object
+        word name_;
+
+        const objectRegistry& obr_;
+
+        //- on/off switch
+        bool active_;
+
+        //- Fields to load
+        wordList fieldSet_;
+
+
+    // Protected Member Functions
+
+        //- Disallow default bitwise copy construct
+        turbulenceFields(const turbulenceFields&);
+
+        //- Disallow default bitwise assignment
+        void operator=(const turbulenceFields&);
+
+        //- Return true if compressible turbulence model is identified
+        bool compressible();
+
+        //- Helper function to return IOobject
+        IOobject io(const word& fieldName) const;
+
+        //- Process the turbulence field
+        template<class Type>
+        void processField
+        (
+            const word& fieldName,
+            const GeometricField<Type, fvPatchField, volMesh>& value
+        );
+
+
+public:
+
+    //- Runtime type information
+    TypeName("turbulenceFields");
+
+
+    // Constructors
+
+        //- Construct for given objectRegistry and dictionary.
+        //  Allow the possibility to load fields from files
+        turbulenceFields
+        (
+            const word& name,
+            const objectRegistry&,
+            const dictionary&,
+            const bool loadFromFiles = false
+        );
+
+
+    //- Destructor
+    virtual ~turbulenceFields();
+
+
+    // Member Functions
+
+        //- Return name of the turbulenceFields object
+        virtual const word& name() const
+        {
+            return name_;
+        }
+
+        //- Read the field min/max data
+        virtual void read(const dictionary&);
+
+        //- Execute, currently does nothing
+        virtual void execute();
+
+        //- Execute at the final time-loop, currently does nothing
+        virtual void end();
+
+        //- Write
+        virtual void write();
+
+        //- Update for changes of mesh
+        virtual void updateMesh(const mapPolyMesh&)
+        {}
+
+        //- Update for changes of mesh
+        virtual void movePoints(const pointField&)
+        {}
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#ifdef NoRepository
+    #include "turbulenceFieldsTemplates.C"
+#endif
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFieldsFunctionObject.C b/src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFieldsFunctionObject.C
new file mode 100644
index 00000000000..f5f542d12f3
--- /dev/null
+++ b/src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFieldsFunctionObject.C
@@ -0,0 +1,42 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "turbulenceFieldsFunctionObject.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    defineNamedTemplateTypeNameAndDebug(turbulenceFieldsFunctionObject, 0);
+
+    addToRunTimeSelectionTable
+    (
+        functionObject,
+        turbulenceFieldsFunctionObject,
+        dictionary
+    );
+}
+
+// ************************************************************************* //
diff --git a/src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFieldsFunctionObject.H b/src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFieldsFunctionObject.H
new file mode 100644
index 00000000000..6631fb14344
--- /dev/null
+++ b/src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFieldsFunctionObject.H
@@ -0,0 +1,54 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Typedef
+    Foam::turbulenceFieldsFunctionObject
+
+Description
+    FunctionObject wrapper around turbulenceFields to allow them to be created
+    via the functions entry within controlDict.
+
+SourceFiles
+    turbulenceFieldsFunctionObject.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef turbulenceFieldsFunctionObject_H
+#define turbulenceFieldsFunctionObject_H
+
+#include "turbulenceFields.H"
+#include "OutputFilterFunctionObject.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    typedef OutputFilterFunctionObject<turbulenceFields>
+        turbulenceFieldsFunctionObject;
+}
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C b/src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C
new file mode 100644
index 00000000000..44cd320c5fd
--- /dev/null
+++ b/src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C
@@ -0,0 +1,51 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "volFields.H"
+
+// * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * * //
+
+template<class Type>
+void Foam::turbulenceFields::processField
+(
+    const word& fieldName,
+    const GeometricField<Type, fvPatchField, volMesh>& value
+)
+{
+    typedef GeometricField<Type, fvPatchField, volMesh> FieldType;
+    if (obr_.foundObject<FieldType>(fieldName))
+    {
+        FieldType& fld =
+            const_cast<FieldType&>(obr_.lookupObject<FieldType>(fieldName));
+        fld == value;
+    }
+    else
+    {
+        obr_.store(new FieldType(io(fieldName), value));
+    }
+}
+
+
+// ************************************************************************* //
-- 
GitLab