nearWallFields.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
6  \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 Class
25  Foam::nearWallFields
26 
27 Group
28  grpFieldFunctionObjects
29 
30 Description
31  This function object samples near-patch volume fields
32 
33  Fields are stored
34  - every time step the field is updated with new values
35  - at output it writes the fields
36 
37  This functionObject can either be used
38  - to calculate a new field as a post-processing step or
39  - since the fields are registered, used in another functionObject
40 
41  Example of function object specification:
42  \verbatim
43  nearWallFields1
44  {
45  type nearWallFields;
46  functionObjectLibs ("libfieldFunctionObjects.so");
47  ...
48  fields ((p pNear)(U UNear));
49  patches (movingWall);
50  distance 0.13;
51  }
52  \endverbatim
53 
54  \heading Function object usage
55  \table
56  Property | Description | Required | Default value
57  type | type name: nearWallFields | yes |
58  fields | list of fields with corresponding output field names | yes |
59  patches | list of patches to sample | yes |
60  distance | distance from patch to sample | yes |
61  log | Log to standard output | no | yes
62  \endtable
63 
64 SeeAlso
65  Foam::functionObject
66  Foam::OutputFilterFunctionObject
67 
68 SourceFiles
69  nearWallFields.C
70  IOnearWallFields.H
71 
72 \*---------------------------------------------------------------------------*/
73 
74 #ifndef nearWallFields_H
75 #define nearWallFields_H
76 
77 #include "OFstream.H"
78 #include "volFields.H"
79 #include "Tuple2.H"
80 #include "interpolationCellPoint.H"
81 
82 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
83 
84 namespace Foam
85 {
86 
87 // Forward declaration of classes
88 class objectRegistry;
89 class dictionary;
90 class mapPolyMesh;
91 
92 /*---------------------------------------------------------------------------*\
93  Class nearWallFields Declaration
94 \*---------------------------------------------------------------------------*/
95 
96 class nearWallFields
97 {
98 protected:
99 
100  // Protected data
101 
102  //- Name of this set of nearWallFields object
103  word name_;
104 
105  const objectRegistry& obr_;
106 
107  //- on/off switch
108  bool active_;
109 
110  // Read from dictionary
111 
112  //- Fields to process
114 
115  //- Switch to send output to Info as well as to file
116  Switch log_;
117 
118  //- Patches to sample
120 
121  //- Distance away from wall
122  scalar distance_;
123 
124  //- From original field to sampled result
126 
127  //- From resulting back to original field
129 
130 
131  // Calculated addressing
132 
133  //- From cell to seed patch faces
135 
136  //- From cell to tracked end point
138 
139  //- Map from cell based data back to patch based data
141 
142 
143  // Locally constructed fields
144 
150 
151 
152  // Protected Member Functions
153 
154  //- Calculate addressing from cells back to patch faces
155  void calcAddressing();
156 
157  template<class Type>
158  void createFields
159  (
161  ) const;
162 
163  //- Override boundary fields with sampled values
164  template<class Type>
166  (
167  const interpolationCellPoint<Type>& interpolator,
169  ) const;
170 
171  template<class Type>
172  void sampleFields
173  (
175  ) const;
176 
177 
178 private:
179 
180  //- Disallow default bitwise copy construct
182 
183  //- Disallow default bitwise assignment
184  void operator=(const nearWallFields&);
185 
186 public:
187 
188  //- Runtime type information
189  TypeName("nearWallFields");
190 
191 
192  // Constructors
193 
194  //- Construct for given objectRegistry and dictionary.
195  // Allow the possibility to load fields from files
197  (
198  const word& name,
199  const objectRegistry&,
200  const dictionary&,
201  const bool loadFromFiles = false
202  );
203 
204 
205  //- Destructor
206  virtual ~nearWallFields();
207 
208 
209  // Member Functions
210 
211  //- Return name of the nearWallFields object
212  virtual const word& name() const
213  {
214  return name_;
215  }
216 
217  //- Read the field min/max data
218  virtual void read(const dictionary&);
219 
220  //- Execute, currently does nothing
221  virtual void execute();
222 
223  //- Execute at the final time-loop, currently does nothing
224  virtual void end();
225 
226  //- Called when time was set at the end of the Time::operator++
227  virtual void timeSet();
228 
229  //- Write
230  virtual void write();
231 
232  //- Update for changes of mesh
233  virtual void updateMesh(const mapPolyMesh&)
234  {}
235 
236  //- Update for changes of mesh
237  virtual void movePoints(const polyMesh&)
238  {}
239 };
240 
241 
242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 
244 } // End namespace Foam
245 
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 
248 #ifdef NoRepository
249 # include "nearWallFieldsTemplates.C"
250 #endif
251 
252 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
253 
254 #endif
255 
256 // ************************************************************************* //
volFields.H
Foam::nearWallFields::log_
Switch log_
Switch to send output to Info as well as to file.
Definition: nearWallFields.H:145
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:60
nearWallFieldsTemplates.C
Foam::nearWallFields::nearWallFields
nearWallFields(const nearWallFields &)
Disallow default bitwise copy construct.
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::nearWallFields::fieldSet_
List< Tuple2< word, word > > fieldSet_
Fields to process.
Definition: nearWallFields.H:142
Foam::nearWallFields::vtf_
PtrList< volTensorField > vtf_
Definition: nearWallFields.H:178
Tuple2.H
Foam::nearWallFields::cellToWalls_
labelListList cellToWalls_
From cell to seed patch faces.
Definition: nearWallFields.H:163
Foam::nearWallFields::cellToSamples_
List< List< point > > cellToSamples_
From cell to tracked end point.
Definition: nearWallFields.H:166
Foam::HashSet< label, Hash< label > >
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::nearWallFields::getPatchDataMapPtr_
autoPtr< mapDistribute > getPatchDataMapPtr_
Map from cell based data back to patch based data.
Definition: nearWallFields.H:169
interpolationCellPoint.H
OFstream.H
Foam::nearWallFields::createFields
void createFields(PtrList< GeometricField< Type, fvPatchField, volMesh > > &) const
Definition: nearWallFieldsTemplates.C:32
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:50
Foam::nearWallFields::vSymmtf_
PtrList< volSymmTensorField > vSymmtf_
Definition: nearWallFields.H:177
Foam::nearWallFields::obr_
const objectRegistry & obr_
Definition: nearWallFields.H:134
Foam::nearWallFields::sampleFields
void sampleFields(PtrList< GeometricField< Type, fvPatchField, volMesh > > &) const
Definition: nearWallFieldsTemplates.C:125
Foam::nearWallFields::patchSet_
labelHashSet patchSet_
Patches to sample.
Definition: nearWallFields.H:148
Foam::interpolationCellPoint
Given cell centre values and point (vertex) values decompose into tetrahedra and linear interpolate w...
Definition: interpolationCellPoint.H:48
Foam::nearWallFields::end
virtual void end()
Execute at the final time-loop, currently does nothing.
Definition: nearWallFields.C:362
Foam::nearWallFields::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update for changes of mesh.
Definition: nearWallFields.H:262
Foam::PtrList
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:61
Foam::nearWallFields::name_
word name_
Name of this set of nearWallFields object.
Definition: nearWallFields.H:132
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
fld
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< ' ';}gmvFile<< nl;forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::nearWallFields::~nearWallFields
virtual ~nearWallFields()
Destructor.
Definition: nearWallFields.C:255
Foam::nearWallFields::name
virtual const word & name() const
Return name of the nearWallFields object.
Definition: nearWallFields.H:241
Foam::HashTable
An STL-conforming hash table.
Definition: HashTable.H:61
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::nearWallFields
This function object samples near-patch volume fields.
Definition: nearWallFields.H:125
Foam::nearWallFields::vvf_
PtrList< volVectorField > vvf_
Definition: nearWallFields.H:175
Foam::nearWallFields::fieldMap_
HashTable< word > fieldMap_
From original field to sampled result.
Definition: nearWallFields.H:154
Foam::nearWallFields::movePoints
virtual void movePoints(const polyMesh &)
Update for changes of mesh.
Definition: nearWallFields.H:266
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::nearWallFields::distance_
scalar distance_
Distance away from wall.
Definition: nearWallFields.H:151
Foam::nearWallFields::write
virtual void write()
Write.
Definition: nearWallFields.C:374
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Foam::nearWallFields::timeSet
virtual void timeSet()
Called when time was set at the end of the Time::operator++.
Definition: nearWallFields.C:368
List
Definition: Test.C:19
Foam::nearWallFields::TypeName
TypeName("nearWallFields")
Runtime type information.
Foam::nearWallFields::reverseFieldMap_
HashTable< word > reverseFieldMap_
From resulting back to original field.
Definition: nearWallFields.H:157
Foam::nearWallFields::vSpheretf_
PtrList< volSphericalTensorField > vSpheretf_
Definition: nearWallFields.H:176
Foam::nearWallFields::sampleBoundaryField
void sampleBoundaryField(const interpolationCellPoint< Type > &interpolator, GeometricField< Type, fvPatchField, volMesh > &fld) const
Override boundary fields with sampled values.
Definition: nearWallFieldsTemplates.C:78
Foam::labelHashSet
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
Definition: HashSet.H:210
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::nearWallFields::operator=
void operator=(const nearWallFields &)
Disallow default bitwise assignment.
Foam::nearWallFields::read
virtual void read(const dictionary &)
Read the field min/max data.
Definition: nearWallFields.C:266
Foam::nearWallFields::active_
bool active_
on/off switch
Definition: nearWallFields.H:137
Foam::nearWallFields::calcAddressing
void calcAddressing()
Calculate addressing from cells back to patch faces.
Definition: nearWallFields.C:42
Foam::nearWallFields::execute
virtual void execute()
Execute, currently does nothing.
Definition: nearWallFields.C:316
Foam::nearWallFields::vsf_
PtrList< volScalarField > vsf_
Definition: nearWallFields.H:174