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 #include "VariableHardSphere.H"
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 template <class CloudType>
32 Foam::VariableHardSphere<CloudType>::VariableHardSphere
34 const dictionary& dict,
38 BinaryCollisionModel<CloudType>(dict, cloud, typeName),
39 Tref_(readScalar(this->coeffDict().lookup("Tref")))
43 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
45 template <class CloudType>
46 Foam::VariableHardSphere<CloudType>::~VariableHardSphere()
50 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
53 template <class CloudType>
54 Foam::scalar Foam::VariableHardSphere<CloudType>::sigmaTcR
62 const CloudType& cloud(this->owner());
67 cloud.constProps(typeIdP).d()
68 + cloud.constProps(typeIdQ).d()
74 cloud.constProps(typeIdP).omega()
75 + cloud.constProps(typeIdQ).omega()
78 scalar cR = mag(UP - UQ);
85 scalar mP = cloud.constProps(typeIdP).mass();
87 scalar mQ = cloud.constProps(typeIdQ).mass();
89 scalar mR = mP*mQ/(mP + mQ);
91 // calculating cross section = pi*dPQ^2, where dPQ is from Bird, eq. 4.79
93 mathematicalConstant::pi*dPQ*dPQ
94 *pow(2.0*CloudType::kb*Tref_/(mR*cR*cR), omegaPQ - 0.5)
95 /exp(Foam::lgamma(2.5 - omegaPQ));
101 template <class CloudType>
102 void Foam::VariableHardSphere<CloudType>::collide
112 CloudType& cloud(this->owner());
114 Random& rndGen(cloud.rndGen());
116 scalar mP = cloud.constProps(typeIdP).mass();
118 scalar mQ = cloud.constProps(typeIdQ).mass();
120 vector Ucm = (mP*UP + mQ*UQ)/(mP + mQ);
122 scalar cR = mag(UP - UQ);
124 scalar cosTheta = 2.0*rndGen.scalar01() - 1.0;
126 scalar sinTheta = sqrt(1.0 - cosTheta*cosTheta);
128 scalar phi = 2.0*mathematicalConstant::pi*rndGen.scalar01();
130 vector postCollisionRelU =
139 UP = Ucm + postCollisionRelU*mQ/(mP + mQ);
141 UQ = Ucm - postCollisionRelU*mP/(mP + mQ);
145 // ************************************************************************* //