MPPICCloud.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) 2013-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::MPPICCloud
26 
27 Description
28  Adds MPPIC modelling to kinematic clouds
29 
30 SourceFiles
31  MPPICCloudI.H
32  MPPICCloud.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef MPPICCloud_H
37 #define MPPICCloud_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 PackingModel;
55 
56 template<class CloudType>
57 class DampingModel;
58 
59 template<class CloudType>
60 class IsotropyModel;
61 
62 /*---------------------------------------------------------------------------*\
63  Class MPPICCloud Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 template<class CloudType>
67 class MPPICCloud
68 :
69  public CloudType
70 {
71 public:
72 
73  // Public Typedefs
74 
75  //- Type of cloud this cloud was instantiated for
76  typedef CloudType cloudType;
77 
78  //- Type of parcel the cloud was instantiated for
79  typedef typename CloudType::parcelType parcelType;
80 
81  //- Convenience typedef for this cloud type
83 
84 
85 private:
86 
87  // Private Data
88 
89  //- Cloud copy pointer
90  autoPtr<MPPICCloud<CloudType>> cloudCopyPtr_;
91 
92 
93 protected:
94 
95  // Protected data
96 
97  // References to the cloud sub-models
98 
99  //- Packing model
101 
102  //- Damping model
105 
106  //- Exchange model
109 
110 
111  // Initialisation
112 
113  //- Set cloud sub-models
114  void setModels();
115 
116 
117 public:
118 
119  // Constructors
120 
121  //- Construct given carrier gas fields
122  MPPICCloud
123  (
124  const word& cloudName,
125  const volScalarField& rho,
126  const volVectorField& U,
127  const volScalarField& mu,
128  const dimensionedVector& g,
129  bool readFields = true
130  );
131 
132  //- Copy constructor with new name
133  MPPICCloud
134  (
136  const word& name
137  );
138 
139  //- Copy constructor with new name - creates bare cloud
140  MPPICCloud
141  (
142  const fvMesh& mesh,
143  const word& name,
144  const MPPICCloud<CloudType>& c
145  );
146 
147  //- Disallow default bitwise copy construction
148  MPPICCloud(const MPPICCloud&) = delete;
149 
150  //- Construct and return clone based on (this) with new name
151  virtual autoPtr<Cloud<parcelType>> clone(const word& name)
152  {
154  (
155  new MPPICCloud(*this, name)
156  );
157  }
158 
159  //- Construct and return bare clone based on (this) with new name
160  virtual autoPtr<Cloud<parcelType>> cloneBare(const word& name) const
161  {
163  (
164  new MPPICCloud(this->mesh(), name, *this)
165  );
166  }
167 
168 
169  //- Destructor
170  virtual ~MPPICCloud();
171 
172 
173  // Member Functions
174 
175  // Access
176 
177  //- Return a reference to the cloud copy
178  inline const MPPICCloud& cloudCopy() const;
179 
180  //- Return const access to the packing model
182  packingModel() const;
183 
184  //- Return a reference to the packing model
186 
187  //- Return condt access to the damping model
189  dampingModel() const;
190 
191  //- Return a reference to the damping model
193 
194  //- Return condt access to the isotropy model
196  isotropyModel() const;
197 
198  //- Return a reference to the isotropy model
200 
201 
202  // Cloud evolution functions
203 
204  //- Store the current cloud state
205  void storeState();
206 
207  //- Reset the current cloud to the previously stored state
208  void restoreState();
209 
210  //- Evolve the cloud
211  void evolve();
212 
213  //- Particle motion
214  template<class TrackCloudType>
215  void motion
216  (
217  TrackCloudType& cloud,
218  typename parcelType::trackingData& td
219  );
220 
221 
222  //- I-O
223 
224  //- Print cloud information
225  void info();
226 
227 
228  // Member Operators
229 
230  //- Disallow default bitwise assignment
231  void operator=(const MPPICCloud&) = delete;
232 };
233 
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 } // End namespace Foam
238 
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 
241 #include "MPPICCloudI.H"
242 
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244 
245 #ifdef NoRepository
246  #include "MPPICCloud.C"
247 #endif
248 
249 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250 
251 #endif
252 
253 // ************************************************************************* //
virtual ~MPPICCloud()
Destructor.
Definition: MPPICCloud.C:135
void operator=(const MPPICCloud &)=delete
Disallow default bitwise assignment.
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
const word & cloudName() const
Return the cloud type.
Definition: DSMCCloudI.H:34
virtual autoPtr< Cloud< parcelType > > cloneBare(const word &name) const
Construct and return bare clone based on (this) with new name.
Definition: MPPICCloud.H:159
void storeState()
Store the current cloud state.
Definition: MPPICCloud.C:142
CloudType::parcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: MPPICCloud.H:78
Base class for packing models.
Definition: MPPICCloud.H:53
const IsotropyModel< MPPICCloud< CloudType > > & isotropyModel() const
Return condt access to the isotropy model.
Definition: MPPICCloudI.H:70
autoPtr< DampingModel< MPPICCloud< CloudType > > > dampingModel_
Damping model.
Definition: MPPICCloud.H:103
const MPPICCloud & cloudCopy() const
Return a reference to the cloud copy.
Definition: MPPICCloudI.H:30
void motion(TrackCloudType &cloud, typename parcelType::trackingData &td)
Particle motion.
Definition: MPPICCloud.C:177
MPPICCloud(const word &cloudName, const volScalarField &rho, const volVectorField &U, const volScalarField &mu, const dimensionedVector &g, bool readFields=true)
Construct given carrier gas fields.
Definition: MPPICCloud.C:69
void info()
I-O.
Definition: MPPICCloud.C:278
autoPtr< IsotropyModel< MPPICCloud< CloudType > > > isotropyModel_
Exchange model.
Definition: MPPICCloud.H:107
MPPICCloud< CloudType > MPPICCloudType
Convenience typedef for this cloud type.
Definition: MPPICCloud.H:81
A class for handling words, derived from string.
Definition: word.H:59
A cloud is a collection of lagrangian particles.
Definition: cloud.H:51
CloudType cloudType
Type of cloud this cloud was instantiated for.
Definition: MPPICCloud.H:75
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:215
Adds MPPIC modelling to kinematic clouds.
Definition: MPPICCloud.H:66
const PackingModel< MPPICCloud< CloudType > > & packingModel() const
Return const access to the packing model.
Definition: MPPICCloudI.H:38
const DampingModel< MPPICCloud< CloudType > > & dampingModel() const
Return condt access to the damping model.
Definition: MPPICCloudI.H:54
const dimensionedScalar mu
Atomic mass unit.
Base class for collisional return-to-isotropy models.
Definition: MPPICCloud.H:59
const fvMesh & mesh() const
Return references to the mesh.
Definition: DSMCCloudI.H:41
U
Definition: pEqn.H:72
void setModels()
Set cloud sub-models.
Definition: MPPICCloud.C:36
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
const dimensionedScalar c
Speed of light in a vacuum.
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 evolve()
Evolve the cloud.
Definition: MPPICCloud.C:163
const dimensionedVector & g
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:69
Base class for collisional damping models.
Definition: MPPICCloud.H:56
autoPtr< PackingModel< MPPICCloud< CloudType > > > packingModel_
Packing model.
Definition: MPPICCloud.H:99
void restoreState()
Reset the current cloud to the previously stored state.
Definition: MPPICCloud.C:155
Namespace for OpenFOAM.