1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "VariableHardSphere.H"
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 template <class CloudType>
31 Foam::VariableHardSphere<CloudType>::VariableHardSphere
33 const dictionary& dict,
37 BinaryCollisionModel<CloudType>(dict, cloud, typeName),
38 Tref_(readScalar(this->coeffDict().lookup("Tref")))
42 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
44 template <class CloudType>
45 Foam::VariableHardSphere<CloudType>::~VariableHardSphere()
49 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
52 template <class CloudType>
53 Foam::scalar Foam::VariableHardSphere<CloudType>::sigmaTcR
61 const CloudType& cloud(this->owner());
66 cloud.constProps(typeIdP).d()
67 + cloud.constProps(typeIdQ).d()
73 cloud.constProps(typeIdP).omega()
74 + cloud.constProps(typeIdQ).omega()
77 scalar cR = mag(UP - UQ);
84 scalar mP = cloud.constProps(typeIdP).mass();
86 scalar mQ = cloud.constProps(typeIdQ).mass();
88 scalar mR = mP*mQ/(mP + mQ);
90 // calculating cross section = pi*dPQ^2, where dPQ is from Bird, eq. 4.79
92 mathematicalConstant::pi*dPQ*dPQ
93 *pow(2.0*CloudType::kb*Tref_/(mR*cR*cR), omegaPQ - 0.5)
94 /exp(Foam::lgamma(2.5 - omegaPQ));
100 template <class CloudType>
101 void Foam::VariableHardSphere<CloudType>::collide
111 CloudType& cloud(this->owner());
113 Random& rndGen(cloud.rndGen());
115 scalar mP = cloud.constProps(typeIdP).mass();
117 scalar mQ = cloud.constProps(typeIdQ).mass();
119 vector Ucm = (mP*UP + mQ*UQ)/(mP + mQ);
121 scalar cR = mag(UP - UQ);
123 scalar cosTheta = 2.0*rndGen.scalar01() - 1.0;
125 scalar sinTheta = sqrt(1.0 - cosTheta*cosTheta);
127 scalar phi = 2.0*mathematicalConstant::pi*rndGen.scalar01();
129 vector postCollisionRelU =
138 UP = Ucm + postCollisionRelU*mQ/(mP + mQ);
140 UQ = Ucm - postCollisionRelU*mP/(mP + mQ);
144 // ************************************************************************* //