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-2024 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
169  {
171  (
172  new CollidingCloud(*this, name)
173  );
174  }
175 
176  //- Construct and return bare clone based on (this) with new name
178  (
179  const word& name
180  ) const
181  {
183  (
184  new CollidingCloud(this->mesh(), name, *this)
185  );
186  }
187 
188 
189  //- Destructor
190  virtual ~CollidingCloud();
191 
192 
193  // Member Functions
194 
195  // Access
196 
197  //- Return a reference to the cloud copy
198  inline const CollidingCloud& cloudCopy() const;
199 
200  //- Return the constant properties
201  inline const typename parcelType::constantProperties&
202  constProps() const;
203 
204 
205  // Sub-models
206 
207  //- Return const access to the collision model
209  collision() const;
210 
211  //- Return reference to the collision model
213  collision();
214 
215  // Check
216 
217  //- Total rotational kinetic energy in the system
218  inline scalar rotationalKineticEnergyOfSystem() const;
219 
220 
221  // Cloud evolution functions
222 
223  //- Store the current cloud state
224  void storeState();
225 
226  //- Reset the current cloud to the previously stored state
227  void restoreState();
228 
229  //- Evolve the cloud
230  void evolve();
231 
232  //- Particle motion
233  template<class TrackCloudType>
234  void motion
235  (
236  TrackCloudType& cloud,
237  typename parcelType::trackingData& td
238  );
239 
240 
241  // I-O
242 
243  //- Print cloud information
244  void info();
245 
246 
247  // Member Operators
248 
249  //- Disallow default bitwise assignment
250  void operator=(const CollidingCloud&) = delete;
251 };
252 
253 
254 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
255 
256 } // End namespace Foam
257 
258 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
259 
260 #include "CollidingCloudI.H"
261 
262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263 
264 #ifdef NoRepository
265  #include "CollidingCloud.C"
266 #endif
267 
268 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
269 
270 #endif
271 
272 // ************************************************************************* //
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.
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.
virtual autoPtr< lagrangian::Cloud< parcelType > > cloneBare(const word &name) const
Construct and return bare clone based on (this) with new name.
Templated collision model class.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:80
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:280
const word & name() const
Return name.
Definition: IOobject.H:307
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Base class for clouds. Provides a basic evolution algorithm, models, and a database for caching deriv...
Definition: cloud.H:63
Base-class for fluid thermodynamic properties.
Definition: fluidThermo.H:56
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:96
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)