33 template<
class CloudType>
37 { interactionType::STICK,
"stick" },
38 { interactionType::ESCAPE,
"escape" },
39 { interactionType::REBOUND,
"rebound" },
45 template<
class CloudType>
49 const label localZonei
52 if (!faceZoneBBs_[localZonei].contains(
p.position()))
58 if ((
p.d() > dMax_) || (
p.d() < dMin_))
67 template<
class CloudType>
76 const label
nZones = faceZoneIDs_.size();
81 this->getModelProperty(
"nEscape", npe0);
82 this->getModelProperty(
"nStick", nps0);
83 this->getModelProperty(
"nRebound", npr0);
91 npe[i] = npe[i] + npe0[i];
92 nps[i] = nps[i] + nps0[i];
93 npr[i] = npr[i] + npr0[i];
100 const label zonei = faceZoneIDs_[i];
101 Info<<
" Zone : " << fzm[zonei].name() <<
nl
102 <<
" Escape : " << npe[i] <<
nl
103 <<
" Stick : " << nps[i] <<
nl
104 <<
" Rebound : " << npr[i] <<
nl;
106 if (this->writeToFile())
108 auto&
os = filePtrs_[i];
110 writeCurrentTime(
os);
113 os <<
tab << scalar(npe[i])
114 <<
tab << scalar(nps[i])
115 <<
tab << scalar(npr[i])
122 this->setModelProperty(
"nEscape", npe);
123 this->setModelProperty(
"nStick", nps);
124 this->setModelProperty(
"nRebound", npr);
126 nEscapeParticles_ =
Zero;
127 nStickParticles_ =
Zero;
128 nReboundParticles_ =
Zero;
134 template<
class CloudType>
139 const word& modelName
152 faceZoneInteraction_(),
156 nReboundParticles_(),
157 dMin_(this->coeffDict().getOrDefault(
"dMin", -GREAT)),
158 dMax_(this->coeffDict().getOrDefault(
"dMax", GREAT))
162 this->coeffDict().
lookup(
"faceZones")
165 filePtrs_.setSize(nameAndInteraction.size());
167 faceZoneBBs_.setSize(nameAndInteraction.size());
168 faceZoneInteraction_.setSize(nameAndInteraction.size());
172 const auto& faces = this->owner().
mesh().
faces();
176 for (
const auto& zoneInfo : nameAndInteraction)
178 const word& zoneName = zoneInfo.first();
187 Info<<
" " << zoneName <<
" faces: " << nFaces <<
nl;
190 faceZoneInteraction_[nZone] =
191 interactionTypeNames_[zoneInfo.second()];
194 auto& bb = faceZoneBBs_[nZone];
195 for (
const label facei : fz)
197 for (
const label fpi : faces[facei])
207 if (this->writeToFile())
212 this->createFile(modelName +
'_' + zoneName)
215 writeHeaderValue(filePtrs_[nZone],
"Source",
type());
216 writeHeaderValue(filePtrs_[nZone],
"Face zone", zoneName);
217 writeHeaderValue(filePtrs_[nZone],
"Faces", nFaces);
218 writeCommented(filePtrs_[nZone],
"Time");
219 writeTabbed(filePtrs_[nZone],
"Escape");
220 writeTabbed(filePtrs_[nZone],
"Stick");
221 writeTabbed(filePtrs_[nZone],
"Rebound");
222 filePtrs_[nZone] <<
nl;
229 <<
"Unable to find faceZone " << zoneName
230 <<
" - removing" <<
endl;
233 faceZoneIDs_.transfer(
zoneIDs);
235 filePtrs_.setSize(nZone);
236 faceZoneBBs_.setSize(nZone);
237 faceZoneInteraction_.setSize(nZone);
238 nEscapeParticles_.setSize(nZone,
Zero);
239 nStickParticles_.setSize(nZone,
Zero);
240 nReboundParticles_.setSize(nZone,
Zero);
244 template<
class CloudType>
252 faceZoneIDs_(pfi.faceZoneIDs_),
253 faceZoneBBs_(pfi.faceZoneBBs_),
255 nEscapeParticles_(pfi.nEscapeParticles_),
256 nStickParticles_(pfi.nStickParticles_),
257 nReboundParticles_(pfi.nReboundParticles_),
265 template<
class CloudType>
276 if (!processParticle(
p, i))
281 const label zonei = faceZoneIDs_[i];
283 const label localFacei = fzm[zonei].find(
p.face());
285 if (localFacei != -1)
287 const label facei = fzm[zonei][localFacei];
289 switch (faceZoneInteraction_[i])
291 case interactionType::ESCAPE:
293 keepParticle =
false;
294 ++nEscapeParticles_[i];
297 case interactionType::STICK:
299 auto& pRef =
const_cast<parcelType&
>(
p);
302 ++nStickParticles_[i];
305 case interactionType::REBOUND:
308 const auto n =
f.unitNormal(this->owner().
mesh().
points());
310 auto& pRef =
const_cast<parcelType&
>(
p);
311 pRef.U() -= 2*
n*(pRef.U() &
n);
312 ++nReboundParticles_[i];
318 <<
"Unhandled enumeration "
319 << interactionTypeNames_[faceZoneInteraction_[i]]