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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2015 OpenFOAM Foundation
9 Copyright (C) 2016-2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::functionObjects::streamLineBase
29
30SeeAlso
31 Foam::functionObjects::streamLine
32 Foam::functionObjects::wallBoundedStreamLine
33
34SourceFiles
35 streamLineBase.C
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef Foam_functionObjects_streamLineBase_H
40#define Foam_functionObjects_streamLineBase_H
41
43#include "DynamicList.H"
44#include "scalarList.H"
45#include "vectorList.H"
46#include "coordSetWriter.H"
48#include "interpolation.H"
49#include "Enum.H"
50
51// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52
53namespace Foam
54{
55
56// Forward Declarations
57class meshSearch;
58class sampledSet;
59
60namespace functionObjects
61{
62
63/*---------------------------------------------------------------------------*\
64 Class streamLineBase Declaration
65\*---------------------------------------------------------------------------*/
68:
70{
71public:
72
73 // Public data types
74
75 //- Enumeration defining the track direction
76 enum trackDirType : char
77 {
81 };
82
83 //- Names for the trackDir
85
86
87protected:
88
89 //- Seed set engine
91
92 //- Axis of the sampled points to output
93 mutable word sampledSetAxis_;
94
95 //- Input dictionary
97
98 //- List of fields to sample
100
101 //- Field to transport particle with
102 word UName_;
103
104 //- Interpolation scheme to use
106
107 //- Whether to use +u or -u or both
109
110 //- Maximum lifetime (= number of cells) of particle
111 label lifeTime_;
112
113 //- Track length
114 scalar trackLength_;
115
116 //- Optional trimming of tracks
118
119 //- Optional specified name of particles
121
122 //- Type of seed
124
125 //- Names of scalar fields
127
128 //- Names of vector fields
130
131
132 // Demand driven
133
134 //- File writer for tracks data
136
137
138 // Generated Data
139
140 //- All tracks. Per track the points it passed through
142
143 //- Per scalarField, per track, the sampled values
145
146 //- Per vectorField, per track, the sampled values
148
149
150 // Protected Member Functions
151
152 //- The axis of the sampledSet. Creates sampledSet if required.
153 const word& sampledSetAxis() const;
154
155 //- Demand driven construction of the sampledSet.
156 // Also updates sampledSetAxis_
157 const sampledSet& sampledSetPoints() const;
158
159 //- Construct patch out of all wall patch faces
161
162 //- Initialise fields, interpolators and track storage
164 (
165 const label nSeeds,
166 label& UIndex,
171 );
172
173 //- Generate point and values by interpolating from existing values
174 void storePoint
175 (
176 const label tracki,
177
178 const scalar w,
179 const label lefti,
180 const label righti,
181
182 DynamicList<point>& newTrack,
183 DynamicList<List<scalar>>& newScalars,
184 DynamicList<List<vector>>& newVectors
185 ) const;
186
187 //- Trim and possibly split a track
188 void trimToBox
189 (
190 const treeBoundBox& bb,
191 const label tracki,
192 PtrList<DynamicList<point>>& newTracks,
193 PtrList<DynamicList<scalarList>>& newScalars,
195 ) const;
196
197 //- Trim tracks to bounding box
198 void trimToBox(const treeBoundBox& bb);
199
200 //- Do the actual tracking to fill the track data
201 virtual void track() = 0;
202
203 //- Write tracks to file
204 virtual bool writeToFile();
205
206 //- Reset the field names
207 virtual void resetFieldNames
208 (
209 const word& newUName,
210 const wordList& newFieldNames
211 );
212
213
214public:
215
216 //- Runtime type information
217 TypeName("streamLineBase");
218
219
220 // Constructors
221
222 //- Construct for given objectRegistry and dictionary.
223 // Allow the possibility to load fields from files
225 (
226 const word& name,
227 const Time& runTime,
228 const dictionary& dict
229 );
230
231 //- Construct from Time and dictionary and list of fields to sample
233 (
234 const word& name,
235 const Time& runTime,
236 const dictionary& dict,
237 const wordList& fieldNames
238 );
239
240
241 //- Destructor
242 virtual ~streamLineBase();
243
244
245 // Member Functions
246
247 //- Read the field average data
248 virtual bool read(const dictionary&);
249
250 //- Execute the averaging
251 virtual bool execute();
252
253 //- Track and write
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// ************************************************************************* //
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:72
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: Enum.H:61
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: PtrList.H:73
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A bounding box defined in terms of min/max extrema points.
Definition: boundBox.H:64
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
const word & name() const noexcept
Return the name of this functionObject.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
autoPtr< sampledSet > sampledSetPtr_
Seed set engine.
word cloudName_
Optional specified name of particles.
const sampledSet & sampledSetPoints() const
Demand driven construction of the sampledSet.
TypeName("streamLineBase")
Runtime type information.
word UName_
Field to transport particle with.
word sampledSetAxis_
Axis of the sampled points to output.
boundBox bounds_
Optional trimming of tracks.
label lifeTime_
Maximum lifetime (= number of cells) of particle.
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.
autoPtr< indirectPrimitivePatch > wallPatch() const
Construct patch out of all wall patch faces.
List< DynamicList< scalarList > > allScalars_
Per scalarField, per track, the sampled values.
const word & sampledSetAxis() const
The axis of the sampledSet. Creates sampledSet if required.
trackDirType trackDir_
Whether to use +u or -u or both.
dictionary dict_
Input dictionary.
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.
virtual void resetFieldNames(const word &newUName, const wordList &newFieldNames)
Reset the field names.
wordList fields_
List of fields to sample.
autoPtr< coordSetWriter > trackWriterPtr_
File writer for tracks data.
trackDirType
Enumeration defining the track direction.
List< DynamicList< vectorList > > allVectors_
Per vectorField, per track, the sampled values.
static const Enum< trackDirType > trackDirTypeNames
Names for the trackDir.
virtual bool writeToFile()
Write tracks to file.
virtual void movePoints(const polyMesh &)
Update for mesh point-motion.
wordList scalarNames_
Names of scalar fields.
word interpolationScheme_
Interpolation scheme to use.
wordList vectorNames_
Names of vector fields.
virtual void updateMesh(const mapPolyMesh &)
Update for changes of mesh.
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.
virtual void track()=0
Do the actual tracking to fill the track data.
virtual bool execute()
Execute the averaging.
virtual bool write()
Track and write.
DynamicList< List< point > > allTracks_
All tracks. Per track the points it passed through.
virtual bool read(const dictionary &)
Read the field average data.
Abstract base class for volume field interpolation.
Definition: interpolation.H:60
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:162
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
Holds list of sampling points which is filled at construction time. Various implementations of this b...
Definition: sampledSet.H:86
Standard boundBox with extra functionality for use in octree.
Definition: treeBoundBox.H:89
A class for handling words, derived from Foam::string.
Definition: word.H:68
engineTime & runTime
Namespace for OpenFOAM.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73