ParticleTracks.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2022 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::ParticleTracks
26 
27 Description
28  Records particle state (all variables) on each call to postFace
29 
30 SourceFiles
31  ParticleTracks.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef ParticleTracks_H
36 #define ParticleTracks_H
37 
38 #include "CloudFunctionObject.H"
39 #include "Cloud.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class ParticleTracks Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 template<class CloudType>
51 class ParticleTracks
52 :
53  public CloudFunctionObject<CloudType>
54 {
55  // Private Typedefs
56 
57  //- Convenience typedef for parcel type
58  typedef typename CloudType::parcelType parcelType;
59 
60  //- Convenience typedef for hash hit-table
63 
64 
65  // Private Data
66 
67  //- Number of face-hit intervals between storing parcel data
68  label trackInterval_;
69 
70  //- Maximum number of particles to store per track
71  label maxSamples_;
72 
73  //- Flag to indicate whether data should be reset/cleared on writing
74  Switch resetOnWrite_;
75 
76  //- Table of number of times a particle has hit a face
77  hitCountTable faceHitCounter_;
78 
79  //- Pointer to the cloud storage
80  autoPtr<Cloud<parcelType>> cloudPtr_;
81 
82 
83 protected:
84 
85  // Protected member functions
86 
87  //- Write post-processing info
88  void write();
89 
90 
91 public:
92 
93  //- Runtime type information
94  TypeName("particleTracks");
95 
96 
97  // Constructors
98 
99  //- Construct from dictionary
101  (
102  const dictionary& dict,
103  CloudType& owner,
104  const word& modelName
105  );
106 
107  //- Construct copy
109 
110  //- Construct and return a clone
112  {
114  (
115  new ParticleTracks<CloudType>(*this)
116  );
117  }
118 
119 
120  //- Destructor
121  virtual ~ParticleTracks();
122 
123 
124  // Member Functions
125 
126  // Evaluation
127 
128  //- Pre-evolve hook
129  virtual void preEvolve();
130 
131  //- Post-patch hook
132  virtual void postPatch(const parcelType& p, const polyPatch& pp);
133 
134  //- Post-face hook
135  virtual void preFace(const parcelType& p);
136 };
137 
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 } // End namespace Foam
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 #ifdef NoRepository
146  #include "ParticleTracks.C"
147 #endif
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 #endif
152 
153 // ************************************************************************* //
Templated cloud function object base class.
const CloudType & owner() const
Return const access to the owner cloud.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:79
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:221
An STL-conforming hash table.
Definition: HashTable.H:127
Records particle state (all variables) on each call to postFace.
TypeName("particleTracks")
Runtime type information.
virtual void postPatch(const parcelType &p, const polyPatch &pp)
Post-patch hook.
ParticleTracks(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
virtual void preFace(const parcelType &p)
Post-face hook.
virtual ~ParticleTracks()
Destructor.
void write()
Write post-processing info.
virtual autoPtr< CloudFunctionObject< CloudType > > clone() const
Construct and return a clone.
virtual void preEvolve()
Pre-evolve hook.
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:61
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:70
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:104
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
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
volScalarField & p