33template<
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);
54template<
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
77 Info<<
" Interaction fields will be written to "
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();
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);
127 nStick_[patchi].setSize(nInjectors,
Zero);
133template<
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)
154template<
class CloudType>
167 this->owner().
name() +
":massEscape",
179 return *massEscapePtr_;
183template<
class CloudType>
196 this->owner().
name() +
":massStick",
208 return *massStickPtr_;
212template<
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);
297 if (
mag(Up) > 0 &&
mag(
U) < this->Urmax())
300 <<
"Particle U the same as patch "
301 <<
" The particle has been removed" <<
nl <<
endl;
303 keepParticle =
false;
314 U -= (1.0 + patchData_[patchi].e())*Un*nw;
317 U -= patchData_[patchi].mu()*Ut;
327 <<
"Unknown interaction type "
328 << patchData_[patchi].interactionTypeName()
329 <<
"(" << it <<
") for patch "
330 << patchData_[patchi].patchName()
331 <<
". Valid selections are:" << this->interactionTypeNames_
343template<
class CloudType>
354 forAll(patchData_, patchi)
356 label lsd = nEscape_[patchi].size();
364 this->getModelProperty(
"nEscape", npe0);
365 this->getModelProperty(
"massEscape", mpe0);
366 this->getModelProperty(
"nStick", nps0);
367 this->getModelProperty(
"massStick", mps0);
374 npe[i] = npe[i] + npe0[i];
381 mpe[i] = mpe[i] + mpe0[i];
388 nps[i] = nps[i] + nps0[i];
395 mps[i] = mps[i] + mps0[i];
398 if (injIdToIndex_.size())
402 labelList indexToInjector(injIdToIndex_.size());
405 indexToInjector[iter.val()] = iter.key();
408 forAll(patchData_, patchi)
410 forAll(mpe[patchi], indexi)
412 const word& patchName = patchData_[patchi].patchName();
414 os <<
" Parcel fate: patch " << patchName
415 <<
" (number, mass)" <<
nl
416 <<
" - escape (injector " << indexToInjector[indexi]
417 <<
" ) = " << npe[patchi][indexi]
418 <<
", " << mpe[patchi][indexi] <<
nl
419 <<
" - stick (injector " << indexToInjector[indexi]
420 <<
" ) = " << nps[patchi][indexi]
421 <<
", " << mps[patchi][indexi] <<
nl;
427 forAll(patchData_, patchi)
429 const word& patchName = patchData_[patchi].patchName();
431 os <<
" Parcel fate: patch " << patchName
432 <<
" (number, mass)" <<
nl
434 << npe[patchi][0] <<
", " << mpe[patchi][0] <<
nl
436 << nps[patchi][0] <<
", " << mps[patchi][0] <<
nl;
442 forAll(npe[patchi], injectori)
445 <<
tab << npe[patchi][injectori]
446 <<
tab << mpe[patchi][injectori]
447 <<
tab << nps[patchi][injectori]
448 <<
tab << mps[patchi][injectori];
452 this->file() <<
endl;
454 if (this->writeTime())
456 this->setModelProperty(
"nEscape", npe);
457 this->setModelProperty(
"massEscape", mpe);
458 this->setModelProperty(
"nStick", nps);
459 this->setModelProperty(
"massStick", mps);
const CloudType & owner() const
Return const access to the owner cloud.
Templated base class for dsmc cloud.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const word & name() const noexcept
Return the object name.
void setSize(const label n)
Alias for resize()
Patch interaction specified on a patch-by-patch basis.
volScalarField & massStick()
Return access to the massStick field.
volScalarField & massEscape()
Return access to the massEscape field.
virtual void writeFileHeader(Ostream &os)
Output file header information.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Templated patch interaction model class.
static interactionType wordToInteractionType(const word &itWord)
Convert word to interaction result.
static void listCombineGather(const List< commsStruct > &comms, List< T > &values, const CombineOp &cop, const int tag, const label comm)
virtual void correct()
Solve the turbulence equations and correct the turbulence viscosity.
static word timeName(const scalar t, const int precision=precision_)
A cloud is a registry collection of lagrangian particles.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
InfoProxy< ensightCells > info() const
Return info proxy.
Mesh data needed to do the Finite Volume discretisation.
const Time & time() const
Return the top-level database.
label index() const noexcept
The index of this patch in the boundaryMesh.
A patch is a list of labels that address the faces in the global face list.
label whichFace(const label l) const
Return label of face in patch from global face label.
void reset(const label nPoints, const label nInternalFaces, const label nFaces, const label nCells)
Reset this primitiveMesh given the primitive array sizes.
const dictionary & coeffDict() const
Return const access to the coefficients dictionary.
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
#define WarningInFunction
Report a warning using Foam::Warning.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
errorManip< error > abort(error &err)
static constexpr const zero Zero
Global zero (0)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
constexpr char nl
The newline '\n' character (0x0a)
constexpr char tab
The tab '\t' character(0x09)
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.