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-2021 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  //- Move-collide particles
120  template<class TrackCloudType>
121  void moveCollide
122  (
123  TrackCloudType& cloud,
124  typename parcelType::trackingData& td,
125  const scalar deltaT
126  );
127 
128  //- Reset state of cloud
130 
131 
132 public:
133 
134  // Constructors
135 
136  //- Construct given carrier fields
138  (
139  const word& cloudName,
140  const volScalarField& rho,
141  const volVectorField& U,
142  const volScalarField& mu,
143  const dimensionedVector& g,
144  const bool readFields = true
145  );
146 
147  //- Construct given carrier fields and thermo
149  (
150  const word& cloudName,
151  const volScalarField& rho,
152  const volVectorField& U,
153  const dimensionedVector& g,
154  const fluidThermo& carrierThermo,
155  const bool readFields = true
156  );
157 
158  //- Copy constructor with new name
160  (
162  const word& name
163  );
164 
165  //- Copy constructor with new name - creates bare cloud
167  (
168  const fvMesh& mesh,
169  const word& name,
171  );
172 
173  //- Disallow default bitwise copy construction
174  CollidingCloud(const CollidingCloud&) = delete;
175 
176  //- Construct and return clone based on (this) with new name
177  virtual autoPtr<Cloud<parcelType>> clone(const word& name)
178  {
180  (
181  new CollidingCloud(*this, name)
182  );
183  }
184 
185  //- Construct and return bare clone based on (this) with new name
186  virtual autoPtr<Cloud<parcelType>> cloneBare(const word& name) const
187  {
189  (
190  new CollidingCloud(this->mesh(), name, *this)
191  );
192  }
193 
194 
195  //- Destructor
196  virtual ~CollidingCloud();
197 
198 
199  // Member Functions
200 
201  // Access
202 
203  //- Return a reference to the cloud copy
204  inline const CollidingCloud& cloudCopy() const;
205 
206  //- Return the constant properties
207  inline const typename parcelType::constantProperties&
208  constProps() const;
209 
210 
211  // Sub-models
212 
213  //- Return const access to the collision model
215  collision() const;
216 
217  //- Return reference to the collision model
219  collision();
220 
221  // Check
222 
223  //- Total rotational kinetic energy in the system
224  inline scalar rotationalKineticEnergyOfSystem() const;
225 
226 
227  // Cloud evolution functions
228 
229  //- Store the current cloud state
230  void storeState();
231 
232  //- Reset the current cloud to the previously stored state
233  void restoreState();
234 
235  //- Evolve the cloud
236  void evolve();
237 
238  //- Particle motion
239  template<class TrackCloudType>
240  void motion
241  (
242  TrackCloudType& cloud,
243  typename parcelType::trackingData& td
244  );
245 
246 
247  // I-O
248 
249  //- Print cloud information
250  void info();
251 
252 
253  // Member Operators
254 
255  //- Disallow default bitwise assignment
256  void operator=(const CollidingCloud&) = delete;
257 };
258 
259 
260 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
261 
262 } // End namespace Foam
263 
264 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265 
266 #include "CollidingCloudI.H"
267 
268 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
269 
270 #ifdef NoRepository
271  #include "CollidingCloud.C"
272 #endif
273 
274 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
275 
276 #endif
277 
278 // ************************************************************************* //
ParcelType particleType
Definition: Cloud.H:105
TemplateName(blendedSchemeBase)
void cloudReset(CollidingCloud< CloudType > &c)
Reset state of cloud.
autoPtr< IOobject > clone() const
Clone.
Definition: IOobject.H:276
const word & name() const
Return name.
Definition: IOobject.H:303
CollidingCloud(const word &cloudName, const volScalarField &rho, const volVectorField &U, const volScalarField &mu, const dimensionedVector &g, const bool readFields=true)
Construct given carrier fields.
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
void evolve()
Evolve the cloud.
const word & cloudName() const
Return the cloud type.
Definition: DSMCCloudI.H:34
const CollisionModel< CollidingCloud< CloudType > > & collision() const
Return const access to the collision model.
CloudType cloudType
Type of cloud this cloud was instantiated for.
const dimensionedScalar c
Speed of light in a vacuum.
CloudType::particleType parcelType
Type of parcel the cloud was instantiated for.
CollidingCloud< CloudType > collidingCloudType
Convenience typedef for this cloud type.
void operator=(const CollidingCloud &)=delete
Disallow default bitwise assignment.
A class for handling words, derived from string.
Definition: word.H:59
void motion(TrackCloudType &cloud, typename parcelType::trackingData &td)
Particle motion.
Base-class for fluid thermodynamic properties.
Definition: fluidThermo.H:53
void moveCollide(TrackCloudType &cloud, typename parcelType::trackingData &td, const scalar deltaT)
Move-collide particles.
A cloud is a collection of lagrangian particles.
Definition: cloud.H:51
Templated collision model class.
Adds collisions to clouds.
const parcelType::constantProperties & constProps() const
Return the constant properties.
const dimensionedScalar mu
Atomic mass unit.
void restoreState()
Reset the current cloud to the previously stored state.
const fvMesh & mesh() const
Return references to the mesh.
Definition: DSMCCloudI.H:41
Forward declarations of fvMatrix specialisations.
void info()
Print cloud information.
U
Definition: pEqn.H:72
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
parcelType::constantProperties constProps_
Thermo parcel constant properties.
virtual autoPtr< Cloud< parcelType > > cloneBare(const word &name) const
Construct and return bare clone based on (this) with new name.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
void setModels()
Set cloud sub-models.
virtual ~CollidingCloud()
Destructor.
const dimensionedVector & g
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:75
const CollidingCloud & cloudCopy() const
Return a reference to the cloud copy.
autoPtr< CollisionModel< CollidingCloud< CloudType > > > collisionModel_
Collision model.
void storeState()
Store the current cloud state.
scalar rotationalKineticEnergyOfSystem() const
Total rotational kinetic energy in the system.
Namespace for OpenFOAM.