binField.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2022 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::functionObjects::binField
28 
29 Group
30  grpFieldFunctionObjects
31 
32 Description
33  Calculates binned data, where specified patches are divided into
34  segments according to various input bin characteristics, so that
35  spatially-localised information can be output for each segment.
36 
37  Operands:
38  \table
39  Operand | Type | Location
40  input | vol<Type>Field(s) <!--
41  --> | <time>/<inpField>s
42  output file | dat <!--
43  --> | postProcessing/<FO>/<time>/<file>
44  output field | - | -
45  \endtable
46 
47  where \c <Type>=Scalar/Vector/SphericalTensor/SymmTensor/Tensor.
48 
49 Usage
50  Minimal example by using \c system/controlDict.functions:
51  \verbatim
52  binField1
53  {
54  // Mandatory entries
55  type binField;
56  libs (fieldFunctionObjects);
57  binModel <word>;
58  fields (<wordHashSet>);
59  patches (<wordRes>);
60  binData
61  {
62  // Entries of the chosen binModel
63  }
64 
65  // Optional entries
66  cellZones (<wordRes>);
67  decomposePatchValues <bool>;
68 
69  // Conditional optional entries
70 
71  // General coordinate system specification
72  coordinateSystem
73  {
74  type cartesian;
75  origin (0 0 0);
76  rotation
77  {
78  type ...
79  ...
80  }
81  }
82 
83  // Define the centre of rotation
84  // with implicit directions e1=(1 0 0) and e3=(0 0 1)
85  CofR (0 0 0);
86 
87  // Inherited entries
88  ...
89  }
90  \endverbatim
91 
92  where the entries mean:
93  \table
94  Property | Description | Type | Reqd | Deflt
95  type | Type name: binField | word | yes | -
96  libs | Library name: fieldFunctionObjects | word | yes | -
97  binModel | Name of the bin model | word | yes | -
98  fields | Names of operand fields | wordHasSet | yes | -
99  patches | Names of operand patches | wordRes | yes | -
100  binData | Entries of the chosen bin model | dict | yes | -
101  decomposePatchValues | Flag to output normal and tangential <!--
102  --> components | bool | no | false
103  cellZones | Names of operand cell zones | wordRes | no | -
104  coordinateSystem | Coordinate system specifier | dict | cndtnl | -
105  CofR | Centre of rotation | vector | cndtnl | -
106  \endtable
107 
108  Options for the \c binModel entry:
109  \verbatim
110  singleDirectionUniformBin | Segments in a single direction
111  uniformBin | Segments in multiple directions
112  \endverbatim
113 
114  The inherited entries are elaborated in:
115  - \link fvMeshFunctionObject.H \endlink
116  - \link writeFile.H \endlink
117  - \link coordinateSystem.H \endlink
118 
119 Note
120  - If a \c coordinateSystem entry exists, it is taken in favour of \c CofR.
121 
122 SourceFiles
123  binField.C
124 
125 \*---------------------------------------------------------------------------*/
126 
127 #ifndef Foam_functionObjects_binField_H
128 #define Foam_functionObjects_binField_H
129 
130 #include "fvMeshFunctionObject.H"
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 namespace Foam
135 {
136 
137 class binModel;
138 
139 namespace functionObjects
140 {
141 
142 /*---------------------------------------------------------------------------*\
143  Class binField Declaration
144 \*---------------------------------------------------------------------------*/
145 
146 class binField
147 :
148  public fvMeshFunctionObject
149 {
150 protected:
151 
152  // Protected Data
153 
154  //- Runtime-selectable bin model
155  autoPtr<binModel> binModelPtr_;
156 
157 
158 public:
159 
160  //- Runtime type information
161  TypeName("binField");
162 
163 
164  // Constructors
165 
166  //- Construct from Time and dictionary
167  binField
168  (
169  const word& name,
170  const Time& runTime,
171  const dictionary& dict,
172  const bool readFields = true
173  );
174 
175  //- Construct from objectRegistry and dictionary
176  binField
177  (
178  const word& name,
179  const objectRegistry& obr,
180  const dictionary& dict,
181  const bool readFields = true
182  );
183 
184  //- No copy construct
185  binField(const binField&) = delete;
186 
187  //- No copy assignment
188  void operator=(const binField&) = delete;
189 
190 
191  //- Destructor
192  virtual ~binField() = default;
193 
194 
195  // Member Functions
196 
197  //- Read the dictionary
198  virtual bool read(const dictionary& dict);
199 
200  //- Execute the function object
201  virtual bool execute();
202 
203  //- Write to data files/fields and to streams
204  virtual bool write();
205 
206  //- Update for changes of mesh
207  virtual void updateMesh(const mapPolyMesh& mpm);
208 
209  //- Update for changes of mesh
210  virtual void movePoints(const polyMesh& mesh);
211 };
212 
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 } // End namespace functionObjects
217 } // End namespace Foam
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 #endif
222 
223 // ************************************************************************* //
dictionary dict
autoPtr< binModel > binModelPtr_
Runtime-selectable bin model.
Definition: binField.H:240
engineTime & runTime
binField(const word &name, const Time &runTime, const dictionary &dict, const bool readFields=true)
Construct from Time and dictionary.
Definition: binField.C:40
virtual bool write()
Write to data files/fields and to streams.
Definition: binField.C:103
const word & name() const noexcept
Return the name of this functionObject.
TypeName("binField")
Runtime type information.
dynamicFvMesh & mesh
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const NameMatchPredicate &selectedFields, DynamicList< regIOobject *> &storedObjects)
Read the selected GeometricFields of the templated type and store on the objectRegistry.
virtual bool read(const dictionary &dict)
Read the dictionary.
Definition: binField.C:77
void operator=(const binField &)=delete
No copy assignment.
virtual bool execute()
Execute the function object.
Definition: binField.C:92
virtual ~binField()=default
Destructor.
virtual void updateMesh(const mapPolyMesh &mpm)
Update for changes of mesh.
Definition: binField.C:109
virtual const objectRegistry & obr() const
The region or sub-region registry being used.
Namespace for OpenFOAM.
virtual void movePoints(const polyMesh &mesh)
Update for changes of mesh.
Definition: binField.C:115