wallBoundedStreamLine.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-2016 OpenFOAM Foundation
6  \\/ M anipulation |
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::functionObjects::wallBoundedStreamLine
26 
27 Group
28  grpFieldFunctionObjects
29 
30 Description
31  This function object generates streamline data by sampling a set of
32  user-specified fields along a particle track, transported by a
33  user-specified velocity field, constrained to a patch.
34 
35  Example of function object specification:
36  \verbatim
37  wallBoundedStreamLine1
38  {
39  type wallBoundedStreamLine;
40  libs ("libfieldFunctionObjects.so");
41  ...
42  setFormat vtk;
43  U UNear;
44  trackForward yes;
45  fields
46  (
47  UNear
48  p
49  );
50  lifeTime 10000;
51  trackLength 1e-3;
52  nSubCycle 5;
53  cloudName particleTracks;
54  seedSampleSet patchSeed;
55  patchSeedCoeffs
56  {
57  type patchSeed;
58  patches (wall);
59  axis x;
60  maxPoints 20000;
61  }
62  }
63  \endverbatim
64 
65 Usage
66  \table
67  Property | Description | Required | Default value
68  type | Type name: wallBoundedStreamLine| yes |
69  setFormat | Output data type | yes |
70  U | Tracking velocity field name | yes |
71  fields | Fields to sample | yes |
72  lifetime | Maximum number of particle tracking steps | yes |
73  trackLength | Tracking segment length | no |
74  nSubCycle | Number of tracking steps per cell | no|
75  cloudName | Cloud name to use | yes |
76  seedSampleSet| Seeding method (see below)| yes |
77  \endtable
78 
79  Where \c seedSampleSet is typically one of
80  \plaintable
81  uniform | uniform particle seeding
82  cloud | cloud of points
83  patchSeed | seeding via patch faces
84  triSurfaceMeshPointSet | points according to a tri-surface mesh
85  \endplaintable
86 
87 Note
88  When specifying the track resolution, the \c trackLength OR \c nSubCycle
89  option should be used
90 
91 See also
92  Foam::functionObject
93  Foam::functionObjects::timeControl
94  Foam::sampledSet
95  Foam::streamLine
96 
97 SourceFiles
98  wallBoundedStreamLine.C
99 
100 \*---------------------------------------------------------------------------*/
101 
102 #ifndef functionObjects_wallBoundedStreamLine_H
103 #define functionObjects_wallBoundedStreamLine_H
104 
105 #include "functionObject.H"
106 #include "volFieldsFwd.H"
107 #include "DynamicList.H"
108 #include "scalarList.H"
109 #include "vectorList.H"
110 #include "writer.H"
111 #include "indirectPrimitivePatch.H"
112 #include "tetIndices.H"
113 
114 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
115 
116 namespace Foam
117 {
118 
119 // Forward declaration of classes
120 class objectRegistry;
121 class meshSearch;
122 class sampledSet;
123 
124 namespace functionObjects
125 {
126 
127 /*---------------------------------------------------------------------------*\
128  Class wallBoundedStreamLine Declaration
129 \*---------------------------------------------------------------------------*/
130 
131 class wallBoundedStreamLine
132 :
133  public functionObject
134 {
135  // Private data
136 
137  //- Database this class is registered to
138  const objectRegistry& obr_;
139 
140  //- Input dictionary
141  dictionary dict_;
142 
143  //- List of fields to sample
144  wordList fields_;
145 
146  //- Field to transport particle with
147  word UName_;
148 
149  //- Interpolation scheme to use
150  word interpolationScheme_;
151 
152  //- Whether to use +u or -u
153  bool trackForward_;
154 
155  //- Maximum lifetime (= number of cells) of particle
156  label lifeTime_;
157 
158  //- Track length
159  scalar trackLength_;
160 
161  //- Optional specified name of particles
162  word cloudName_;
163 
164  //- Type of seed
165  word seedSet_;
166 
167  //- Names of scalar fields
168  wordList scalarNames_;
169 
170  //- Names of vector fields
171  wordList vectorNames_;
172 
173 
174  // Demand driven
175 
176  //- Mesh searching enigne
177  autoPtr<meshSearch> meshSearchPtr_;
178 
179  //- Seed set engine
180  autoPtr<sampledSet> sampledSetPtr_;
181 
182  //- Axis of the sampled points to output
183  word sampledSetAxis_;
184 
185  //- File output writer
186  autoPtr<writer<scalar>> scalarFormatterPtr_;
187 
188  autoPtr<writer<vector>> vectorFormatterPtr_;
189 
190 
191  // Generated data
192 
193  //- All tracks. Per particle the points it passed through
194  DynamicList<List<point>> allTracks_;
195 
196  //- Per scalarField, per particle, the sampled value.
197  List<DynamicList<scalarList>> allScalars_;
198 
199  //- Per scalarField, per particle, the sampled value.
200  List<DynamicList<vectorList>> allVectors_;
201 
202 
203  //- Construct patch out of all wall patch faces
204  autoPtr<indirectPrimitivePatch> wallPatch() const;
205 
206  //- Find wall tet on cell
207  tetIndices findNearestTet
208  (
209  const PackedBoolList& isWallPatch,
210  const point& seedPt,
211  const label celli
212  ) const;
213 
214  //- Do all seeding and tracking
215  void track();
216 
217  //- Disallow default bitwise copy construct
219 
220  //- Disallow default bitwise assignment
221  void operator=(const wallBoundedStreamLine&);
222 
223 
224 public:
225 
226  //- Runtime type information
227  TypeName("wallBoundedStreamLine");
228 
229 
230  // Constructors
231 
232  //- Construct from Time and dictionary
234  (
235  const word& name,
236  const Time& runTime,
237  const dictionary& dict
238  );
239 
240 
241  //- Destructor
242  virtual ~wallBoundedStreamLine();
243 
244 
245  // Member Functions
246 
247  //- Read the field average data
248  virtual bool read(const dictionary&);
249 
250  //- Do nothing
251  virtual bool execute();
252 
253  //- Calculate and write the wall-bounded streamlines
254  virtual bool write();
255 
256  //- Update for changes of mesh
257  virtual void updateMesh(const mapPolyMesh&);
258 
259  //- Update for mesh point-motion
260  virtual void movePoints(const polyMesh&);
261 };
262 
263 
264 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265 
266 } // End namespace functionObjects
267 } // End namespace Foam
268 
269 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
270 
271 #endif
272 
273 // ************************************************************************* //
virtual bool write()
Calculate and write the wall-bounded streamlines.
dictionary dict
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
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
virtual bool read(const dictionary &)
Read the field average data.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
This function object generates streamline data by sampling a set of user-specified fields along a par...
const word & name() const
Return the name of this functionObject.
A class for handling words, derived from string.
Definition: word.H:59
virtual void movePoints(const polyMesh &)
Update for mesh point-motion.
Storage and named access for the indices of a tet which is part of the decomposition of a cell...
Definition: tetIndices.H:81
List< word > wordList
A List of words.
Definition: fileName.H:54
A bit-packed bool list.
virtual void updateMesh(const mapPolyMesh &)
Update for changes of mesh.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:53
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Namespace for OpenFOAM.
TypeName("wallBoundedStreamLine")
Runtime type information.