wallBoundedStreamLineParticle.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) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2017-2019 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::wallBoundedStreamLineParticle
29
30Description
31 Particle class that samples fields as it passes through. Used in streamline
32 calculation.
33
34SourceFiles
35 wallBoundedStreamLineParticle.C
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef wallBoundedStreamLineParticle_H
40#define wallBoundedStreamLineParticle_H
41
42#include "wallBoundedParticle.H"
43#include "autoPtr.H"
44#include "interpolation.H"
45#include "vectorList.H"
46#include "InfoProxy.H"
47
48// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49
50namespace Foam
51{
52
53class wallBoundedStreamLineParticleCloud;
54
55
56// Forward declaration of friend functions and operators
57
58class wallBoundedStreamLineParticle;
59
60Ostream& operator<<(Ostream&, const wallBoundedStreamLineParticle&);
61
62
63/*---------------------------------------------------------------------------*\
64 Class wallBoundedStreamLineParticle Declaration
65\*---------------------------------------------------------------------------*/
68:
70{
71
72public:
73
74 //- Class used to pass tracking data to the trackToEdge function
75 class trackingData
76 :
78 {
79
80 public:
81
85 const label UIndex_;
86 const scalar trackLength_;
91
92
93 // Constructors
94
95 template <class TrackCloudType>
97 (
98 TrackCloudType& cloud,
99 const PtrList<interpolation<scalar>>& vsInterp,
100 const PtrList<interpolation<vector>>& vvInterp,
101 const label UIndex,
102 const scalar trackLength,
103 const bitSet& isWallPatch,
104
105 DynamicList<List<point>>& allPositions,
106 List<DynamicList<scalarList>>& allScalars,
107 List<DynamicList<vectorList>>& allVectors
108 )
109 :
111 (
112 cloud,
113 isWallPatch
114 ),
115 vsInterp_(vsInterp),
116 vvInterp_(vvInterp),
117 UIndex_(UIndex),
118 trackLength_(trackLength),
119
120 allPositions_(allPositions),
121 allScalars_(allScalars),
122 allVectors_(allVectors)
123 {}
125 virtual ~trackingData() = default;
126 };
127
128
129protected:
130
131 // Protected data
132
133 //- Track with +U or -U
134 bool trackForward_;
135
136 //- Lifetime of particle. Particle dies when reaches 0.
137 label lifeTime_;
138
139 //- Sampled positions
141
142 //- Sampled scalars
144
145 //- Sampled vectors
147
148
149 // Protected Member Functions
150
152 (
153 const trackingData& td,
154 const point& position,
155 const label celli,
156 const label facei
157 );
158
160
161
162public:
163
164 // Constructors
165
166 //- Construct from components
168 (
169 const polyMesh& c,
170 const point& position,
171 const label celli,
172 const label tetFacei,
173 const label tetPti,
174 const label meshEdgeStart,
175 const label diagEdge,
176 const bool trackForward,
177 const label lifeTime
178 );
179
180 //- Construct from Istream
182 (
183 const polyMesh& c,
184 Istream& is,
185 bool readFields = true,
186 bool newFormat = true
187 );
188
189 //- Construct copy
191
192 //- Construct and return a clone
194 {
196 }
197
198 //- Factory class to read-construct particles used for
199 // parallel transfer
200 class iNew
201 {
202 const polyMesh& mesh_;
203
204 public:
206 iNew(const polyMesh& mesh)
207 :
208 mesh_(mesh)
209 {}
212 (
213 Istream& is
214 ) const
215 {
217 (
218 new wallBoundedStreamLineParticle(mesh_, is, true)
219 );
220 }
221 };
222
223
224 // Member Functions
225
226 // Tracking
227
228 //- Track all particles to their end point
229 template<class TrackCloudType>
230 bool move
231 (
232 TrackCloudType& cloud,
233 trackingData& td,
234 const scalar trackTime
235 );
236
237
238 // I-O
239
240 //- Read
242
243 //- Write
244 static void writeFields
245 (
247 );
248
249
250 // Ostream Operator
252 friend Ostream& operator<<
253 (
254 Ostream&,
256 );
257};
258
259
260// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
261
262} // End namespace Foam
263
264// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265
266#ifdef NoRepository
268#endif
269
270// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
271
272#endif
273
274// ************************************************************************* //
Base cloud calls templated on particle type.
Definition: Cloud.H:68
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:72
Minimal example by using system/controlDict.functions:
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:77
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: PtrList.H:73
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:66
A cloud is a registry collection of lagrangian particles.
Definition: cloud.H:60
Abstract base class for volume field interpolation.
Definition: interpolation.H:60
vector position() const
Return current particle position.
Definition: particleI.H:314
const polyMesh & mesh() const noexcept
Return the mesh database.
Definition: particleI.H:137
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
Class used to pass tracking data to the trackToFace function.
Particle class that tracks on triangles of boundary faces. Use trackToEdge similar to trackToFace on ...
label meshEdgeStart() const
-1 or label of mesh edge
label diagEdge() const
-1 or diagonal edge
Factory class to read-construct particles used for.
Class used to pass tracking data to the trackToEdge function.
trackingData(TrackCloudType &cloud, const PtrList< interpolation< scalar > > &vsInterp, const PtrList< interpolation< vector > > &vvInterp, const label UIndex, const scalar trackLength, const bitSet &isWallPatch, DynamicList< List< point > > &allPositions, List< DynamicList< scalarList > > &allScalars, List< DynamicList< vectorList > > &allVectors)
const PtrList< interpolation< vector > > & vvInterp_
const PtrList< interpolation< scalar > > & vsInterp_
Particle class that samples fields as it passes through. Used in streamline calculation.
vector interpolateFields(const trackingData &td, const point &position, const label celli, const label facei)
autoPtr< particle > clone() const
Construct and return a clone.
static void writeFields(const Cloud< wallBoundedStreamLineParticle > &)
Write.
label lifeTime_
Lifetime of particle. Particle dies when reaches 0.
DynamicList< point > sampledPositions_
Sampled positions.
List< DynamicList< vector > > sampledVectors_
Sampled vectors.
bool move(TrackCloudType &cloud, trackingData &td, const scalar trackTime)
Track all particles to their end point.
List< DynamicList< scalar > > sampledScalars_
Sampled scalars.
static void readFields(Cloud< wallBoundedStreamLineParticle > &)
Read.
volScalarField & p
Namespace for OpenFOAM.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83