MaxwellianThermal.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 "MaxwellianThermal.H"
00028
00029
00030
00031 template <class CloudType>
00032 Foam::MaxwellianThermal<CloudType>::MaxwellianThermal
00033 (
00034 const dictionary& dict,
00035 CloudType& cloud
00036 )
00037 :
00038 WallInteractionModel<CloudType>(dict, cloud, typeName)
00039 {}
00040
00041
00042
00043
00044 template <class CloudType>
00045 Foam::MaxwellianThermal<CloudType>::~MaxwellianThermal()
00046 {}
00047
00048
00049
00050
00051 template <class CloudType>
00052 void Foam::MaxwellianThermal<CloudType>::correct
00053 (
00054 const wallPolyPatch& wpp,
00055 const label faceId,
00056 vector& U,
00057 scalar& Ei,
00058 label typeId
00059 )
00060 {
00061 label wppIndex = wpp.index();
00062
00063 label wppLocalFace = wpp.whichFace(faceId);
00064
00065 vector nw = wpp.faceAreas()[wppLocalFace];
00066
00067
00068 nw /= mag(nw);
00069
00070
00071 scalar magUn = U & nw;
00072
00073
00074 vector Ut = U - magUn*nw;
00075
00076 CloudType& cloud(this->owner());
00077
00078 Random& rndGen(cloud.rndGen());
00079
00080 while (mag(Ut) < SMALL)
00081 {
00082
00083
00084
00085
00086 U = vector
00087 (
00088 U.x()*(0.8 + 0.2*rndGen.scalar01()),
00089 U.y()*(0.8 + 0.2*rndGen.scalar01()),
00090 U.z()*(0.8 + 0.2*rndGen.scalar01())
00091 );
00092
00093 magUn = U & nw;
00094
00095 Ut = U - magUn*nw;
00096 }
00097
00098
00099 vector tw1 = Ut/mag(Ut);
00100
00101
00102 vector tw2 = nw^tw1;
00103
00104 scalar T = cloud.T().boundaryField()[wppIndex][wppLocalFace];
00105
00106 scalar mass = cloud.constProps(typeId).mass();
00107
00108 scalar iDof = cloud.constProps(typeId).internalDegreesOfFreedom();
00109
00110 U =
00111 sqrt(CloudType::kb*T/mass)
00112 *(
00113 rndGen.GaussNormal()*tw1
00114 + rndGen.GaussNormal()*tw2
00115 - sqrt(-2.0*log(max(1 - rndGen.scalar01(), VSMALL)))*nw
00116 );
00117
00118 U += cloud.U().boundaryField()[wppIndex][wppLocalFace];
00119
00120 Ei = cloud.equipartitionInternalEnergy(T, iDof);
00121 }
00122
00123
00124
Copyright © 2000-2009 OpenCFD Ltd