particles.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) 2016-2023 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::functionObjects::particles
26 
27 Description
28  This functionObject tracks a particle cloud in the specified velocity field
29  of an incompressible flow (laminar, RANS or LES).
30 
31  It may be used in conjunction with any transient single-phase incompressible
32  flow solvers or solver modules such as incompressibleFluid and tracks the
33  particles or parcels without affecting the flow-field.
34 
35  The cloud requires the density of the fluid which is looked-up from
36  constant/phaseProperties dictionary and the acceleration due to gravity
37  which is read from the constant/g file if present or defaults to zero.
38 
39  The cloud properties are read from the constant/<cloudName>Properties
40  dictionary in the usual manner.
41 
42  Example of function object specification:
43  \verbatim
44  particles
45  {
46  libs ("liblagrangianFunctionObjects.so");
47  type particles;
48  }
49  \endverbatim
50 
51 Usage
52  \table
53  Property | Description | Required | Default value
54  type | Type name: particles | yes |
55  U | Name of the velocity field | no | U
56  cloud | Name of the cloud | no | cloud
57  \endtable
58 
59 See also
60  Foam::functionObjects::fvMeshFunctionObject
61 
62 SourceFiles
63  particles.C
64 
65 \*---------------------------------------------------------------------------*/
66 
67 #ifndef functionObjects_particles_H
68 #define functionObjects_particles_H
69 
70 #include "fvMeshFunctionObject.H"
71 #include "parcelCloud.H"
72 #include "volFieldsFwd.H"
74 
75 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
76 
77 namespace Foam
78 {
79 
80 class viscosityModel;
81 
82 namespace functionObjects
83 {
84 
85 /*---------------------------------------------------------------------------*\
86  Class particles Declaration
87 \*---------------------------------------------------------------------------*/
88 
89 class particles
90 :
91  public fvMeshFunctionObject
92 {
93  // Private member data
94 
95  //- Optional acceleration due to gravity
97 
98  //- Reference to the carrier fluid viscosity model
99  const viscosityModel& viscosity_;
100 
101  //- Uniform density value
102  dimensionedScalar rhoValue_;
103 
104  //- Density field needed to construct the cloud
105  volScalarField rho_;
106 
107  //- Dynamic viscosity field needed to construct the cloud
109 
110  //- Reference to the velocity field
111  const volVectorField& U_;
112 
113  //- Name of the cloud
114  word cloudName_;
115 
116  //- The cloud
117  autoPtr<parcelCloud> cloudPtr_;
118 
119 
120 public:
121 
122  //- Runtime type information
123  TypeName("particles");
124 
125 
126  // Constructors
127 
128  //- Construct for given objectRegistry and dictionary.
129  // Allow the possibility to load fields from files
130  particles
131  (
132  const word& name,
133  const Time& runTime,
134  const dictionary& dict
135  );
136 
137  //- Disallow default bitwise copy construction
138  particles(const particles&) = delete;
139 
140 
141  //- Destructor
142  virtual ~particles();
143 
144 
145  // Member Functions
146 
147  //- Read the controls
148  virtual bool read(const dictionary&);
149 
150  //- Return the list of fields required
151  virtual wordList fields() const
152  {
153  return wordList::null();
154  }
155 
156  //- Track the cloud
157  virtual bool execute();
158 
159  //- Write the cloud
160  virtual bool write();
161 
162 
163  // Member Operators
164 
165  //- Disallow default bitwise assignment
166  void operator==(const particles&) = delete;
167 };
168 
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 } // End namespace functionObjects
173 } // End namespace Foam
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 #endif
178 
179 // ************************************************************************* //
Generic GeometricField class.
static const List< word > & null()
Return a null List.
Definition: ListI.H:118
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
const word & name() const
Return the name of this functionObject.
This functionObject tracks a particle cloud in the specified velocity field of an incompressible flow...
Definition: particles.H:111
virtual wordList fields() const
Return the list of fields required.
Definition: particles.H:170
virtual ~particles()
Destructor.
Definition: particles.C:115
virtual bool execute()
Track the cloud.
Definition: particles.C:132
virtual bool write()
Write the cloud.
Definition: particles.C:142
TypeName("particles")
Runtime type information.
particles(const word &name, const Time &runTime, const dictionary &dict)
Construct for given objectRegistry and dictionary.
Definition: particles.C:50
virtual bool read(const dictionary &)
Read the controls.
Definition: particles.C:122
void operator==(const particles &)=delete
Disallow default bitwise assignment.
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
UniformDimensionedField< vector > uniformDimensionedVectorField
VolField< scalar > volScalarField
Definition: volFieldsFwd.H:61
dictionary dict