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 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::wallBoundedStreamLineParticle
29 
30 Description
31  Particle class that samples fields as it passes through. Used in streamline
32  calculation.
33 
34 SourceFiles
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 
50 namespace Foam
51 {
52 
53 class wallBoundedStreamLineParticleCloud;
54 
55 
56 // Forward declaration of friend functions and operators
57 
58 class wallBoundedStreamLineParticle;
59 
60 Ostream& operator<<(Ostream&, const wallBoundedStreamLineParticle&);
61 
62 
63 /*---------------------------------------------------------------------------*\
64  Class wallBoundedStreamLineParticle Declaration
65 \*---------------------------------------------------------------------------*/
66 
68 :
69  public wallBoundedParticle
70 {
71 
72 public:
73 
74  //- Class used to pass tracking data to the trackToEdge function
75  class trackingData
76  :
78  {
79 
80  public:
81 
82 
85  const label UIndex_;
86  const scalar trackLength_;
87 
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  {}
124 
125  virtual ~trackingData() = default;
126  };
127 
128 
129 protected:
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 
162 public:
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
193  autoPtr<particle> clone() const
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:
205 
206  iNew(const polyMesh& mesh)
207  :
208  mesh_(mesh)
209  {}
210 
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
251 
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 // ************************************************************************* //
Foam::wallBoundedStreamLineParticle::clone
autoPtr< particle > clone() const
Construct and return a clone.
Definition: wallBoundedStreamLineParticle.H:192
p
volScalarField & p
Definition: createFieldRefs.H:8
vectorList.H
Foam::wallBoundedStreamLineParticle::wallBoundedStreamLineParticle
wallBoundedStreamLineParticle(const polyMesh &c, const point &position, const label celli, const label tetFacei, const label tetPti, const label meshEdgeStart, const label diagEdge, const bool trackForward, const label lifeTime)
Construct from components.
Definition: wallBoundedStreamLineParticle.C:123
Foam::bitSet
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:63
Foam::DynamicList
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:55
InfoProxy.H
Foam::wallBoundedStreamLineParticle::sampledPositions_
DynamicList< point > sampledPositions_
Sampled positions.
Definition: wallBoundedStreamLineParticle.H:139
Foam::wallBoundedStreamLineParticle::trackingData::allScalars_
List< DynamicList< scalarList > > & allScalars_
Definition: wallBoundedStreamLineParticle.H:88
interpolation.H
Foam::wallBoundedStreamLineParticle::iNew::iNew
iNew(const polyMesh &mesh)
Definition: wallBoundedStreamLineParticle.H:205
Foam::wallBoundedStreamLineParticle::trackingData::UIndex_
const label UIndex_
Definition: wallBoundedStreamLineParticle.H:84
Foam::wallBoundedStreamLineParticle::lifeTime_
label lifeTime_
Lifetime of particle. Particle dies when reaches 0.
Definition: wallBoundedStreamLineParticle.H:136
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::wallBoundedStreamLineParticle::sample
vector sample(trackingData &td)
Definition: wallBoundedStreamLineParticle.C:94
Foam::wallBoundedStreamLineParticle::trackingData::~trackingData
virtual ~trackingData()=default
Foam::wallBoundedStreamLineParticle::trackingData::allVectors_
List< DynamicList< vectorList > > & allVectors_
Definition: wallBoundedStreamLineParticle.H:89
Foam::wallBoundedStreamLineParticle::trackingData::allPositions_
DynamicList< vectorList > & allPositions_
Definition: wallBoundedStreamLineParticle.H:87
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
wallBoundedStreamLineParticleTemplates.C
Foam::wallBoundedStreamLineParticle::trackingData
Class used to pass tracking data to the trackToEdge function.
Definition: wallBoundedStreamLineParticle.H:74
wallBoundedParticle.H
Foam::wallBoundedParticle::meshEdgeStart
label meshEdgeStart() const
-1 or label of mesh edge
Definition: wallBoundedParticle.H:217
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::wallBoundedParticle
Particle class that tracks on triangles of boundary faces. Use trackToEdge similar to trackToFace on ...
Definition: wallBoundedParticle.H:63
Foam::wallBoundedStreamLineParticle
Particle class that samples fields as it passes through. Used in streamline calculation.
Definition: wallBoundedStreamLineParticle.H:66
Foam::wallBoundedStreamLineParticle::trackingData::vvInterp_
const PtrList< interpolation< vector > > & vvInterp_
Definition: wallBoundedStreamLineParticle.H:83
Foam::particle::position
vector position() const
Return current particle position.
Definition: particleI.H:314
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:62
Foam::particle::mesh
const polyMesh & mesh() const
Return the mesh database.
Definition: particleI.H:137
Foam::wallBoundedStreamLineParticle::writeFields
static void writeFields(const Cloud< wallBoundedStreamLineParticle > &)
Write.
Definition: wallBoundedStreamLineParticle.C:235
Foam::interpolation< scalar >
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::wallBoundedStreamLineParticle::move
bool move(TrackCloudType &cloud, trackingData &td, const scalar trackTime)
Track all particles to their end point.
Definition: wallBoundedStreamLineParticleTemplates.C:33
Foam::wallBoundedParticle::trackingData
Class used to pass tracking data to the trackToFace function.
Definition: wallBoundedParticle.H:70
Foam::wallBoundedStreamLineParticle::sampledVectors_
List< DynamicList< vector > > sampledVectors_
Sampled vectors.
Definition: wallBoundedStreamLineParticle.H:145
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::cloud
A cloud is a registry collection of lagrangian particles.
Definition: cloud.H:57
Foam::wallBoundedStreamLineParticle::readFields
static void readFields(Cloud< wallBoundedStreamLineParticle > &)
Read.
Definition: wallBoundedStreamLineParticle.C:201
Foam::Vector< scalar >
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:63
Foam::wallBoundedStreamLineParticle::trackingData::trackingData
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)
Definition: wallBoundedStreamLineParticle.H:96
Foam::wallBoundedStreamLineParticle::iNew
Factory class to read-construct particles used for.
Definition: wallBoundedStreamLineParticle.H:199
Foam::Cloud< wallBoundedStreamLineParticle >
Foam::wallBoundedStreamLineParticle::trackingData::trackLength_
const scalar trackLength_
Definition: wallBoundedStreamLineParticle.H:85
Foam::wallBoundedStreamLineParticle::trackingData::vsInterp_
const PtrList< interpolation< scalar > > & vsInterp_
Definition: wallBoundedStreamLineParticle.H:82
Foam::constant::universal::c
const dimensionedScalar c
Speed of light in a vacuum.
Foam::wallBoundedParticle::diagEdge
label diagEdge() const
-1 or diagonal edge
Definition: wallBoundedParticle.H:223
Foam::wallBoundedStreamLineParticle::interpolateFields
vector interpolateFields(const trackingData &td, const point &position, const label celli, const label facei)
Definition: wallBoundedStreamLineParticle.C:35
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::wallBoundedStreamLineParticle::sampledScalars_
List< DynamicList< scalar > > sampledScalars_
Sampled scalars.
Definition: wallBoundedStreamLineParticle.H:142
Foam::wallBoundedStreamLineParticle::trackForward_
bool trackForward_
Track with +U or -U.
Definition: wallBoundedStreamLineParticle.H:133
autoPtr.H