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-------------------------------------------------------------------------------
11License
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
31using namespace Foam::constant;
32using namespace Foam::constant::mathematical;
33
34// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
35
36template<class ParcelType>
38{
39 return cloudName_;
40}
41
42
43template<class ParcelType>
45{
46 return mesh_;
47}
48
49
50template<class ParcelType>
51inline const Foam::IOdictionary&
53{
54 return particleProperties_;
55}
56
57
58template<class ParcelType>
59inline const Foam::List<Foam::word>&
61{
62 return typeIdList_;
63}
64
65
66template<class ParcelType>
67inline Foam::scalar Foam::DSMCCloud<ParcelType>::nParticle() const
68{
69 return nParticle_;
70}
71
72
73template<class ParcelType>
76{
77 return cellOccupancy_;
78}
79
80
81template<class ParcelType>
83{
84 return sigmaTcRMax_;
85}
86
87
88template<class ParcelType>
91{
92 return collisionSelectionRemainder_;
93}
94
95
96template<class ParcelType>
99{
100 return constProps_;
101}
102
103
104template<class ParcelType>
105inline 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
123template<class ParcelType>
125{
126 return rndGen_;
127}
128
129
130template<class ParcelType>
133{
134 return q_.boundaryFieldRef();
135}
136
137
138template<class ParcelType>
141{
142 return fD_.boundaryFieldRef();
143}
144
145
146template<class ParcelType>
149{
150 return rhoN_.boundaryFieldRef();
151}
152
153
154template<class ParcelType>
157{
158 return rhoM_.boundaryFieldRef();
159}
160
161
162template<class ParcelType>
165{
166 return linearKE_.boundaryFieldRef();
167}
168
169
170template<class ParcelType>
173{
174 return internalE_.boundaryFieldRef();
175}
176
177
178template<class ParcelType>
181{
182 return iDof_.boundaryFieldRef();
183}
184
185
186template<class ParcelType>
189{
190 return momentum_.boundaryFieldRef();
191}
192
193
194template<class ParcelType>
195inline const Foam::volScalarField&
197{
198 return boundaryT_;
199}
200
201
202template<class ParcelType>
203inline const Foam::volVectorField&
205{
206 return boundaryU_;
207}
208
209
210template<class ParcelType>
213{
214 return binaryCollisionModel_;
215}
216
217
218template<class ParcelType>
221{
222 return *binaryCollisionModel_;
223}
224
225
226template<class ParcelType>
229{
230 return *wallInteractionModel_;
231}
232
233
234template<class ParcelType>
237{
238 return *wallInteractionModel_;
239}
240
241
242template<class ParcelType>
245{
246 return *inflowBoundaryModel_;
247}
248
249
250template<class ParcelType>
253{
254 return *inflowBoundaryModel_;
255}
256
257
258template<class ParcelType>
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
277template<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
296template<class ParcelType>
297inline 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
316template<class ParcelType>
317inline 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
331template<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
343template<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
356template<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
367template<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
380template<class ParcelType>
381inline 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
392template<class ParcelType>
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
406template<class ParcelType>
408{
409 return q_;
410}
411
412
413template<class ParcelType>
415{
416 return fD_;
417}
418
419
420template<class ParcelType>
421inline const Foam::volScalarField&
423{
424 return rhoN_;
425}
426
427
428template<class ParcelType>
430{
431 return rhoM_;
432}
433
434
435template<class ParcelType>
436inline const Foam::volScalarField&
438{
439 return dsmcRhoN_;
440}
441
442
443template<class ParcelType>
444inline const Foam::volScalarField&
446{
447 return linearKE_;
448}
449
450
451template<class ParcelType>
452inline const Foam::volScalarField&
454{
455 return internalE_;
456}
457
458
459template<class ParcelType>
460inline const Foam::volScalarField&
462{
463 return iDof_;
464}
465
466
467template<class ParcelType>
469{
470 return momentum_;
471}
472
473
474template<class ParcelType>
476{
478}
479
480
481// ************************************************************************* //
Templated DSMC particle collision class.
volScalarField::Boundary & rhoMBF()
Return non-const mass density boundary field reference.
Definition: DSMCCloudI.H:156
const volScalarField & boundaryT() const
Return macroscopic temperature.
Definition: DSMCCloudI.H:196
const word & cloudName() const
Return the cloud type.
Definition: DSMCCloudI.H:37
Random & rndGen()
Return reference to the random object.
Definition: DSMCCloudI.H:124
scalar massInSystem() const
Total mass in system.
Definition: DSMCCloudI.H:259
volScalarField::Boundary & rhoNBF()
Return non-const number density boundary field reference.
Definition: DSMCCloudI.H:148
const List< typename ParcelType::constantProperties > & constProps() const
Return all of the constant properties.
Definition: DSMCCloudI.H:98
const volScalarField & q() const
Return heat flux at surface field.
Definition: DSMCCloudI.H:407
const List< DynamicList< ParcelType * > > & cellOccupancy() const
Return the cell occupancy addressing.
Definition: DSMCCloudI.H:75
volScalarField::Boundary & internalEBF()
Return non-const internal energy density boundary field.
Definition: DSMCCloudI.H:172
volScalarField & sigmaTcRMax()
Return the sigmaTcRMax field. non-const access to allow.
Definition: DSMCCloudI.H:82
vector linearMomentumOfSystem() const
Total linear momentum of the system.
Definition: DSMCCloudI.H:278
const InflowBoundaryModel< DSMCCloud< ParcelType > > & inflowBoundary() const
Return reference to wall interaction model.
Definition: DSMCCloudI.H:244
const volScalarField & iDof() const
Return the average internal degrees of freedom field.
Definition: DSMCCloudI.H:461
const BinaryCollisionModel< DSMCCloud< ParcelType > > & binaryCollision() const
Return reference to binary elastic collision model.
Definition: DSMCCloudI.H:212
scalar nParticle() const
Return the number of real particles represented by one.
Definition: DSMCCloudI.H:67
const volVectorField & boundaryU() const
Return macroscopic velocity.
Definition: DSMCCloudI.H:204
scalar maxwellianRMSSpeed(scalar temperature, scalar mass) const
RMS particle speed.
Definition: DSMCCloudI.H:358
scalar maxwellianMostProbableSpeed(scalar temperature, scalar mass) const
Most probable speed.
Definition: DSMCCloudI.H:383
volScalarField::Boundary & linearKEBF()
Return non-const linear kinetic energy density boundary.
Definition: DSMCCloudI.H:164
volVectorField::Boundary & momentumBF()
Return non-const momentum density boundary field reference.
Definition: DSMCCloudI.H:188
volScalarField::Boundary & qBF()
Return non-const heat flux boundary field reference.
Definition: DSMCCloudI.H:132
volVectorField::Boundary & fDBF()
Return non-const force density at boundary field reference.
Definition: DSMCCloudI.H:140
scalar internalEnergyOfSystem() const
Total internal energy in the system.
Definition: DSMCCloudI.H:318
scalarField & collisionSelectionRemainder()
Return the collision selection remainder field. non-const.
Definition: DSMCCloudI.H:90
const volVectorField & momentum() const
Return the momentum density field.
Definition: DSMCCloudI.H:468
const List< word > & typeIdList() const
Return the idList.
Definition: DSMCCloudI.H:60
volScalarField::Boundary & iDofBF()
Return non-const internal degree of freedom density boundary.
Definition: DSMCCloudI.H:180
const IOdictionary & particleProperties() const
Return particle properties dictionary.
Definition: DSMCCloudI.H:52
const volScalarField & linearKE() const
Return the total linear kinetic energy (translational and.
Definition: DSMCCloudI.H:445
void clear()
Clear the Cloud.
Definition: DSMCCloudI.H:475
const volScalarField & dsmcRhoN() const
Return the field of number of DSMC particles.
Definition: DSMCCloudI.H:437
const fvMesh & mesh() const
Return reference to the mesh.
Definition: DSMCCloudI.H:44
const volScalarField & internalE() const
Return the internal energy density field.
Definition: DSMCCloudI.H:453
scalar maxwellianAverageSpeed(scalar temperature, scalar mass) const
Average particle speed.
Definition: DSMCCloudI.H:333
const volScalarField & rhoM() const
Return the particle mass density field.
Definition: DSMCCloudI.H:429
const volScalarField & rhoN() const
Return the real particle number density field.
Definition: DSMCCloudI.H:422
scalar linearKineticEnergyOfSystem() const
Total linear kinetic energy in the system.
Definition: DSMCCloudI.H:298
const volVectorField & fD() const
Return force density at surface field.
Definition: DSMCCloudI.H:414
const WallInteractionModel< DSMCCloud< ParcelType > > & wallInteraction() const
Return reference to wall interaction model.
Definition: DSMCCloudI.H:228
void clear()
Clear the contents of the list.
Definition: ILList.C:101
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
Templated inflow boundary model class.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:77
Random number generator.
Definition: Random.H:60
Templated wall interaction model class.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
volScalarField & p
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Mathematical constants.
constexpr scalar pi(M_PI)
const dimensionedScalar k
Boltzmann constant.
Different types of constants.
dimensionedScalar sqrt(const dimensionedScalar &ds)
errorManip< error > abort(error &err)
Definition: errorManip.H:144
error FatalError
constexpr char nl
The newline '\n' character (0x0a)
Definition: Ostream.H:53