Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / src / postProcessing / functionObjects / field / nearWallFields / nearWallFields.H
blob76da3c0e228bd69074b9c25fc9935a5853648f20
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2010-2010 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software: you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by
13     the Free Software Foundation, either version 3 of the License, or
14     (at your option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::nearWallFields
27 Description
28     Samples near-patch volFields
30     Holds fields
31     - every timestep the field get updated with new values
32     - at write it writes the fields
33     so this functionObject can either be used to calculate a new field
34     as a postprocessing step or (since the fields are registered)
35     use these in another functionObject (e.g. faceSource).
37     surfaceValues
38     {
39         type        nearWallFields;
40         ..
41         enabled         true;
42         outputControl   outputTime;
43         ..
44         // Name of volField and corresponding surfaceField
45         fields      ((p pNear)(U UNear));
46         // Name of patch to sample
47         patches     (movingWall);
48         // Distance away from the wall
49         distance    0.13;   // distance away from wall
50     }
53 SourceFiles
54     nearWallFields.C
55     IOnearWallFields.H
57 \*---------------------------------------------------------------------------*/
59 #ifndef nearWallFields_H
60 #define nearWallFields_H
62 #include "OFstream.H"
63 #include "volFields.H"
64 #include "Tuple2.H"
66 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 namespace Foam
71 // Forward declaration of classes
72 class objectRegistry;
73 class dictionary;
74 class mapPolyMesh;
76 /*---------------------------------------------------------------------------*\
77                          Class nearWallFields Declaration
78 \*---------------------------------------------------------------------------*/
80 class nearWallFields
82 protected:
84     // Protected data
86         //- Name of this set of nearWallFields object
87         word name_;
89         const objectRegistry& obr_;
91         //- on/off switch
92         bool active_;
94         // Read from dictionary
96             //- Fields to process
97             List<Tuple2<word, word> > fieldSet_;
99             //- Patches to sample
100             labelHashSet patchSet_;
102             //- Distance away from wall
103             scalar distance_;
105             //- From original field to sampled result
106             HashTable<word> fieldMap_;
108             //- From resulting back to original field
109             HashTable<word> reverseFieldMap_;
111         //- Locally constructed fields
112         PtrList<volScalarField> vsf_;
113         PtrList<volVectorField> vvf_;
114         PtrList<volSphericalTensorField> vSpheretf_;
115         PtrList<volSymmTensorField> vSymmtf_;
116         PtrList<volTensorField> vtf_;
119     // Protected Member Functions
121         //- Disallow default bitwise copy construct
122         nearWallFields(const nearWallFields&);
124         //- Disallow default bitwise assignment
125         void operator=(const nearWallFields&);
127         template<class Type>
128         void createFields
129         (
130             PtrList<GeometricField<Type, fvPatchField, volMesh> >&
131         ) const;
133         template<class Type>
134         void sampleFields
135         (
136             PtrList<GeometricField<Type, fvPatchField, volMesh> >&
137         ) const;
139 public:
141     //- Runtime type information
142     TypeName("nearWallFields");
145     // Constructors
147         //- Construct for given objectRegistry and dictionary.
148         //  Allow the possibility to load fields from files
149         nearWallFields
150         (
151             const word& name,
152             const objectRegistry&,
153             const dictionary&,
154             const bool loadFromFiles = false
155         );
158     //- Destructor
159     virtual ~nearWallFields();
162     // Member Functions
164         //- Return name of the nearWallFields object
165         virtual const word& name() const
166         {
167             return name_;
168         }
170         //- Read the field min/max data
171         virtual void read(const dictionary&);
173         //- Execute, currently does nothing
174         virtual void execute();
176         //- Execute at the final time-loop, currently does nothing
177         virtual void end();
179         //- Write
180         virtual void write();
182         //- Update for changes of mesh
183         virtual void updateMesh(const mapPolyMesh&)
184         {}
186         //- Update for changes of mesh
187         virtual void movePoints(const pointField&)
188         {}
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 } // End namespace Foam
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 #ifdef NoRepository
199 #   include "nearWallFieldsTemplates.C"
200 #endif
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 #endif
206 // ************************************************************************* //