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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::solidParticle
29
30Description
31 Simple solid spherical particle class with one-way coupling with the
32 continuous phase.
33
34SourceFiles
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"
48#include "contiguous.H"
49
50// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51
52namespace Foam
53{
54
55// Forward Declarations
56class solidParticleCloud;
57class solidParticle;
58
59Ostream& operator<<(Ostream&, const solidParticle&);
60
61
62/*---------------------------------------------------------------------------*\
63 Class solidParticle Declaration
64\*---------------------------------------------------------------------------*/
66class 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
79public:
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,
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:
176 iNew(const polyMesh& mesh)
177 :
178 mesh_(mesh)
179 {}
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
236 friend Ostream& operator<<(Ostream&, const solidParticle&);
237};
238
239
240// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
241
242//- Contiguous data for solidParticle
243template<> 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// ************************************************************************* //
Base cloud calls templated on particle type.
Definition: Cloud.H:68
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A cloud is a registry collection of lagrangian particles.
Definition: cloud.H:60
Given cell centre values and point (vertex) values decompose into tetrahedra and linear interpolate w...
Base particle class.
Definition: particle.H:79
vector position() const
Return current particle position.
Definition: particleI.H:314
const polyMesh & mesh() const noexcept
Return the mesh database.
Definition: particleI.H:137
const barycentric & coordinates() const noexcept
Return current particle coordinates.
Definition: particleI.H:143
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
A Cloud of solid particles.
Factory class to read-construct particles (for parallel transfer)
autoPtr< solidParticle > operator()(Istream &is) const
iNew(const polyMesh &mesh)
Class used to pass tracking data to the trackToFace function.
Definition: solidParticle.H:86
const interpolationCellPoint< scalar > & rhoInterp() const
const interpolationCellPoint< vector > & UInterp() const
const interpolationCellPoint< scalar > & nuInterp() const
Simple solid spherical particle class with one-way coupling with the continuous phase.
Definition: solidParticle.H:68
virtual void transformProperties(const tensor &T)
Transform the physical properties of the particle.
const vector & U() const
Return velocity.
void hitWallPatch(solidParticleCloud &cloud, trackingData &td)
Overridable function to handle the particle hitting a wallPatch.
scalar d() const
Return diameter.
virtual autoPtr< particle > clone() const
Construct and return a clone.
static const std::size_t sizeofFields
Size in bytes of the fields.
bool move(solidParticleCloud &, trackingData &, const scalar)
Move.
Definition: solidParticle.C:40
friend Ostream & operator<<(Ostream &, const solidParticle &)
bool hitPatch(solidParticleCloud &cloud, trackingData &td)
Overridable function to handle the particle hitting a patch.
Definition: solidParticle.C:91
void hitProcessorPatch(solidParticleCloud &cloud, trackingData &td)
Overridable function to handle the particle hitting a.
Definition: solidParticle.C:98
static void readFields(Cloud< solidParticle > &c)
static void writeFields(const Cloud< solidParticle > &c)
const volScalarField & T
Namespace for OpenFOAM.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:78