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 "KinematicParcel.H"
00028 #include "dimensionedConstants.H"
00029
00030
00031
00032 template<class ParcelType>
00033 template<class TrackData>
00034 void Foam::KinematicParcel<ParcelType>::setCellValues
00035 (
00036 TrackData& td,
00037 const scalar dt,
00038 const label cellI
00039 )
00040 {
00041 rhoc_ = td.rhoInterp().interpolate(this->position(), cellI);
00042 if (rhoc_ < td.constProps().rhoMin())
00043 {
00044 WarningIn
00045 (
00046 "void Foam::KinematicParcel<ParcelType>::setCellValues"
00047 "("
00048 "TrackData&, "
00049 "const scalar, "
00050 "const label"
00051 ")"
00052 ) << "Limiting observed density in cell " << cellI << " to "
00053 << td.constProps().rhoMin() << nl << endl;
00054
00055 rhoc_ = td.constProps().rhoMin();
00056 }
00057
00058 Uc_ = td.UInterp().interpolate(this->position(), cellI);
00059
00060 muc_ = td.muInterp().interpolate(this->position(), cellI);
00061
00062
00063 Uc_ = td.cloud().dispersion().update
00064 (
00065 dt,
00066 cellI,
00067 U_,
00068 Uc_,
00069 UTurb_,
00070 tTurb_
00071 );
00072 }
00073
00074
00075 template<class ParcelType>
00076 template<class TrackData>
00077 void Foam::KinematicParcel<ParcelType>::cellValueSourceCorrection
00078 (
00079 TrackData& td,
00080 const scalar dt,
00081 const label cellI
00082 )
00083 {
00084 Uc_ += td.cloud().UTrans()[cellI]/massCell(cellI);
00085 }
00086
00087
00088 template<class ParcelType>
00089 template<class TrackData>
00090 void Foam::KinematicParcel<ParcelType>::calc
00091 (
00092 TrackData& td,
00093 const scalar dt,
00094 const label cellI
00095 )
00096 {
00097
00098
00099 const scalar np0 = nParticle_;
00100 const scalar d0 = d_;
00101 const vector U0 = U_;
00102 const scalar rho0 = rho_;
00103 const scalar mass0 = mass();
00104
00105
00106
00107 vector Su = vector::zero;
00108
00109
00110 vector dUTrans = vector::zero;
00111
00112
00113
00114
00115
00116
00117 vector U1 = calcVelocity(td, dt, cellI, d0, U0, rho0, mass0, Su, dUTrans);
00118
00119
00120
00121
00122 if (td.cloud().coupled())
00123 {
00124
00125 td.cloud().UTrans()[cellI] += np0*dUTrans;
00126 }
00127
00128
00129
00130
00131 U_ = U1;
00132 }
00133
00134
00135 template<class ParcelType>
00136 template<class TrackData>
00137 const Foam::vector Foam::KinematicParcel<ParcelType>::calcVelocity
00138 (
00139 TrackData& td,
00140 const scalar dt,
00141 const label cellI,
00142 const scalar d,
00143 const vector& U,
00144 const scalar rho,
00145 const scalar mass,
00146 const vector& Su,
00147 vector& dUTrans
00148 ) const
00149 {
00150 const polyMesh& mesh = this->cloud().pMesh();
00151
00152
00153 const scalar utc =
00154 td.cloud().drag().utc(U - Uc_, d, rhoc_, muc_) + ROOTVSMALL;
00155
00156
00157 const vector FCoupled =
00158 mass*td.cloud().forces().calcCoupled(cellI, dt, rhoc_, rho, Uc_, U);
00159 const vector FNonCoupled =
00160 mass*td.cloud().forces().calcNonCoupled(cellI, dt, rhoc_, rho, Uc_, U);
00161
00162
00163
00164
00165
00166
00167 const scalar As = this->areaS(d);
00168 const vector ap = Uc_ + (FCoupled + FNonCoupled + Su)/(utc*As);
00169 const scalar bp = 6.0*utc/(rho*d);
00170
00171 IntegrationScheme<vector>::integrationResult Ures =
00172 td.cloud().UIntegrator().integrate(U, dt, ap, bp);
00173
00174 vector Unew = Ures.value();
00175
00176 dUTrans += dt*(utc*As*(Ures.average() - Uc_) - FCoupled);
00177
00178
00179 meshTools::constrainDirection(mesh, mesh.solutionD(), Unew);
00180 meshTools::constrainDirection(mesh, mesh.solutionD(), dUTrans);
00181
00182 return Unew;
00183 }
00184
00185
00186
00187
00188 template <class ParcelType>
00189 Foam::KinematicParcel<ParcelType>::KinematicParcel
00190 (
00191 const KinematicParcel<ParcelType>& p
00192 )
00193 :
00194 Particle<ParcelType>(p),
00195 typeId_(p.typeId_),
00196 nParticle_(p.nParticle_),
00197 d_(p.d_),
00198 U_(p.U_),
00199 rho_(p.rho_),
00200 tTurb_(p.tTurb_),
00201 UTurb_(p.UTurb_),
00202 rhoc_(p.rhoc_),
00203 Uc_(p.Uc_),
00204 muc_(p.muc_)
00205 {}
00206
00207
00208
00209
00210 template<class ParcelType>
00211 template<class TrackData>
00212 bool Foam::KinematicParcel<ParcelType>::move(TrackData& td)
00213 {
00214 ParcelType& p = static_cast<ParcelType&>(*this);
00215
00216 td.switchProcessor = false;
00217 td.keepParticle = true;
00218
00219 const polyMesh& mesh = td.cloud().pMesh();
00220 const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();
00221
00222 const scalar deltaT = mesh.time().deltaT().value();
00223 scalar tEnd = (1.0 - p.stepFraction())*deltaT;
00224 const scalar dtMax = tEnd;
00225
00226 while (td.keepParticle && !td.switchProcessor && tEnd > ROOTVSMALL)
00227 {
00228
00229 meshTools::constrainToMeshCentre(mesh, p.position());
00230
00231
00232 scalar dt = min(dtMax, tEnd);
00233
00234
00235
00236 label cellI = p.cell();
00237
00238 dt *= p.trackToFace(p.position() + dt*U_, td);
00239
00240 tEnd -= dt;
00241 p.stepFraction() = 1.0 - tEnd/deltaT;
00242
00243
00244 if (dt > ROOTVSMALL)
00245 {
00246
00247 p.setCellValues(td, dt, cellI);
00248
00249 if (td.cloud().cellValueSourceCorrection())
00250 {
00251 p.cellValueSourceCorrection(td, dt, cellI);
00252 }
00253
00254 p.calc(td, dt, cellI);
00255 }
00256
00257 if (p.onBoundary() && td.keepParticle)
00258 {
00259 if (isType<processorPolyPatch>(pbMesh[p.patch(p.face())]))
00260 {
00261 td.switchProcessor = true;
00262 }
00263 }
00264 }
00265
00266 return td.keepParticle;
00267 }
00268
00269
00270 template<class ParcelType>
00271 template<class TrackData>
00272 bool Foam::KinematicParcel<ParcelType>::hitPatch
00273 (
00274 const polyPatch& pp,
00275 TrackData& td,
00276 const label patchI
00277 )
00278 {
00279 ParcelType& p = static_cast<ParcelType&>(*this);
00280 td.cloud().postProcessing().postPatch(p, patchI);
00281
00282 return td.cloud().patchInteraction().correct(pp, this->face(), U_);
00283 }
00284
00285
00286 template<class ParcelType>
00287 bool Foam::KinematicParcel<ParcelType>::hitPatch
00288 (
00289 const polyPatch& pp,
00290 int& td,
00291 const label patchI
00292 )
00293 {
00294 return false;
00295 }
00296
00297
00298 template<class ParcelType>
00299 template<class TrackData>
00300 void Foam::KinematicParcel<ParcelType>::hitProcessorPatch
00301 (
00302 const processorPolyPatch&,
00303 TrackData& td
00304 )
00305 {
00306 td.switchProcessor = true;
00307 }
00308
00309
00310 template<class ParcelType>
00311 void Foam::KinematicParcel<ParcelType>::hitProcessorPatch
00312 (
00313 const processorPolyPatch&,
00314 int&
00315 )
00316 {}
00317
00318
00319 template<class ParcelType>
00320 template<class TrackData>
00321 void Foam::KinematicParcel<ParcelType>::hitWallPatch
00322 (
00323 const wallPolyPatch& wpp,
00324 TrackData& td
00325 )
00326 {
00327
00328 }
00329
00330
00331 template<class ParcelType>
00332 void Foam::KinematicParcel<ParcelType>::hitWallPatch
00333 (
00334 const wallPolyPatch&,
00335 int&
00336 )
00337 {}
00338
00339
00340 template<class ParcelType>
00341 template<class TrackData>
00342 void Foam::KinematicParcel<ParcelType>::hitPatch
00343 (
00344 const polyPatch&,
00345 TrackData& td
00346 )
00347 {
00348 td.keepParticle = false;
00349 }
00350
00351
00352 template<class ParcelType>
00353 void Foam::KinematicParcel<ParcelType>::hitPatch(const polyPatch&, int&)
00354 {}
00355
00356
00357 template<class ParcelType>
00358 void Foam::KinematicParcel<ParcelType>::transformProperties(const tensor& T)
00359 {
00360 Particle<ParcelType>::transformProperties(T);
00361 U_ = transform(T, U_);
00362 }
00363
00364
00365 template<class ParcelType>
00366 void Foam::KinematicParcel<ParcelType>::transformProperties
00367 (
00368 const vector& separation
00369 )
00370 {
00371 Particle<ParcelType>::transformProperties(separation);
00372 }
00373
00374
00375
00376
00377 #include "KinematicParcelIO.C"
00378
00379
00380