1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
29 template<class ParcelType>
30 inline const Foam::word& Foam::DsmcCloud<ParcelType>::cloudName() const
36 template<class ParcelType>
37 inline const Foam::fvMesh& Foam::DsmcCloud<ParcelType>::mesh() const
43 template<class ParcelType>
44 inline const Foam::IOdictionary&
45 Foam::DsmcCloud<ParcelType>::particleProperties() const
47 return particleProperties_;
51 template<class ParcelType>
52 inline const Foam::List<Foam::word>&
53 Foam::DsmcCloud<ParcelType>::typeIdList() const
59 template<class ParcelType>
60 inline Foam::scalar Foam::DsmcCloud<ParcelType>::nParticle() const
66 template<class ParcelType>
67 inline const Foam::List<Foam::DynamicList<ParcelType*> >&
68 Foam::DsmcCloud<ParcelType>::cellOccupancy() const
70 return cellOccupancy_;
74 template<class ParcelType>
75 inline Foam::volScalarField& Foam::DsmcCloud<ParcelType>::sigmaTcRMax()
81 template<class ParcelType>
82 inline Foam::scalarField&
83 Foam::DsmcCloud<ParcelType>::collisionSelectionRemainder()
85 return collisionSelectionRemainder_;
89 template<class ParcelType>
90 inline const Foam::List<typename ParcelType::constantProperties>&
91 Foam::DsmcCloud<ParcelType>::constProps() const
97 template<class ParcelType>
98 inline const typename ParcelType::constantProperties&
99 Foam::DsmcCloud<ParcelType>::constProps
104 if (typeId < 0 || typeId >= constProps_.size())
106 FatalErrorIn("Foam::DsmcCloud<ParcelType>::constProps(label typeId)")
107 << "constantProperties for requested typeId index "
108 << typeId << " do not exist" << nl
109 << abort(FatalError);
112 return constProps_[typeId];
116 template<class ParcelType>
117 inline Foam::Random& Foam::DsmcCloud<ParcelType>::rndGen()
123 template<class ParcelType>
124 inline Foam::volScalarField::GeometricBoundaryField&
125 Foam::DsmcCloud<ParcelType>::qBF()
127 return q_.boundaryField();
131 template<class ParcelType>
132 inline Foam::volVectorField::GeometricBoundaryField&
133 Foam::DsmcCloud<ParcelType>::fDBF()
135 return fD_.boundaryField();
139 template<class ParcelType>
140 inline Foam::volScalarField::GeometricBoundaryField&
141 Foam::DsmcCloud<ParcelType>::rhoNBF()
143 return rhoN_.boundaryField();
147 template<class ParcelType>
148 inline Foam::volScalarField::GeometricBoundaryField&
149 Foam::DsmcCloud<ParcelType>::rhoMBF()
151 return rhoM_.boundaryField();
155 template<class ParcelType>
156 inline Foam::volScalarField::GeometricBoundaryField&
157 Foam::DsmcCloud<ParcelType>::linearKEBF()
159 return linearKE_.boundaryField();
163 template<class ParcelType>
164 inline Foam::volScalarField::GeometricBoundaryField&
165 Foam::DsmcCloud<ParcelType>::internalEBF()
167 return internalE_.boundaryField();
171 template<class ParcelType>
172 inline Foam::volScalarField::GeometricBoundaryField&
173 Foam::DsmcCloud<ParcelType>::iDofBF()
175 return iDof_.boundaryField();
179 template<class ParcelType>
180 inline Foam::volVectorField::GeometricBoundaryField&
181 Foam::DsmcCloud<ParcelType>::momentumBF()
183 return momentum_.boundaryField();
187 template<class ParcelType>
188 inline const Foam::volScalarField&
189 Foam::DsmcCloud<ParcelType>::boundaryT() const
195 template<class ParcelType>
196 inline const Foam::volVectorField&
197 Foam::DsmcCloud<ParcelType>::boundaryU() const
203 template<class ParcelType>
204 inline const Foam::BinaryCollisionModel<Foam::DsmcCloud<ParcelType> >&
205 Foam::DsmcCloud<ParcelType>::binaryCollision() const
207 return binaryCollisionModel_;
211 template<class ParcelType>
212 inline Foam::BinaryCollisionModel<Foam::DsmcCloud<ParcelType> >&
213 Foam::DsmcCloud<ParcelType>::binaryCollision()
215 return binaryCollisionModel_();
219 template<class ParcelType>
220 inline const Foam::WallInteractionModel<Foam::DsmcCloud<ParcelType> >&
221 Foam::DsmcCloud<ParcelType>::wallInteraction() const
223 return wallInteractionModel_;
227 template<class ParcelType>
228 inline Foam::WallInteractionModel<Foam::DsmcCloud<ParcelType> >&
229 Foam::DsmcCloud<ParcelType>::wallInteraction()
231 return wallInteractionModel_();
235 template<class ParcelType>
236 inline const Foam::InflowBoundaryModel<Foam::DsmcCloud<ParcelType> >&
237 Foam::DsmcCloud<ParcelType>::inflowBoundary() const
239 return inflowBoundaryModel_;
243 template<class ParcelType>
244 inline Foam::InflowBoundaryModel<Foam::DsmcCloud<ParcelType> >&
245 Foam::DsmcCloud<ParcelType>::inflowBoundary()
247 return inflowBoundaryModel_();
251 template<class ParcelType>
252 inline Foam::scalar Foam::DsmcCloud<ParcelType>::massInSystem() const
254 scalar sysMass = 0.0;
256 forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
258 const ParcelType& p = iter();
260 const typename ParcelType::constantProperties& cP = constProps
265 sysMass += cP.mass();
268 return nParticle_*sysMass;
272 template<class ParcelType>
273 inline Foam::vector Foam::DsmcCloud<ParcelType>::linearMomentumOfSystem() const
275 vector linearMomentum(vector::zero);
277 forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
279 const ParcelType& p = iter();
281 const typename ParcelType::constantProperties& cP = constProps
286 linearMomentum += cP.mass()*p.U();
289 return nParticle_*linearMomentum;
293 template<class ParcelType>
295 Foam::DsmcCloud<ParcelType>::linearKineticEnergyOfSystem() const
297 scalar linearKineticEnergy = 0.0;
299 forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
301 const ParcelType& p = iter();
303 const typename ParcelType::constantProperties& cP = constProps
308 linearKineticEnergy += 0.5*cP.mass()*(p.U() & p.U());
311 return nParticle_*linearKineticEnergy;
315 template<class ParcelType>
317 Foam::DsmcCloud<ParcelType>::internalEnergyOfSystem() const
319 scalar internalEnergy = 0.0;
321 forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
323 const ParcelType& p = iter();
325 internalEnergy += p.Ei();
328 return nParticle_*internalEnergy;
332 template<class ParcelType>
333 inline Foam::scalar Foam::DsmcCloud<ParcelType>::maxwellianAverageSpeed
340 2.0*sqrt(2.0*kb*temperature/(mathematicalConstant::pi*mass));
344 template<class ParcelType>
345 inline Foam::scalarField Foam::DsmcCloud<ParcelType>::maxwellianAverageSpeed
347 scalarField temperature,
352 2.0*sqrt(2.0*kb*temperature/(mathematicalConstant::pi*mass));
356 template<class ParcelType>
357 inline Foam::scalar Foam::DsmcCloud<ParcelType>::maxwellianRMSSpeed
363 return sqrt(3.0*kb*temperature/mass);
367 template<class ParcelType>
368 inline Foam::scalarField Foam::DsmcCloud<ParcelType>::maxwellianRMSSpeed
370 scalarField temperature,
374 return sqrt(3.0*kb*temperature/mass);
378 template<class ParcelType>
380 Foam::DsmcCloud<ParcelType>::maxwellianMostProbableSpeed
386 return sqrt(2.0*kb*temperature/mass);
390 template<class ParcelType>
391 inline Foam::scalarField
392 Foam::DsmcCloud<ParcelType>::maxwellianMostProbableSpeed
394 scalarField temperature,
398 return sqrt(2.0*kb*temperature/mass);
402 template<class ParcelType>
403 inline const Foam::volScalarField& Foam::DsmcCloud<ParcelType>::q() const
409 template<class ParcelType>
410 inline const Foam::volVectorField& Foam::DsmcCloud<ParcelType>::fD() const
416 template<class ParcelType>
417 inline const Foam::volScalarField&
418 Foam::DsmcCloud<ParcelType>::rhoN() const
424 template<class ParcelType>
425 inline const Foam::volScalarField& Foam::DsmcCloud<ParcelType>::rhoM() const
431 template<class ParcelType>
432 inline const Foam::volScalarField&
433 Foam::DsmcCloud<ParcelType>::dsmcRhoN() const
439 template<class ParcelType>
440 inline const Foam::volScalarField&
441 Foam::DsmcCloud<ParcelType>::linearKE() const
447 template<class ParcelType>
448 inline const Foam::volScalarField&
449 Foam::DsmcCloud<ParcelType>::internalE() const
455 template<class ParcelType>
456 inline const Foam::volScalarField&
457 Foam::DsmcCloud<ParcelType>::iDof() const
463 template<class ParcelType>
464 inline const Foam::volVectorField& Foam::DsmcCloud<ParcelType>::momentum() const
470 template<class ParcelType>
471 inline void Foam::DsmcCloud<ParcelType>::clear()
473 return IDLList<ParcelType>::clear();
477 // ************************************************************************* //