33 template<
class CloudType>
40 const word& patchName = patchData_[patchi].patchName();
42 forAll(nEscape_[patchi], injectori)
45 this->writeTabbed(os, patchName +
"_nEscape_" + suffix);
46 this->writeTabbed(os, patchName +
"_massEscape_" + suffix);
47 this->writeTabbed(os, patchName +
"_nStick_" + suffix);
48 this->writeTabbed(os, patchName +
"_massStick_" + suffix);
54 template<
class CloudType>
62 patchData_(
cloud.mesh(), this->coeffDict()),
63 nEscape_(patchData_.size()),
64 massEscape_(nEscape_.size()),
65 nStick_(nEscape_.size()),
66 massStick_(nEscape_.size()),
67 writeFields_(this->coeffDict().getOrDefault(
"writeFields",
false)),
69 massEscapePtr_(
nullptr),
70 massStickPtr_(
nullptr)
72 const bool outputByInjectorId
73 = this->coeffDict().getOrDefault(
"outputByInjectorId",
false);
77 Info<<
" Interaction fields will be written to "
78 << this->owner().name() <<
":massEscape"
80 << this->owner().name() <<
":massStick" <<
endl;
87 Info<<
" Interaction fields will not be written" <<
endl;
92 if (outputByInjectorId)
94 for (
const auto& inj :
cloud.injectors())
96 injIdToIndex_.insert(inj.injectorID(), nInjectors++);
107 forAll(patchData_, patchi)
109 const word& interactionTypeName =
110 patchData_[patchi].interactionTypeName();
112 this->wordToInteractionType(interactionTypeName);
116 const word& patchName = patchData_[patchi].patchName();
118 <<
"Unknown patch interaction type "
119 << interactionTypeName <<
" for patch " << patchName
120 <<
". Valid selections are:"
125 nEscape_[patchi].setSize(nInjectors,
Zero);
126 massEscape_[patchi].setSize(nInjectors,
Zero);
127 nStick_[patchi].setSize(nInjectors,
Zero);
128 massStick_[patchi].setSize(nInjectors,
Zero);
133 template<
class CloudType>
140 patchData_(pim.patchData_),
141 nEscape_(pim.nEscape_),
142 massEscape_(pim.massEscape_),
143 nStick_(pim.nStick_),
144 massStick_(pim.massStick_),
145 writeFields_(pim.writeFields_),
146 injIdToIndex_(pim.injIdToIndex_),
147 massEscapePtr_(
nullptr),
148 massStickPtr_(
nullptr)
154 template<
class CloudType>
157 if (!massEscapePtr_.valid())
167 this->owner().
name() +
":massEscape",
168 mesh.time().timeName(),
170 IOobject::READ_IF_PRESENT,
179 return *massEscapePtr_;
183 template<
class CloudType>
186 if (!massStickPtr_.valid())
196 this->owner().
name() +
":massStick",
197 mesh.time().timeName(),
199 IOobject::READ_IF_PRESENT,
208 return *massStickPtr_;
212 template<
class CloudType>
220 const label patchi = patchData_.applyToPatch(pp.
index());
230 ? injIdToIndex_.lookup(
p.typeId(), 0)
235 this->wordToInteractionType
237 patchData_[patchi].interactionTypeName()
248 keepParticle =
false;
252 const scalar dm =
p.mass()*
p.nParticle();
254 nEscape_[patchi][idx]++;
255 massEscape_[patchi][idx] += dm;
259 const label pI = pp.
index();
261 massEscape().boundaryFieldRef()[pI][fI] += dm;
271 const scalar dm =
p.mass()*
p.nParticle();
273 nStick_[patchi][idx]++;
274 massStick_[patchi][idx] += dm;
278 const label pI = pp.
index();
280 massStick().boundaryFieldRef()[pI][fI] += dm;
292 this->owner().patchData(
p, pp, nw, Up);
302 U -= (1.0 + patchData_[patchi].e())*Un*nw;
305 U -= patchData_[patchi].mu()*Ut;
315 <<
"Unknown interaction type "
316 << patchData_[patchi].interactionTypeName()
317 <<
"(" << it <<
") for patch "
318 << patchData_[patchi].patchName()
319 <<
". Valid selections are:" << this->interactionTypeNames_
331 template<
class CloudType>
342 forAll(patchData_, patchi)
344 label lsd = nEscape_[patchi].size();
345 npe0[patchi].setSize(lsd,
Zero);
346 mpe0[patchi].setSize(lsd,
Zero);
347 nps0[patchi].setSize(lsd,
Zero);
348 mps0[patchi].setSize(lsd,
Zero);
352 this->getModelProperty(
"nEscape", npe0);
353 this->getModelProperty(
"massEscape", mpe0);
354 this->getModelProperty(
"nStick", nps0);
355 this->getModelProperty(
"massStick", mps0);
362 npe[i] = npe[i] + npe0[i];
369 mpe[i] = mpe[i] + mpe0[i];
376 nps[i] = nps[i] + nps0[i];
383 mps[i] = mps[i] + mps0[i];
386 if (injIdToIndex_.size())
390 labelList indexToInjector(injIdToIndex_.size());
393 indexToInjector[iter.val()] = iter.key();
396 forAll(patchData_, patchi)
398 forAll(mpe[patchi], indexi)
400 const word& patchName = patchData_[patchi].patchName();
402 os <<
" Parcel fate: patch " << patchName
403 <<
" (number, mass)" <<
nl
404 <<
" - escape (injector " << indexToInjector[indexi]
405 <<
" ) = " << npe[patchi][indexi]
406 <<
", " << mpe[patchi][indexi] <<
nl
407 <<
" - stick (injector " << indexToInjector[indexi]
408 <<
" ) = " << nps[patchi][indexi]
409 <<
", " << mps[patchi][indexi] <<
nl;
415 forAll(patchData_, patchi)
417 const word& patchName = patchData_[patchi].patchName();
419 os <<
" Parcel fate: patch " << patchName
420 <<
" (number, mass)" <<
nl
422 << npe[patchi][0] <<
", " << mpe[patchi][0] <<
nl
424 << nps[patchi][0] <<
", " << mps[patchi][0] <<
nl;
430 forAll(npe[patchi], injectori)
433 <<
tab << npe[patchi][injectori]
434 <<
tab << mpe[patchi][injectori]
435 <<
tab << nps[patchi][injectori]
436 <<
tab << mps[patchi][injectori];
440 this->file() <<
endl;
442 if (this->writeTime())
444 this->setModelProperty(
"nEscape", npe);
445 this->setModelProperty(
"massEscape", mpe);
446 this->setModelProperty(
"nStick", nps);
447 this->setModelProperty(
"massStick", mps);