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 | Copyright (C) 2011-2015 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  Class solidParticle Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class solidParticle
59 :
60  public particle
61 {
62  // Private data
63 
64  //- Size in bytes of the fields
65  static const std::size_t sizeofFields_;
66 
67  //- Diameter
68  scalar d_;
69 
70  //- Velocity of parcel
71  vector U_;
72 
73 
74 public:
75 
76  friend class Cloud<solidParticle>;
77 
78  //- Class used to pass tracking data to the trackToFace function
79  class trackingData
80  :
81  public particle::TrackingData<solidParticleCloud>
82  {
83  // Interpolators for continuous phase fields
84 
88 
89  //- Local gravitational or other body-force acceleration
90  const vector& g_;
91 
92 
93  public:
94 
95  // Constructors
96 
97  inline trackingData
98  (
99  solidParticleCloud& spc,
103  const vector& g
104  );
105 
106 
107  // Member functions
108 
109  inline const interpolationCellPoint<scalar>& rhoInterp() const;
110 
111  inline const interpolationCellPoint<vector>& UInterp() const;
112 
113  inline const interpolationCellPoint<scalar>& nuInterp() const;
114 
115  inline const vector& g() const;
116  };
117 
118 
119  // Constructors
120 
121  //- Construct from components
122  inline solidParticle
123  (
124  const polyMesh& mesh,
125  const vector& position,
126  const label cellI,
127  const label tetFaceI,
128  const label tetPtI,
129  const scalar d,
130  const vector& U
131  );
132 
133  //- Construct from Istream
135  (
136  const polyMesh& mesh,
137  Istream& is,
138  bool readFields = true
139  );
140 
141  //- Construct and return a clone
142  virtual autoPtr<particle> clone() const
143  {
144  return autoPtr<particle>(new solidParticle(*this));
145  }
146 
147  //- Factory class to read-construct particles used for
148  // parallel transfer
149  class iNew
150  {
151  const polyMesh& mesh_;
152 
153  public:
154 
155  iNew(const polyMesh& mesh)
156  :
157  mesh_(mesh)
158  {}
159 
161  {
163  (
164  new solidParticle(mesh_, is, true)
165  );
166  }
167  };
168 
169 
170  // Member Functions
171 
172  // Access
173 
174  //- Return diameter
175  inline scalar d() const;
176 
177  //- Return velocity
178  inline const vector& U() const;
179 
180 
181  // Tracking
182 
183  //- Move
184  bool move(trackingData&, const scalar);
185 
186 
187  // Patch interactions
188 
189  //- Overridable function to handle the particle hitting a patch
190  // Executed before other patch-hitting functions
191  bool hitPatch
192  (
193  const polyPatch&,
194  trackingData& td,
195  const label patchI,
196  const scalar trackFraction,
197  const tetIndices& tetIs
198  );
199 
200  //- Overridable function to handle the particle hitting a
201  // processorPatch
202  void hitProcessorPatch
203  (
204  const processorPolyPatch&,
205  trackingData& td
206  );
207 
208  //- Overridable function to handle the particle hitting a wallPatch
209  void hitWallPatch
210  (
211  const wallPolyPatch&,
212  trackingData& td,
213  const tetIndices&
214  );
215 
216  //- Overridable function to handle the particle hitting a polyPatch
217  void hitPatch
218  (
219  const polyPatch&,
220  trackingData& td
221  );
222 
223  //- Transform the physical properties of the particle
224  // according to the given transformation tensor
225  virtual void transformProperties(const tensor& T);
226 
227  //- Transform the physical properties of the particle
228  // according to the given separation vector
229  virtual void transformProperties(const vector& separation);
230 
231  //- The nearest distance to a wall that
232  // the particle can be in the n direction
233  virtual scalar wallImpactDistance(const vector& n) const;
234 
235 
236  // I-O
237 
238  static void readFields(Cloud<solidParticle>& c);
239 
240  static void writeFields(const Cloud<solidParticle>& c);
241 
242 
243  // Ostream Operator
244 
245  friend Ostream& operator<<(Ostream&, const solidParticle&);
246 };
247 
248 
249 template<>
250 inline bool contiguous<solidParticle>()
251 {
252  return true;
253 }
254 
255 
256 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
257 
258 } // End namespace Foam
259 
260 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
261 
262 #include "solidParticleI.H"
263 
264 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265 
266 #endif
267 
268 // ************************************************************************* //
Foam::Tensor
Templated 3D tensor derived from VectorSpace adding construction from 9 components,...
Definition: complexI.H:224
solidParticleI.H
Foam::solidParticle::sizeofFields_
static const std::size_t sizeofFields_
Size in bytes of the fields.
Definition: solidParticle.H:64
Foam::solidParticle::trackingData::trackingData
trackingData(solidParticleCloud &spc, const interpolationCellPoint< scalar > &rhoInterp, const interpolationCellPoint< vector > &UInterp, const interpolationCellPoint< scalar > &nuInterp, const vector &g)
Definition: solidParticleI.H:29
Foam::solidParticle::iNew
Factory class to read-construct particles used for.
Definition: solidParticle.H:148
Foam::solidParticle::iNew::mesh_
const polyMesh & mesh_
Definition: solidParticle.H:150
Foam::solidParticleCloud
A Cloud of solid particles.
Definition: solidParticleCloud.H:55
Foam::solidParticle::trackingData::g
const vector & g() const
Definition: solidParticleI.H:84
Foam::solidParticle::trackingData::rhoInterp_
const interpolationCellPoint< scalar > & rhoInterp_
Definition: solidParticle.H:84
Foam::solidParticle::trackingData::UInterp_
const interpolationCellPoint< vector > & UInterp_
Definition: solidParticle.H:85
Foam::solidParticle::hitPatch
bool hitPatch(const polyPatch &, trackingData &td, const label patchI, const scalar trackFraction, const tetIndices &tetIs)
Overridable function to handle the particle hitting a patch.
Definition: solidParticle.C:107
Foam::solidParticle::trackingData::nuInterp_
const interpolationCellPoint< scalar > & nuInterp_
Definition: solidParticle.H:86
Foam::readFields
This function object reads fields from the time directories and adds them to the mesh database for fu...
Definition: readFields.H:104
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::solidParticle::wallImpactDistance
virtual scalar wallImpactDistance(const vector &n) const
The nearest distance to a wall that.
Definition: solidParticle.C:174
interpolationCellPoint.H
Foam::solidParticle::transformProperties
virtual void transformProperties(const tensor &T)
Transform the physical properties of the particle.
Definition: solidParticle.C:161
Foam::solidParticle::trackingData::UInterp
const interpolationCellPoint< vector > & UInterp() const
Definition: solidParticleI.H:72
Foam::solidParticle::iNew::operator()
autoPtr< solidParticle > operator()(Istream &is) const
Definition: solidParticle.H:159
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::label
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
Foam::solidParticle::U
const vector & U() const
Return velocity.
Definition: solidParticleI.H:96
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::interpolationCellPoint< scalar >
Foam::solidParticle::trackingData::nuInterp
const interpolationCellPoint< scalar > & nuInterp() const
Definition: solidParticleI.H:79
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
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:55
Foam::processorPolyPatch
Neighbour processor patch.
Definition: processorPolyPatch.H:55
Foam::particle::mesh
const polyMesh & mesh() const
Return the mesh database.
Definition: particleI.H:580
Foam::solidParticle::d_
scalar d_
Diameter.
Definition: solidParticle.H:67
Foam::solidParticle::hitProcessorPatch
void hitProcessorPatch(const processorPolyPatch &, trackingData &td)
Overridable function to handle the particle hitting a.
Definition: solidParticle.C:120
Foam::solidParticle::writeFields
static void writeFields(const Cloud< solidParticle > &c)
Definition: solidParticleIO.C:93
Foam::solidParticle::solidParticle
solidParticle(const polyMesh &mesh, const vector &position, const label cellI, const label tetFaceI, const label tetPtI, const scalar d, const vector &U)
Construct from components.
Definition: solidParticleI.H:46
Foam::wallPolyPatch
Foam::wallPolyPatch.
Definition: wallPolyPatch.H:48
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::solidParticle::trackingData
Class used to pass tracking data to the trackToFace function.
Definition: solidParticle.H:78
Foam::solidParticle::readFields
static void readFields(Cloud< solidParticle > &c)
Definition: solidParticleIO.C:66
Foam::tetIndices
Storage and named access for the indices of a tet which is part of the decomposition of a cell.
Definition: tetIndices.H:73
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::solidParticle::clone
virtual autoPtr< particle > clone() const
Construct and return a clone.
Definition: solidParticle.H:141
Foam::solidParticle::U_
vector U_
Velocity of parcel.
Definition: solidParticle.H:70
Foam::solidParticle::iNew::iNew
iNew(const polyMesh &mesh)
Definition: solidParticle.H:154
Foam::solidParticle::move
bool move(trackingData &, const scalar)
Move.
Definition: solidParticle.C:38
Foam::Vector< scalar >
Foam::solidParticle::hitWallPatch
void hitWallPatch(const wallPolyPatch &, trackingData &td, const tetIndices &)
Overridable function to handle the particle hitting a wallPatch.
Definition: solidParticle.C:130
contiguous.H
Template function to specify if the data of a type are contiguous.
Foam::particle
Base particle class.
Definition: particle.H:78
Foam::Cloud
Base cloud calls templated on particle type.
Definition: Cloud.H:52
Foam::solidParticle::d
scalar d() const
Return diameter.
Definition: solidParticleI.H:90
Foam::solidParticle
Simple solid spherical particle class with one-way coupling with the continuous phase.
Definition: solidParticle.H:57
Foam::particle::position
const vector & position() const
Return current particle position.
Definition: particleI.H:586
particle.H
Foam::constant::universal::c
const dimensionedScalar c
Speed of light in a vacuum.
Foam::contiguous< solidParticle >
bool contiguous< solidParticle >()
Definition: solidParticle.H:249
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::solidParticle::trackingData::rhoInterp
const interpolationCellPoint< scalar > & rhoInterp() const
Definition: solidParticleI.H:65
Foam::solidParticle::trackingData::g_
const vector & g_
Local gravitational or other body-force acceleration.
Definition: solidParticle.H:89
Foam::particle::TrackingData
Definition: particle.H:94
autoPtr.H