CollidingCloud.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) 2011-2022 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::CollidingCloud
26 
27 Description
28  Adds collisions to clouds
29 
30 SourceFiles
31  CollidingCloudI.H
32  CollidingCloud.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef CollidingCloud_H
37 #define CollidingCloud_H
38 
39 #include "volFieldsFwd.H"
40 #include "fvMatricesFwd.H"
41 #include "dimensionedTypes.H"
42 #include "fvMesh.H"
43 #include "fluidThermo.H"
44 #include "Cloud.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 // Forward declaration of classes
52 
53 template<class CloudType>
54 class CollisionModel;
55 
56 
57 /*---------------------------------------------------------------------------*\
58  Class CollidingCloudName Declaration
59 \*---------------------------------------------------------------------------*/
60 
62 
63 
64 /*---------------------------------------------------------------------------*\
65  Class CollidingCloud Declaration
66 \*---------------------------------------------------------------------------*/
67 
68 template<class CloudType>
69 class CollidingCloud
70 :
71  public CloudType,
72  public CollidingCloudName
73 {
74 public:
75 
76  // Public Typedefs
77 
78  //- Type of cloud this cloud was instantiated for
79  typedef CloudType cloudType;
80 
81  //- Type of parcel the cloud was instantiated for
82  typedef typename CloudType::particleType parcelType;
83 
84  //- Convenience typedef for this cloud type
86 
87 
88 private:
89 
90  // Private Data
91 
92  //- Cloud copy pointer
93  autoPtr<CollidingCloud<CloudType>> cloudCopyPtr_;
94 
95 
96 protected:
97 
98  // Protected data
99 
100  //- Thermo parcel constant properties
101  typename parcelType::constantProperties constProps_;
102 
103 
104  // References to the cloud sub-models
105 
106  //- Collision model
109 
110 
111  // Initialisation
112 
113  //- Set cloud sub-models
114  void setModels();
115 
116 
117  // Cloud evolution functions
118 
119  //- Reset state of cloud
121 
122 
123 public:
124 
125  // Constructors
126 
127  //- Construct given carrier fields
129  (
130  const word& cloudName,
131  const volScalarField& rho,
132  const volVectorField& U,
133  const volScalarField& mu,
134  const dimensionedVector& g,
135  const bool readFields = true
136  );
137 
138  //- Construct given carrier fields and thermo
140  (
141  const word& cloudName,
142  const volScalarField& rho,
143  const volVectorField& U,
144  const dimensionedVector& g,
145  const fluidThermo& carrierThermo,
146  const bool readFields = true
147  );
148 
149  //- Copy constructor with new name
151  (
153  const word& name
154  );
155 
156  //- Copy constructor with new name - creates bare cloud
158  (
159  const fvMesh& mesh,
160  const word& name,
162  );
163 
164  //- Disallow default bitwise copy construction
165  CollidingCloud(const CollidingCloud&) = delete;
166 
167  //- Construct and return clone based on (this) with new name
168  virtual autoPtr<Cloud<parcelType>> clone(const word& name)
169  {
171  (
172  new CollidingCloud(*this, name)
173  );
174  }
175 
176  //- Construct and return bare clone based on (this) with new name
177  virtual autoPtr<Cloud<parcelType>> cloneBare(const word& name) const
178  {
180  (
181  new CollidingCloud(this->mesh(), name, *this)
182  );
183  }
184 
185 
186  //- Destructor
187  virtual ~CollidingCloud();
188 
189 
190  // Member Functions
191 
192  // Access
193 
194  //- Return a reference to the cloud copy
195  inline const CollidingCloud& cloudCopy() const;
196 
197  //- Return the constant properties
198  inline const typename parcelType::constantProperties&
199  constProps() const;
200 
201 
202  // Sub-models
203 
204  //- Return const access to the collision model
206  collision() const;
207 
208  //- Return reference to the collision model
210  collision();
211 
212  // Check
213 
214  //- Total rotational kinetic energy in the system
215  inline scalar rotationalKineticEnergyOfSystem() const;
216 
217 
218  // Cloud evolution functions
219 
220  //- Store the current cloud state
221  void storeState();
222 
223  //- Reset the current cloud to the previously stored state
224  void restoreState();
225 
226  //- Evolve the cloud
227  void evolve();
228 
229  //- Particle motion
230  template<class TrackCloudType>
231  void motion
232  (
233  TrackCloudType& cloud,
234  typename parcelType::trackingData& td
235  );
236 
237 
238  // I-O
239 
240  //- Print cloud information
241  void info();
242 
243 
244  // Member Operators
245 
246  //- Disallow default bitwise assignment
247  void operator=(const CollidingCloud&) = delete;
248 };
249 
250 
251 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252 
253 } // End namespace Foam
254 
255 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256 
257 #include "CollidingCloudI.H"
258 
259 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
260 
261 #ifdef NoRepository
262  #include "CollidingCloud.C"
263 #endif
264 
265 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
266 
267 #endif
268 
269 // ************************************************************************* //
ParcelType particleType
Definition: Cloud.H:128
Adds collisions to clouds.
void operator=(const CollidingCloud &)=delete
Disallow default bitwise assignment.
const parcelType::constantProperties & constProps() const
Return the constant properties.
void setModels()
Set cloud sub-models.
void motion(TrackCloudType &cloud, typename parcelType::trackingData &td)
Particle motion.
void storeState()
Store the current cloud state.
autoPtr< CollisionModel< CollidingCloud< CloudType > > > collisionModel_
Collision model.
scalar rotationalKineticEnergyOfSystem() const
Total rotational kinetic energy in the system.
void cloudReset(CollidingCloud< CloudType > &c)
Reset state of cloud.
virtual autoPtr< Cloud< parcelType > > cloneBare(const word &name) const
Construct and return bare clone based on (this) with new name.
CloudType::particleType parcelType
Type of parcel the cloud was instantiated for.
const CollidingCloud & cloudCopy() const
Return a reference to the cloud copy.
CollidingCloud(const word &cloudName, const volScalarField &rho, const volVectorField &U, const volScalarField &mu, const dimensionedVector &g, const bool readFields=true)
Construct given carrier fields.
CloudType cloudType
Type of cloud this cloud was instantiated for.
void evolve()
Evolve the cloud.
parcelType::constantProperties constProps_
Thermo parcel constant properties.
CollidingCloud< CloudType > collidingCloudType
Convenience typedef for this cloud type.
void info()
Print cloud information.
void restoreState()
Reset the current cloud to the previously stored state.
virtual ~CollidingCloud()
Destructor.
const CollisionModel< CollidingCloud< CloudType > > & collision() const
Return const access to the collision model.
Templated collision model class.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:79
const word & cloudName() const
Return the cloud type.
Definition: DSMCCloudI.H:34
const fvMesh & mesh() const
Return references to the mesh.
Definition: DSMCCloudI.H:41
Generic GeometricField class.
autoPtr< IOobject > clone() const
Clone.
Definition: IOobject.H:283
const word & name() const
Return name.
Definition: IOobject.H:310
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 cloud is a collection of lagrangian particles.
Definition: cloud.H:55
Base-class for fluid thermodynamic properties.
Definition: fluidThermo.H:57
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
A class for handling words, derived from string.
Definition: word.H:62
Forward declarations of fvMatrix specialisations.
U
Definition: pEqn.H:72
const dimensionedScalar mu
Atomic mass unit.
const dimensionedScalar c
Speed of light in a vacuum.
Namespace for OpenFOAM.
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const HashSet< word > &selectedFields, LIFOStack< regIOobject * > &storedObjects)
Read the selected GeometricFields of the specified type.
Definition: ReadFields.C:244
TemplateName(FvFaceCellWave)