solidParticle.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-2020 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::solidParticle
26 
27 Description
28  Simple solid spherical particle class with one-way coupling with the
29  continuous phase.
30 
31 SourceFiles
32  solidParticleI.H
33  solidParticle.C
34  solidParticleIO.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef solidParticle_H
39 #define solidParticle_H
40 
41 #include "particle.H"
42 #include "IOstream.H"
43 #include "autoPtr.H"
44 #include "interpolationCellPoint.H"
45 #include "contiguous.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 class solidParticleCloud;
53 
54 
55 // Forward declaration of friend functions and operators
56 
57 class solidParticle;
58 
59 Ostream& operator<<(Ostream&, const solidParticle&);
60 
61 
62 /*---------------------------------------------------------------------------*\
63  Class solidParticle Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 class solidParticle
67 :
68  public particle
69 {
70  // Private Data
71 
72  //- Size in bytes of the fields
73  static const std::size_t sizeofFields_;
74 
75  //- Diameter
76  scalar d_;
77 
78  //- Velocity of parcel
79  vector U_;
80 
81 
82 public:
83 
84  friend class Cloud<solidParticle>;
85 
86  //- Class used to pass tracking data to the trackToFace function
87  class trackingData
88  :
90  {
91  // Interpolators for continuous phase fields
92 
93  const interpolationCellPoint<scalar>& rhoInterp_;
94  const interpolationCellPoint<vector>& UInterp_;
95  const interpolationCellPoint<scalar>& nuInterp_;
96 
97  //- Local gravitational or other body-force acceleration
98  const vector& g_;
99 
100 
101  public:
102 
103  // Constructors
104 
105  inline trackingData
106  (
107  const solidParticleCloud& spc,
111  const vector& g
112  );
113 
114 
115  // Member Functions
116 
117  inline const interpolationCellPoint<scalar>& rhoInterp() const;
118 
119  inline const interpolationCellPoint<vector>& UInterp() const;
120 
121  inline const interpolationCellPoint<scalar>& nuInterp() const;
122 
123  inline const vector& g() const;
124  };
125 
126 
127  // Constructors
128 
129  //- Construct from components
130  inline solidParticle
131  (
132  const polyMesh& mesh,
133  const barycentric& coordinates,
134  const label celli,
135  const label tetFacei,
136  const label tetPti,
137  const scalar d,
138  const vector& U
139  );
140 
141  //- Construct from Istream
143  (
144  const polyMesh& mesh,
145  Istream& is,
146  bool readFields = true
147  );
148 
149  //- Construct and return a clone
150  virtual autoPtr<particle> clone() const
151  {
152  return autoPtr<particle>(new solidParticle(*this));
153  }
154 
155  //- Factory class to read-construct particles used for
156  // parallel transfer
157  class iNew
158  {
159  const polyMesh& mesh_;
160 
161  public:
163  iNew(const polyMesh& mesh)
164  :
165  mesh_(mesh)
166  {}
168  autoPtr<solidParticle> operator()(Istream& is) const
169  {
171  (
172  new solidParticle(mesh_, is, true)
173  );
174  }
175  };
176 
177 
178  // Member Functions
179 
180  // Access
181 
182  //- Return diameter
183  inline scalar d() const;
184 
185  //- Return velocity
186  inline const vector& U() const;
187 
188 
189  // Tracking
190 
191  //- Move
192  bool move(solidParticleCloud&, trackingData&, const scalar);
193 
194 
195  // Patch interactions
196 
197  //- Overridable function to handle the particle hitting a patch
198  // Executed before other patch-hitting functions
200 
201  //- Overridable function to handle the particle hitting a
202  // processorPatch
204 
205  //- Overridable function to handle the particle hitting a wallPatch
206  void hitWallPatch(solidParticleCloud& cloud, trackingData& td);
207 
208  //- Transform the physical properties of the particle
209  // according to the given transformation
210  virtual void transformProperties(const transformer&);
211 
212 
213  // I-O
214 
215  static void readFields(Cloud<solidParticle>& c);
216 
217  static void writeFields(const Cloud<solidParticle>& c);
218 
219 
220  // Ostream Operator
221 
222  friend Ostream& operator<<(Ostream&, const solidParticle&);
223 };
224 
225 
226 template<>
227 inline bool contiguous<solidParticle>()
228 {
229  return true;
230 }
231 
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 } // End namespace Foam
236 
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 
239 #include "solidParticleI.H"
240 
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 
243 #endif
244 
245 // ************************************************************************* //
const polyMesh & mesh() const
Return the mesh database.
Definition: particleI.H:125
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
Vector-tensor class used to perform translations and rotations in 3D space.
Definition: transformer.H:83
trackingData(const solidParticleCloud &spc, const interpolationCellPoint< scalar > &rhoInterp, const interpolationCellPoint< vector > &UInterp, const interpolationCellPoint< scalar > &nuInterp, const vector &g)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Template function to specify if the data of a type are contiguous.
bool hitPatch(solidParticleCloud &cloud, trackingData &td)
Overridable function to handle the particle hitting a patch.
Definition: solidParticle.C:89
bool contiguous< solidParticle >()
const dimensionedScalar & c
Speed of light in a vacuum.
scalar d() const
Return diameter.
Base particle class.
Definition: particle.H:84
const vector & U() const
Return velocity.
A cloud is a collection of lagrangian particles.
Definition: cloud.H:51
A Cloud of solid particles.
const interpolationCellPoint< scalar > & rhoInterp() const
const interpolationCellPoint< scalar > & nuInterp() const
Base cloud calls templated on particle type.
Definition: Cloud.H:52
Factory class to read-construct particles used for.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
const interpolationCellPoint< vector > & UInterp() const
Class used to pass tracking data to the trackToFace function.
Definition: solidParticle.H:86
static void writeFields(const Cloud< solidParticle > &c)
solidParticle(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti, const scalar d, const vector &U)
Construct from components.
void hitProcessorPatch(solidParticleCloud &cloud, trackingData &td)
Overridable function to handle the particle hitting a.
Definition: solidParticle.C:96
virtual autoPtr< particle > clone() const
Construct and return a clone.
Ostream & operator<<(Ostream &, const ensightPart &)
bool move(solidParticleCloud &, trackingData &, const scalar)
Move.
Definition: solidParticle.C:38
const barycentric & coordinates() const
Return current particle coordinates.
Definition: particleI.H:131
virtual void transformProperties(const transformer &)
Transform the physical properties of the particle.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
void hitWallPatch(solidParticleCloud &cloud, trackingData &td)
Overridable function to handle the particle hitting a wallPatch.
static void readFields(Cloud< solidParticle > &c)
Simple solid spherical particle class with one-way coupling with the continuous phase.
Definition: solidParticle.H:65
friend Ostream & operator<<(Ostream &, const solidParticle &)
Namespace for OpenFOAM.