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