00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 template<class ParcelType>
00030 inline const Foam::word& Foam::DsmcCloud<ParcelType>::cloudName() const
00031 {
00032 return cloudName_;
00033 }
00034
00035
00036 template<class ParcelType>
00037 inline const Foam::fvMesh& Foam::DsmcCloud<ParcelType>::mesh() const
00038 {
00039 return mesh_;
00040 }
00041
00042
00043 template<class ParcelType>
00044 inline const Foam::IOdictionary&
00045 Foam::DsmcCloud<ParcelType>::particleProperties() const
00046 {
00047 return particleProperties_;
00048 }
00049
00050
00051 template<class ParcelType>
00052 inline const Foam::List<Foam::word>&
00053 Foam::DsmcCloud<ParcelType>::typeIdList() const
00054 {
00055 return typeIdList_;
00056 }
00057
00058
00059 template<class ParcelType>
00060 inline Foam::scalar Foam::DsmcCloud<ParcelType>::nParticle() const
00061 {
00062 return nParticle_;
00063 }
00064
00065
00066 template<class ParcelType>
00067 inline const Foam::List<Foam::DynamicList<ParcelType*> >&
00068 Foam::DsmcCloud<ParcelType>::cellOccupancy() const
00069 {
00070 return cellOccupancy_;
00071 }
00072
00073
00074 template<class ParcelType>
00075 inline Foam::volScalarField& Foam::DsmcCloud<ParcelType>::sigmaTcRMax()
00076 {
00077 return sigmaTcRMax_;
00078 }
00079
00080
00081 template<class ParcelType>
00082 inline Foam::scalarField&
00083 Foam::DsmcCloud<ParcelType>::collisionSelectionRemainder()
00084 {
00085 return collisionSelectionRemainder_;
00086 }
00087
00088
00089 template<class ParcelType>
00090 inline const Foam::List<typename ParcelType::constantProperties>&
00091 Foam::DsmcCloud<ParcelType>::constProps() const
00092 {
00093 return constProps_;
00094 }
00095
00096
00097 template<class ParcelType>
00098 inline const typename ParcelType::constantProperties&
00099 Foam::DsmcCloud<ParcelType>::constProps
00100 (
00101 label typeId
00102 ) const
00103 {
00104 if (typeId < 0 || typeId >= constProps_.size())
00105 {
00106 FatalErrorIn("Foam::DsmcCloud<ParcelType>::constProps(label typeId)")
00107 << "constantProperties for requested typeId index "
00108 << typeId << " do not exist" << nl
00109 << abort(FatalError);
00110 }
00111
00112 return constProps_[typeId];
00113 }
00114
00115
00116 template<class ParcelType>
00117 inline Foam::Random& Foam::DsmcCloud<ParcelType>::rndGen()
00118 {
00119 return rndGen_;
00120 }
00121
00122
00123 template<class ParcelType>
00124 inline void Foam::DsmcCloud<ParcelType>::storeDeltaT()
00125 {
00126 cachedDeltaT_ = mesh().time().deltaT().value();
00127 }
00128
00129
00130 template<class ParcelType>
00131 inline Foam::scalar Foam::DsmcCloud<ParcelType>::cachedDeltaT() const
00132 {
00133 return cachedDeltaT_;
00134 }
00135
00136
00137 template<class ParcelType>
00138 inline const Foam::volScalarField& Foam::DsmcCloud<ParcelType>::q() const
00139 {
00140 return q_;
00141 }
00142
00143
00144 template<class ParcelType>
00145 inline Foam::volScalarField& Foam::DsmcCloud<ParcelType>::q()
00146 {
00147 return q_;
00148 }
00149
00150
00151 template<class ParcelType>
00152 inline const Foam::volVectorField& Foam::DsmcCloud<ParcelType>::fD() const
00153 {
00154 return fD_;
00155 }
00156
00157
00158 template<class ParcelType>
00159 inline Foam::volVectorField& Foam::DsmcCloud<ParcelType>::fD()
00160 {
00161 return fD_;
00162 }
00163
00164
00165 template<class ParcelType>
00166 inline const Foam::volScalarField& Foam::DsmcCloud<ParcelType>::T() const
00167 {
00168 return T_;
00169 }
00170
00171
00172 template<class ParcelType>
00173 inline const Foam::volVectorField& Foam::DsmcCloud<ParcelType>::U() const
00174 {
00175 return U_;
00176 }
00177
00178
00179 template<class ParcelType>
00180 inline const Foam::BinaryCollisionModel<Foam::DsmcCloud<ParcelType> >&
00181 Foam::DsmcCloud<ParcelType>::binaryCollision() const
00182 {
00183 return binaryCollisionModel_;
00184 }
00185
00186
00187 template<class ParcelType>
00188 inline Foam::BinaryCollisionModel<Foam::DsmcCloud<ParcelType> >&
00189 Foam::DsmcCloud<ParcelType>::binaryCollision()
00190 {
00191 return binaryCollisionModel_();
00192 }
00193
00194
00195 template<class ParcelType>
00196 inline const Foam::WallInteractionModel<Foam::DsmcCloud<ParcelType> >&
00197 Foam::DsmcCloud<ParcelType>::wallInteraction() const
00198 {
00199 return wallInteractionModel_;
00200 }
00201
00202
00203 template<class ParcelType>
00204 inline Foam::WallInteractionModel<Foam::DsmcCloud<ParcelType> >&
00205 Foam::DsmcCloud<ParcelType>::wallInteraction()
00206 {
00207 return wallInteractionModel_();
00208 }
00209
00210
00211 template<class ParcelType>
00212 inline const Foam::InflowBoundaryModel<Foam::DsmcCloud<ParcelType> >&
00213 Foam::DsmcCloud<ParcelType>::inflowBoundary() const
00214 {
00215 return inflowBoundaryModel_;
00216 }
00217
00218
00219 template<class ParcelType>
00220 inline Foam::InflowBoundaryModel<Foam::DsmcCloud<ParcelType> >&
00221 Foam::DsmcCloud<ParcelType>::inflowBoundary()
00222 {
00223 return inflowBoundaryModel_();
00224 }
00225
00226
00227 template<class ParcelType>
00228 inline Foam::scalar Foam::DsmcCloud<ParcelType>::massInSystem() const
00229 {
00230 scalar sysMass = 0.0;
00231
00232 forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
00233 {
00234 const ParcelType& p = iter();
00235
00236 const typename ParcelType::constantProperties& cP = constProps
00237 (
00238 p.typeId()
00239 );
00240
00241 sysMass += cP.mass();
00242 }
00243
00244 return nParticle_*sysMass;
00245 }
00246
00247
00248 template<class ParcelType>
00249 inline Foam::vector Foam::DsmcCloud<ParcelType>::linearMomentumOfSystem() const
00250 {
00251 vector linearMomentum(vector::zero);
00252
00253 forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
00254 {
00255 const ParcelType& p = iter();
00256
00257 const typename ParcelType::constantProperties& cP = constProps
00258 (
00259 p.typeId()
00260 );
00261
00262 linearMomentum += cP.mass()*p.U();
00263 }
00264
00265 return nParticle_*linearMomentum;
00266 }
00267
00268
00269 template<class ParcelType>
00270 inline Foam::scalar
00271 Foam::DsmcCloud<ParcelType>::linearKineticEnergyOfSystem() const
00272 {
00273 scalar linearKineticEnergy = 0.0;
00274
00275 forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
00276 {
00277 const ParcelType& p = iter();
00278
00279 const typename ParcelType::constantProperties& cP = constProps
00280 (
00281 p.typeId()
00282 );
00283
00284 linearKineticEnergy += 0.5*cP.mass()*(p.U() & p.U());
00285 }
00286
00287 return nParticle_*linearKineticEnergy;
00288 }
00289
00290
00291 template<class ParcelType>
00292 inline Foam::scalar
00293 Foam::DsmcCloud<ParcelType>::internalEnergyOfSystem() const
00294 {
00295 scalar internalEnergy = 0.0;
00296
00297 forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
00298 {
00299 const ParcelType& p = iter();
00300
00301 internalEnergy += p.Ei();
00302 }
00303
00304 return nParticle_*internalEnergy;
00305 }
00306
00307
00308 template<class ParcelType>
00309 inline Foam::scalar Foam::DsmcCloud<ParcelType>::maxwellianAverageSpeed
00310 (
00311 scalar temperature,
00312 scalar mass
00313 ) const
00314 {
00315 return 2.0*sqrt(2.0*kb*temperature/(mathematicalConstant::pi*mass));
00316 }
00317
00318
00319 template<class ParcelType>
00320 inline Foam::scalarField Foam::DsmcCloud<ParcelType>::maxwellianAverageSpeed
00321 (
00322 scalarField temperature,
00323 scalar mass
00324 ) const
00325 {
00326 return 2.0*sqrt(2.0*kb*temperature/(mathematicalConstant::pi*mass));
00327 }
00328
00329
00330 template<class ParcelType>
00331 inline Foam::scalar Foam::DsmcCloud<ParcelType>::maxwellianRMSSpeed
00332 (
00333 scalar temperature,
00334 scalar mass
00335 ) const
00336 {
00337 return sqrt(3.0*kb*temperature/mass);
00338 }
00339
00340
00341 template<class ParcelType>
00342 inline Foam::scalarField Foam::DsmcCloud<ParcelType>::maxwellianRMSSpeed
00343 (
00344 scalarField temperature,
00345 scalar mass
00346 ) const
00347 {
00348 return sqrt(3.0*kb*temperature/mass);
00349 }
00350
00351
00352 template<class ParcelType>
00353 inline Foam::scalar
00354 Foam::DsmcCloud<ParcelType>::maxwellianMostProbableSpeed
00355 (
00356 scalar temperature,
00357 scalar mass
00358 ) const
00359 {
00360 return sqrt(2.0*kb*temperature/mass);
00361 }
00362
00363
00364 template<class ParcelType>
00365 inline Foam::scalarField
00366 Foam::DsmcCloud<ParcelType>::maxwellianMostProbableSpeed
00367 (
00368 scalarField temperature,
00369 scalar mass
00370 ) const
00371 {
00372 return sqrt(2.0*kb*temperature/mass);
00373 }
00374
00375
00376 template<class ParcelType>
00377 inline const Foam::tmp<Foam::volScalarField>
00378 Foam::DsmcCloud<ParcelType>::rhoN() const
00379 {
00380 tmp<volScalarField> trhoN
00381 (
00382 new volScalarField
00383 (
00384 IOobject
00385 (
00386 this->name() + "rhoN",
00387 this->db().time().timeName(),
00388 this->db(),
00389 IOobject::NO_READ,
00390 IOobject::NO_WRITE,
00391 false
00392 ),
00393 mesh_,
00394 dimensionedScalar("zero", dimensionSet(0, -3, 0, 0, 0), VSMALL)
00395 )
00396 );
00397
00398 scalarField& rhoN = trhoN().internalField();
00399 forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
00400 {
00401 const ParcelType& p = iter();
00402 const label cellI = p.cell();
00403
00404 rhoN[cellI]++;
00405 }
00406
00407 rhoN *= nParticle_/mesh().cellVolumes();
00408
00409 return trhoN;
00410 }
00411
00412
00413 template<class ParcelType>
00414 inline const Foam::tmp<Foam::volScalarField>
00415 Foam::DsmcCloud<ParcelType>::rhoM() const
00416 {
00417 tmp<volScalarField> trhoM
00418 (
00419 new volScalarField
00420 (
00421 IOobject
00422 (
00423 this->name() + "rhoM",
00424 this->db().time().timeName(),
00425 this->db(),
00426 IOobject::NO_READ,
00427 IOobject::NO_WRITE,
00428 false
00429 ),
00430 mesh_,
00431 dimensionedScalar("zero", dimensionSet(1, -3, 0, 0, 0), VSMALL)
00432 )
00433 );
00434
00435 scalarField& rhoM = trhoM().internalField();
00436 forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
00437 {
00438 const ParcelType& p = iter();
00439 const label cellI = p.cell();
00440
00441 rhoM[cellI] += constProps(p.typeId()).mass();
00442 }
00443
00444 rhoM *= nParticle_/mesh().cellVolumes();
00445
00446 return trhoM;
00447 }
00448
00449
00450 template<class ParcelType>
00451 inline const Foam::tmp<Foam::volScalarField>
00452 Foam::DsmcCloud<ParcelType>::dsmcRhoN() const
00453 {
00454 tmp<volScalarField> tdsmcRhoN
00455 (
00456 new volScalarField
00457 (
00458 IOobject
00459 (
00460 this->name() + "dsmcRhoN",
00461 this->db().time().timeName(),
00462 this->db(),
00463 IOobject::NO_READ,
00464 IOobject::NO_WRITE,
00465 false
00466 ),
00467 mesh_,
00468 dimensionedScalar("zero", dimensionSet(0, -3, 0, 0, 0), 0.0)
00469 )
00470 );
00471
00472 scalarField& dsmcRhoN = tdsmcRhoN().internalField();
00473 forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
00474 {
00475 const ParcelType& p = iter();
00476 const label cellI = p.cell();
00477
00478 dsmcRhoN[cellI]++;
00479 }
00480
00481 return tdsmcRhoN;
00482 }
00483
00484
00485 template<class ParcelType>
00486 inline const Foam::tmp<Foam::volVectorField>
00487 Foam::DsmcCloud<ParcelType>::momentum() const
00488 {
00489 tmp<volVectorField> tmomentum
00490 (
00491 new volVectorField
00492 (
00493 IOobject
00494 (
00495 this->name() + "momentum",
00496 this->db().time().timeName(),
00497 this->db(),
00498 IOobject::NO_READ,
00499 IOobject::NO_WRITE,
00500 false
00501 ),
00502 mesh_,
00503 dimensionedVector
00504 (
00505 "zero",
00506 dimensionSet(1, -2, -1, 0, 0),
00507 vector::zero
00508 )
00509 )
00510 );
00511
00512 vectorField& momentum = tmomentum().internalField();
00513 forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
00514 {
00515 const ParcelType& p = iter();
00516 const label cellI = p.cell();
00517
00518 momentum[cellI] += constProps(p.typeId()).mass()*p.U();
00519 }
00520
00521 momentum *= nParticle_/mesh().cellVolumes();
00522
00523 return tmomentum;
00524 }
00525
00526
00527 template<class ParcelType>
00528 inline const Foam::tmp<Foam::volScalarField>
00529 Foam::DsmcCloud<ParcelType>::linearKE() const
00530 {
00531 tmp<volScalarField> tlinearKE
00532 (
00533 new volScalarField
00534 (
00535 IOobject
00536 (
00537 this->name() + "linearKE",
00538 this->db().time().timeName(),
00539 this->db(),
00540 IOobject::NO_READ,
00541 IOobject::NO_WRITE,
00542 false
00543 ),
00544 mesh_,
00545 dimensionedScalar("zero", dimensionSet(1, -1, -2, 0, 0), 0.0)
00546 )
00547 );
00548
00549 scalarField& linearKE = tlinearKE().internalField();
00550 forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
00551 {
00552 const ParcelType& p = iter();
00553 const label cellI = p.cell();
00554
00555 linearKE[cellI] += 0.5*constProps(p.typeId()).mass()*(p.U() & p.U());
00556 }
00557
00558 linearKE *= nParticle_/mesh().cellVolumes();
00559
00560 return tlinearKE;
00561 }
00562
00563
00564 template<class ParcelType>
00565 inline const Foam::tmp<Foam::volScalarField>
00566 Foam::DsmcCloud<ParcelType>::internalE() const
00567 {
00568 tmp<volScalarField> tinternalE
00569 (
00570 new volScalarField
00571 (
00572 IOobject
00573 (
00574 this->name() + "internalE",
00575 this->db().time().timeName(),
00576 this->db(),
00577 IOobject::NO_READ,
00578 IOobject::NO_WRITE,
00579 false
00580 ),
00581 mesh_,
00582 dimensionedScalar("zero", dimensionSet(1, -1, -2, 0, 0), 0.0)
00583 )
00584 );
00585
00586 scalarField& internalE = tinternalE().internalField();
00587 forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
00588 {
00589 const ParcelType& p = iter();
00590 const label cellI = p.cell();
00591
00592 internalE[cellI] += p.Ei();
00593 }
00594
00595 internalE *= nParticle_/mesh().cellVolumes();
00596
00597 return tinternalE;
00598 }
00599
00600
00601 template<class ParcelType>
00602 inline const Foam::tmp<Foam::volScalarField>
00603 Foam::DsmcCloud<ParcelType>::iDof() const
00604 {
00605 tmp<volScalarField> tiDof
00606 (
00607 new volScalarField
00608 (
00609 IOobject
00610 (
00611 this->name() + "iDof",
00612 this->db().time().timeName(),
00613 this->db(),
00614 IOobject::NO_READ,
00615 IOobject::NO_WRITE,
00616 false
00617 ),
00618 mesh_,
00619 dimensionedScalar("zero", dimensionSet(0, -3, 0, 0, 0), VSMALL)
00620 )
00621 );
00622
00623 scalarField& iDof = tiDof().internalField();
00624
00625 forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
00626 {
00627 const ParcelType& p = iter();
00628 const label cellI = p.cell();
00629
00630 iDof[cellI] += constProps(p.typeId()).internalDegreesOfFreedom();
00631 }
00632
00633 iDof *= nParticle_/mesh().cellVolumes();
00634
00635 return tiDof;
00636 }
00637
00638
00639 template<class ParcelType>
00640 inline void Foam::DsmcCloud<ParcelType>::clear()
00641 {
00642 return IDLList<ParcelType>::clear();
00643 }
00644
00645
00646