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-2022 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  //- Reset state of cloud
128 
129 
130 public:
131 
132  // Constructors
133 
134  //- Construct given carrier fields
135  MPPICCloud
136  (
137  const word& cloudName,
138  const volScalarField& rho,
139  const volVectorField& U,
140  const volScalarField& mu,
141  const dimensionedVector& g,
142  const bool readFields = true
143  );
144 
145  //- Construct given carrier fields and thermo
146  MPPICCloud
147  (
148  const word& cloudName,
149  const volScalarField& rho,
150  const volVectorField& U,
151  const dimensionedVector& g,
152  const fluidThermo& carrierThermo,
153  const bool readFields = true
154  );
155 
156  //- Copy constructor with new name
157  MPPICCloud
158  (
160  const word& name
161  );
162 
163  //- Copy constructor with new name - creates bare cloud
164  MPPICCloud
165  (
166  const fvMesh& mesh,
167  const word& name,
168  const MPPICCloud<CloudType>& c
169  );
170 
171  //- Disallow default bitwise copy construction
172  MPPICCloud(const MPPICCloud&) = delete;
173 
174  //- Construct and return clone based on (this) with new name
175  virtual autoPtr<Cloud<parcelType>> clone(const word& name)
176  {
178  (
179  new MPPICCloud(*this, name)
180  );
181  }
182 
183  //- Construct and return bare clone based on (this) with new name
184  virtual autoPtr<Cloud<parcelType>> cloneBare(const word& name) const
185  {
187  (
188  new MPPICCloud(this->mesh(), name, *this)
189  );
190  }
191 
192 
193  //- Destructor
194  virtual ~MPPICCloud();
195 
196 
197  // Member Functions
198 
199  // Access
200 
201  //- Return a reference to the cloud copy
202  inline const MPPICCloud& cloudCopy() const;
203 
204  //- Return const access to the packing model
206  packingModel() const;
207 
208  //- Return a reference to the packing model
210 
211  //- Return condt access to the damping model
213  dampingModel() const;
214 
215  //- Return a reference to the damping model
217 
218  //- Return condt access to the isotropy model
220  isotropyModel() const;
221 
222  //- Return a reference to the isotropy model
224 
225 
226  // Cloud evolution functions
227 
228  //- Store the current cloud state
229  void storeState();
230 
231  //- Reset the current cloud to the previously stored state
232  void restoreState();
233 
234  //- Evolve the cloud
235  void evolve();
236 
237  //- Particle motion
238  template<class TrackCloudType>
239  void motion
240  (
241  TrackCloudType& cloud,
242  typename parcelType::trackingData& td
243  );
244 
245 
246  //- I-O
247 
248  //- Print cloud information
249  void info();
250 
251 
252  // Member Operators
253 
254  //- Disallow default bitwise assignment
255  void operator=(const MPPICCloud&) = delete;
256 };
257 
258 
259 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
260 
261 } // End namespace Foam
262 
263 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
264 
265 #include "MPPICCloudI.H"
266 
267 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
268 
269 #ifdef NoRepository
270  #include "MPPICCloud.C"
271 #endif
272 
273 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
274 
275 #endif
276 
277 // ************************************************************************* //
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:79
const word & cloudName() const
Return the cloud type.
Definition: DSMCCloudI.H:34
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:221
const fvMesh & mesh() const
Return references to the mesh.
Definition: DSMCCloudI.H:41
Base class for collisional damping models.
Definition: DampingModel.H:60
Generic GeometricField class.
autoPtr< IOobject > clone() const
Clone.
Definition: IOobject.H:283
const word & name() const
Return name.
Definition: IOobject.H:310
Base class for collisional return-to-isotropy models.
Definition: IsotropyModel.H:60
Adds MPPIC modelling to clouds.
Definition: MPPICCloud.H:78
const DampingModel< MPPICCloud< CloudType > > & dampingModel() const
Return condt access to the damping model.
Definition: MPPICCloudI.H:54
const IsotropyModel< MPPICCloud< CloudType > > & isotropyModel() const
Return condt access to the isotropy model.
Definition: MPPICCloudI.H:70
void setModels()
Set cloud sub-models.
Definition: MPPICCloud.C:36
void motion(TrackCloudType &cloud, typename parcelType::trackingData &td)
Particle motion.
Definition: MPPICCloud.C:201
void storeState()
Store the current cloud state.
Definition: MPPICCloud.C:165
virtual autoPtr< Cloud< parcelType > > cloneBare(const word &name) const
Construct and return bare clone based on (this) with new name.
Definition: MPPICCloud.H:183
autoPtr< IsotropyModel< MPPICCloud< CloudType > > > isotropyModel_
Exchange model.
Definition: MPPICCloud.H:117
MPPICCloud< CloudType > MPPICCloudType
Convenience typedef for this cloud type.
Definition: MPPICCloud.H:90
virtual ~MPPICCloud()
Destructor.
Definition: MPPICCloud.C:158
void operator=(const MPPICCloud &)=delete
Disallow default bitwise assignment.
const MPPICCloud & cloudCopy() const
Return a reference to the cloud copy.
Definition: MPPICCloudI.H:30
CloudType cloudType
Type of cloud this cloud was instantiated for.
Definition: MPPICCloud.H:84
void evolve()
Evolve the cloud.
Definition: MPPICCloud.C:187
autoPtr< PackingModel< MPPICCloud< CloudType > > > packingModel_
Packing model.
Definition: MPPICCloud.H:109
void info()
I-O.
Definition: MPPICCloud.C:308
void restoreState()
Reset the current cloud to the previously stored state.
Definition: MPPICCloud.C:178
void cloudReset(MPPICCloud< CloudType > &c)
Reset state of cloud.
Definition: MPPICCloud.C:66
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:80
CloudType::parcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: MPPICCloud.H:87
const PackingModel< MPPICCloud< CloudType > > & packingModel() const
Return const access to the packing model.
Definition: MPPICCloudI.H:38
autoPtr< DampingModel< MPPICCloud< CloudType > > > dampingModel_
Damping model.
Definition: MPPICCloud.H:113
Base class for packing models.
Definition: PackingModel.H:65
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A cloud is a collection of lagrangian particles.
Definition: cloud.H:55
Base-class for fluid thermodynamic properties.
Definition: fluidThermo.H:57
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
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)