Loading...
Searching...
No Matches
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-2024 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 Foam_solidParticle_H
42#define Foam_solidParticle_H
43
44#include "particle.H"
45#include "IOstream.H"
47#include "contiguous.H"
48
49// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50
51namespace Foam
52{
53
54// Forward Declarations
55class solidParticle;
57
60/*---------------------------------------------------------------------------*\
61 Class solidParticle Declaration
62\*---------------------------------------------------------------------------*/
63
64class solidParticle
65:
66 public particle
67{
68 // Private Data
69
70 //- Diameter
71 scalar d_;
72
73 //- Velocity of parcel
74 vector U_;
75
76
77public:
78
79 friend class Cloud<solidParticle>;
80
81 //- Class used to pass tracking data to the trackToFace function
82 class trackingData
83 :
85 {
86 // Interpolators for continuous phase fields
87
88 const interpolationCellPoint<scalar>& rhoInterp_;
89 const interpolationCellPoint<vector>& UInterp_;
90 const interpolationCellPoint<scalar>& nuInterp_;
91
92 //- Local gravitational or other body-force acceleration
93 const vector& g_;
94
95
96 public:
97
98 // Constructors
99
101 (
102 const solidParticleCloud& cld,
106 const vector& g
107 )
108 :
110 rhoInterp_(rhoInterp),
111 UInterp_(UInterp),
112 nuInterp_(nuInterp),
113 g_(g)
114 {}
115
116
117 // Member Functions
118
120 {
121 return nuInterp_;
123
125 {
126 return UInterp_;
128
130 {
131 return rhoInterp_;
133
134 const vector& g() const noexcept { return g_; }
135 };
136
138 // Static data members
139
140 //- Size in bytes of the fields
141 static const std::size_t sizeofFields;
142
143
144 // Constructors
145
146 //- Construct from a position and a cell
147 // Searches for the rest of the required topology.
148 // Other properties are zero initialised.
150 (
151 const polyMesh& mesh,
152 const vector& position,
153 const label celli = -1
154 )
155 :
156 particle(mesh, position, celli),
157 d_(0),
158 U_(Zero)
159 {}
160
161 //- Construct from components
163 (
164 const polyMesh& mesh,
166 const label celli,
167 const label tetFacei,
168 const label tetPti,
169 const scalar d,
170 const vector& U
171 )
173 particle(mesh, coordinates, celli, tetFacei, tetPti),
174 d_(d),
175 U_(U)
176 {}
177
178 //- Construct from Istream
180 (
181 const polyMesh& mesh,
182 Istream& is,
183 bool readFields = true,
184 bool newFormat = true
185 );
186
187 //- Return a clone
188 virtual autoPtr<particle> clone() const
189 {
190 return particle::Clone(*this);
191 }
192
193 //- Factory class to read-construct particles (for parallel transfer)
194 class iNew
195 {
196 const polyMesh& mesh_;
197
198 public:
199
200 iNew(const polyMesh& mesh)
201 :
202 mesh_(mesh)
203 {}
204
206 {
207 return autoPtr<solidParticle>::New(mesh_, is, true);
208 }
209 };
211
212 // Member Functions
213
214 // Access
215
216 //- Return diameter
217 scalar d() const noexcept { return d_; }
218
219 //- Return velocity
220 const vector& U() const noexcept { return U_; }
222
223 // Tracking
224
225 //- Move
226 bool move(solidParticleCloud&, trackingData&, const scalar);
227
228
229 // Patch interactions
230
231 //- Overridable function to handle the particle hitting a patch
232 // Executed before other patch-hitting functions
234
235 //- Overridable function to handle the particle hitting a
236 // processorPatch
238
239 //- Overridable function to handle the particle hitting a wallPatch
241
242 //- Transform the physical properties of the particle
243 // according to the given transformation tensor
244 virtual void transformProperties(const tensor& T);
245
246 //- Transform the physical properties of the particle
247 // according to the given separation vector
248 virtual void transformProperties(const vector& separation);
249
250
251 // I-O
252
253 static void readFields(Cloud<solidParticle>& c);
254
255 static void writeFields(const Cloud<solidParticle>& c);
256
257
258 // Ostream Operator
259
260 friend Ostream& operator<<(Ostream&, const solidParticle&);
261};
262
263
264// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
265
266//- Contiguous data for solidParticle
267template<> struct is_contiguous<solidParticle> : std::true_type {};
268
269
270// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
271
272} // End namespace Foam
273
274// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
275
276#endif
277
278// ************************************************************************* //
Base cloud calls templated on particle type.
Definition Cloud.H:64
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
Definition autoPtr.H:178
A cloud is a registry collection of lagrangian particles.
Definition cloud.H:56
Given cell centre values and point (vertex) values decompose into tetrahedra and linear interpolate w...
vector position() const
Return current particle position.
Definition particleI.H:283
static autoPtr< particle > Clone(const Derived &p)
Clone a particle.
Definition particle.H:552
const polyMesh & mesh() const noexcept
Return the mesh database.
Definition particleI.H:110
const barycentric & coordinates() const noexcept
Return current particle coordinates.
Definition particleI.H:116
particle(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti)
Construct from components.
Definition particle.C:507
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
A Cloud of solid particles.
autoPtr< solidParticle > operator()(Istream &is) const
iNew(const polyMesh &mesh)
Class used to pass tracking data to the trackToFace function.
const interpolationCellPoint< scalar > & nuInterp() const noexcept
const interpolationCellPoint< scalar > & rhoInterp() const noexcept
const interpolationCellPoint< vector > & UInterp() const noexcept
const vector & g() const noexcept
trackingData(const solidParticleCloud &cld, const interpolationCellPoint< scalar > &rhoInterp, const interpolationCellPoint< vector > &UInterp, const interpolationCellPoint< scalar > &nuInterp, const vector &g)
Simple solid spherical particle class with one-way coupling with the continuous phase.
virtual void transformProperties(const tensor &T)
Transform the physical properties of the particle.
void hitWallPatch(solidParticleCloud &cloud, trackingData &td)
Overridable function to handle the particle hitting a wallPatch.
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.
virtual autoPtr< particle > clone() const
Return a clone.
static const std::size_t sizeofFields
Size in bytes of the fields.
const vector & U() const noexcept
Return velocity.
scalar d() const noexcept
Return diameter.
bool move(solidParticleCloud &, trackingData &, const scalar)
Move.
friend Ostream & operator<<(Ostream &, const solidParticle &)
solidParticle(const polyMesh &mesh, const vector &position, const label celli=-1)
Construct from a position and a cell.
bool hitPatch(solidParticleCloud &cloud, trackingData &td)
Overridable function to handle the particle hitting a patch.
void hitProcessorPatch(solidParticleCloud &cloud, trackingData &td)
Overridable function to handle the particle hitting a.
static void readFields(Cloud< solidParticle > &c)
static void writeFields(const Cloud< solidParticle > &c)
U
Definition pEqn.H:72
dynamicFvMesh & mesh
PtrList< coordinateSystem > coordinates(solidRegions.size())
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
Namespace for OpenFOAM.
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const NameMatchPredicate &selectedFields, DynamicList< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type and store on the objectRegistry.
Tensor< scalar > tensor
Definition symmTensor.H:57
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127
const direction noexcept
Definition scalarImpl.H:265
Barycentric< scalar > barycentric
A scalar version of the templated Barycentric.
Definition barycentric.H:45
Vector< scalar > vector
Definition vector.H:57
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
A template class to specify that a data type can be considered as being contiguous in memory.
Definition contiguous.H:70