ParticleTracks.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-2017 OpenFOAM Foundation
9  Copyright (C) 2019-2020 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::ParticleTracks
29 
30 Group
31  grpLagrangianIntermediateFunctionObjects
32 
33 Description
34  Records particle state (all variables) on each call to postFace
35 
36 SourceFiles
37  ParticleTracks.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef ParticleTracks_H
42 #define ParticleTracks_H
43 
44 #include "CloudFunctionObject.H"
45 #include "labelPairHashes.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class ParticleTracks Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 template<class CloudType>
57 class ParticleTracks
58 :
59  public CloudFunctionObject<CloudType>
60 {
61  //- Convenience typedef for parcel type
62  typedef typename CloudType::parcelType parcelType;
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  //- Should data should be reset/cleared on writing?
74  bool resetOnWrite_;
75 
76  //- Table of number of times a particle has hit a face
77  labelPairLookup 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() = default;
122 
123 
124  // Member Functions
125 
126  // Access
127 
128  //- Return const access to the track interval
129  inline label trackInterval() const;
130 
131  //- Return const access to the max samples
132  inline label maxSamples() const;
133 
134  //- Should data be reset on write?
135  inline bool resetOnWrite() const;
136 
137  //- Return the table of number of times a particle has hit a face
138  inline const labelPairLookup& faceHitCounter() const;
139 
140  //- Return const access to the cloud
141  inline const Cloud<parcelType>& cloud() const;
142 
143 
144  // Evaluation
145 
146  //- Pre-evolve hook
147  virtual void preEvolve
148  (
149  const typename parcelType::trackingData& td
150  );
151 
152  //- Post-face hook
153  virtual void postFace(const parcelType& p, bool& keepParticle);
154 };
155 
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 } // End namespace Foam
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 #include "ParticleTracksI.H"
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 #ifdef NoRepository
168  #include "ParticleTracks.C"
169 #endif
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #endif
174 
175 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::ParticleTracks::~ParticleTracks
virtual ~ParticleTracks()=default
Destructor.
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::ParticleTracks::write
void write()
Write post-processing info.
Definition: ParticleTracks.C:37
Foam::ParticleTracks::preEvolve
virtual void preEvolve(const typename parcelType::trackingData &td)
Pre-evolve hook.
Definition: ParticleTracks.C:93
Foam::ParticleTracks::clone
virtual autoPtr< CloudFunctionObject< CloudType > > clone() const
Construct and return a clone.
Definition: ParticleTracks.H:110
Foam::ParticleTracks
Records particle state (all variables) on each call to postFace.
Definition: ParticleTracks.H:56
Foam::ParticleTracks::trackInterval
label trackInterval() const
Return const access to the track interval.
Definition: ParticleTracksI.H:34
Foam::subModelBase::modelName
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:107
Foam::ParticleTracks::ParticleTracks
ParticleTracks(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Definition: ParticleTracks.C:59
CloudFunctionObject.H
Foam::ParticleTracks::TypeName
TypeName("particleTracks")
Runtime type information.
ParticleTracks.C
Foam::ParticleTracks::faceHitCounter
const labelPairLookup & faceHitCounter() const
Return the table of number of times a particle has hit a face.
Definition: ParticleTracksI.H:56
labelPairHashes.H
A HashTable to objects of type <T> with a labelPair key. The hashing is based on labelPair (FixedList...
Foam::subModelBase::dict
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:113
Foam::CloudSubModelBase::owner
const CloudType & owner() const
Return const access to the owner cloud.
Definition: CloudSubModelBase.C:106
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::ParticleTracks::cloud
const Cloud< parcelType > & cloud() const
Return const access to the cloud.
Definition: ParticleTracksI.H:64
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::ParticleTracks::maxSamples
label maxSamples() const
Return const access to the max samples.
Definition: ParticleTracksI.H:41
Foam::HashTable< label, labelPair, Foam::Hash< labelPair > >
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::ParticleTracks::postFace
virtual void postFace(const parcelType &p, bool &keepParticle)
Post-face hook.
Definition: ParticleTracks.C:108
ParticleTracksI.H
Foam::CloudFunctionObject
Templated cloud function object base class.
Definition: CloudFunctionObject.H:62
Foam::Cloud< parcelType >
Foam::ParticleTracks::resetOnWrite
bool resetOnWrite() const
Should data be reset on write?
Definition: ParticleTracksI.H:48
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220