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-2019 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 coolisions to kinematic clouds
29 
30 SourceFiles
31  CollidingCloudI.H
32  CollidingCloud.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef CollidingCloud_H
37 #define CollidingCloud_H
38 
39 #include "particle.H"
40 #include "Cloud.H"
41 #include "IOdictionary.H"
42 #include "autoPtr.H"
43 #include "fvMesh.H"
44 #include "volFields.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  Class CollidingCloud Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 template<class CloudType>
61 class CollidingCloud
62 :
63  public CloudType
64 {
65 public:
66 
67  // Public Typedefs
68 
69  //- Type of cloud this cloud was instantiated for
70  typedef CloudType cloudType;
71 
72  //- Type of parcel the cloud was instantiated for
73  typedef typename CloudType::particleType parcelType;
74 
75  //- Convenience typedef for this cloud type
77 
78 
79 private:
80 
81  // Private Data
82 
83  //- Cloud copy pointer
84  autoPtr<CollidingCloud<CloudType>> cloudCopyPtr_;
85 
86 
87 protected:
88 
89  // Protected data
90 
91  //- Thermo parcel constant properties
92  typename parcelType::constantProperties constProps_;
93 
94 
95  // References to the cloud sub-models
96 
97  //- Collision model
100 
101 
102  // Initialisation
103 
104  //- Set cloud sub-models
105  void setModels();
106 
107 
108  // Cloud evolution functions
109 
110  //- Move-collide particles
111  template<class TrackCloudType>
112  void moveCollide
113  (
114  TrackCloudType& cloud,
115  typename parcelType::trackingData& td,
116  const scalar deltaT
117  );
118 
119  //- Reset state of cloud
121 
122 
123 public:
124 
125  // Constructors
126 
127  //- Construct given carrier gas fields
129  (
130  const word& cloudName,
131  const volScalarField& rho,
132  const volVectorField& U,
133  const volScalarField& mu,
134  const dimensionedVector& g,
135  bool readFields = true
136  );
137 
138  //- Copy constructor with new name
140  (
142  const word& name
143  );
144 
145  //- Copy constructor with new name - creates bare cloud
147  (
148  const fvMesh& mesh,
149  const word& name,
151  );
152 
153  //- Disallow default bitwise copy construction
154  CollidingCloud(const CollidingCloud&) = delete;
155 
156  //- Construct and return clone based on (this) with new name
157  virtual autoPtr<Cloud<parcelType>> clone(const word& name)
158  {
160  (
161  new CollidingCloud(*this, name)
162  );
163  }
164 
165  //- Construct and return bare clone based on (this) with new name
166  virtual autoPtr<Cloud<parcelType>> cloneBare(const word& name) const
167  {
169  (
170  new CollidingCloud(this->mesh(), name, *this)
171  );
172  }
173 
174 
175  //- Destructor
176  virtual ~CollidingCloud();
177 
178 
179  // Member Functions
180 
181  // Access
182 
183  //- Return a reference to the cloud copy
184  inline const CollidingCloud& cloudCopy() const;
185 
186  //- Return the constant properties
187  inline const typename parcelType::constantProperties&
188  constProps() const;
189 
190 
191  // Sub-models
192 
193  //- Return const access to the collision model
195  collision() const;
196 
197  //- Return reference to the collision model
199  collision();
200 
201  // Check
202 
203  //- Total rotational kinetic energy in the system
204  inline scalar rotationalKineticEnergyOfSystem() const;
205 
206 
207  // Cloud evolution functions
208 
209  //- Store the current cloud state
210  void storeState();
211 
212  //- Reset the current cloud to the previously stored state
213  void restoreState();
214 
215  //- Evolve the cloud
216  void evolve();
217 
218  //- Particle motion
219  template<class TrackCloudType>
220  void motion
221  (
222  TrackCloudType& cloud,
223  typename parcelType::trackingData& td
224  );
225 
226 
227  // I-O
228 
229  //- Print cloud information
230  void info();
231 
232 
233  // Member Operators
234 
235  //- Disallow default bitwise assignment
236  void operator=(const CollidingCloud&) = delete;
237 };
238 
239 
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 
242 } // End namespace Foam
243 
244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 
246 #include "CollidingCloudI.H"
247 
248 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
249 
250 #ifdef NoRepository
251  #include "CollidingCloud.C"
252 #endif
253 
254 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
255 
256 #endif
257 
258 // ************************************************************************* //
ParcelType particleType
Definition: Cloud.H:105
void cloudReset(CollidingCloud< CloudType > &c)
Reset state of cloud.
autoPtr< IOobject > clone() const
Clone.
Definition: IOobject.H:268
const word & name() const
Return name.
Definition: IOobject.H:295
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.
CollidingCloud(const word &cloudName, const volScalarField &rho, const volVectorField &U, const volScalarField &mu, const dimensionedVector &g, bool readFields=true)
Construct given carrier gas fields.
CloudType cloudType
Type of cloud this cloud was instantiated for.
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.
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 coolisions to kinematic 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
void info()
Print cloud information.
U
Definition: pEqn.H:72
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
const dimensionedScalar c
Speed of light in a vacuum.
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:69
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.