DsmcParcel.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 "DsmcParcel.H"
00028 #include "dimensionedConstants.H"
00029
00030
00031
00032 template<class ParcelType>
00033 template<class TrackData>
00034 bool Foam::DsmcParcel<ParcelType>::move
00035 (
00036 TrackData& td
00037 )
00038 {
00039 ParcelType& p = static_cast<ParcelType&>(*this);
00040
00041 td.switchProcessor = false;
00042 td.keepParticle = true;
00043
00044 const polyMesh& mesh = td.cloud().pMesh();
00045 const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();
00046
00047 const scalar deltaT = td.cloud().cachedDeltaT();
00048 scalar tEnd = (1.0 - p.stepFraction())*deltaT;
00049 const scalar dtMax = tEnd;
00050
00051 while (td.keepParticle && !td.switchProcessor && tEnd > ROOTVSMALL)
00052 {
00053
00054 scalar dt = min(dtMax, tEnd);
00055
00056 dt *= p.trackToFace(p.position() + dt*U_, td);
00057
00058 tEnd -= dt;
00059
00060 p.stepFraction() = 1.0 - tEnd/deltaT;
00061
00062 if (p.onBoundary() && td.keepParticle)
00063 {
00064 if (isType<processorPolyPatch>(pbMesh[p.patch(p.face())]))
00065 {
00066 td.switchProcessor = true;
00067 }
00068 }
00069 }
00070
00071 return td.keepParticle;
00072 }
00073
00074
00075 template<class ParcelType>
00076 template<class TrackData>
00077 bool Foam::DsmcParcel<ParcelType>::hitPatch
00078 (
00079 const polyPatch&,
00080 TrackData& td,
00081 const label patchI
00082 )
00083 {
00084 return false;
00085 }
00086
00087
00088 template<class ParcelType>
00089 template<class TrackData>
00090 void Foam::DsmcParcel<ParcelType>::hitProcessorPatch
00091 (
00092 const processorPolyPatch&,
00093 TrackData& td
00094 )
00095 {
00096 td.switchProcessor = true;
00097 }
00098
00099
00100 template<class ParcelType>
00101 void Foam::DsmcParcel<ParcelType>::hitProcessorPatch
00102 (
00103 const processorPolyPatch&,
00104 int&
00105 )
00106 {}
00107
00108
00109 template<class ParcelType>
00110 template<class TrackData>
00111 void Foam::DsmcParcel<ParcelType>::hitWallPatch
00112 (
00113 const wallPolyPatch& wpp,
00114 TrackData& td
00115 )
00116 {
00117 const constantProperties& constProps(td.cloud().constProps(typeId_));
00118
00119 scalar m = constProps.mass();
00120
00121
00122 scalar preIE = 0.5*m*(U_ & U_) + Ei_;
00123
00124
00125 vector preIMom = m*U_;
00126
00127 td.cloud().wallInteraction().correct
00128 (
00129 wpp,
00130 this->face(),
00131 U_,
00132 Ei_,
00133 typeId_
00134 );
00135
00136
00137 scalar postIE = 0.5*m*(U_ & U_) + Ei_;
00138
00139
00140 vector postIMom = m*U_;
00141
00142 label wppIndex = wpp.index();
00143
00144 label wppLocalFace = wpp.whichFace(this->face());
00145
00146 const scalar fA = mag(wpp.faceAreas()[wppLocalFace]);
00147
00148 const scalar deltaT = td.cloud().cachedDeltaT();
00149
00150 scalar deltaQ = td.cloud().nParticle()*(preIE - postIE)/(deltaT*fA);
00151
00152 vector deltaFD = td.cloud().nParticle()*(preIMom - postIMom)/(deltaT*fA);
00153
00154 td.cloud().q().boundaryField()[wppIndex][wppLocalFace] += deltaQ;
00155
00156 td.cloud().fD().boundaryField()[wppIndex][wppLocalFace] += deltaFD;
00157 }
00158
00159
00160 template<class ParcelType>
00161 void Foam::DsmcParcel<ParcelType>::hitWallPatch
00162 (
00163 const wallPolyPatch&,
00164 int&
00165 )
00166 {}
00167
00168
00169 template<class ParcelType>
00170 template<class TrackData>
00171 void Foam::DsmcParcel<ParcelType>::hitPatch
00172 (
00173 const polyPatch&,
00174 TrackData& td
00175 )
00176 {
00177 td.keepParticle = false;
00178 }
00179
00180
00181 template<class ParcelType>
00182 void Foam::DsmcParcel<ParcelType>::hitPatch
00183 (
00184 const polyPatch&,
00185 int&
00186 )
00187 {}
00188
00189
00190 template<class ParcelType>
00191 void Foam::DsmcParcel<ParcelType>::transformProperties
00192 (
00193 const tensor& T
00194 )
00195 {
00196 Particle<ParcelType>::transformProperties(T);
00197 U_ = transform(T, U_);
00198 }
00199
00200
00201 template<class ParcelType>
00202 void Foam::DsmcParcel<ParcelType>::transformProperties
00203 (
00204 const vector& separation
00205 )
00206 {
00207 Particle<ParcelType>::transformProperties(separation);
00208 }
00209
00210
00211
00212
00213 #include "DsmcParcelIO.C"
00214
00215
00216
Copyright © 2000-2009 OpenCFD Ltd