LarsenBorgnakkeVariableHardSphere.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 "LarsenBorgnakkeVariableHardSphere.H"
00028
00029
00030
00031 template <class CloudType>
00032 Foam::scalar Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::energyRatio
00033 (
00034 scalar ChiA,
00035 scalar ChiB
00036 )
00037 {
00038 CloudType& cloud(this->owner());
00039
00040 Random& rndGen(cloud.rndGen());
00041
00042 scalar ChiAMinusOne = ChiA - 1;
00043
00044 scalar ChiBMinusOne = ChiB - 1;
00045
00046 if (ChiAMinusOne < SMALL && ChiBMinusOne < SMALL)
00047 {
00048 return rndGen.scalar01();
00049 }
00050
00051 scalar energyRatio;
00052
00053 scalar P;
00054
00055 do
00056 {
00057 P = 0;
00058
00059 energyRatio = rndGen.scalar01();
00060
00061 if (ChiAMinusOne < SMALL)
00062 {
00063 P = 1.0 - pow(energyRatio, ChiB);
00064 }
00065 else if (ChiBMinusOne < SMALL)
00066 {
00067 P = 1.0 - pow(energyRatio, ChiA);
00068 }
00069 else
00070 {
00071 P =
00072 pow
00073 (
00074 (ChiAMinusOne + ChiBMinusOne)*energyRatio/ChiAMinusOne,
00075 ChiAMinusOne
00076 )
00077 *pow
00078 (
00079 (ChiAMinusOne + ChiBMinusOne)*(1 - energyRatio)
00080 /ChiBMinusOne,
00081 ChiBMinusOne
00082 );
00083 }
00084 } while (P < rndGen.scalar01());
00085
00086 return energyRatio;
00087 }
00088
00089
00090
00091
00092 template <class CloudType>
00093 Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::LarsenBorgnakkeVariableHardSphere
00094 (
00095 const dictionary& dict,
00096 CloudType& cloud
00097 )
00098 :
00099 BinaryCollisionModel<CloudType>(dict, cloud, typeName),
00100 Tref_(readScalar(this->coeffDict().lookup("Tref"))),
00101 relaxationCollisionNumber_
00102 (
00103 readScalar(this->coeffDict().lookup("relaxationCollisionNumber"))
00104 )
00105 {}
00106
00107
00108
00109
00110 template <class CloudType>
00111 Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::
00112 ~LarsenBorgnakkeVariableHardSphere()
00113 {}
00114
00115
00116
00117
00118
00119 template <class CloudType>
00120 Foam::scalar Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::sigmaTcR
00121 (
00122 label typeIdP,
00123 label typeIdQ,
00124 const vector& UP,
00125 const vector& UQ
00126 ) const
00127 {
00128 const CloudType& cloud(this->owner());
00129
00130 scalar dPQ =
00131 0.5
00132 *(
00133 cloud.constProps(typeIdP).d()
00134 + cloud.constProps(typeIdQ).d()
00135 );
00136
00137 scalar omegaPQ =
00138 0.5
00139 *(
00140 cloud.constProps(typeIdP).omega()
00141 + cloud.constProps(typeIdQ).omega()
00142 );
00143
00144 scalar cR = mag(UP - UQ);
00145
00146 if (cR < VSMALL)
00147 {
00148 return 0;
00149 }
00150
00151 scalar mP = cloud.constProps(typeIdP).mass();
00152
00153 scalar mQ = cloud.constProps(typeIdQ).mass();
00154
00155 scalar mR = mP*mQ/(mP + mQ);
00156
00157
00158 scalar sigmaTPQ =
00159 mathematicalConstant::pi*dPQ*dPQ
00160 *pow(2.0*CloudType::kb*Tref_/(mR*cR*cR), omegaPQ - 0.5)
00161 /exp(Foam::lgamma(2.5 - omegaPQ));
00162
00163 return sigmaTPQ*cR;
00164 }
00165
00166
00167 template <class CloudType>
00168 void Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::collide
00169 (
00170 label typeIdP,
00171 label typeIdQ,
00172 vector& UP,
00173 vector& UQ,
00174 scalar& EiP,
00175 scalar& EiQ
00176 )
00177 {
00178 CloudType& cloud(this->owner());
00179
00180 Random& rndGen(cloud.rndGen());
00181
00182 scalar inverseCollisionNumber = 1/relaxationCollisionNumber_;
00183
00184
00185
00186
00187
00188 scalar preCollisionEiP = EiP;
00189
00190 scalar preCollisionEiQ = EiQ;
00191
00192 scalar iDofP = cloud.constProps(typeIdP).internalDegreesOfFreedom();
00193
00194 scalar iDofQ = cloud.constProps(typeIdQ).internalDegreesOfFreedom();
00195
00196 scalar omegaPQ =
00197 0.5
00198 *(
00199 cloud.constProps(typeIdP).omega()
00200 + cloud.constProps(typeIdQ).omega()
00201 );
00202
00203 scalar mP = cloud.constProps(typeIdP).mass();
00204
00205 scalar mQ = cloud.constProps(typeIdQ).mass();
00206
00207 scalar mR = mP*mQ/(mP + mQ);
00208
00209 vector Ucm = (mP*UP + mQ*UQ)/(mP + mQ);
00210
00211 scalar cRsqr = magSqr(UP - UQ);
00212
00213 scalar availableEnergy = 0.5*mR*cRsqr;
00214
00215 scalar ChiB = 2.5 - omegaPQ;
00216
00217 if (iDofP > 0)
00218 {
00219 if (inverseCollisionNumber > rndGen.scalar01())
00220 {
00221 availableEnergy += preCollisionEiP;
00222
00223 scalar ChiA = 0.5*iDofP;
00224
00225 EiP = energyRatio(ChiA, ChiB)*availableEnergy;
00226
00227 availableEnergy -= EiP;
00228 }
00229 }
00230
00231 if (iDofQ > 0)
00232 {
00233 if (inverseCollisionNumber > rndGen.scalar01())
00234 {
00235 availableEnergy += preCollisionEiQ;
00236
00237
00238 scalar energyRatio = 1.0 - pow(rndGen.scalar01(),(1.0/ChiB));
00239
00240 EiQ = energyRatio*availableEnergy;
00241
00242 availableEnergy -= EiQ;
00243 }
00244 }
00245
00246
00247 scalar cR = sqrt(2.0*availableEnergy/mR);
00248
00249
00250
00251 scalar cosTheta = 2.0*rndGen.scalar01() - 1.0;
00252
00253 scalar sinTheta = sqrt(1.0 - cosTheta*cosTheta);
00254
00255 scalar phi = 2.0*mathematicalConstant::pi*rndGen.scalar01();
00256
00257 vector postCollisionRelU =
00258 cR
00259 *vector
00260 (
00261 cosTheta,
00262 sinTheta*cos(phi),
00263 sinTheta*sin(phi)
00264 );
00265
00266 UP = Ucm + postCollisionRelU*mQ/(mP + mQ);
00267
00268 UQ = Ucm - postCollisionRelU*mP/(mP + mQ);
00269 }
00270
00271
00272
Copyright © 2000-2009 OpenCFD Ltd