streamLineBase.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) 2015 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::streamLineBase
26 
27 SeeAlso
28  Foam::streamLine
29  Foam::wallBoundedStreamLine
30 
31 SourceFiles
32  streamLineBase.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef streamLineBase_H
37 #define streamLineBase_H
38 
39 #include "functionObjectState.H"
40 #include "DynamicList.H"
41 #include "scalarList.H"
42 #include "vectorList.H"
43 #include "writer.H"
44 #include "indirectPrimitivePatch.H"
45 #include "interpolation.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 // Forward declaration of classes
53 class objectRegistry;
54 class dictionary;
55 class mapPolyMesh;
56 class meshSearch;
57 class sampledSet;
58 
59 /*---------------------------------------------------------------------------*\
60  Class streamLineBase Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 class streamLineBase
64 :
65  public functionObjectState
66 {
67 protected:
68 
69  //- Input dictionary
71 
72  //- Database this class is registered to
73  const objectRegistry& obr_;
74 
75  //- Load fields from files (not from objectRegistry)
76  bool loadFromFiles_;
77 
78  //- Switch to send output to Info as well as to file
79  Switch log_;
80 
81  //- List of fields to sample
83 
84  //- Field to transport particle with
85  word UName_;
86 
87  //- Interpolation scheme to use
89 
90  //- Whether to use +u or -u
91  bool trackForward_;
92 
93  //- Maximum lifetime (= number of cells) of particle
95 
96  //- Track length
97  scalar trackLength_;
98 
99  //- Optional trimming of tracks
101 
102  //- Optional specified name of particles
104 
105  //- Type of seed
106  word seedSet_;
107 
108  //- Names of scalar fields
110 
111  //- Names of vector fields
113 
114 
115  // Demand driven
116 
117  //- Mesh searching enigne
119 
120  //- Seed set engine
122 
123  //- Axis of the sampled points to output
125 
126  //- File writer for scalar data
128 
129  //- File writer for vector data
131 
132 
133  // Generated data
134 
135  //- All tracks. Per track the points it passed through
137 
138  //- Per scalarField, per track, the sampled values
140 
141  //- Per vectorField, per track, the sampled values
143 
144 
145  //- Construct patch out of all wall patch faces
147 
148  //- Initialise fields, interpolators and track storage
149  void initInterpolations
150  (
151  const label nSeeds,
152  label& UIndex,
153  PtrList<volScalarField>& vsFlds,
154  PtrList<interpolation<scalar> >& vsInterp,
155  PtrList<volVectorField>& vvFlds,
156  PtrList<interpolation<vector> >& vvInterp
157  );
158 
159  //- Generate point and values by interpolating from existing values
160  void storePoint
161  (
162  const label trackI,
163 
164  const scalar w,
165  const label leftI,
166  const label rightI,
167 
168  DynamicList<point>& newTrack,
169  DynamicList<List<scalar> >& newScalars,
170  DynamicList<List<vector> >& newVectors
171  ) const;
172 
173  //- Trim and possibly split a track
174  void trimToBox
175  (
176  const treeBoundBox& bb,
177  const label trackI,
178  PtrList<DynamicList<point> >& newTracks,
179  PtrList<DynamicList<scalarList> >& newScalars,
180  PtrList<DynamicList<vectorList> >& newVectors
181  ) const;
182 
183  //- Trim tracks to bounding box
184  void trimToBox(const treeBoundBox& bb);
185 
186  //- Do the actual tracking to fill the track data
187  virtual void track() = 0;
188 
189 
190 public:
191 
192  //- Runtime type information
193  TypeName("streamLineBase");
194 
195 
196  // Constructors
197 
198  //- Construct for given objectRegistry and dictionary.
199  // Allow the possibility to load fields from files
201  (
202  const word& name,
203  const objectRegistry&,
204  const dictionary&,
205  const bool loadFromFiles = false
206  );
207 
208 
209  //- Destructor
210  virtual ~streamLineBase();
211 
212 
213  // Member Functions
214 
215  //- Read the field average data
216  virtual void read(const dictionary&);
217 
218  //- Execute the averaging
219  virtual void execute();
220 
221  //- Execute the averaging at the final time-loop, currently does nothing
222  virtual void end();
223 
224  //- Called when time was set at the end of the Time::operator++
225  virtual void timeSet();
226 
227  //- Track and write
228  virtual void write();
229 
230  //- Update for changes of mesh
231  virtual void updateMesh(const mapPolyMesh&);
232 
233  //- Update for mesh point-motion
234  virtual void movePoints(const polyMesh&);
235 };
236 
237 
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 
240 } // End namespace Foam
241 
242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 
244 #endif
245 
246 // ************************************************************************* //
Foam::streamLineBase::obr_
const objectRegistry & obr_
Database this class is registered to.
Definition: streamLineBase.H:72
Foam::streamLineBase::track
virtual void track()=0
Do the actual tracking to fill the track data.
Foam::streamLineBase::allTracks_
DynamicList< List< point > > allTracks_
All tracks. Per track the points it passed through.
Definition: streamLineBase.H:135
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:60
w
volScalarField w(IOobject("w", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE), mesh, dimensionedScalar("w", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0.0))
vectorList.H
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::streamLineBase::initInterpolations
void initInterpolations(const label nSeeds, label &UIndex, PtrList< volScalarField > &vsFlds, PtrList< interpolation< scalar > > &vsInterp, PtrList< volVectorField > &vvFlds, PtrList< interpolation< vector > > &vvInterp)
Initialise fields, interpolators and track storage.
Definition: streamLineBase.C:98
Foam::streamLineBase::allVectors_
List< DynamicList< vectorList > > allVectors_
Per vectorField, per track, the sampled values.
Definition: streamLineBase.H:141
Foam::functionObjectState
Base class for function objects, adding functionality to read/write state information (data required ...
Definition: functionObjectState.H:54
Foam::streamLineBase::scalarNames_
wordList scalarNames_
Names of scalar fields.
Definition: streamLineBase.H:108
Foam::DynamicList
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:56
Foam::streamLineBase::execute
virtual void execute()
Execute the averaging.
Definition: streamLineBase.C:656
Foam::treeBoundBox
Standard boundBox + extra functionality for use in octree.
Definition: treeBoundBox.H:75
functionObjectState.H
Foam::streamLineBase::write
virtual void write()
Track and write.
Definition: streamLineBase.C:668
Foam::streamLineBase::log_
Switch log_
Switch to send output to Info as well as to file.
Definition: streamLineBase.H:78
Foam::streamLineBase::sampledSetPtr_
autoPtr< sampledSet > sampledSetPtr_
Seed set engine.
Definition: streamLineBase.H:120
interpolation.H
Foam::streamLineBase::read
virtual void read(const dictionary &)
Read the field average data.
Definition: streamLineBase.C:560
Foam::streamLineBase::dict_
dictionary dict_
Input dictionary.
Definition: streamLineBase.H:69
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
scalarList.H
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:50
Foam::streamLineBase::fields_
wordList fields_
List of fields to sample.
Definition: streamLineBase.H:81
Foam::streamLineBase::trimToBox
void trimToBox(const treeBoundBox &bb, const label trackI, PtrList< DynamicList< point > > &newTracks, PtrList< DynamicList< scalarList > > &newScalars, PtrList< DynamicList< vectorList > > &newVectors) const
Trim and possibly split a track.
Definition: streamLineBase.C:316
Foam::streamLineBase::movePoints
virtual void movePoints(const polyMesh &)
Update for mesh point-motion.
Definition: streamLineBase.C:970
Foam::streamLineBase::interpolationScheme_
word interpolationScheme_
Interpolation scheme to use.
Definition: streamLineBase.H:87
Foam::label
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
Foam::streamLineBase::sampledSetAxis_
word sampledSetAxis_
Axis of the sampled points to output.
Definition: streamLineBase.H:123
Foam::streamLineBase::vectorFormatterPtr_
autoPtr< writer< vector > > vectorFormatterPtr_
File writer for vector data.
Definition: streamLineBase.H:129
Foam::streamLineBase::bounds_
boundBox bounds_
Optional trimming of tracks.
Definition: streamLineBase.H:99
Foam::streamLineBase::loadFromFiles_
bool loadFromFiles_
Load fields from files (not from objectRegistry)
Definition: streamLineBase.H:75
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::interpolation< scalar >
Foam::streamLineBase::meshSearchPtr_
autoPtr< meshSearch > meshSearchPtr_
Mesh searching enigne.
Definition: streamLineBase.H:117
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::streamLineBase::UName_
word UName_
Field to transport particle with.
Definition: streamLineBase.H:84
Foam::streamLineBase::wallPatch
autoPtr< indirectPrimitivePatch > wallPatch() const
Construct patch out of all wall patch faces.
Definition: streamLineBase.C:47
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::streamLineBase::cloudName_
word cloudName_
Optional specified name of particles.
Definition: streamLineBase.H:102
Foam::streamLineBase::~streamLineBase
virtual ~streamLineBase()
Destructor.
Definition: streamLineBase.C:554
Foam::streamLineBase::seedSet_
word seedSet_
Type of seed.
Definition: streamLineBase.H:105
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::streamLineBase::end
virtual void end()
Execute the averaging at the final time-loop, currently does nothing.
Definition: streamLineBase.C:660
Foam::streamLineBase::timeSet
virtual void timeSet()
Called when time was set at the end of the Time::operator++.
Definition: streamLineBase.C:664
Foam::streamLineBase::streamLineBase
streamLineBase(const word &name, const objectRegistry &, const dictionary &, const bool loadFromFiles=false)
Construct for given objectRegistry and dictionary.
Definition: streamLineBase.C:537
Foam::streamLineBase::lifeTime_
label lifeTime_
Maximum lifetime (= number of cells) of particle.
Definition: streamLineBase.H:93
Foam::streamLineBase
Definition: streamLineBase.H:62
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::streamLineBase::trackLength_
scalar trackLength_
Track length.
Definition: streamLineBase.H:96
Foam::streamLineBase::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update for changes of mesh.
Definition: streamLineBase.C:964
Foam::streamLineBase::storePoint
void storePoint(const label trackI, const scalar w, const label leftI, const label rightI, DynamicList< point > &newTrack, DynamicList< List< scalar > > &newScalars, DynamicList< List< vector > > &newVectors) const
Generate point and values by interpolating from existing values.
Definition: streamLineBase.C:270
Foam::boundBox
A bounding box defined in terms of the points at its extremities.
Definition: boundBox.H:55
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Foam::streamLineBase::TypeName
TypeName("streamLineBase")
Runtime type information.
DynamicList.H
writer.H
Foam::streamLineBase::allScalars_
List< DynamicList< scalarList > > allScalars_
Per scalarField, per track, the sampled values.
Definition: streamLineBase.H:138
Foam::streamLineBase::scalarFormatterPtr_
autoPtr< writer< scalar > > scalarFormatterPtr_
File writer for scalar data.
Definition: streamLineBase.H:126
Foam::streamLineBase::trackForward_
bool trackForward_
Whether to use +u or -u.
Definition: streamLineBase.H:90
Foam::functionObjectState::name
const word & name() const
Return the name.
Definition: functionObjectState.C:58
Foam::streamLineBase::vectorNames_
wordList vectorNames_
Names of vector fields.
Definition: streamLineBase.H:111