VariableHardSphere.C
Go to the documentation of this file.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 #include "VariableHardSphere.H"
00028
00029
00030
00031 template <class CloudType>
00032 Foam::VariableHardSphere<CloudType>::VariableHardSphere
00033 (
00034 const dictionary& dict,
00035 CloudType& cloud
00036 )
00037 :
00038 BinaryCollisionModel<CloudType>(dict, cloud, typeName),
00039 Tref_(readScalar(this->coeffDict().lookup("Tref")))
00040 {}
00041
00042
00043
00044
00045 template <class CloudType>
00046 Foam::VariableHardSphere<CloudType>::~VariableHardSphere()
00047 {}
00048
00049
00050
00051
00052
00053 template <class CloudType>
00054 Foam::scalar Foam::VariableHardSphere<CloudType>::sigmaTcR
00055 (
00056 label typeIdP,
00057 label typeIdQ,
00058 const vector& UP,
00059 const vector& UQ
00060 ) const
00061 {
00062 const CloudType& cloud(this->owner());
00063
00064 scalar dPQ =
00065 0.5
00066 *(
00067 cloud.constProps(typeIdP).d()
00068 + cloud.constProps(typeIdQ).d()
00069 );
00070
00071 scalar omegaPQ =
00072 0.5
00073 *(
00074 cloud.constProps(typeIdP).omega()
00075 + cloud.constProps(typeIdQ).omega()
00076 );
00077
00078 scalar cR = mag(UP - UQ);
00079
00080 if (cR < VSMALL)
00081 {
00082 return 0;
00083 }
00084
00085 scalar mP = cloud.constProps(typeIdP).mass();
00086
00087 scalar mQ = cloud.constProps(typeIdQ).mass();
00088
00089 scalar mR = mP*mQ/(mP + mQ);
00090
00091
00092 scalar sigmaTPQ =
00093 mathematicalConstant::pi*dPQ*dPQ
00094 *pow(2.0*CloudType::kb*Tref_/(mR*cR*cR), omegaPQ - 0.5)
00095 /exp(Foam::lgamma(2.5 - omegaPQ));
00096
00097 return sigmaTPQ*cR;
00098 }
00099
00100
00101 template <class CloudType>
00102 void Foam::VariableHardSphere<CloudType>::collide
00103 (
00104 label typeIdP,
00105 label typeIdQ,
00106 vector& UP,
00107 vector& UQ,
00108 scalar& EiP,
00109 scalar& EiQ
00110 )
00111 {
00112 CloudType& cloud(this->owner());
00113
00114 Random& rndGen(cloud.rndGen());
00115
00116 scalar mP = cloud.constProps(typeIdP).mass();
00117
00118 scalar mQ = cloud.constProps(typeIdQ).mass();
00119
00120 vector Ucm = (mP*UP + mQ*UQ)/(mP + mQ);
00121
00122 scalar cR = mag(UP - UQ);
00123
00124 scalar cosTheta = 2.0*rndGen.scalar01() - 1.0;
00125
00126 scalar sinTheta = sqrt(1.0 - cosTheta*cosTheta);
00127
00128 scalar phi = 2.0*mathematicalConstant::pi*rndGen.scalar01();
00129
00130 vector postCollisionRelU =
00131 cR
00132 *vector
00133 (
00134 cosTheta,
00135 sinTheta*cos(phi),
00136 sinTheta*sin(phi)
00137 );
00138
00139 UP = Ucm + postCollisionRelU*mQ/(mP + mQ);
00140
00141 UQ = Ucm - postCollisionRelU*mP/(mP + mQ);
00142 }
00143
00144
00145
Copyright © 2000-2009 OpenCFD Ltd