DSMCCloudI.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "constants.H"
30 
31 using namespace Foam::constant;
32 using namespace Foam::constant::mathematical;
33 
34 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
35 
36 template<class ParcelType>
38 {
39  return cloudName_;
40 }
41 
42 
43 template<class ParcelType>
45 {
46  return mesh_;
47 }
48 
49 
50 template<class ParcelType>
51 inline const Foam::IOdictionary&
53 {
54  return particleProperties_;
55 }
56 
57 
58 template<class ParcelType>
59 inline const Foam::List<Foam::word>&
61 {
62  return typeIdList_;
63 }
64 
65 
66 template<class ParcelType>
67 inline Foam::scalar Foam::DSMCCloud<ParcelType>::nParticle() const
68 {
69  return nParticle_;
70 }
71 
72 
73 template<class ParcelType>
76 {
77  return cellOccupancy_;
78 }
79 
80 
81 template<class ParcelType>
83 {
84  return sigmaTcRMax_;
85 }
86 
87 
88 template<class ParcelType>
89 inline Foam::scalarField&
91 {
92  return collisionSelectionRemainder_;
93 }
94 
95 
96 template<class ParcelType>
99 {
100  return constProps_;
101 }
102 
103 
104 template<class ParcelType>
105 inline const typename ParcelType::constantProperties&
107 (
108  label typeId
109 ) const
110 {
111  if (typeId < 0 || typeId >= constProps_.size())
112  {
114  << "constantProperties for requested typeId index "
115  << typeId << " do not exist" << nl
116  << abort(FatalError);
117  }
118 
119  return constProps_[typeId];
120 }
121 
122 
123 template<class ParcelType>
125 {
126  return rndGen_;
127 }
128 
129 
130 template<class ParcelType>
131 inline Foam::volScalarField::Boundary&
133 {
134  return q_.boundaryFieldRef();
135 }
136 
137 
138 template<class ParcelType>
139 inline Foam::volVectorField::Boundary&
141 {
142  return fD_.boundaryFieldRef();
143 }
144 
145 
146 template<class ParcelType>
147 inline Foam::volScalarField::Boundary&
149 {
150  return rhoN_.boundaryFieldRef();
151 }
152 
153 
154 template<class ParcelType>
155 inline Foam::volScalarField::Boundary&
157 {
158  return rhoM_.boundaryFieldRef();
159 }
160 
161 
162 template<class ParcelType>
163 inline Foam::volScalarField::Boundary&
165 {
166  return linearKE_.boundaryFieldRef();
167 }
168 
169 
170 template<class ParcelType>
171 inline Foam::volScalarField::Boundary&
173 {
174  return internalE_.boundaryFieldRef();
175 }
176 
177 
178 template<class ParcelType>
179 inline Foam::volScalarField::Boundary&
181 {
182  return iDof_.boundaryFieldRef();
183 }
184 
185 
186 template<class ParcelType>
187 inline Foam::volVectorField::Boundary&
189 {
190  return momentum_.boundaryFieldRef();
191 }
192 
193 
194 template<class ParcelType>
195 inline const Foam::volScalarField&
197 {
198  return boundaryT_;
199 }
200 
201 
202 template<class ParcelType>
203 inline const Foam::volVectorField&
205 {
206  return boundaryU_;
207 }
208 
209 
210 template<class ParcelType>
213 {
214  return binaryCollisionModel_;
215 }
216 
217 
218 template<class ParcelType>
221 {
222  return *binaryCollisionModel_;
223 }
224 
225 
226 template<class ParcelType>
229 {
230  return *wallInteractionModel_;
231 }
232 
233 
234 template<class ParcelType>
237 {
238  return *wallInteractionModel_;
239 }
240 
241 
242 template<class ParcelType>
245 {
246  return *inflowBoundaryModel_;
247 }
248 
249 
250 template<class ParcelType>
253 {
254  return *inflowBoundaryModel_;
255 }
256 
257 
258 template<class ParcelType>
259 inline Foam::scalar Foam::DSMCCloud<ParcelType>::massInSystem() const
260 {
261  scalar sysMass = 0.0;
262 
263  for (const ParcelType& p : *this)
264  {
265  const typename ParcelType::constantProperties& cP = constProps
266  (
267  p.typeId()
268  );
269 
270  sysMass += cP.mass();
271  }
272 
273  return nParticle_*sysMass;
274 }
275 
276 
277 template<class ParcelType>
279 {
280  vector linearMomentum(Zero);
281 
282  for (const ParcelType& p : *this)
283  {
284  const typename ParcelType::constantProperties& cP = constProps
285  (
286  p.typeId()
287  );
288 
289  linearMomentum += cP.mass()*p.U();
290  }
291 
292  return nParticle_*linearMomentum;
293 }
294 
295 
296 template<class ParcelType>
297 inline Foam::scalar
299 {
300  scalar linearKineticEnergy = 0.0;
301 
302  for (const ParcelType& p : *this)
303  {
304  const typename ParcelType::constantProperties& cP = constProps
305  (
306  p.typeId()
307  );
308 
309  linearKineticEnergy += 0.5*cP.mass()*(p.U() & p.U());
310  }
311 
312  return nParticle_*linearKineticEnergy;
313 }
314 
315 
316 template<class ParcelType>
317 inline Foam::scalar
319 {
320  scalar internalEnergy = 0.0;
321 
322  for (const ParcelType& p : *this)
323  {
324  internalEnergy += p.Ei();
325  }
326 
327  return nParticle_*internalEnergy;
328 }
329 
330 
331 template<class ParcelType>
333 (
334  scalar temperature,
335  scalar mass
336 ) const
337 {
338  return
339  2.0*sqrt(2.0*physicoChemical::k.value()*temperature/(pi*mass));
340 }
341 
342 
343 template<class ParcelType>
345 (
346  scalarField temperature,
347  scalar mass
348 ) const
349 {
350  tmp<scalarField> tfld =
351  2.0*sqrt(2.0*physicoChemical::k.value()*temperature/(pi*mass));
352  return tfld();
353 }
354 
355 
356 template<class ParcelType>
358 (
359  scalar temperature,
360  scalar mass
361 ) const
362 {
363  return sqrt(3.0*physicoChemical::k.value()*temperature/mass);
364 }
365 
366 
367 template<class ParcelType>
369 (
370  scalarField temperature,
371  scalar mass
372 ) const
373 {
374  tmp<scalarField> tfld =
375  sqrt(3.0*physicoChemical::k.value()*temperature/mass);
376  return tfld();
377 }
378 
379 
380 template<class ParcelType>
381 inline Foam::scalar
383 (
384  scalar temperature,
385  scalar mass
386 ) const
387 {
388  return sqrt(2.0*physicoChemical::k.value()*temperature/mass);
389 }
390 
391 
392 template<class ParcelType>
393 inline Foam::scalarField
395 (
396  scalarField temperature,
397  scalar mass
398 ) const
399 {
400  tmp<scalarField> tfld =
401  sqrt(2.0*physicoChemical::k.value()*temperature/mass);
402  return tfld();
403 }
404 
405 
406 template<class ParcelType>
408 {
409  return q_;
410 }
411 
412 
413 template<class ParcelType>
415 {
416  return fD_;
417 }
418 
419 
420 template<class ParcelType>
421 inline const Foam::volScalarField&
423 {
424  return rhoN_;
425 }
426 
427 
428 template<class ParcelType>
430 {
431  return rhoM_;
432 }
433 
434 
435 template<class ParcelType>
436 inline const Foam::volScalarField&
438 {
439  return dsmcRhoN_;
440 }
441 
442 
443 template<class ParcelType>
444 inline const Foam::volScalarField&
446 {
447  return linearKE_;
448 }
449 
450 
451 template<class ParcelType>
452 inline const Foam::volScalarField&
454 {
455  return internalE_;
456 }
457 
458 
459 template<class ParcelType>
460 inline const Foam::volScalarField&
462 {
463  return iDof_;
464 }
465 
466 
467 template<class ParcelType>
469 {
470  return momentum_;
471 }
472 
473 
474 template<class ParcelType>
476 {
478 }
479 
480 
481 // ************************************************************************* //
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
Foam::Random
Random number generator.
Definition: Random.H:59
Foam::DSMCCloud::rhoMBF
volScalarField::Boundary & rhoMBF()
Return non-const mass density boundary field reference.
Definition: DSMCCloudI.H:156
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::DSMCCloud::collisionSelectionRemainder
scalarField & collisionSelectionRemainder()
Return the collision selection remainder field. non-const.
Definition: DSMCCloudI.H:90
Foam::DSMCCloud::massInSystem
scalar massInSystem() const
Total mass in system.
Definition: DSMCCloudI.H:259
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::DSMCCloud::rhoNBF
volScalarField::Boundary & rhoNBF()
Return non-const number density boundary field reference.
Definition: DSMCCloudI.H:148
Foam::constant::physicoChemical::k
const dimensionedScalar k
Boltzmann constant.
Definition: LISASMDCalcMethod2.H:41
Foam::DSMCCloud::sigmaTcRMax
volScalarField & sigmaTcRMax()
Return the sigmaTcRMax field. non-const access to allow.
Definition: DSMCCloudI.H:82
Foam::DSMCCloud::constProps
const List< typename ParcelType::constantProperties > & constProps() const
Return all of the constant properties.
Definition: DSMCCloudI.H:98
Foam::BinaryCollisionModel
Templated DSMC particle collision class.
Definition: DSMCCloud.H:58
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::constant
Different types of constants.
Definition: atomicConstants.C:38
Foam::DSMCCloud::qBF
volScalarField::Boundary & qBF()
Return non-const heat flux boundary field reference.
Definition: DSMCCloudI.H:132
Foam::DSMCCloud::boundaryT
const volScalarField & boundaryT() const
Return macroscopic temperature.
Definition: DSMCCloudI.H:196
Foam::DSMCCloud::boundaryU
const volVectorField & boundaryU() const
Return macroscopic velocity.
Definition: DSMCCloudI.H:204
Foam::DSMCCloud::momentumBF
volVectorField::Boundary & momentumBF()
Return non-const momentum density boundary field reference.
Definition: DSMCCloudI.H:188
Foam::DSMCCloud::rndGen
Random & rndGen()
Return reference to the random object.
Definition: DSMCCloudI.H:124
Foam::DSMCCloud::fDBF
volVectorField::Boundary & fDBF()
Return non-const force density at boundary field reference.
Definition: DSMCCloudI.H:140
Foam::DSMCCloud::clear
void clear()
Clear the Cloud.
Definition: DSMCCloudI.H:475
Foam::DSMCCloud::typeIdList
const List< word > & typeIdList() const
Return the idList.
Definition: DSMCCloudI.H:60
Foam::DSMCCloud::cloudName
const word & cloudName() const
Return the cloud type.
Definition: DSMCCloudI.H:37
Foam::DSMCCloud::linearKineticEnergyOfSystem
scalar linearKineticEnergyOfSystem() const
Total linear kinetic energy in the system.
Definition: DSMCCloudI.H:298
Foam::Field< scalar >
Foam::DSMCCloud::mesh
const fvMesh & mesh() const
Return reference to the mesh.
Definition: DSMCCloudI.H:44
Foam::DSMCCloud::iDof
const volScalarField & iDof() const
Return the average internal degrees of freedom field.
Definition: DSMCCloudI.H:461
Foam::DSMCCloud::rhoN
const volScalarField & rhoN() const
Return the real particle number density field.
Definition: DSMCCloudI.H:422
Foam::DSMCCloud::iDofBF
volScalarField::Boundary & iDofBF()
Return non-const internal degree of freedom density boundary.
Definition: DSMCCloudI.H:180
Foam::DSMCCloud::inflowBoundary
const InflowBoundaryModel< DSMCCloud< ParcelType > > & inflowBoundary() const
Return reference to wall interaction model.
Definition: DSMCCloudI.H:244
Foam::ILList::clear
void clear()
Clear the contents of the list.
Definition: ILList.C:112
Foam::DSMCCloud::cellOccupancy
const List< DynamicList< ParcelType * > > & cellOccupancy() const
Return the cell occupancy addressing.
Definition: DSMCCloudI.H:75
Foam::DSMCCloud::maxwellianRMSSpeed
scalar maxwellianRMSSpeed(scalar temperature, scalar mass) const
RMS particle speed.
Definition: DSMCCloudI.H:358
Foam::WallInteractionModel
Templated wall interaction model class.
Definition: DSMCCloud.H:61
Foam::FatalError
error FatalError
Foam::DSMCCloud::internalE
const volScalarField & internalE() const
Return the internal energy density field.
Definition: DSMCCloudI.H:453
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam::DSMCCloud::q
const volScalarField & q() const
Return heat flux at surface field.
Definition: DSMCCloudI.H:407
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
Foam::DSMCCloud::internalEnergyOfSystem
scalar internalEnergyOfSystem() const
Total internal energy in the system.
Definition: DSMCCloudI.H:318
constants.H
Foam::DSMCCloud::maxwellianAverageSpeed
scalar maxwellianAverageSpeed(scalar temperature, scalar mass) const
Average particle speed.
Definition: DSMCCloudI.H:333
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::constant::mathematical
Mathematical constants.
Foam::DSMCCloud::internalEBF
volScalarField::Boundary & internalEBF()
Return non-const internal energy density boundary field.
Definition: DSMCCloudI.H:172
Foam::DSMCCloud::linearKEBF
volScalarField::Boundary & linearKEBF()
Return non-const linear kinetic energy density boundary.
Definition: DSMCCloudI.H:164
Foam::constant::mathematical::pi
constexpr scalar pi(M_PI)
Foam::nl
constexpr char nl
Definition: Ostream.H:404
Foam::Vector< scalar >
Foam::List< Foam::word >
Foam::sqrt
dimensionedScalar sqrt(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:144
Foam::DSMCCloud::momentum
const volVectorField & momentum() const
Return the momentum density field.
Definition: DSMCCloudI.H:468
Foam::DSMCCloud::maxwellianMostProbableSpeed
scalar maxwellianMostProbableSpeed(scalar temperature, scalar mass) const
Most probable speed.
Definition: DSMCCloudI.H:383
Foam::DSMCCloud::rhoM
const volScalarField & rhoM() const
Return the particle mass density field.
Definition: DSMCCloudI.H:429
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::InflowBoundaryModel
Templated inflow boundary model class.
Definition: DSMCCloud.H:64
Foam::DSMCCloud::binaryCollision
const BinaryCollisionModel< DSMCCloud< ParcelType > > & binaryCollision() const
Return reference to binary elastic collision model.
Definition: DSMCCloudI.H:212
Foam::DSMCCloud::dsmcRhoN
const volScalarField & dsmcRhoN() const
Return the field of number of DSMC particles.
Definition: DSMCCloudI.H:437
Foam::DSMCCloud::linearKE
const volScalarField & linearKE() const
Return the total linear kinetic energy (translational and.
Definition: DSMCCloudI.H:445
Foam::DSMCCloud::nParticle
scalar nParticle() const
Return the number of real particles represented by one.
Definition: DSMCCloudI.H:67
Foam::DSMCCloud::linearMomentumOfSystem
vector linearMomentumOfSystem() const
Total linear momentum of the system.
Definition: DSMCCloudI.H:278
Foam::DSMCCloud::fD
const volVectorField & fD() const
Return force density at surface field.
Definition: DSMCCloudI.H:414
Foam::DSMCCloud::wallInteraction
const WallInteractionModel< DSMCCloud< ParcelType > > & wallInteraction() const
Return reference to wall interaction model.
Definition: DSMCCloudI.H:228
Foam::DSMCCloud::particleProperties
const IOdictionary & particleProperties() const
Return particle properties dictionary.
Definition: DSMCCloudI.H:52