CollidingCloud.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 | Copyright (C) 2011-2016 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  // Private Member Functions
88 
89  //- Disallow default bitwise copy construct
91 
92  //- Disallow default bitwise assignment
93  void operator=(const CollidingCloud&);
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 TrackData>
121  void moveCollide(TrackData& td, const scalar deltaT);
122 
123  //- Reset state of cloud
125 
126 
127 public:
128 
129  // Constructors
130 
131  //- Construct given carrier gas fields
133  (
134  const word& cloudName,
135  const volScalarField& rho,
136  const volVectorField& U,
137  const volScalarField& mu,
138  const dimensionedVector& g,
139  bool readFields = true
140  );
141 
142  //- Copy constructor with new name
144  (
146  const word& name
147  );
148 
149  //- Copy constructor with new name - creates bare cloud
151  (
152  const fvMesh& mesh,
153  const word& name,
155  );
156 
157  //- Construct and return clone based on (this) with new name
158  virtual autoPtr<Cloud<parcelType>> clone(const word& name)
159  {
161  (
162  new CollidingCloud(*this, name)
163  );
164  }
165 
166  //- Construct and return bare clone based on (this) with new name
167  virtual autoPtr<Cloud<parcelType>> cloneBare(const word& name) const
168  {
170  (
171  new CollidingCloud(this->mesh(), name, *this)
172  );
173  }
174 
175 
176  //- Destructor
177  virtual ~CollidingCloud();
178 
179 
180  // Member Functions
181 
182  // Access
183 
184  //- Return a reference to the cloud copy
185  inline const CollidingCloud& cloudCopy() const;
186 
187  //- Return the constant properties
188  inline const typename parcelType::constantProperties&
189  constProps() const;
190 
191 
192  //- If the collision model controls the wall interaction,
193  // then the wall impact distance should be zero.
194  // Otherwise, it should be allowed to be the value from
195  // the Parcel.
196  virtual bool hasWallImpactDistance() const;
197 
198 
199  // Sub-models
200 
201  //- Return const access to the collision model
203  collision() const;
204 
205  //- Return reference to the collision model
207  collision();
208 
209  // Check
210 
211  //- Total rotational kinetic energy in the system
212  inline scalar rotationalKineticEnergyOfSystem() const;
213 
214 
215  // Cloud evolution functions
216 
217  //- Store the current cloud state
218  void storeState();
219 
220  //- Reset the current cloud to the previously stored state
221  void restoreState();
222 
223  //- Evolve the cloud
224  void evolve();
225 
226  //- Particle motion
227  template<class TrackData>
228  void motion(TrackData& td);
229 
230 
231  // I-O
232 
233  //- Print cloud information
234  void info();
235 };
236 
237 
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 
240 } // End namespace Foam
241 
242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 
244 #include "CollidingCloudI.H"
245 
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 
248 #ifdef NoRepository
249  #include "CollidingCloud.C"
250 #endif
251 
252 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
253 
254 #endif
255 
256 // ************************************************************************* //
ParcelType particleType
Definition: Cloud.H:114
void cloudReset(CollidingCloud< CloudType > &c)
Reset state of cloud.
U
Definition: pEqn.H:83
scalar rotationalKineticEnergyOfSystem() const
Total rotational kinetic energy in the system.
virtual bool hasWallImpactDistance() const
If the collision model controls the wall interaction,.
void evolve()
Evolve the cloud.
const CollisionModel< CollidingCloud< CloudType > > & collision() const
Return const access to the collision model.
virtual autoPtr< Cloud< parcelType > > cloneBare(const word &name) const
Construct and return bare clone based on (this) with new name.
const parcelType::constantProperties & constProps() const
Return the constant properties.
void moveCollide(TrackData &td, const scalar deltaT)
Move-collide particles.
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.
A class for handling words, derived from string.
Definition: word.H:59
Foam::autoPtr< IOobject > clone() const
Clone.
Definition: IOobject.H:239
Templated collision model class.
Adds coolisions to kinematic clouds.
void motion(TrackData &td)
Particle motion.
const dimensionedVector & g
virtual void readFields()
Read the field data for the cloud of particles. Dummy at.
const dimensionedScalar mu
Atomic mass unit.
void restoreState()
Reset the current cloud to the previously stored state.
void info()
Print cloud information.
const fvMesh & mesh() const
Return refernce to the mesh.
Definition: DSMCCloudI.H:41
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.
const word & cloudName() const
Return the cloud type.
Definition: DSMCCloudI.H:34
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:53
void setModels()
Set cloud sub-models.
virtual ~CollidingCloud()
Destructor.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
autoPtr< CollisionModel< CollidingCloud< CloudType > > > collisionModel_
Collision model.
void storeState()
Store the current cloud state.
const word & name() const
Return name.
Definition: IOobject.H:260
Namespace for OpenFOAM.
const CollidingCloud & cloudCopy() const
Return a reference to the cloud copy.