solidParticle.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) 2016-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::solidParticle
29 
30 Description
31  Simple solid spherical particle class with one-way coupling with the
32  continuous phase.
33 
34 SourceFiles
35  solidParticleI.H
36  solidParticle.C
37  solidParticleIO.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef solidParticle_H
42 #define solidParticle_H
43 
44 #include "particle.H"
45 #include "IOstream.H"
46 #include "autoPtr.H"
47 #include "interpolationCellPoint.H"
48 #include "contiguous.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 // Forward Declarations
56 class solidParticleCloud;
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  //- Diameter
73  scalar d_;
74 
75  //- Velocity of parcel
76  vector U_;
77 
78 
79 public:
80 
81  friend class Cloud<solidParticle>;
82 
83  //- Class used to pass tracking data to the trackToFace function
84  class trackingData
85  :
87  {
88  // Interpolators for continuous phase fields
89 
90  const interpolationCellPoint<scalar>& rhoInterp_;
91  const interpolationCellPoint<vector>& UInterp_;
92  const interpolationCellPoint<scalar>& nuInterp_;
93 
94  //- Local gravitational or other body-force acceleration
95  const vector& g_;
96 
97 
98  public:
99 
100  // Constructors
101 
102  inline trackingData
103  (
104  const solidParticleCloud& spc,
108  const vector& g
109  );
110 
111 
112  // Member functions
113 
114  inline const interpolationCellPoint<scalar>& rhoInterp() const;
115 
116  inline const interpolationCellPoint<vector>& UInterp() const;
117 
118  inline const interpolationCellPoint<scalar>& nuInterp() const;
119 
120  inline const vector& g() const;
121  };
122 
123 
124  // Static data members
125 
126  //- Size in bytes of the fields
127  static const std::size_t sizeofFields;
128 
129 
130  // Constructors
131 
132  //- Construct from a position and a cell
133  // Searches for the rest of the required topology.
134  // Other properties are zero initialised.
135  inline solidParticle
136  (
137  const polyMesh& mesh,
138  const vector& position,
139  const label celli = -1
140  );
141 
142  //- Construct from components
143  inline solidParticle
144  (
145  const polyMesh& mesh,
146  const barycentric& coordinates,
147  const label celli,
148  const label tetFacei,
149  const label tetPti,
150  const scalar d,
151  const vector& U
152  );
153 
154  //- Construct from Istream
156  (
157  const polyMesh& mesh,
158  Istream& is,
159  bool readFields = true,
160  bool newFormat = true
161  );
162 
163  //- Construct and return a clone
164  virtual autoPtr<particle> clone() const
165  {
166  return autoPtr<particle>(new solidParticle(*this));
167  }
168 
169  //- Factory class to read-construct particles (for parallel transfer)
170  class iNew
171  {
172  const polyMesh& mesh_;
173 
174  public:
175 
176  iNew(const polyMesh& mesh)
177  :
178  mesh_(mesh)
179  {}
180 
182  {
183  return autoPtr<solidParticle>::New(mesh_, is, true);
184  }
185  };
186 
187 
188  // Member Functions
189 
190  // Access
191 
192  //- Return diameter
193  inline scalar d() const;
194 
195  //- Return velocity
196  inline const vector& U() const;
197 
198 
199  // Tracking
200 
201  //- Move
202  bool move(solidParticleCloud&, trackingData&, const scalar);
203 
204 
205  // Patch interactions
206 
207  //- Overridable function to handle the particle hitting a patch
208  // Executed before other patch-hitting functions
209  bool hitPatch(solidParticleCloud& cloud, trackingData& td);
210 
211  //- Overridable function to handle the particle hitting a
212  // processorPatch
213  void hitProcessorPatch(solidParticleCloud& cloud, trackingData& td);
214 
215  //- Overridable function to handle the particle hitting a wallPatch
216  void hitWallPatch(solidParticleCloud& cloud, trackingData& td);
217 
218  //- Transform the physical properties of the particle
219  // according to the given transformation tensor
220  virtual void transformProperties(const tensor& T);
221 
222  //- Transform the physical properties of the particle
223  // according to the given separation vector
224  virtual void transformProperties(const vector& separation);
225 
226 
227  // I-O
228 
229  static void readFields(Cloud<solidParticle>& c);
230 
231  static void writeFields(const Cloud<solidParticle>& c);
232 
233 
234  // Ostream Operator
235 
236  friend Ostream& operator<<(Ostream&, const solidParticle&);
237 };
238 
239 
240 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
241 
242 //- Contiguous data for solidParticle
243 template<> struct is_contiguous<solidParticle> : std::true_type {};
244 
245 
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 
248 } // End namespace Foam
249 
250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
251 
252 #include "solidParticleI.H"
253 
254 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
255 
256 #endif
257 
258 // ************************************************************************* //
Foam::autoPtr::New
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
Foam::Tensor< scalar >
solidParticleI.H
Foam::solidParticle::iNew
Factory class to read-construct particles (for parallel transfer)
Definition: solidParticle.H:169
Foam::solidParticleCloud
A Cloud of solid particles.
Definition: solidParticleCloud.H:58
Foam::solidParticle::trackingData::g
const vector & g() const
Definition: solidParticleI.H:100
Foam::solidParticle::hitWallPatch
void hitWallPatch(solidParticleCloud &cloud, trackingData &td)
Overridable function to handle the particle hitting a wallPatch.
Definition: solidParticle.C:107
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
interpolationCellPoint.H
Foam::solidParticle::transformProperties
virtual void transformProperties(const tensor &T)
Transform the physical properties of the particle.
Definition: solidParticle.C:123
Foam::solidParticle::trackingData::UInterp
const interpolationCellPoint< vector > & UInterp() const
Definition: solidParticleI.H:88
Foam::solidParticle::iNew::operator()
autoPtr< solidParticle > operator()(Istream &is) const
Definition: solidParticle.H:180
Foam::particle::coordinates
const barycentric & coordinates() const
Return current particle coordinates.
Definition: particleI.H:143
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::solidParticle::U
const vector & U() const
Return velocity.
Definition: solidParticleI.H:112
Foam::solidParticle::solidParticle
solidParticle(const polyMesh &mesh, const vector &position, const label celli=-1)
Construct from a position and a cell.
Definition: solidParticleI.H:49
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::interpolationCellPoint< scalar >
Foam::solidParticle::trackingData::nuInterp
const interpolationCellPoint< scalar > & nuInterp() const
Definition: solidParticleI.H:95
Foam::solidParticle::operator<<
friend Ostream & operator<<(Ostream &, const solidParticle &)
IOstream.H
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::particle::position
vector position() const
Return current particle position.
Definition: particleI.H:314
Foam::Barycentric< scalar >
Foam::particle::mesh
const polyMesh & mesh() const
Return the mesh database.
Definition: particleI.H:137
Foam::solidParticle::writeFields
static void writeFields(const Cloud< solidParticle > &c)
Definition: solidParticleIO.C:101
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::solidParticle::trackingData::trackingData
trackingData(const solidParticleCloud &spc, const interpolationCellPoint< scalar > &rhoInterp, const interpolationCellPoint< vector > &UInterp, const interpolationCellPoint< scalar > &nuInterp, const vector &g)
Definition: solidParticleI.H:32
Foam::solidParticle::trackingData
Class used to pass tracking data to the trackToFace function.
Definition: solidParticle.H:83
Foam::solidParticle::readFields
static void readFields(Cloud< solidParticle > &c)
Definition: solidParticleIO.C:79
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::solidParticle::clone
virtual autoPtr< particle > clone() const
Construct and return a clone.
Definition: solidParticle.H:163
Foam::solidParticle::iNew::iNew
iNew(const polyMesh &mesh)
Definition: solidParticle.H:175
Foam::Vector< scalar >
contiguous.H
Foam::solidParticle::move
bool move(solidParticleCloud &, trackingData &, const scalar)
Move.
Definition: solidParticle.C:40
Foam::particle
Base particle class.
Definition: particle.H:76
Foam::Cloud
Base cloud calls templated on particle type.
Definition: Cloud.H:55
Foam::solidParticle::d
scalar d() const
Return diameter.
Definition: solidParticleI.H:106
Foam::solidParticle
Simple solid spherical particle class with one-way coupling with the continuous phase.
Definition: solidParticle.H:65
particle.H
Foam::constant::universal::c
const dimensionedScalar c
Speed of light in a vacuum.
Foam::solidParticle::sizeofFields
static const std::size_t sizeofFields
Size in bytes of the fields.
Definition: solidParticle.H:126
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::solidParticle::trackingData::rhoInterp
const interpolationCellPoint< scalar > & rhoInterp() const
Definition: solidParticleI.H:81
Foam::particle::trackingData
Definition: particle.H:95
Foam::solidParticle::hitPatch
bool hitPatch(solidParticleCloud &cloud, trackingData &td)
Overridable function to handle the particle hitting a patch.
Definition: solidParticle.C:91
Foam::solidParticle::hitProcessorPatch
void hitProcessorPatch(solidParticleCloud &cloud, trackingData &td)
Overridable function to handle the particle hitting a.
Definition: solidParticle.C:98
Foam::is_contiguous
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:75
autoPtr.H